I created a stopwatch for the fire sport - a timer to record attacks. The stopwatch allows you to print up to two times (for left and right attack) on the LCD character display with I2C converter. The stopwatch is equipped with four buttons (switching contacts) for start actions, stop left time, stop right time and restart time.
The switching contact for starting the stopwatch can also be connected to the signal gun. Time stop contacts for left and right attack are located on the targets. As these contacts are exposed to water, it is necessary to use either a mechanical covered (maintenance-free) contact or a gold contact pad that does not participate in oxidation. The stopwatch is suitable for voluntary fire brigades and orienteering training times. These stopwatches cannot replace a certified timer. Stopwatch timing works on the principle of an internal timer - the millis () function, which returns the number of milliseconds.
- Arduino Uno / Nano / standalone chip AtMega328P
- 4x switching contact / button
- LCD character display 20x4 / 16x2 with I2C converter
- Stopwatch for tenths of a second
- Stopwatch for hundreds of seconds
The decimal stopwatch logic is executed every 100 milliseconds. Thus, once every 100 milliseconds, one tenth is added (if the time is active) and the display is updated (both times are displayed). The display takes 32 milliseconds. The problem with implementing hundreds of hundreds was that the system logic is executed every 10 milliseconds. As the printout lasted 32 milliseconds. When the stopwatch is running in such a configuration, the stopwatch would be misaligned by 3 hundred per display display.
For this reason, it was necessary to change the logic of the display (update only a specific position on the display when changing it, not the entire line), increase the speed of the I2C bus (from the original 400 kHz). The result is a stopwatch that allows you to measure and display time in hundreds of seconds.
The accuracy of the stopwatch depends on the crystal (oscillator) used. The original Arduino boards have a more accurate 16MHz crystal than the Chinese. For this reason, the timing is also more accurate. However, since the differences in the frequency of the crystals are very small, the deviation will only become apparent when compared over a longer period of time. Since the stopwatch is mainly used to calculate attack time, which lasts up to about one minute, these differences are negligible and accuracy is sufficient for indicative measurements.
The switching contacts used in this stopwatch connection use an internal PULLUP resistor of 50kohm Arduino, by which these digital inputs are connected in parallel to a 5V power supply. By switching the button, the value 0V (GND) is applied to the given terminal.
This change is registered in the program immediately, the order of each input is tested several times per millisecond. No debounce is used for the contacts, therefore it is necessary to use a reduced external pullup resistor for longer contact to the contacts.
Depending on the length of the cable used to the switches, a delay must also be taken into account. Since the line length does not change, this delay is always the same and included in the resulting time (until the signal arrives).
Stopwatches for tenths of a second are available with source code, stopwatches for hundreds of seconds are only available in machine code - shareware - 30 seconds initialization, max. measurement 15 seconds.
Source codes are available at Github: https://github.com/martinius96/hasicske-stopky