Arduino Based Auto Timer
Last week around at work I had another usual un-usual problem to face with. Having to make lots of mechanisms n components to work with-in seconds or fracs at times I kind-of knew this was always coming.
And invariably so my poor mind couldn’t think of anything but Arduino for a handy solution that should be compact, flexible, highly customizable, rugged and most importantly easier to work around.
Step 1: The Problem:
What we had is an arm moving around from an actuator which we would like to tap with some contact type micro switces (limit switches) to give a feed-back signal as the awkward figure suggests.
Step 2: Components:
I franatically searched for the components from the Junks I always treasured with the hobby kit coming-in handy..
LCD Display (16×2) – 1
Arduino – 1 (Duemelanove is what I had)
Micro Switches – 2
Hook-up wires for (bread board) – Plenty (see Fritizing schematic for actuals)
Bread Board – 1 (for Prototyping)
LED – 1 (fok blinking indication)
Resistors 330 & 2K – 1 each
potentiometer 4k – 1 ( I had used one 2k Resistor and a 4K POT in comb. instead of a 6k pot to control the display as it came so handy from the junk parts)
Step 3: The Methodology
Now that all I/O’s are wired in order as per the schematic, it pretty much works-out itself and it all boils down to the programming now..
I had used the StopWatch library to evoke the timer and initiated the millis() function to record time step value as soon as Arduino is started.
But what I need is just a differential timer with the simple math which gives us the time on air or otherwise.
All that I did is declared some run-time variables and do some math to display the difference value to show only the time between micro-switches getting energised. Otherwise to display the time correctly in the format is similar to Dan Thompson’s method as it only records the time values in millis and we have to convert the values to sec, min, hr and microsecs.
The other problem i encounter is the sign reversal as arduino cannot handle large buffer. I finally managed to overcome this error by using the unsigned longint as integer data type.
Step 4: Display Shield
The display shield is constructed of pretty much the same components over a matrix board with pin rails for piggy-backing Arduino.
Had used some old components from an electronic choke for compacting
For more detail: Arduino Based Auto Timer
We recommend EasyEDA for electronic circuit design.
From Schematic to PCB Production, Just Need One Tool
Free Circuit Design Software: learn to use Editor quickly and easily
Cheapest PCB: 10pcs 2-layers 10cm×10cm only $8.21, 3-day build time, 100% E-test
This Post / Project can also be found using search terms:
- arduino timer
- aduino time
- arduino based auto timer
- timer time switch arduino