Stand-alone Arduino timer?

Post your thoughts and ideas on safety here.
Post Reply
User avatar
Riddle
****
Posts: 1135
Joined: 24 Sep 2008, 08:37
Location: Oregon, USA
Contact:

Stand-alone Arduino timer?

Post by Riddle »

As a sanity check, I would appreciate your inputs on using an Arduino as a timer for a stockade.  A clock IC can provide accurate time to Arduino and a MOSFET can translate the Arduino output to the electromagnets level.

So far, I am planning to use a 12V 3.6AH sealed lead battery for the main power and a USB cord for the Arduino power.  Right off the battery will be a small fuse (1 to 5 amp). Twin 12V 250mA solenoids control the stocks.

Is there any further precautions required to make this circuit reasonably safe?  Is further redundancy (if so, what degree?) necessary?  Am I missing a detail? 
Resident timer maker. :hi:
Let’s make timers together!
lj
Moderator
Posts: 2255
Joined: 14 Oct 2008, 18:22
Location: East Anglia, UK

Re: Stand-alone Arduino timer?

Post by lj »

Despite being an Electronics Engineer, I'm not familiar with the Arduino products, as I usually design at the microprocessor level. However, a quick glance at the data sheet suggests you should be able to use an on board timer to generate your timing intervals with considerable accuracy. There are several counter/timers on the chip so perhaps these are available to use as time-keepers ?

As you are proposing to use a 3.6AH battery, and you suggest the solenoid load is 2 x 250mA, that give a theoretical battery life of 7 hours, a sensible precaution and one I always recommend for electrically operated SB machines. HOWEVER this only applies if the locking mechanism is held locked by the supplied current, and always releases when the power is disconnected or the battery runs flat. Any mechanism that works in the opposite sense is inherently dangerous.

I'd suggest a 1amp anti-surge fuse, as there may be an inrush current when the solenoids are energised, and don't forget to put a "back-protection" diode across the solenoid coils - most MOSFETs can cope, but better safe than sorry.

If it was me, I would also have a secondary non-electric release, perhaps an ice key-drop or an " make an expensive mess" emergency release.

I don't know if you have experienced a stockade ? but it puts you in a fairly uncomfortable position and this can be difficult to maintain - I certainly wouldn't want to be locked in one for 7 hours !
be a switch, double the fun :-)
cooper1337
**
Posts: 153
Joined: 10 Sep 2011, 00:37
Location: Germany
Contact:

Re: Stand-alone Arduino timer?

Post by cooper1337 »

If you're using the arduino library system, there should be some lib available for this task, e.g. http://arduino.cc/playground/Code/SimpleTimer
(I don't know how stable this lib is, so check this on your own).
bdsm984
**
Posts: 80
Joined: 29 Mar 2012, 15:51
Location: NL

Re: Stand-alone Arduino timer?

Post by bdsm984 »

One thing I would do is, if possible, remove the Arduino from the equation after prototyping. That means you look up the datasheets on the used Atmel chip and just hook it up like the Arduino would've been. This saves space, electronics and would overall be able to look a lot cleaner. That is, if you are willing/prepared to learn a bit more on the subject matter.

As for lj's comment about not being familiar with the Arduino products. It's just a simple Atmel microcontroller (think the old AVR series, like the ATMega168/ATMega328) with sane circuitry on the I/O and an easy to use library for programming. Though, if you're wanting to do real time-critical stuff using an Arduino, I'd wish you the best of luck. The Arduino libraries themself give a lot of overhead and will boost program size considerably.

That's just my 2 cents anyway. The idea is great, and pretty safe given the conditions lj stated.
User avatar
Riddle
****
Posts: 1135
Joined: 24 Sep 2008, 08:37
Location: Oregon, USA
Contact:

Re: Stand-alone Arduino timer?

Post by Riddle »

Thank you all for your inputs. I had hoped to have already completed testing of the timer last month but more electronic parts had to be ordered... The MOSFET needed 10 volts for full conduction and did not directly work with the microcontroller. A 13 amp MOSFET compatible with logic level control (full on at 3-5V) is now on order. Also, ended up deciding to install a 5V 7805 regulator on the board to supply the Arduino from the 12V battery to drain the battery faster and minimize complexity. Now, the circuit board only has 2 wire pairs to connect: power and solenoids.

Thank you LJ for pointing out the accurate timers on the chip itself and the protection diode. A clock program I (inexperienced) made kept time within 30 seconds per 24 hours which is well within tolerance for the timer.

Hope you do not mind if only the specifics of the timer are discussed in this thread; the other details were discussed in older threads and will be updated after the timer works.

As for the Arduino, I use "Ardweeny" devices which is just an ATmega328 dip with the Arduino bootloader and basic support circuits (reset switch, resonator, and programming header) stacked on top of the IC. This is reasonably cheap and almost as compact as just the IC chip. Still working up to using the Atmel chips without the Arduino boot loader (another learning project for another day).
Resident timer maker. :hi:
Let’s make timers together!
cooper1337
**
Posts: 153
Joined: 10 Sep 2011, 00:37
Location: Germany
Contact:

Re: Stand-alone Arduino timer?

Post by cooper1337 »

Riddle wrote:Also, ended up deciding to install a 5V 7805 regulator on the board to supply the Arduino from the 12V battery to drain the battery faster and minimize complexity.
This will not decrease battery life significantly, since the whole board will only consume a few mA.
If you want to decrease battery life, you could use either a smaller battery or some high-power resistor.
User avatar
Riddle
****
Posts: 1135
Joined: 24 Sep 2008, 08:37
Location: Oregon, USA
Contact:

Re: Stand-alone Arduino timer?

Post by Riddle »

Wow, the timer works well and functions precisely as intended. The battery is not so good.Bought some F12N10L MOSFETs and some new heat sinks for the TO-220 devices (7805 VR and MOSFET). Everything went together nicely and tested flawlessly prior to the first session. The first session went perfectly. After the programmed 1 hour time, the restraints released.

As far as the battery and its life goes, need to figure out how to prevent over-discharging the battery. The battery powered everything for at least 4 hours with 11.5V left. The following morning, the timer was still dimly showing all zeros with the battery voltage connected at 4.5V. Disconnected, the battery read 5.5V. The battery is still charging after 15 hours and waiting to see if it will register full after such a low discharge. This bring me to the next question, what would be a safe way to prevent such a low discharge on the battery?

The battery was still at 11.5 volts after 2 full-timer test runs of 1.5 hours each, several hours running the timer, and a 1 hour bondage session. The timer completed another 1 hour cycle with correct release after that, but I did not check the voltage level. Theoretically, the 6mA of the VR alone would decrease time 6 minutes. Add in some extra LEDs for a time display and blinking pin 13, I figured might get the draw above 550 mA which is enough to bring battery capacity down to 6.54 hours or better... Not sure how long the battery would keep the restraints applied, but it is at least 6 hours. This is an acceptable ballpark.
Resident timer maker. :hi:
Let’s make timers together!
Post Reply