University of Manitoba
Department of Electrical & Computer Engineering
ECE 4600 Group Design Project
Final Project Report
Swimming Data Acquisition by Ultrasonic Detection
Final report submitted in partial satisfaction of the requirements for the degree of
Bachelor of Science in Electrical Engineering
by
Group 2
Andrew Maronese Adam Brown Evan Wilson
Academic Supervisor
Dean McNeill
Industry Supervisor
Daniel C. Card
Date of Submission
March 17, 2017
Copyright c© 2017 Andrew Maronese, Adam Brown, Evan Wilson
Abstract
It is common for a swimmer to keep track of their swimming times with a stopwatch
and mentally track their lap count. This poses an issue because the swimmer may forget
the number of laps while he or she is focusing on their technique. Furthermore it is difficult
for a swimmer to measure the time that each lap takes, so they end up averaging the total
swim time to estimate the particular lap time. This introduces a lot of inaccuracies and
does not give the swimmer sufficiently detailed information about their performance.
The swimming data acquisition by ultrasonic detection device is described in this re-
port as a solution to these problems. It is a device that is placed at the end of the pool
that tracks the swimmer and displays their lap data, and will log their progress over mul-
tiple sessions. It is designed to eliminate the inherent inaccuracies in tracking a swimmer’s
progress manually. This report outlines the design and implementation of the various sub-
systems of the swimming data acquisition device, from the power delivery system and data
acquisition/logging to the user controls and enclosure design. The design described in this
report was built and successfully acquires swimming data.
i
Contributions
Ada
mB
row
n
And
rew
Mar
ones
e
Eva
nW
ilson
Data Acquisition System • Data Logging System •
Controls and Monitoring Interface • Power Delivery System •
Enclosure • System Integration and Testing
Final Report Final Presentation
• = Design Lead
= Design Support
ii
Acknowledgements
The success of this project would not have been possible without consultation from indus-
try contacts as well as members of the Department of Electrical and Computer Engineering
at the University of Manitoba. The authors of this report would like to acknowledge the
following individuals for their contributions:
• Mr. Daniel Card was our industry supervisor as well as our client for the project. He
provided us with his expertise in electrical design and system testing. The mentoring
received throughout the project helped bring the project to completion through team
difficulties.
• Mr. Dean McNeill was our academic supervisor and provided insight and suggestions
throughout the design and final build of the project.
• Mrs. Chelsea Maronese is a speed swimming coach who helped in the initial brain-
storming which gave valuable insight into applications in this field.
• Mr. Sinisa Janic aided in the acquisition of materials and components in order to
build this project.
• Mr. Glen Kolansky provided rental components to allow testing and project progres-
sion while parts were being ordered.
• Dr. Derek Oliver provided extensive knowledge on the guidelines and team man-
agement techniques for the project. He also provided support and guidance through
team difficulties.
• UMIEEE provided a workspace and tools for the construction of this project.
• Mr. Cory Smit assisted with precise machining of the enclosure and acquisition of
mounting hardware.
iii
CONTENTS
Contents
Abstract i
Contributions ii
Acknowledgements iii
List of Figures vii
List of Tables viii
Nomenclature ix
1 Introduction 1
1.1 System Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Performance Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2 Data Acquisition System 3
2.1 Microcontroller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.1.1 Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.1.2 Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2 Ultrasonic Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2.1 Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2.2 Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3 Data Logging System 12
3.1 SD Card Reader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.1.1 Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.1.2 Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4 Controls and Monitoring Interface 16
4.1 Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.1.1 Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.1.2 Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.2 Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
iv
CONTENTS
4.2.1 Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.2.2 Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.3 Audible Feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5 Power Delivery System 21
5.1 Battery Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
5.1.1 Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
5.1.2 Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
5.2 DC-DC Converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
5.2.1 Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
5.2.2 Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
5.3 Battery Protection Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
5.3.1 Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
5.3.2 Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
6 Enclosure 33
6.1 Physical and Display Considerations . . . . . . . . . . . . . . . . . . . . . . 33
6.1.1 Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
6.1.2 Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
6.2 Mounting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
6.3 Peripheral Casings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
6.3.1 Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
6.3.2 Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
7 Integration and Assembly 41
7.1 Peripheral Electrical Systems Integration . . . . . . . . . . . . . . . . . . . 41
7.1.1 Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
7.1.2 Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
7.2 Power Delivery Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
7.3 Assembly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
7.3.1 Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
8 Conclusion 46
8.1 Project Outcome . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
8.2 Future Developments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
v
CONTENTS
References 47
A Appendix - Battery Test 48
B Appendix - Arduino Mega Schematic 49
C Appendix - Enclosure Dimensions 50
D Appendix - Peripherals Pin Assignment Table 51
vi
LIST OF FIGURES
List of Figures1 Overview of Subsystem Interaction . . . . . . . . . . . . . . . . . . . . . . . 2
2.1 Microcontroller Current Draw Test . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 Object Detection Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3 Sensor Distance Test Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.4 Sensor Beam Angle Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.5 Sensor Beam Angle Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.1 SD Card Data Writing Unit Testing . . . . . . . . . . . . . . . . . . . . . . 14
3.2 Integrated Data Logging System . . . . . . . . . . . . . . . . . . . . . . . . 15
4.1 LCD Display Test at Joyce Fromson Pool . . . . . . . . . . . . . . . . . . . 18
4.2 Button Waterproofing Test . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5.1 Battery Testing with Electronic Load at 100 mA . . . . . . . . . . . . . . . 24
5.2 DC-DC Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
5.3 DC-DC Converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
5.4 Monitor Images for Various Configurations . . . . . . . . . . . . . . . . . . 27
5.5 Software Shutdown Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
5.6 9.5V Shut-off Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
5.7 9.5V Shut-off Test Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
5.8 Auto Shutoff Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
6.1 Initial Waterproofing Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
6.2 1 m Drop Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
6.3 Internal Case Dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
6.4 Mounting Top and Back Plates . . . . . . . . . . . . . . . . . . . . . . . . . 38
6.5 SOLIDWORKS Button Case Design . . . . . . . . . . . . . . . . . . . . . . 39
6.6 SOLIDWORKS Sensor Case Design . . . . . . . . . . . . . . . . . . . . . . 40
6.7 Integrated Button and Sensor Casings . . . . . . . . . . . . . . . . . . . . . 40
7.1 Shield Wiring Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
7.2 Final Shield Construction and Peripheral Integration . . . . . . . . . . . . . 42
7.3 Final Construction of the Swimmer’s Data Acquisition System . . . . . . . 44
A.1 Battery Test Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
B.2 Arduino Mega Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
C.3 Enclosure Dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
D.4 Peripherals Pin Assignment Table . . . . . . . . . . . . . . . . . . . . . . . 51
vii
LIST OF TABLES
List of Tables1 Performance Metrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.1 Decision Matrix Evaluation Criteria . . . . . . . . . . . . . . . . . . . . . . 4
2.2 Microcontroller Decision Matrix . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.3 Ultrasonic Sensor Decision Matrix . . . . . . . . . . . . . . . . . . . . . . . 6
3.1 Data Logger Decision Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.1 Display Decision Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.1 Battery Energy Densities and Cell Voltages . . . . . . . . . . . . . . . . . . 22
5.2 Battery Decision Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
5.3 DC-DC Converter Decision Matrix . . . . . . . . . . . . . . . . . . . . . . . 26
6.1 Enclosure Decision Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
7.1 Lap Detection Test Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
viii
NOMENCLATURE
Nomenclature
ASCII American Standard Code for Information Interchange
AWG American Wire Gauge
CS Chip Select
dB Decibel
DC Direct Current
EEPROM Electronic Erasable Programmable Read Only Memory
GB Gigabyte
I/O Input/Output
IDE Integrated Development Environment
LED Light Emitting Diode
LCD Liquid Crystal Display
LiPo Lithium Polymer
MISO Master In Slave Out
MDF Medium-Density Fiberboard
MOSFET Metal-Oxide Semiconductor Field-Effect Transistor
ix
NOMENCLATURE
MOSI Master Out Slave In
NiCd Nickel-Cadmium
NiMH Nickel-Metal Hydride
OV Over Voltage
PCB Printed Circuit Board
PWM Pulse Width Modulation
RFID Radio Frequency Identification
SC Short-Circuit
SCK Serial Clock
SD Secure Digital
SPI Serial Peripheral Interface
TFT Thin Film Transistor
VGS Gate-Source Voltage
x
1 Introduction
1 IntroductionThe purpose of this project is to design and build a swimmer’s data acquisition device
with distance tracking, user controls, and memory storage capabilities. When placed on
the pool edge while the user swims it tracks their progress and store it to be evaluated
later. It is designed for recreational swimmers’ use as the level of precision is not intended
for competitive sport.
1.1 System Overview
The swimmer’s data acquisition device is placed on the edge of the pool, where it sends
out an ultrasonic wave that bounces off of the swimmer as they approach. The time taken
for the wave to travel to the swimmer and back is interpreted as a distance in the the
data acquisition subsystem. The controls and monitoring interface covers how the system
displays the lap time to the liquid crystal display (LCD) display and accepts user input to
start and stop the device.
When the swimmer is within a set distance from the wall the device logs the lap time
and number to an secure digital (SD) card in the data logging system. The data is logged
on an SD card in .csv format so it can easily be transferred to a computer and viewed later.
This format allows it to be opened in an Excel spreadsheet where the user can then make
graphs and analyze the data to reflect on their training.
The power delivery system powers all of these components at the required voltages and
offers protection for the lithium polymer rechargeable batteries as they are depleted. Fi-
nally the enclosure ensures that the whole system is both waterproofed and shock-proofed,
while keeping it simple to view the display, interact with the controls, and access the mem-
ory storage. The interactions of these subsystems can be seen in Figure 1 below.
1
1 Introduction
Figure 1: Overview of Subsystem Interaction
1.2 Performance Specifications
Table 1 outlines the target specifications and outcomes for each feature of the completed
device. The specifications were chosen to encompass all subsections of the project to ensure
every aspect is functional.
Table 1: Performance Metrics
Feature Target Specification Outcome Pass/Fail/Exceed
Manual Start/Stop Yes Yes Pass
Operating Temperature 0 to 40 C 0 to 40 C Pass
Sensor Dead-band Range 20 cm ± 5 cm 20 cm ± 5 cm Pass
Sensor Resolution ≤ 1 cm 0.5 cm Exceed
Annunciator Volume 80dB or loud enough to hear in water 75dB and audible underwater Pass
Lap Number Display 2 digit display 2 digit display Pass
Session Information Display 1 line of 16 characters display 2 line of 16 characters display Exceed
Data Logging ≥1 GB of storage 32 GB of storage Exceed
Water Resistance 10 cm depth for 1 hour ∼30 cm depth for 2 hours Exceed
Operating Time Active 200 hours/Inactive 8500 hours Upgraded to rechargeable Specification altered
batteries on client’s approval
2
2 DATA ACQUISITION SYSTEM
2 Data Acquisition SystemThe purpose of the data acquisition system is to detect the swimmer and calculate
the lap number and lap time. An ultrasonic sensor will detect the swimmer and relay the
information to a microcontroller, which will then process it in preparation for display and
storage.
2.1 Microcontroller
The microcontroller will be used to control a LCD, an ultrasonic sensor, a SD card, two
input buttons, a buzzer, and a battery monitoring circuit. In order to control these devices
it requires a minimum of 16 digital Input/Output (I/O) pins, 4 analog pins and Serial
Peripheral Interface (SPI) support. To handle the processing requirements it must have a
minimum clock speed of 16 MHz. As with the space restrictions the microcontroller must
also have a small form factor. Due to the team’s programming experience being mainly
in C/C++, the microcontroller should utilize those languages or have extensive software
support.
2.1.1 Design
An Arduino Mega was chosen as the microcontroller due to its low cost, easy to use inte-
grated development environment (IDE), online support, large quantity of I/O pins, and low
power consumption. The Beaglebone Green offered similar specs at a significantly higher
cost and the Arduino Uno didn’t meet the digital I/O requirements. The Nucleo-L476RG
offered similar specs at a comparable price but would have required extensive programming
experience with Nucleo devices. The Arduino Mega comes equipped with 16 analog and
54 digital I/O pins, 14 of which can be used for pulse width modulation (PWM) and 4 to
support SPI communication [1]. The process for selecting the microcontroller is outlined
below in Table 2.2. All decision matrices in the report use the criteria specified in Table 2.1.
3
2 DATA ACQUISITION SYSTEM
Table 2.1: Decision Matrix Evaluation Criteria
Grades Weight
Poor 1
Below Average 2
Average 3
Good 4
Excellent 5
Table 2.2: Microcontroller Decision Matrix
Microcontrollers
Arduino Uno Arduino Mega Beaglebone Green Nucleo-L476RG
Cost Excellent Good Below Average Average
Size (L x W x H) Excellent Good Excellent Excellent
Clock Speed Average Good Excellent Below Average
Digital I/O pins Below Average Excellent Good Below Average
Analog pins Average Excellent Average Average
SPI Support Excellent Excellent Excellent Excellent
Online Support Excellent Excellent Good Average
Programming Software Excellent Excellent Average Average
Sum 33 37 31 26
Rank 2 1 3 4
Result No Yes No No
Lap Time Calculations
When the microcontroller starts the program, it creates a start time variable from the
internal clock. When a lap is completed, the microcontroller subtracts the start time from
the internal clock in order to calculate the elapsed lap time. The start time variable is then
updated to the completed lap time to allow for the calculation of the next lap.
2.1.2 Performance
The power requirements were to have the device run 200 hours in active mode or 8000
hours inactive. Therefore having low power consumption is a major factor in performance.
A current draw test was performed on the microcontroller to get a no load current draw
value.
4
2 DATA ACQUISITION SYSTEM
Current Draw Test
To test the current draw from the Arduino Mega it was connected to a DC regulated
power supply where the applied voltage was increased while limiting the current to avoid
damaging the microcontroller. The voltage was increased up to the recommended operating
voltage of the controller and current draw value was observed under normal operation to
be 70 mA. In Figure 2.1 below, the total current draw at 9.3 V is seen on the DC regulated
power supply.
Figure 2.1: Microcontroller Current Draw Test
5
2 DATA ACQUISITION SYSTEM
2.2 Ultrasonic Sensor
The ultrasonic sensor will be in an environment where it will be subjected to moisture
and possibly submerged underwater. Therefore the sensor must be waterproof or have a
waterproof housing. The enclosure dimensions must be small as per the requirements. As
such the sensor must have a small form factor to allow integration within the enclosure
and other components. The sensor must have a detectable range between 20 and 100 cm
with a beam width of 45 and a distance resolution of 1 cm. The sensor must use logic
level control to be compatible with the microcontroller. Finally the sensor must be energy
efficient to allow for a longer active time.
2.2.1 Design
When deciding which sensor to select for the project there were four main design criteria:
cost, size, resolution, and water resistance. With the costs of the enclosure, hardware,
waterproofing, and potential Printed Circuit Board (PCB) system integration, this left a
small portion of the budget for the remaining components. The enclosure size requirements
meant there was limited space for the sensor amidst other components. Since the majority
of the sensors on the market were able to meet the distance detection requirement, the
resolution criteria held more weight. Having a more accurate sensor would improve the
performance and help meet the performance goals. The decision making process is shown
in Table 2.3 below.
Table 2.3: Ultrasonic Sensor Decision Matrix
Ultrasonic Sensors
Maxbotix Sensor RPS-400-30 Sensor Senix Tough Sonic 3 JSN-SR04T Sensor
Cost Poor Poor Poor Excellent
Size Average Average Average Excellent
Range (cm) Excellent Excellent Excellent Good
Water Resistance Excellent Excellent Excellent Good
Input Voltage Below Average Below Average Below Average Excellent
Resolution Good Excellent Excellent Excellent
Detection Angle Average Average Good Good
Operating Temperature Excellent Excellent Excellent Good
Sum 28 29 30 36
Rank 4 3 2 1
Result No No No Yes
The JSN-SR04T waterproof ultrasonic sensor was chosen as it met and exceeded most
6
2 DATA ACQUISITION SYSTEM
of our major and minor requirements. Though the other sensor had superior performance,
the high cost, large form factor and excessive input voltage requirements ruled them out.
With the low cost of the JSN-SR04T, two were able to purchased for a fraction of the other
models’ prices. This left a back up sensor if one was damaged in testing. The sensor’s Ar-
duino Mega compatibility and low power consumption simplified integration. The sensor
has a specified detection range between 25 and 450 cm with a beam angle of less than 50,
which exceeds the performance requirements [2].
Distance Measurement
The ultrasonic sensor is mounted through the front of the enclosure at a 12 angle
below the horizontal. This is to ensure the radiated waves hit the swimmer and reflect
back to the sensor. The angle was chosen due to the water level typically being lower than
the edge of the pool where the device is placed. The sensor’s effective range is between 25
and 450 cm leaving a dead-band area from 0 to 25 cm. Having the device resting above
the water with the angle adjustment allows the swimmer to record a lap before they enter
the dead-band.
The ultrasonic sensor operates by sending a 10 µs pulse to the trigger pin on the sensor.
This triggers the sensor to send an ultrasonic signal at 40 kHz for 8 periods. The sensor
waits for an echo signal to be received, at which point it calculates the distance based on
the time delay of the echo. This is shown in Equation 2.1, though the equation varies
as ultrasonic waves travel differently through different mediums [3]. For this project the
calculations were done in air.
Distance =(Signal Travel Time × Speed of Sound in Air)
2(2.1)
Lap Detection
To determine when the swimmer has completed a lap, the placement of the sensor in
relation to the swimmer and the surface of the water needed to be considered. At Joyce
Fromson Pool the curved pool coping has a width of 4 cm and the distance to the water
level was 14 cm. With these measurements the distance and angle that the sensor should
be from the edge of the pool can be calculated. This calculation will optimize the accuracy
of detecting a lap. A 3D printed sensor casing sets the angle of the sensor to 12. This
7
2 DATA ACQUISITION SYSTEM
places the center of the beam width at 109.03 cm from the pool edge. With a beam width
of 22 and a coded lap detection range of 25 to 35 cm, the swimmer could be detected in
the desired range. This design is illustrated in Figure 2.2 below.
14 cm
109.03
22°
POOL EDGE
SENSOR
BEAM CENTER
WATER LEVEL
SWIMMER
10.00
LAP COMPLETION RANGE
Figure 2.2: Object Detection Diagram
Lap Calculations
The completion of a lap occurs when a swimmer touches the end of the pool. The sensor
tracks the position of the swimmer’s head as they approach the edge of the pool. The
microcontroller increments the lap counter once the swimmer is within the lap detection
range of 25 to 35 cm. Once the lap counter is updated, the sensor is not pinged for a buffer
period to allow the swimmer to turn around and leave the detection range. This is done
so that multiple laps are not recorded at the completion of one lap.
2.2.2 Performance
A test platform was built in order to confirm the sensor specifications that were claimed
in the data sheet. The accuracy of the sensor distance detection was tested as well as the
sensor beam width.
Sensor Distance Measurement Test
To test the accuracy of the sensor, paper was taped down with inch markings along
its edge. A board was placed at the 0 inches mark and secured at a 90 angle to allow
for optimal reflections when sliding the sensor. The sensor was placed 20 inches from the
8
2 DATA ACQUISITION SYSTEM
board and the measurement system indicated a distance of 19.88 inches. The variation in
accuracy could be due to the board setup tolerances or if the humidity, temperature and
air pressure changed the wave propagation properties. However, this was well within the
performance metric of ≤ 1 cm (0.12 inches = 0.305 cm).
In order to test the dead-band distances, the sensor was moved relative to the board
until the measurements failed to update correctly. Through testing it was found that the
sensor dead-band was anything less than 8.16 inches (20.73 cm) and anything greater than
61.88 inches (154.64 cm). To ensure proper detection a minimum distance of 25 cm was
set so that no measurements were missed. The distance test setup is shown in Figure 2.3
below.
Figure 2.3: Sensor Distance Test Setup
Sensor Beam Width Measurement Test
The JSN-SR04T sensor data sheet specified a beam width of 50 degrees [2]. A beam
width measurement test was performed to validate this and find the sensor’s minimum
beam width to compare to the performance metric. The test schematic can be seen in
Figure 2.4 and the experimental test setup in Figure 2.5. The sensor was set at a known
distance of ∆X = 47.04 cm as measured from the sensor. The sensor was mounted in a test
housing at a height h = 9.21 cm. Using a separate wooden board with a known thickness
2.5 cm, the board was moved slowly down until a value of 44.54 cm was recorded. Once
9
2 DATA ACQUISITION SYSTEM
the board was detected the height of the board was marked and the difference in height
∆Y was measured. Using the properties of a right angle triangle, half of the beam width
was calculated with Equation 2.2.
tan(θ) =Opposite
Adjacent(2.2)
Re-arranging for θ we get:
θ =tan−1(∆Y
∆X
)
θ =tan−1(18.42 cm − 9.21 cm
44.54 cm
)
θ =11.68 cm
(2.3)
47.04 cm
X
Y
9.21 cm
SENSOR
FRONT PLATEBACK PLATE
Figure 2.4: Sensor Beam Angle Schematic
10
2 DATA ACQUISITION SYSTEM
Figure 2.5: Sensor Beam Angle Test
The results from the test confirmed that the sensor’s total beam width was 23.72,
which is much lower than the specified value. This allowed considerations to be made into
the sensor mounting angle to ensure that the swimmer is detected.
Sensor Waterproofing Test
The JSN-SR04T sensor was marketed as waterproof/water resistant so to verify this
claim it was subjected to a waterproofing test. The sensor exterior housing was epoxied
and left to dry to emulate its environment in the final product then submerged in 20 cm
of water while a test program was run. The sensor functioned as expected under these
conditions. Subsequently the sensor was left submerged for a total of 1 hour at the depth
of 20 cm before removal for further testing. The sensor performed as intended with no
signs of measurement errors. This exceeded the waterproofing performance metric for the
project.
11
3 DATA LOGGING SYSTEM
3 Data Logging SystemThe data logging system consists of an SD card reader interfaced with the Arduino
Mega microprocessor. The data logger is triggered whenever the sensor detects that a lap
is completed, at which point it stores the lap number and lap time to the SD card. The
SD card can then be removed after the session and the data transferred to a computer for
the user to view.
3.1 SD Card Reader
The data logging subsystem was an optional addition in the main scope of the project.
As such, it did not have design criteria specified in the product requirement statement,
so some criteria were defined. The options were evaluated based on cost, ease of imple-
mentation, storage capacity, and user friendliness. The options for this subsystem were to
either use an SD card and reader, store information on the Arduino’s Electronic Erasable
Programmable Read Only Memory (EEPROM), implement a Wi-Fi module to save data
to a server, or to not implement data storage and just track and display the user’s data
for the session.
3.1.1 Design
Data logging was included because it would drastically improve the project’s function-
ality by allowing the user to track their progress over multiple sessions. Furthermore the
data logging options were relatively inexpensive and easy to implement.
After evaluation, the SD card reader option was chosen over the Wi-Fi module and the
EEPROM storage. The Wi-Fi option would introduce difficulties for the user. It would
have required wireless internet connection in the pool facility which is not always an op-
tion, and it would introduce the added difficulty of connecting it initially. The EEPROM
storage method had the benefits of simplicity and no extra costs, but EEPROM cells can
only be written to a finite number of times before they burn out and cannot be replaced
easily [1]. That user difficulty plus the smaller EEPROM storage capacity led us to choose
the SD card reader option. This decision was made according to the data logger decision
matrix outlined in Table 3.1 below.
12
3 DATA LOGGING SYSTEM
Table 3.1: Data Logger Decision Matrix
Data Logging Options
Ethernet SD Card No Long-Term EEPROM
Shield Reader Storage
Cost Average Good Exceptional Exceptional
Ease of Implementation Below Average Good Exceptional Exceptional
Storage Capacity Exceptional Good Poor Poor
User Friendliness Below Average Good Poor Average
Sum 12 16 12 15
Rank 3 1 3 2
Decision No Yes No Yes
The SD card reader requires the SPI communication pins on the Arduino Mega board.
The Master In Slave Out (MISO), Master Out Slave In (MOSI), Serial Clock (SCK), and
Chip Select (CS) pins on the card reader were connected to the corresponding SPI pins on
the Arduino Mega.
3.1.2 Performance
The data logging system was unit tested with a basic data logging Arduino program
that was designed to write a series of 20 random numbers in string format to a .csv file.
This was made to emulate the actual data that will be written to memory, as it will be a
time and lap count of similar length in string format. Initially it tested well and stored the
transmitted data onto the 32 GB SD card. However at a later stage when it was being in-
tegrated with the data acquisition and controls systems, corrupted data was being written
to memory.
This necessitated more unit testing so the testing program was again employed with
another SD card reader, another SD card, and the various combinations of these compo-
nents. It was determined that the card reader itself was causing the error and was unable
to initialize properly without corrupting the serial data on the serial monitor. The com-
parison between the card readers can be seen in Figures 3.1a and 3.1b, with the original
card reader’s serial monitor interface shown first in Figure 3.1a and the new card reader’s
performance below in Figure 3.1b.
13
3 DATA LOGGING SYSTEM
(a) Faulty SD Card Reader Serial Monitor Output
(b) Replacement SD Card Reader Serial Monitor Out-put
Figure 3.1: SD Card Data Writing Unit Testing
14
3 DATA LOGGING SYSTEM
With the replacement card reader the data logging subsystem was ready to be connected
to the other subsystems of the project. The data logging system can be seen integrated
with the data acquisition system in Figure 3.2.
Figure 3.2: Integrated Data Logging System
15
4 CONTROLS AND MONITORING INTERFACE
4 Controls and Monitoring Inter-face
An LCD and two waterproof buttons were chosen to provide visual data output and
manual control. Upon lap completion, the LCD displays the current lap number as well as
the elapsed time. This feature allows the user to see real time swim data without having
to turn off the device and read the data from the SD card. The two buttons provide start
and stop/reset functionality.
4.1 Display
The display feature has two mandatory features: it needs to be able display the current
lap number and completed lap time, and the display must be visible in a 200-600 lux
environment. The other factors that went into the decision were cost, number of electrical
connections, display output contrast, American Standard Code for Information Interchange
(ASCII) capability and efficiency.
4.1.1 Design
The selection process is outlined in Table 4.1 below. Seven segment displays were
considered but required more power and connections than the LCD, and the thin film
transistor (TFT) LCD is more expensive and displays less information. The LCD with two
rows of 16 characters was selected over the others primarily because of its ASCII capability,
good display contrast, and efficiency. The LCD is connected to the Arduino microcontroller
by six digital pins which send ASCII data to be displayed. A 10 kΩ potentiometer is used
to control the contrast ratio of the LCD. The LCD draws 1.2 mA at 5 V only using 7.2
mW of power which is well within the energy consumption limits.
16
4 CONTROLS AND MONITORING INTERFACE
Table 4.1: Display Decision Matrix
Display Options
LCD 2x16 TFT LCD 7 Segment
Cost Good Below Average Good
Connections Good Excellent Average
Display Output Contrast Good Good Excellent
ASCII Capable Excellent Excellent Poor
Efficiency Good Below Average Below Average
Sum 21 18 16
Rank 1 2 3
Result Yes No No
4.1.2 Performance
Display Testing
The display unit test involved running a simple program to display text and verify the
working order of the display. Next the contrast was adjusted in a bright room to ensure
the text would be visible in the 200-600 lux pool environment. The LCD was taken to the
Joyce Fromson Pool at University of Manitoba as part of testing for other components,
where the display visibility was confirmed. This test can be seen in Figure 4.1 below. The
LCD performed as intended and the text was adequately visible from the poolside.
17
4 CONTROLS AND MONITORING INTERFACE
Figure 4.1: LCD Display Test at Joyce Fromson Pool
4.2 Controls
Tactile controls are used to allow the user to start and stop/reset the program. The two
buttons used to control these functions need to be waterproof as they will be subjected to
the electrically hazardous pool environment. The controls are inset into the enclosure by
design as outlined in Section 6. This design eliminates some of the ruggedness requirement
as the controls are no longer exposed. The buttons still must have a small form factor to
reduce the size of the peripheral casing and the hole made for it in the enclosure.
4.2.1 Design
There were many buttons on the market that are waterproof, however the limited
enclosure space helped narrow down the choices. The majority of the remaining options
were around equal in cost, functionality, and size, and were all waterproof. The buttons
with a dome shape were selected for their good tactile response and load distribution if
contact was made with them. They were very inexpensive which permitted purchasing
multiple backups for stress and waterproof testing.
18
4 CONTROLS AND MONITORING INTERFACE
4.2.2 Performance
Input Testing
To test the selected buttons the exposed soldered leads were first epoxied to simulate
how they will be properly waterproofed in the button casing. Next they were submerged
in a bucket of water at a 10 cm depth. A multimeter was connected to the leads and con-
duction was confirmed when the button was pressed underwater. After passing the initial
test the button was left submerged for 1.5 hours before the conduction was tested again.
The button conducted properly only when the button was depressed. This test setup is
demonstrated in Figures 4.2a and 4.2b.
(a) 0L Indicates No Conduction (b) 0 Indicates Conduction
Figure 4.2: Button Waterproofing Test
4.3 Audible Feedback
An optional addition to the project was to implement audible feedback at the comple-
tion of a lap. This would indicate to the swimmer that the lap was completed and logged.
The purpose of this feature was to allow the swimmer to focus on their technique instead of
tracking their progression every lap. A piezoelectric buzzer was used to provide an audible
tone when the lap was completed.
The main requirement when selecting the buzzer was its Decibel (dB) rating because
19
4 CONTROLS AND MONITORING INTERFACE
the tone needed to be audible from underwater. The buzzer that was selected was the
TKD PS1440P02BT buzzer which has a decibel rating of 75 dB [4]. When tested at Joyce
Fromson Pool with a swimmer they were able to hear the tone above and below the water
at the completion of a lap.
20
5 POWER DELIVERY SYSTEM
5 Power Delivery SystemThe power delivery system consists of three parts: the battery, the converter system,
and the battery protection circuit. The power system is designed to be efficient, safe, and
light. The most energy dense battery option, a high efficiency DC-DC converter system,
and protection systems that allow for safe operation of the device were implemented to
achieve these design goals. The following sections will outline the decision making process
behind our design for these systems.
5.1 Battery Considerations
Proper battery design is important because all of the other subsystems rely on the
battery to work, and it can potentially be the most volatile and dangerous aspect. That is
why the battery decision criteria include the safety and stability of the battery, the energy
density (ampacity divided by mass), and the individual cell voltage. The ease of operation
for the user was also considered, as well as the cost. During the design phase it was found
that the system required a significant amount of power and a large battery pack would be
required to meet the active operation time requirement. A large battery pack would make
it difficult to meet the density requirement of ≤0.8 g/cm3.
5.1.1 Design
The batteries considered for this project were Lead-Acid, Nickel-Cadmium (NiCd),
Nickel-Metal Hydride (NiMH), Lithium-Polymer (LiPo), or a series of 8 D cell batteries.
Regarding ampacity, the device needed to achieve an active operation time of 200 hours
and 8000 hours inactive. Initially the design called for disposable D cell batteries but
it became apparent what mass of battery that would require. Equation 5.1 outlines the
minimum ampacity necessary considering the base current requirement of 100 mA for the
Arduino microcontroller with additional components.
100mA x 200 hours = 20000 mAh (5.1)
Each D cell operating at 1.5 volts has approximately 15000 mAh ampacity [5]. Equation
21
5 POWER DELIVERY SYSTEM
5.2 outlines the necessary number of cells to meet our 12 volt system voltage requirement.
12 V (total)
1.5 V (per cell)= 8 D cells (5.2)
At least two of these eight cell packs would be necessary to meet the ampacity require-
ments. Given that the mass of one D cell battery is 135 grams, Equation 5.3 gives the
battery mass required to power the system.
135 g × 8 × 2 = 2160 g (5.3)
Furthermore these calculations are made assuming the current draw is not significantly
larger than the base current requirement of 100 mA. The projected mass of 2.16 kilograms
is more than could be allotted for the batteries. One of the design criteria is that the whole
project has a density less than 0.8 g/cm3 so that it would float on water and this battery
mass would make that very extremely difficult. The overall density calculations are carried
out in Section 6.
The specific energy densities and cell voltages of all battery options are outlined in
Table 5.1. Though we considered D cells to have too low energy density per cell, they
are the second best option in that regard. This led to a revision of the 200 active hours
performance metric with the client.
Table 5.1: Battery Energy Densities and Cell Voltages
Batteries
D Cell Lead Acid NiCd NiMH LiPo
Cell Energy Density (Wh/kg) 154.3 30-50 45-80 60-120 181.8 – 265.3
Cell Voltage (nominal) 1.5 V 2 V 1.2 V 1.2 V 3.3 V
A change in the design was proposed to the client regarding switching to a recharge-
able battery and lowering the active operation time requirement. The client approved the
changes in the design and requirements. At approximately 1 hour per session it was estab-
lished that it is reasonable to have the unit only require charging once every 25 - 30 uses,
so the battery system was redesigned to have a minimum 30 hours active time. An added
benefit is that a rechargeable battery eliminates the expensive and time consuming need
22
5 POWER DELIVERY SYSTEM
to replace disposable batteries regularly.
The Turnigy 3s 5200 mAh LiPo battery was chosen primarily because it offers high
energy density while keeping costs low. It has 5200 mAh capacity, 12.6 V max to 9 V min,
JST-XH and XT60u connectors, and a durable design. The criteria used in this decision
are outlined in Table 5.2 below.
Table 5.2: Battery Decision Matrix
Batteries
D-Cell Lead Acid NiCd NiMH LiPo
Energy Density Good Poor Below Average Average Exceptional
Cell Voltage Below Average Average Poor Poor Good
Safety Good Average Average Average Below Average
Cost Good Below Average Average Average Average
User Friendliness Exceptional Below Average Average Average Below Average
Sum 19 11 12 13 16
Rank 1 5 4 3 2
Result No No No No Yes
The main wires to the battery cells are a 14 American Wire Gauge (AWG) size cable
capable of 5.9 A of power transmission. The smaller wire is a 24 AWG capable of 577 mA
of power transmission [11]. Since our device will only be conducting between 70 mA and
140 mA we will use the smaller 24 AWG wires to connect our circuit.
5.1.2 Performance
Unit testing was done on the battery to determine its amp hour characteristics. The
test shows how much the voltage drops over time as the battery is depleted under the
maximum expected load. The battery discharge test is shown in Figure 5.1 with the BK
Precision Programmable DC Electronic Load 8500 Series test apparatus [9].
23
5 POWER DELIVERY SYSTEM
Figure 5.1: Battery Testing with Electronic Load at 100 mA
The battery was drained for three hours at 100 mA current draw to simulate the device
load. The test returned a plot of battery voltage as a function of capacity. These results
were extrapolated and cross-referenced with the projected battery discharge characteris-
tics to give us an idea of when the voltage will reach the threshold where the battery
protection circuit shuts the device off. The battery started at 11.94 V and finished at
11.85 V. Assuming linear operation, the battery active operation time is approximately
3 hours/0.09V = 33.3 hours/V and the operating voltage range is about 2.6 V therefore
the operating time is roughly 2.6 V × 33.3 hours/V = 86.7 hours.
5.2 DC-DC Converter
The DC-DC converter has the function of receiving the battery voltage and stepping
it down to a stable 5 V output, while protecting the processor from harmful short circuit
(SC) currents and over voltages (OV). The lower voltage is necessary to power the micro-
controller and its subsystems.
There were many important considerations that went into choosing the converter such
as magnitude of the current output and efficiency. As the battery gets depleted there is
some variation in its output voltage, so the range of acceptable input voltages to the con-
verter must be considered. Finally the temperature rating and cost of the converter are
also taken into account.
24
5 POWER DELIVERY SYSTEM
5.2.1 Design
The DC-DC converter is designed to accept input voltages from 9 to 12.6 volts, though
the battery protection circuit will cease operation once the input voltage drops below
10 volts to protect the battery cells. Figure 5.2 below shows the layout of the DC-DC
converter as it accepts a range of input voltages and outputs the requisite 5 volts to power
the Arduino and components.
12-9.5V Input
1a
+
1b
−DC-DC 5V Output
2a
+
2b
−
Figure 5.2: DC-DC Conversion
The simplest option considered for the DC-DC converter was a linear regulator, but
that would have introduced immense losses and reduced the efficiency. A more expensive
converting option was needed to improve the battery lifetime and save on energy costs
in the long run. For this reason a buck converter was implemented. Buck, boost, and
buck-boost converters are highly efficient compared to linear regulators because they are
composed of non-resistive components [8].
The CUI Inc. DC-DC converter proved to be superior to the other options in all ways
except cost, though the cost was still relatively low and certainly justifiable for the benefits
it provided [10]. It has an 88% efficiency which will significantly reduce the energy cost
in the conversion. The device is easily mounted to the enclosure through two small screw
mounting holes. The screw terminal connectors make it easy to connect wires together.
The CUI Inc. DC-DC converter can be seen below in Figure 5.3. The decision matrix used
in this process can be seen in Figure 5.3.
25
5 POWER DELIVERY SYSTEM
Figure 5.3: DC-DC Converter
Table 5.3: DC-DC Converter Decision Matrix
DC-DC Converters
Linear Regulator CUI Inc LTC3703SelfDesign
Input Range Average Exceptional Average Poor
SC, OV protection Average Exceptional Poor Poor
Temperature rating Average Exceptional Exceptional Poor
Efficiency Low Exceptional Average Poor
Current output Low Exceptional Average Average
Cost Exceptional Poor Average Average
Sum 16 26 18 10
Rank 2 1 3 4
Result No Yes No No
Protection is crucial because a LiPo battery is capable of current output in the 1000A
range in the case of a short circuit. If that were to occur, a voltage difference with essen-
tially no resistance can produce enough current to release heat and combust. The CUI Inc.
DC-DC converter offers the short circuit protection necessary to avoid this.
5.2.2 Performance
Unit testing was carried out on the converter to verify its output performance across
the input range by connecting the the converter input to a power supply and measuring
26
5 POWER DELIVERY SYSTEM
the output. The desired 5 V output was observed across an even larger range of input
voltages than expected. The results at 3 different voltages can be observed in Figure 5.4a,
5.4b, and 5.4c below.
(a) DC-DC Converter Testing at 0.7V (b) DC-DC Converter Testing at 8.5V
(c) DC-DC Converter Testing at 13.8V
Figure 5.4: Monitor Images for Various Configurations
Figure 5.4a shows that the output is 0 volts when the input is low. The following two
Figures 5.4b and 5.4c display the experimental upper and lower limits of the input range;
13.8 V and 8.5 V respectively. These test results ensure that the device will work for all
ranges of inputs that we need.
27
5 POWER DELIVERY SYSTEM
These tests proved that the converter would work for the design. The converter could
be safely integrated into the complete design for system integration testing. Because there
is no feasible way of disconnecting the battery from the circuit when the battery voltage
reached 9V, the battery protection circuit was designed to do that.
5.3 Battery Protection Circuit
A battery protection system is necessary for LiPo batteries to prevent the cells from
becoming unbalanced and to stop the voltage from dropping dangerously low. Unbalanced
cells can cause dangerously high currents that would be dangerous to the user and device.
However cell balancing is not the most pressing issue for this application because the data
acquisition by ultrasonic detection device is expected to pull less than 200 mA. A large
current draw can cause more voltage drop on an outer cell than an inner cell and create
imbalance, but at such low currents the cells are self balancing.
Protection against low voltage operation is the concern for this application. If the
voltage drops below 3 V in any cell, it can become damaged. Damage can render the cell
unable to hold a charge, or in the worst case scenario the battery could light on fire or
explode [6][7].
5.3.1 Design
Two systems were designed for low voltage protection. The first method involves mon-
itoring the battery cell voltage using an Arduino analog pin. Arduino software was created
to automatically shut down the circuit if the cell voltage drops below a safety threshold.
The second low voltage protection method is electronically switching the circuit off when
the voltage drops below 10V. This reduces the life cycle of the device but ensures that it
is safe.
Software Voltage Protection
Figure 5.5 shows the connection to the analog input pin on the Arduino Mega via a
JST-XH connector. The connection enables us to monitor one of three cells on the battery,
from which we can determine when to open the circuit. The single cell maximum voltage
is 4.2 V, which is sufficiently lower than the Arduino’s analog input handling voltage. It is
28
5 POWER DELIVERY SYSTEM
possible to monitor all three cells with voltage dividers on the other two, but this would be
unnecessary and inefficient. The low current means the cells will stay balanced so monitor-
ing one is sufficient, and voltage dividers would waste power. By design when the voltage
of the single cell drops below 3V the circuit will be opened.
3.8V
3.8V
3.8V
7.6V
+
−
11.4V
+
−
100 MΩ
100 kΩ
Arduino
A0
Figure 5.5: Software Shutdown Circuit
The only cost to adding this into our system is the minimal energy lost by monitoring
the voltage on the cell. Given that the input resistance to the Arduino on its analog inputs
is 100 MΩ, the current being pulled from the battery to measure the voltage is a mere 50
nA. The software is meant to be the redundant protection system that only is triggered if
the hardware protection system fails.
Hardware Voltage Protection
The hardware voltage protection circuit consists of a Zener diode driving a Metal Oxide
Semiconductor Field Effect Transistor (MOSFET) switch with a fuse in series. When the
battery voltage is above the threshold set by the Zener breakdown voltage and the Gate-
Source Voltage (VGS), the MOSFET will close the circuit and allow conduction through
the load. Below the voltage threshold the MOSFET switch is off and no current will flow
through the load.
29
5 POWER DELIVERY SYSTEM
9 − 12.6V
Fuse
8.2V
+
−
R2
Q1
VGS
1.3V
+
−
Load
Figure 5.6: 9.5V Shut-off Circuit
As seen in Figure 5.6, the cutoff voltage is set at 9.5 V which will trigger before the
software protection at 9 V. The Zener diode requires 8.2 V to breakdown and allow con-
duction to the switch, and the MOSFET requires an additional 1.3 V to trigger the switch.
5.3.2 Performance
To ensure the proper operation of the shutoff circuit it was tested under different supply
voltages. A power supply with variable supply voltage and current limiting was utilized
with a test circuit. This circuit seen in Figure 5.7 used a Light Emitting Diode (LED) and
200 Ω resistor as a load to show what voltage was required to turn the circuit on and off.
The expected cutoff voltage was at 9.5 V.
30
5 POWER DELIVERY SYSTEM
9 − 12.6V
Fuse
8.2V
R2
Q1
Figure 5.7: 9.5V Shut-off Test Circuit
This test setup showed whether the output was on, off, or partially on based on the
LED brightness. The MOSFET’s operation at a low VGS is the reason why the circuit can
be partially on at a certain voltage. In this small region of operation the current flow is
limited instead of being on or off. The off, partially on, and on voltage ranges are shown
below in Figures 5.8a, 5.8b, and 5.8c respectively.
31
5 POWER DELIVERY SYSTEM
(a) Auto Shut-off Testing at 9.4V (b) Auto Shut-off Testing at 9.6V
(c) Auto Shut-off Testing 13.2V
Figure 5.8: Auto Shutoff Testing
The test results highlight the fact that the circuit works as expected in all voltage
ranges. The circuit remains fully off at 9.4 V and is partially on at 9.6, as the LED has
started to get brighter. The LED turned fully on after the input voltage was increased to
10 V. The final picture in Figure 5.8c is of the absolute peak input voltage of 13.2 V to
prove that the battery protection circuit is functional over the full range of voltages. The
positive test results validated the battery protection circuit design and allowed the final
integration and assembly to take place.
32
6 ENCLOSURE
6 EnclosureThe purpose of the enclosure is to contain all of the other components and meet several
crucial design metrics relating to durability, shock-proofing, and waterproofing. The enclo-
sure must allow the user access to the manual controls and give them sight of the display,
and let the ultrasonic sensor sit securely on the exterior at the desired angle. Subsections
of the enclosure include the enclosure base design, mounting of the components within the
enclosure, and peripheral casings for the user interaction components.
6.1 Physical and Display Considerations
The enclosure is required to satisfy several of the performance metrics relating to the
physical durability and size of the project. The enclosure has to be shockproof for a 1
meter drop test and water resistant at a 10 cm depth for 1 hour. It is required to have
dimensions no larger than 10.5 x 20.5 x 30.5 cm, a maximum mass of 1300 grams, and
density lower than 0.8 g/cm3 so that it will float. Furthermore it is necessary for an LCD
display to either be visible through the case or mounted and waterproofed on the outside.
6.1.1 Design
The initial base design for the enclosure was to 3D print an enclosure in pieces and
epoxy it together to waterproof it. However this would make it difficult to view the LCD
display as the 3D printed material is opaque, thus requiring some difficult waterproofing.
Another option considered early on was to build the case out of cut Plexiglas pieces that
would be secured together and waterproofed with epoxy. However this introduced more
problems with shock-proofing the case itself and the components inside, as it would be
difficult to mount them securely.
There were case options from OKW Enclosures and Serpac Enclosures that fit the size,
waterproofing and shock proofing requirements. Both options fit all of the requirements
and would make mounting easier. The OKW enclosure was chosen because the company
offered to send a free model for testing, thus eliminating the budget constraints. The de-
cision process is outlined in Table 6.1 below.
33
6 ENCLOSURE
Table 6.1: Enclosure Decision Matrix
Enclosures
OKW 3D Printed Plexiglass Serpac 193RC
Availability Average Good Good Average
Cost Exceptional Good Good Poor
Waterproof Exceptional Average Average Exceptional
Shock proof Exceptional Average Below Average Exceptional
Transparency Exceptional Poor Exceptional Exceptional
Sum 23 15 18 19
Rank 1 4 3 2
Decision Yes No No No
All cases considered would also meet the density requirement of less than 0.8 g/cm3
(less than water). The main component contributing to the weight of the project is the
battery, which only weighs 436 grams. The Arduino Mega weighs 37 grams. Erring on the
side of caution the other electrical/mounting components were estimated to be significantly
less than 500 grams. As shown in Equation 6.1 and Equation 6.2 even if the enclosure is
only half of the allotted 6565.125 cm3 in volume, the case would need to be more than 1.65
kg for it to be too dense to float.
0.8 g/cm3 =436 g + 37 g + 500 g + Enclosure Mass
6565.125 cm3/2(6.1)
Enclosure Mass =1653 g (6.2)
The 3D printed or Plexiglas enclosures could have been designed large enough within
the space restrictions to meet the density requirement easily. The OKW enclosure that
we chose was 602.9 grams and has dimensions 25.2x16.2x9 centimeters which gives 3674.16
cm3 volume [12]. As shown in Equation 6.3, its approximate density is 0.4265 g/cm3 which
is well below the requirement.
34
6 ENCLOSURE
Density =427 g + 37 g + 500 g + 602.9 g
3674.16 cm3= 0.4265 g/cm3 < 0.8 g/cm3 (6.3)
6.1.2 Performance
The performance of the base enclosure was assessed through some early unit tests;
specifically a waterproofing test shown in Figure 6.1 and a 1 meter drop test in Figure 6.2.
The enclosure passed the drop test showing no signs of damage.
The waterproofing test was carried out by weighing the enclosure down and leaving it
underwater for 1 hour with paper towels inside to indicate leakage. Upon opening it again,
there was only some slight indication of water on one edge. However the exterior of the
case was only lightly dried off before opening it and that edge was in the direction that
the lid was tilted to when opening the case. It is believed that opening the case was the
cause of the moisture there and that the enclosure passed the waterproofing test.
Figure 6.1: Initial Waterproofing Test
35
6 ENCLOSURE
Figure 6.2: 1 m Drop Test
6.2 Mounting
To ensure the components inside the enclosure are shock-proofed and secure, the mount-
ing design had to be considered. The OKW enclosure had multiple mounting standoffs
designed for a back plate. To save costs and shipping time a back plate was constructed
out of Medium-Density Fiberboard (MDF). OKW Enclosures were able to provide the
AutoCAD drawings in Figure 6.3 detailing the interior of the case and standoff locations
for back plate design and construction. The back plate offers a location to securely mount
the microcontroller, battery, DC-DC converter and battery protection circuit.
36
6 ENCLOSURE
Figure 6.3: Internal Case Dimensions
To refine the design and improve the aesthetics, a top plate was made to mount the
LCD, piezoelectric buzzer, and SD card reader, as well as to hide the wires and electronics
below. Mounting across two layers made more efficient use of the space which was already
restricted by the client’s specifications. To separate the two plates, 1-1/2” standoffs were
used. The integrated top and bottom plates can be seen in Figure 6.4 below.
37
6 ENCLOSURE
Figure 6.4: Mounting Top and Back Plates
6.3 Peripheral Casings
A challenge that the project faced was to successfully waterproof the entire enclosure
yet still allow the user to control it with two buttons to start and stop it and a power switch
to turn it on and off. These requirements meant that it was necessary to find waterproof
button and switch components, and also find a way to attach them on the outside of the
enclosure where they will not compromise the waterproofing. The same issue applied to
the ultrasonic sensor, because it cannot produce useful data through the enclosure.
6.3.1 Design
The first plan for this issue was to drill and cut holes for the buttons, switch, and sensor
into the case and secure them in place with epoxy that would waterproof the edges. The
problem with this is the low precision cuts that would be made. Precision is necessary, as
the outer lip of the circular buttons (meant to spread onto the outside of the enclosure)
has a diameter of only 19 mm, and the diameter of the inner section is 18 mm. Using a
circular drill bit would not return a ≤1 mm precision, and the button would likely not fit
38
6 ENCLOSURE
at all or fall through the hole.
This led to 3D modeling the peripheral casings as a solution. The 3D modeling and
printing offered very high precision to make sure the buttons, switch, and sensor would fit
tight in the casing and make waterproofing easier. Then a larger hole could be cut in the
enclosure for the casing to fit into, and could be made watertight by designing the lip of
the casing to protrude further out over the enclosure.
3D printing the casings made it easy to achieve a precise 12 angle for the sensor to
be mounted at. This angle was necessary to reliably detect the swimmer and this was
achieved in the 3D design.
Figure 6.5: SOLIDWORKS Button Case Design
39
6 ENCLOSURE
Figure 6.6: SOLIDWORKS Sensor Case Design
6.3.2 Performance
The models were made in SOLIDWORKS and printed with the UMIEEE lab 3D printer.
The holes for the peripheral casings were cut with the help of the University of Manitoba
Engineering Machine Shop. The peripheral casings secured to the enclosure can be seen
below in Figure 6.7.
Figure 6.7: Integrated Button and Sensor Casings
40
7 SYSTEM INTEGRATION
7 Integration and AssemblyAfter the completion of prototyping and unit testing, final integration and assembly of
the data acquisition by ultrasonic detection device could take place. The product needed
to be waterproof, durable, buoyant, and compact. These specifications guided the final
integration and assembly.
7.1 Peripheral Electrical Systems Integration
The electrical subsystems required a method of integration that kept them secure from
physical jarring within the enclosure. The electrical tolerances of the integration method
had to be taken into account, as well as the space it would require.
7.1.1 Design
Secure connection of all peripheral devices was the most vital design criteria in the final
electrical system integration. Assembling the electrical components on a PCB would save
space and reduce the electrical tolerances, and the soldered connections would be more
secure than jumper cables. However there was limited experience in PCB design among
the team members and long PCB shipping times meant that any mistakes could take weeks
to right. Simply connecting the electrical subsystems with jumper wires would not meet
the durability and shock-proofing requirements, so the decision was made to assemble the
electrical components on a custom Arduino shield.
The Arduino Mega shield integrates smoothly with the microcontroller headers and
give the flexibility to create more secure headers for the peripheral devices. Headers were
soldered to make connections between the shield and the Arduino Mega microcontroller.
The shield provides connections for the two buttons, LCD Display, buzzer, SD Card reader,
ultrasonic sensor, and battery monitoring input.
Male pin headers were soldered to the shield in order to make secure connection but still
allow for easy removal if a component malfunctions. A wiring diagram was created as seen
in Figure 7.1 to provide routing and soldering of microcontroller to header connections.
The final construction and integration of the shield can be seen in Figure 7.2 below.
41
7 SYSTEM INTEGRATION
Figure 7.1: Shield Wiring Diagram
n 5V Power n Ground n Signal
Figure 7.2: Final Shield Construction and Peripheral Integration
42
7 SYSTEM INTEGRATION
7.1.2 Performance
Once the peripherals were integrated with the Arduino Mega shield they needed to be
tested together. The final compiled code was uploaded to the system and the program
was ran. The buttons responded properly by starting and stopping/resetting the program.
The LCD displayed the distance measured from the sensor, and when a lap was detected
the SD card was successfully written to with the current lap number and time.
To finalize the lap detection, the device was taken to Joyce Fromson Pool where trials
were run. The detection range was set at 25-27 cm and increased until no lap detection
was missed over 10 measurements. We found the minimum detection range to be 25-31
cm. This test data can be seen in Table 7.1 below where ’X’ indicates a missed lap and,
’ ’ indicates a lap detected. This confirmed that the detection range set at 25-35 cm will
perform as needed.
Table 7.1: Lap Detection Test Data
Lap
Detection Range (cm) 1 2 3 4 5 6 7 8 9 10
25-27 X X X X X X X
25-28 X X X X X X
25-29 X X X X
25-30 X X
25-31
7.2 Power Delivery Integration
After the peripheral electrical systems were successfully integrated with each other,
the next step was to power them with the power delivery system instead of a computer.
First the rechargeable battery was interfaced with the DC-DC converter and the battery
protection circuit. After verification that the system was producing the desired voltage, it
was connected to the microcontroller.
A JST-XH connector was used to link up the battery with the protection circuit. This
connector was chosen with the user in mind because it allows the user to disconnect and
reconnect the battery easily for charging. Wires were securely soldered across the micro-
43
7 SYSTEM INTEGRATION
processor shield and the battery secured to the enclosure back plate with Velcro tape to
satisfy the shock-proofing requirements. The DC-DC converter’s mounting holes and wood
screws were utilized to secure it to the enclosure. Epoxy was used for mechanical support
at wire connection points.
The completed prototype circuit shown in Figure 7.2 was made to test the power
delivery system while integrated into the full system. The integrated system worked as
expected and these test results paved the way to the final assembly with the enclosure.
7.3 Assembly
Assembly of the final product began by epoxying the button housing and sensor housing
to the case in the gaps machined out for them. The sensor and buttons were then fed
through and epoxied in place to ensure a water tight fit. Following this the back plate was
mounted to the enclosure. The microcontroller, the DC-DC converter with the battery
protection circuit, and the LiPo battery were then mounted to the back plate with mounting
screws and Velcro tape. The LCD and the buzzer were mounted to the top side of the
top plate, while the SD card reader was secured to its underside. All of the electrical
connections were made from the peripherals to the microcontroller before the top plate
was attached to the bottom plate with the 1-1/2 inch board spacers. With everything
mounted to the interior, the clear enclosure top half was screwed to the bottom half to
complete the assembly and prepare for the final performance tests. The final assembled
build can be seen below in Figure 7.3.
Figure 7.3: Final Construction of the Swimmer’s Data Acquisition System
44
7 SYSTEM INTEGRATION
7.3.1 Performance
The final two tests that needed to be done were a drop test and a waterproofing test.
The drop test was performed to ensure the enclosure and the mounting of the components
could withstand a fall from 1 m height. The waterproofing test had the enclosure sub-
merged in 20 cm of water for 1 hour to test that the enclosure and the peripheral casings
were properly sealed.
Drop Test
For the final drop test the project’s electronics were removed to make sure they would
not be damaged if the test failed. However the mounts and connections for those compo-
nents were what needed to be tested, so they were replaced with stand-ins that resembled
the parts as closely as possible. A broken microcontroller with the same mounting hole spac-
ings was used in place of the Arduino Mega, and various other components were mounted
using the same methods the real components would use. The drop test was carried out on
all faces and corners of the enclosure. At the completion of the test the enclosure and com-
ponents showed no signs of damage or stress which validated it for the final waterproofing
test.
Final Waterproofing
After the drop test the stand-in internal components were left in place for the final
waterproofing test. This test would serve a second purpose of doubly verifying the previous
drop test by indicating small cracks with water leakage. The enclosure was stuffed with
paper towel to indicate leaks, before being submerged 20 cm below water level in a tub for
1 hour. When the enclosure was removed it was examined and returned no signs of leakage
externally. After drying the exterior and examining the interior paper towel padding, there
was again no sign of water penetration so the waterproofing of the enclosure was confirmed.
45
8 CONCLUSIONS
8 ConclusionThe purpose of this project was to design and build a functional swimmer’s data acqui-
sition device to track and log a swimmer’s progress over multiple sessions. The following
section highlights the outcomes and achievements made in this regard, and presents areas
where future work can be done to build on the project.
8.1 Project Outcome
In short, the goal of designing and building a functional swimming lap counter has been
achieved. The device meets or exceeds the design specifications laid out at the beginning of
the project. The device tracks the swimmer in the 20 to 154 cm range, interprets the track-
ing information and writes it to a removable SD card via SPI communication. A functional
user interface with buttons, switches, and displays was implemented and the processing
done by an Arduino microcontroller programmed in C/C++. Power was safely supplied
to all of the subsystems from a rechargeable LiPo battery and the enclosure waterproofed
and shock-proofed to tolerate the device’s environment.
Some design changes were made throughout the project’s duration but were dealt with
accordingly. Limitations on the battery life/overall mass and density parameters were
found. A major change to the design was made by switching from higher capacity dis-
posable batteries to rechargeable batteries which improved the design in many ways and
allowed the other design parameters to be met.
8.2 Future Developments
Improvements can be made to this design in several areas including the implementation
of Radio Frequency Identification (RFID), compressing the size, and improving the look
and feel. With a larger budget adding RFID capabilities would allow multiple swimmers
to track their progress at the same time in the same lane. This feature would require
more design into the user controls to start/stop tracking for multiple users and create the
necessity for active electronic devices on each user for identification. Using more energy
efficient components or smaller batteries, or compressing the electronics to a PCB would
maintain the same functionality while compressing the size of the unit.
46
9 Bibliography
References[1] ATmega640/V-1280/V-1281/V-2560/V-2561/V, Atmel Corporation, Datasheet, 2014.
[2] (2016). Ultrasonic Module JSN-SR04T Distance Measuring Transducer Sen-
sor, [Online]. Available:http://www.icstation.com/ultrasonic-module-sr04t-distance-
measuring-transducer-sensor-p-5046.html.
[3] S. Ramo, J. R. Whinnery, and T. V. Duzer, in Fields and Waves in Communication
Electronics. Hoboken, NJ: J. Wiley, 1993.
[4] Piezoelectronic Buzzers PS Series, TKD, Datasheet, May 2011.
[5] Duracell Copper Top Alkaline-Manganese Dioxide Battery, Duracell Batteries,
Datasheet.
[6] Microelectronic Circuits, A.S. Sedra and K.C. Smith, Oxford University Press, 7th
edition
[7] Basic Engineering Circuit Analysis, J. David Irwin and R. Mark Nelms, 11th Edition,
Wiley, 2015.
[8] Power Electronics, Daniel Hart, 2nd edition, McGraw-Hill, 2011. ISBN: 0073380679
[9] BK Precision , User Manual 8500 SERIES DC ELECTRONIC LOADS,
User Manual, Published in China, China, viewed 12 March 2017, https :
//bkpmedia.s3.amazonaws.com/downloads/manuals/en− us/85xxmanual.pdf .
[10] CUI inc , DC-DC CONVERTER, Datasheet, Published in USA, Tualatin, OR, viewed
16 March 2017, http : //www.cui.com/product/resource/pyb10 − t.pdf .
[11] Solaris, American Wire Gauge AWG Standards, Datasheet,
Published in USA, 1501 W Tufts Ave Suite 208 Englewood,
CO 80110, viewed 17 March 2017, https : //www.solaris −shop.com/content/American%20Wire%20Gauge%20Conductor%20Size%20Table.pdf .
[12] (2017) C7025084 In-Box, OKW Enclosures Inc. [Online]. Available:
https://www.okwenclosures.com/en/In-Box/C7025084.htm?var=afaebd21-c2e5-
11e2-8e2c-0050568225d7.
47
Appendix
A Appendix - Battery Test
Figure A.1: Battery Test Data
48
Appendix
B Appendix - Arduino Mega Schematic
3x2
M
+5V
GN
D
+5V
GN
D
8x1
F-H
8.5
GN
D
+5V
GN
D
47u
47u
GN
DG
ND
GND
GN
D
GR
EE
N
GND
+5V
M7
GN
D
NC
P111
7S
T50T
3G
100nG
ND
100n
100n
8x1
F-H
8.5
8x1
F-H
8.5
+3V
3
+5V
+5V
AT
ME
GA
2560-1
6A
U
100n
100n8
x1F
-H8.5
22p +
5V
GN
D
100n
GN
D
1u
YE
LLO
W
YE
LLO
W
US
B-B
_T
H
MF
-MS
MF
050-2
500m
A
+5V
100n
GN
D
YE
LLO
W
GND
100n
FD
N340P
GN
D
100n
GN
D
+5V
100n
+5V
GN
D
1u
+5V
AT
ME
GA
16U
2-M
U
3x2
M
+5V
GN
D
GN
D
GN
D
BLM
21
CG0603MLC-05E
CG0603MLC-05E
CS
TC
E16M
0V
53-R
0 1
6M
HZ
GND
1M
1k
1k
1k
1k
10K
10K
10K10K
10K
10K
10K
10K
1k
1k
1k
1k
22R
22R
22R
22R
TS
42031-1
60R
-TR
-7260
1M
GN
D
16MHz
22p 22p
GND
2x2M - NM
LM
V358ID
GK
R
LM
V358ID
GK
R
CD1206-S01575
18x2
F-H
8.5
+5V GND
10x1
F-H
8.5
8x1
F-H
8.5
CD1206-S01575
ICS
P1
23
45
6
1 2 3 4 5 6 7 8
PW
ML
PC
1P
C2
ON
D1
11
22
33
1
IN3
OU
T42
IC1
C3
C6
C2
1 2 3 4 5 6 7 8
AD
CL
1 2 3 4 5 6 7 8
CO
MM
UN
ICA
TIO
N
GN
DG
ND
GN
D
VC
CV
CC
VC
C
(A8
)PC
05
3(A
9)P
C1
54
(A1
0)P
C2
55
(A11
)PC
35
6(A
12
)PC
45
7(A
13
)PC
55
8(A
14
)PC
65
9(A
15
)PC
76
0
(AD
0)P
A0
78
(AD
1)P
A1
77
(AD
2)P
A2
76
(AD
3)P
A3
75
(AD
4)P
A4
74
(AD
5)P
A5
73
(AD
6)P
A6
72
(AD
7)P
A7
71
(AD
C0
)PF
09
7(A
DC
1)P
F1
96
(AD
C2
)PF
29
5(A
DC
3)P
F3
94
(AD
C4
/TC
K)P
F4
93
(AD
C5
/TM
S)P
F5
92
(AD
C6
/TD
O)P
F6
91
(AD
C7
/TD
I)PF
79
0
(AL
E)P
G2
70
(CL
KO
/ICP
3/IN
T7
)PE
79
(ICP
1)P
D4
47
(MIS
O/P
CIN
T3
)PB
32
2
(MO
SI/P
CIN
T2
)PB
22
1
(OC
0A
/OC
1C
/PC
INT
7)P
B7
26
(OC
0B
)PG
51
(OC
1A
/PC
INT
5)P
B5
24
(OC
1B
/PC
INT
6)P
B6
25
(OC
2A
/PC
INT
4)P
B4
23
(OC
3A
/AIN
1)P
E3
5(O
C3
B/IN
T4
)PE
46
(OC
3C
/INT
5)P
E5
7
(RD
)PG
15
2
(RX
D0
/PC
IN8
)PE
02
(RX
D1
/INT
2)P
D2
45
(SC
K/P
CIN
T1
)PB
12
0
(SC
L/IN
T0
)PD
04
3(S
DA
/INT
1)P
D1
44
(SS
/PC
INT
0)P
B0
19
(T0
)PD
75
0
(T1
)PD
64
9
(T3
/INT
6)P
E6
8
(TO
SC
1)P
G4
29
(TO
SC
2)P
G3
28
(TX
D0
)PE
13
(TX
D1
/INT
3)P
D3
46
(WR
)PG
05
1
(XC
K0
/AIN
0)P
E2
4
(XC
K1
)PD
54
8
AG
ND
99
AR
EF
98
AV
CC
10
0
GN
D113
26
28
1
PH
0(R
XD
2)
12
PH
1(T
XD
2)
13
PH
2(X
CK
2)
14
PH
3(O
C4
A)
15
PH
4(O
C4
B)
16
PH
5(O
C4
C)
17
PH
6(O
C2
B)
18
PH
7(T
4)
27
PJ0
(RX
D3
/PC
INT
9)
63
PJ1
(TX
D3
/PC
INT
10
)6
4P
J2(X
CK
3/P
CIN
T11
)6
5P
J3(P
CIN
T1
2)
66
PJ4
(PC
INT
13
)6
7P
J5(P
CIN
T1
4)
68
PJ6
(PC
INT
15
)6
9P
J77
9
PK
0(A
DC
8/P
CIN
T1
6)
89
PK
1(A
DC
9/P
CIN
T1
7)
88
PK
2(A
DC
10
/PC
INT
18
)8
7P
K3
(AD
C11
/PC
INT
19
)8
6P
K4
(AD
C1
2/P
CIN
T2
0)
85
PK
5(A
DC
13
/PC
INT
21
)8
4P
K6
(AD
C1
4/P
CIN
T2
2)
83
PK
7(A
DC
15
/PC
INT
23
)8
2
PL
0(IC
P4
)3
5P
L1
(ICP
5)
36
PL
2(T
5)
37
PL
3(O
C5
A)
38
PL
4(O
C5
B)
39
PL
5(O
C5
C)
40
PL
64
1P
L7
42
RE
SE
T3
0
VC
C1
03
16
18
0
XTA
L1
34
XTA
L2
33
IC3
C5
C4
1 2 3 4 5 6 7 8
AD
CH
C1
C8
C13
RX
TX
X2
1234
P$1P$1
P$2P$2
F1
C9
L
C7
T1
C12
C11
21RE
SE
T-E
N
C10
IC4
(AIN
0/IN
T1
)PD
17
(AIN
2/P
CIN
T11
)PC
25
(CT
S/H
WB
/AIN
6/T
O/IN
T7
)PD
71
3
(INT
4/IC
P1
/CL
K0
)PC
72
2
(INT
5/A
IN3
)PD
41
0
(OC
0B
/INT
0)P
D0
6
(OC
1A
/PC
INT
8)P
C6
23
(PC
INT
5)P
B5
19
(PC
INT
6)P
B6
20
(PC
INT
7/O
C0
A/O
C1
C)P
B7
21
(PC
INT
9/O
C1
B)P
C5
25
(PC
INT
10
)PC
42
6
(PD
0/M
ISO
/PC
INT
3)P
B3
17
(PD
I/MO
SI/P
CIN
T2
)PB
21
6
(RT
S/A
IN5
/INT
6)P
D6
12
(RX
D1
/AIN
1/IN
T2
)PD
28
(SC
LK
/PC
INT
1)P
B1
15
(SS
/PC
INT
0)P
B0
14
(T1
/PC
INT
4)P
B4
18
(TX
D1
/INT
3)P
D3
9
(XC
K/A
IN4
/PC
INT
12
)PD
511
AV
CC
32
D+
29
D-
30
GN
D3
PA
D3
3
RE
SE
T(P
C1
/DW
)2
4
UC
AP
27
UG
ND
28
UV
CC
31
VC
C4
XTA
L1
1
XTA
L2
(PC
0)
2
ICS
P1
12
34
56
L1
Z1
Z2
21GR
OU
ND
Y1
R1
RN
4A
18
RN
4B
27
RN
4C
36
RN
4D
45
RN5A
1 8
RN5B27
RN5C
3 6
RN5D
4 5
RN
1A
18
RN1B
2 7
RN1C
3 6
RN
1D
45
RN
3A
18
RN
3B2
7
36
RN
3C
4 5
RN3D
RN
2A1
8
RN
2B
27
RN
2C
36
RN
2D4
5
RE
SE
T
1 23 4
5
R2
IN1
ON
/OF
F3
NC
/FB
4
OU
T5
GN
D2
Y2
2 1
C14 C15
JP5
1 23 4
IC7A
2 31
IC7B
6 57
84
D3
XIO
12
34
56
78
91
011
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
JP
61234567891
0
12345678
PO
WE
R
D2
+5V
+5V
GN
DA
RE
F
AR
EF
AR
EF
RE
SE
T
RE
SE
T
RE
SE
T
RE
SE
T
RE
SE
T
VIN
VIN
VIN
M8R
XD
M8R
XD
M8T
XD
M8T
XD
PW
RIN
AD
C0
AD
C2
AD
C1
AD
C3
AD
C4
AD
C5
AD
C6
AD
C7
+3V
3
+3V3
+3V
3
SD
A
SD
A
SD
A
SC
L
SC
L
SC
L
AD
C9
AD
C8
AD
C10
AD
C11
AD
C12
AD
C13
AD
C14
AD
C15
PB
3
PB
3
PB
3
PB
2
PB
2
PB
2
PB
1
PB
1
PB
1
PB
5P
B4
PE
5
PE
5P
E4
PE
4P
E3
PE
3
PE
1P
E1
PE
1
PE
0P
E0
PE
0
DT
R
US
BV
CC
US
BV
CC
US
BV
CC
GA
TE
_C
MD
CM
P
PB
6
PH
3
PH
3
PH
4
PH
4
PH
5
PH
5
PH
6
PH
6
PG
5
PG
5 RX
D1
TX
D1
RX
D2
RX
D2
RX
D3
RX
D3
TX
D2
TX
D2
TX
D3
TX
D3
PC
0
PC
0
PC
1
PC
1
PC
2
PC
2
PC
3
PC
3
PC
4
PC
4
PC
5
PC
5
PC
6
PC
6
PC
7
PC
7
PB
0
PB
0
PG
0
PG
0
PG
1
PG
1
PG
2
PG
2
PD
7P
D7
PA
0
PA
0
PA
1
PA
1
PA
2
PA
2
PA
3
PA
3
PA
4
PA
4
PA
5
PA
5
PA
6
PA
6
PA
7
PA
7P
L0
PL0
PL1
PL1
PL2
PL2
PL3
PL3
PL4
PL4
PL5
PL5
PL6
PL6
PL7
PL7
PB
7
VU
CA
P
RD
-
RD
-
RD
+
RD
+
RE
SE
T2
RE
SE
T2
MIS
O2
MIS
O2
MO
SI2
MO
SI2
SC
K2
SC
K2
XV
CC
RX
LT
XL
D-
D+
UGND
UG
ND
USHIELD
XTA
L2
XTA
L1
XTA
L1
XT
2
XT
1
8PB78PB6
8PB58PB4
L13
+
+
X1
PO
WE
RS
UP
PLY
_D
C21M
MX
USB
0 1 2 3 4 5 6 7
8 9 10
11 12
13
Ard
uin
o M
EG
A 2
560
15
16
17
18
19
20
21
14
(SC
K)
(MIS
O)
(MO
SI)
pw
mpw
mpw
mpw
m
pw
mpw
mpw
m
pw
mpw
mpw
mpw
mpw
m
pw
mpw
mpw
m
(TX
0)
(RX
0)
51
52
53
pw
mpw
m
pw
m
pw
mpw
m
(MIS
O)
(SC
K)
(MO
SI)
(SS
)(M
OS
I)(S
CK
)(M
ISO
)
22
23
24
25
26
27
28
29
30
32
34
36
31
33
35
37
49
47
45
43
41
39
50
48
46
44
42
40
38
pw
mpw
mpw
m
USB boot En
TM
Refe
rence D
esig
ns A
RE
PR
OV
IDE
D "A
S IS
" AN
D "W
ITH
ALL F
AU
LTS
. Ard
uin
o D
ISC
LA
IMS
ALL O
TH
ER
WA
RR
AN
TIE
S, E
XP
RE
SS
OR
IMP
LIE
D,
Ard
uin
o m
ay m
ake c
hang
es to
specific
atio
ns a
nd p
roduct d
escrip
tions a
t any tim
e, w
ithout n
otic
e. T
he C
usto
mer m
ust n
ot
RE
GA
RD
ING
PR
OD
UC
TS
, INC
LU
DIN
G B
UT
NO
T L
IMIT
ED
TO
, AN
Y IM
PLIE
D W
AR
RA
NT
IES
OF
ME
RC
HA
NTA
BIL
ITY
OR
FIT
NE
SS
FO
R A
PA
RT
ICU
LA
R P
UR
PO
SE
rely o
n th
e a
bsence o
r chara
cte
ristic
s o
f any fe
atu
res o
r instru
ctio
ns m
ark
ed "re
serve
d" o
r "undefin
ed." A
rduin
o re
serve
sth
ese fo
r futu
re d
efin
ition a
nd s
hall h
ave
no re
sponsib
ility whats
oeve
r for c
onflic
ts o
r incom
patib
ilities a
risin
g fro
m fu
ture
chang
es to
them
.T
he p
roduct in
form
atio
n o
n th
e W
eb S
ite o
r Mate
rials
is s
ubje
ct to
chang
e w
ithout n
otic
e. D
o n
ot fin
alize
a d
esig
n w
ith th
is in
form
atio
n.
AR
DU
INO
is a
reg
iste
red
trad
em
ark
.
Figure B.2: Arduino Mega Schematic
49
Appendix
C Appendix - Enclosure Dimen-sions
252,00
162,00
R5,00
59,30 30,00
90,00
135,00162,00
225,00252,00
R5,00
R3,00
18,40223,00245,00
74,00114,00154,00190,50212,00238,00
117,00155,00
40,0075,00128,00130,00136,00
128,60
75,00
A
A
B
B
Unterteil Innenansicht
Base part inside view
7,00 74,70
1,20
3,404,00
15,008,00
A-A
0,401,30
4,507,75
4,00
B-B
220,00242,00
114,00152,00
Oberteil Innenansicht
Top part inside view
224,65
134,65
R3,00
FolientastaturM
embrane keyboard
+0
+0
220,50
152,50
212,00
128,00
4,20
R10,50
147,00
115,00
243,00
Platine U
nterteilP
CB
base part
M 1:1.5
152,50128,00
147,00
220,50212,00
4,20R10,50
Montageplatte
Mounting plate
2.5mm
dickthickness 2.5m
m
ML
87654321
ML
KJ
HG
FE
DC
BA
KJ
HG
FE
DC
BA
87654321
ENTWICKLUNG
Technische Änderungen vorbehalten. Irrtümer oder Druckfehlerbegründen keinen Anspruch auf Schadenersatz. W
ichtige Ein-baumaße bitte direkt mit dem aktuellen Produkt abstimmen.Subject to technical modification without prior notice. Typogra-phical and other errors do not justify any claim for damages. Alldimensions should be verified using an actual moulded part.Sous reserve de modifications techniques. Toute erreur ou fauted'impression ne justife aucune demande d'indemnisation. Nousprions les clients de verifer les dimensions des composants avecles boitiers avant le montage.
Informationskopie
wird nicht aktualisiert
Copy for Inform
ationw
ill not be updated
1:1
DIN 6 Teil 2
M00013957Dateinam
e:
Status:
KUNDEZeichnungsart:
Toleranzen:
Volumen:
DIN 16901 T13001.08.2012
01 D. Hasselbach
252 x 162 x 90C702508*
IN-BOX
Erst. von:
Freig. von:
Erst. am:
Freig. am:
Revision:
not be reproduced or copied and not be used or incorporated in any product.and is tendered subject to the conditions that the inform
ation be retained in confidence
Für dieses Dokument behalten wir uns alle Urheberrechte vor. Es darf auch auszugs-
weise weder vervielfältigt noch Dritten in irgendeiner Form zugänglich gem
acht werden.
This document contains proprietary inform
ation of OKW
Gehäusesystem
e Gm
bH
D
1
C
Figure C.3: Enclosure Dimensions
50
Appendix
D Appendix - Peripherals Pin As-signment Table
0 GND GND GND Button1(S/S) Pin341 5V MISO 50 GND2 20kPot SCK 52 Button2(Reset) Pin363 Pin32 MOSI 51 GND4 GND CS 535 Pin30 5V 5V Buzzer Pin36 - 3V3 3V3 GND7 - GND -8 - DigitalPinsUsed 4 VoltReadout Pin19 - AnalogPinsUsed 0 Control Pin3810 Pin28 PWMPinsUsed 011 Pin26 GND GND12 Pin24 Echo Pin713 Pin22 Trig Pin3814 5V 5V 5V15 GND DigitalPinsUsed 4
DigitalPinsUsed 6 AnalogPinsUsed 1AnalogPinsUsed 0 PWMPinsUsed 1PWMPinsUsed 0
PeripheralsPinAssignmentTable
ExternalPowerPinAssignment
BuzzerPinAssignment
SensorPinAssignment
LCDPinAssignment SDCardPinAssignment ButtonPinAssignment
Figure D.4: Peripherals Pin Assignment Table
51