Timer to Protect Solenoids Used in One Man Band Drum Kit

We were recently commissioned to design a device to protect the solenoids used as components within a one-man band drum kit. Rather than wearing the drums on the back, this drum kit is made to sit alongside the one-man controlled by foot pedals leaving hands free to play the guitar or a keyboard.

Each foot pedal contains two micro-switches. Rocking the foot backwards and forwards, the heel and toe trigger those switches which activate solenoids which pull a cord which impacts the drumstick on a drum. A bass drum could be connected to the toe switch and a snare drum to the heel switch on one pedal, and a second pedal could control the high hats for example enabling complicated rhythms to be played.

This system all works well except that if the foot is left resting on the pedal so that one of the micro-switches remains closed, the solenoid will burn out. It is also difficult to depress a micro-switch for the correct length of time so that the drumstick hits the drum and bounces immediately off rather than being left pressed against the skin of the drum affecting the sound.

The timer we came up with detects when a drum pedal micro-switch is pressed. It then supplies an output to the solenoid for exactly 0.10 seconds (which has been proven experimentally to be the perfect length of time with this setup). The solenoid will not be activated again until after at least 0.40 seconds has passed and also the micro-switch has been seen to be released before being pressed again. Therefore, if the micro-switch is kept pressed down, the solenoid will not be activated (and not kept activated) and so it will not burn out.

Solenoid protection timer for single drum

Pictured above is the first prototype unit used for testing purposes with one drum pedal micro-switch and one solenoid only.

Pictured below is the control board for three foot pedal inputs and three solenoid outputs, so heel and toe in one foot pedal and heel or toe in a second foot pedal to control three drums.

Solenoid protection timer for three drums

If you need any type of timer controller device, email neil@reuk.co.uk with details of your requirements.

Automatic Scarecrow Motor Timer Controller

Pictured below is the controller board we made for an automatic motorised scarecrow used to scare pigeons and crows from an orchard.

Timer Controller board to automatically run a motorised scarecrowThis scarecrow has two arms. As a motor turns, the arms flap up and down which scares birds away. We designed this device so that the orchard owner can set a motor running time of 1,2,3,4,5…etc seconds, and then a waiting time of 5,10,15,20..etc minutes before the scarecrow operates again. User programmability is important to enable optimal settings to be found to make the scarecrow as effective as possible.

If a motorised scarecrow is left with its arms up or out to the side, they can catch the wind which can lead to the scarecrow being damaged during bad weather. Our controller protects against this. When the motor running time countdown has finished, the motor continues to run until a microswitch detects that the arms are in the down position. The motor then stops.

Crows are dawn and dusk feeders, whereas pigeons are day feeders. Therefore the scarecrow is only required to operate from the start of dawn until the end of dusk. To that end, this controller includes a light detector, and the operator can calibrate the ambient light level above which the scarecrow will operate.

If you need any kind of timer controller, email neil@reuk.co.uk with details of your requirements.

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 neil@reuk.co.uk 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.

// © reuk.co.uk - 2018
// Double Thermometer with Display.

// For the DS18B20 temperature sensors.
#include <OneWire.h> // (https://github.com/PaulStoffregen/OneWire)
#include <DallasTemperature.h> // (https://github.com/milesburton/Arduino-Temperature-Control-Library)

// 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 neil@reuk.co.uk 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.

Another Race Starting Timer

Pictured below is another similar race starting timer we made which controls three powerful lights via external relays.

3-light-formula-one-start-timerWhen the start button is pressed, there is a five second delay, then the three lights turn on one by one at one second intervals. After a random 0.5 to 4-5 second delay, the lights all turn back off.

If you need any kind of bespoke timer or controller, please email neil@reuk.co.uk 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 neil@reuk.co.uk 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 neil@reuk.co.uk 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 neil@reuk.co.uk with details of your requirements.