Converting Digital Watch into a Timer Stopwatch for Projects

Pictured below are the inner workings of a cheap digital watch which has been modified to enable remote operation of the buttons so it can be used for automatic stopwatch timing.

Modified digital watch used as stopwatch with remote buttons or relay control

This particular watch had a broken backlight and broken strap, but it had always kept very good time. Therefore it was a perfect candidate to be re-purposed.

The watch had rubber button tops integrated into the watch case. When the workings are removed from the case, the buttons themselves are exposed. They comprise a thin strip of metal separated from a metal pad on the watch PCB. When the rubber button top is pressed down, the metal strip makes contact with the metal pad making an electrical connection.

Inside look at a digital watch button

All of the metal strips are connected to the watch battery ground, so the watch detects button presses by waiting for 0V to appear on one of the metal pads (which are electrically connected to the microcontroller inside the watch).

We soldered wires to the three metal pads of the buttons we wanted to control, and a ground wire to one of the commonly connected metal strips. Shorting the end of this ground wire to the end of any of the other wires causes the relevant button operation to take place.

relay board to control a stopwatch for timing arduino projectsWe next made the above pictured board. We put three tactile switches on the board and wired them up so that when pressed, they would short a mode button input to ground. These tact switches make it much easier to interact with the wired-up watch manually.

Then we added a small 5V coil relay and connected its NO and COM pins to the Start/Stop button connection and to ground for the watch. When the relay is energised (closed) it will simulate the Start/Stop button of the watch being held down.

The final component is an Arduino Pro Mini in a socket. This board will be used to calibrate the internal clocks of Arduino Pro Mini clones as their crystals are not accurate enough for some of the projects we build.

(Note that we are powering this board with 12VDC for convenience as that is the voltage we use for all of our testing rigs with a bench power supply, but for a one off it would have been 5VDC powered – 4 AA cells for example.)

Controlling the Stopwatch via Arduino and Calibrating the Arduino’s Internal Clock

 digitalWrite(relay, HIGH);
 digitalWrite(relay, LOW);

The Arduino code above is used to briefly energise the relay which starts and stops the stopwatch. We used a 50 millisecond delay so that the relay has time to energise (physically close its internal contacts) and button presses of under 20 milliseconds were ignored by this watch. When someone presses a button, they typically keep it held down for from 30-70 milliseconds, so we replicated that.

To roughly measure how long is 10 seconds for the Arduino, we used the following code:

digitalWrite(relay, HIGH);
digitalWrite(relay, LOW);


digitalWrite(relay, HIGH);
digitalWrite(relay, LOW);

It starts the stopwatch, waits 10,000 milliseconds, and then stops the stopwatch. If the Arduino is accurate, the stopwatch will stop with 10.00 seconds displayed. In a few quick runs we got 10.03, 10.07, 10.06, 10.06, 10.03, 10.03, and 10.06 seconds. This seems to show that this particular Arduino Pro Mini was running a little slow (it could also be that it takes longer for the relay to energise than de-energise which could be significant when only timing 10 seconds).

The delay() function is not accurate in general since we do not know how long the loop execution time is. Instead for accurate time testing we use millis().
Replacing delay(10000); with the following:

unsigned long startTime = millis();
} while (startTime + 10000> millis());

we got 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, and 10.00 seconds on the stopclock in initial testing.

For calibration we test for a minimum of 8 hours, but sometimes 12 or 24 hours. The longer the test, the greater the accuracy of the results and therefore the better we can calibrate the Arduino’s internal clock.

There are 28800000 milliseconds in 8 hours for example. So we’d modify the code above to have while(startTime + 28800000 > millis()); . After 8 hours, the stopwatch will show a time. We found that that this Arduino Pro Mini was running 4 seconds slow….so after 8 hours the clock showed 8h 00m 04s.
There are 28,000 seconds in 8 hours, so the error in the Arduino clock is
1 – 28,000/28004 = 0.0001428 = 0.01428%.
We can save this percentage error in memory on this Arduino Pro Mini and take it into account when using it in timing applications. If we want to use this Pro Mini to time 5 hours accurately, we’d run the timer for 5 hours minus 0.01428% of 5 hours.

Multiple Switch Bathroom Fan Controller

Pictured below is a bathroom extractor fan controller we were recently commissioned to build.three switch bathroom extractor fan controller

The client has a house with a newly renovated bathroom and three existing light switches which are to be used to control a mains powered extractor fan in the new bathroom. If any of the three light switches is on, the fan is to run.

If the output from these three switches were to be connected directly to the fan, then the fan would turn on if any of the switches is on, but it would also result in the lights controlled by the three switches (in different rooms) all turning on simultaneously. This would be a problem.

Therefore, the output from the three switches is connected to three independent relays with 240V AC coils on the board pictured. These three relays each switch a single 12V signal from a nearby mains transformer to energise a 12V DC coil relay which in turn switches mains live to supply power to the fan when one or more of the light switches is on.

If you require any kind of bespoke controller, please email with details of your requirements.

Arduino Two Channel Thermometer with Display (Full Code)

Pictured below is a two-channel thermometer we recently built for a customer. This device takes inputs from two ds18b20 temperature sensors and displays their measured temperatures on a 1602 LCD display module. The thermometer is built around an Arduino Pro Mini.

Arduino double thermometer with lcd display - full code provided

Below is the full Arduino sketch (code) for our device.

See this guide to Connecting an I2C Display to Arduino for the LCD connections. We have added the necessary 3k3 pull up resistors between pin A4 and 5V, and pin A5 and 5V – click here to read about I2C Pull Up Resistors. We have also used an external 5V regulator rather than relying on the 5V regulator built into the Arduino Pro Mini, and added reverse polarity protection on the input with a 1N4001 diode.

// © - 2018
// Double Thermometer with Display.

// For the DS18B20 temperature sensors.
#include <OneWire.h> // (
#include <DallasTemperature.h> // (

// Data wires are plugged into pins 2 and 3 on the arduino.
#define ONE_WIRE_BUS 2
#define SECOND_BUS 3

// For the 1602 LCD module.
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#define I2C_ADDR 0x27 // Note that some modules have address 0x3F

#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7
LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

// Setup a oneWire instances to communicate with OneWire devices.
OneWire oneWire(ONE_WIRE_BUS);
OneWire secondWire(SECOND_BUS);

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensor1(&oneWire);
DallasTemperature sensor2(&secondWire);

float sensorOneTemperature = 0.0;
float sensorTwoTemperature = 0.0;

void setup(void)
 // Start up the temperature sensor library.
 // Set the temperature sensor resolutions to 11 bit
 // ADC (12 bit is much slower but higher resolution).
 // Initialise the LCD.
 lcd.begin (16,2); // For a 16x2 character LCD
 // Switch on the LCD backlight.
 // Clear the LCD screen.

void loop(void)
 // Read in the temperatures of the two sensors.
 sensor1.requestTemperatures(); // Read temperature of sensor1
 sensorOneTemperature = sensor1.getTempCByIndex(0);
 sensor2.requestTemperatures(); // Read temperature of sensor2
 sensorTwoTemperature = sensor2.getTempCByIndex(0);

 // Display the temperatures of the sensors on the LCD.

void displayTemperatures(){
 // Display sensor1's temperature.
 lcd.print(" T1: ");
 lcd.print("C ");
 // Display sensor2's temperature.
 lcd.print(" T2: ");
 lcd.print("C ");

If you need any kind of bespoke thermometer or thermostat, please email with details of your specific requirements.

Formula 1 Race Starting Lighting Timer

formula 1 racing timerPictured above is a timer we recently built for a customer which will be used in a Formula 1 style race start lighting gantry. This gantry will be fitted at the top of a slope with toy cars held by a small gate latched up by a small solenoid with a spring loaded core. When the race is to start, the solenoid is energised which drops the gate allowing the cars to roll down the slope in their race.

In the photograph, five red LEDs are temporarily attached to the timer board for testing, but these will be mounted into the gantry across the track when it is finished.

When the user presses the button, the LEDs follow the standard F1 race start sequence – each red LED turns on in sequence with a one second interval. As each LED turns on, an on board piezo buzzer briefly pips. Then, when all five LEDs are illuminated, there is a random time interval of between 1 and 3 seconds before all the LEDs are turned off.

formula 1 race starting gantryThe lights turning off indicates that the race is to start. The buzzer sounds for 1 second, while the on board relay energises for 1 second to energise the solenoid and start the race.

If you need any kind of bespoke timer or controller, please email with details of your requirements.

Mini Temperature Data Logger Design Plans

mini temperature data logger

Pictured above is a high accuracy (within 0.1°C) low power temperature data logger designed originally for scientific research in sea turtle egg incubation, but which could be put to use in a great many other applications.

This logger measures and logs the temperature once every 10 minutes exactly with sufficient memory space to hold 180 days of data (26,000 records). The logger is powered by a CR2032 coin cell battery which can keep it running unattended for the full 180 days.

When the measurement period is over, the logger can be extracted from its waterproof case and the logged data transmitted over a UART connection via a cable to a PC for subsequent analysis.

The goal of this project was to achieve all of the above at a cost per unit (of a batch of 50 units) of under €5, including the case.

mini temperature logger pcbThe temperature sensor used is a 16-bit resolution digital MAX30205MTA+. This gives a temperature resolution of 0.00390625°C and 0.1°C accuracy in the range 0-50°C. The microcontroller chosen is the ATMEGA328PB – a slightly more feature rich version of the MCU found on many Arduino boards. The serial flash memory chip used is a 512kbit AT25DN512C from Adesto which has sufficient space to hold the 410-420kbit of data to be logged in six months.

For full details, plans, and discussion of this project, click here: Low Power Cost and Size Temperature Data Logger.

Multi-sensor datalogger and timer relay

Pictured below is a device we were recently commissioned to design and build.

multi-sensor 3 channel datalogger with relay timerThis device, built around an Arduino Pro Mini, is one of the most complex projects we have completed recently. It is primarily a timer (utilising a ds3231 real time clock (RTC)) to energise a relay for a user programmed number of minutes once every day, week, fortnight, or month. However it must also monitor and process data from three sensors and log these readings to a micro SD card for later analysis at intervals which depend on the status of the system at any one time.

display for three channel datalogger

This device has a display to show the user the status of the system with readings from a pressure and a flow rate sensor as well as a valve and a relay which the device controls.

Detailed datalogging is only required when the valve is open (with logs appended at a rate of once per second), but the pressure sensor status must be logged every hour and changes to the status of the valve and other significant system changes must also be logged as and when they occur.

When logging data every second, it does not take long to generate a file which is unwieldy to process in Excel or other programmes. Therefore, our device creates a new file each time the valve opens, and logs to it until the valve closes again. In this way, there is one reasonably sized datalog file for each valve opening event together with one master log file which is appended hourly and also when there is a significant change detected in the system.

setting the time and date for a real time clock datalogger

Having mulitple datalog files not always recording data at regular intervals, it was essential that the timestamp for each line record in the logs showed the actual time and date rather than just an index value.

datalogger file from 3 channel arduino dataloggerThis will make future analysis of the collected data much easier.

The user is able to set the number of minutes that the relay is ‘on’ and also the precise time of day at which they would like the relay to turn ‘on’. The interval between relay ‘on’ events for this particular device was set to daily, weekly (7 days), fortnightly (14 days), or monthly (28 days).

setting up the arduino 3 channel dataloggerAn added feature is that the user can manually change the number of days until the relay will next turn ‘on’ which is particularly useful for testing the system or forcing the relay to turn ‘on’ at a previously unscheduled time and date if required.

The last piece of complexity was the flow rate sensor. This sensor outputs high pulses at a per second rate which when multiplied by 0.2 gives the litres per minute rate of flow through the sensor. The results generated then had to be converted into the desired cubic metres of flow per hour to be displayed and logged. As we did not have access to this flow rate sensor, we had to use a second Arduino to simulate the square wave the sensor generates to fully test the device we built. With a maximum of 1000 pulses per second to detect (for the maximum expected 12m3 per hour flow rate), the 16MHz clock of the Arduino Pro Mini was more than up to the job of simulating the sensor.

If you need any kind of timer or multi-channel datalogger, please email with details of your requirements.

Poultry Egg Incubator with On Board Display and Humidity Maintenance

We have made many poultry egg incubators and timers over the last few years – devices which monitor and maintain temperature and humidity and also turn the eggs at regular intervals. Below is an image of one such incubator controller which we were recently commissioned to build which is a bit different from those.

poultry egg incubator controller

The motor is set to turn for three seconds five times per day to rotate the eggs. This is standard.

The heating element used for this incubator is a bit oversized, so we have to be careful not to overheat the eggs when it is used. When the temperature is measured to be 0.5C or more below a user set target temperature, the heater is turned on. Then, when the target temperature is reached, the heater is turned off. Because the element remains hot after being turned off, the incubator will continue to heat up to a little above target temperature while the element cools down. Therefore, there is also a fan which turns on just in case the temperature exceeds the target by 1.5C or more to cool things down long before the eggs overheat.

display for poultry egg incubation controller

Humidity management is also achieved rather differently than usual. In all previous incubators we have made which have included humidity sensing, a commercial humidifier has been switched on/off to maintain appropriate humidity levels. For this controller, when humidity is measured to be below a user set target minimum level, a pump is turned on for five second which adds water to a container in the incubator. The rapid evaporation of this water in the warmth of the incubator increases the humidity level back above the minimum rapidly. In order to prevent flooding or raising the humidity level excessively, the controller will run the pump at most once every ten minutes.

This entire system is powered by a solar charged 12V battery bank.

If you need any type of incubator (or humidor), please email with details of your requirements.

Water Tank Thermostat Controller

We were recently commissioned to design and build a thermostatic controller for a large tank of water (5m3) which has to be maintained within a narrow temperature window for the testing of ultra-sonic scanning equipment.

thermostat controller for large water tankPictured above is the device we came up with. The user can set a target temperature threshold of 15 and 30 °C in 0.5°C steps using the UP and DOWN buttons. If the temperature of the water falls to 0.25°C or more below the threshold, then a relay closes which turns on a heater. When the temperature of the water has reached 0.25°C or more above the threshold, the relay opens again and the heater turns off. This keeps the water within +/- 0.25°C of the target temperature.

Since the temperature of such a large volume of water is slow to change, the update time of the thermometer in this device does not need to be very fast. We could therefore set the resolution of the DS18B20 temperature sensor to 12-bit (0.0625°C) by accepting an almost 0.75 seconds temperature reading update time.

thermostatic controller display

The display shows the current measured temperature (top left), heater status (top right), and the temperature threshold which has been set by the user.

If you need any kind of thermostatic controller, please email with details of your requirements.

Testing 128×32 OLED IIC Display with Arduino

Many of the products we sell make use of 16×2 character LCD displays. These displays coupled with an Hitachi HD44780 LCD control module enable an Arduino or Raspberry Pi to operate the display very simply with just two data connections and two power connections required.

16x2 LCD display with module for use with Arduino and Raspberry Pi

However, these displays are physically quite large being 80 x 36mm, and while they are well suited to panel mounting, they cannot really be attached to the circuit board that is driving it without creating a device with large dimensions.

We have recently being looking at alternatives to these displays looking for something physically smaller, easily circuit board mountable, lower power consumption, and improved contrast. After much testing, we have chosen the OLED display pictured below.128x32 i2c arduino displayThese displays are far smaller having an active screen area of just 22.38 x 5.58mm. They require no backlight as each of the 128×32 pixels self-illuminates thanks to OLED technology. The maximum power consumption of one of these displays is 0.08W with every pixel illuminated – therefore less when showing text or when nothing is being displayed. In all ways these displays are an improvement on the 16×2 character LCDs.

OLED display used with arduinoThese OLED displays have much better contrast than LCDs, there is more space available to display information since more characters can be displayed, and there are much better graphics capabilities with the OLED displays. The image above shows the new OLED version of the LCD display from our REUK Low Voltage Disconnect with Display pictured below.

LCD display on REUK low voltage disconnect (LVD)

The biggest advantage however is the ease with which these OLED displays can be mounted to the circuit boards of our controllers so that we can produce more convenient small form factor integrated units with no increase in our pricing for customers.

arduino pro mini controlled 128 x 32 oled display

If you are interested in trying out one of these displays for your own projects, click here: buy 128×32 OLED Display for under £3 including delivery. If you intend to use one with an Arduino project, you will need to add the following libraries to your Arduino IDE: SSD1306 Library and Adafruit GFX Library, so that you can communicate with the display.

Controller for Multi-Pump Irrigation System Water Distribution

Pictured below is a diagram of an irrigation system comprising three water tanks located on three terraces. The lowest tank contains a bilge pump which will pump water up to the next terrace, and the tank on that terrace has a pump to send water up to the top tank.
Irrigation system diagram - multi tank, multi pump, multi terrace

The bilge pump has its own float switches and will, when powered, start pumping when its upper float switch detects water (full tank) and will stop when its lower float switch does not detect water (empty tank).

The two higher tanks have float switches so that their water level status can be monitored. Pictured below is the controller we built to manage the two pumps in order to best distribute the stored water across the three tanks while minimising overflow wastage. Ideally no tank should ever be completely empty, and no tank should be full and overflowing if the next higher tank is not full.

irrigation system pump controllerThis controller, built around an Arduino Pro Mini monitors the status of the float switches of the two upper tanks to decide when power should be supplied to a pump or pumps. If for example the middle tank is full, and the top tank is not, the Tank 2 pump will be run until either the middle tank is empty or the top tank is full. If the bottom tank is full, and Tank 2 is not, then the bilge pump will fill up Tank 2.

In order to prevent multi-switching (a pump being turned on and off rapidly and repeatedly) timers are built into this controller so that a pump will always overrun by 10 seconds when it is to be turned off. This will ensure that the state of the float switch which called for the pump to be turned off will be stable and unaffected by turbulence in tank.

If you need any type of pump controller, please email with details of your requirements.