Posts tonen met het label Atmega328. Alle posts tonen
Posts tonen met het label Atmega328. Alle posts tonen

maandag 17 januari 2011

Auto powerdown

A little detail from the Secret d'Icey project: I am actually not very familiar with Atmel's own power saving capabilities, so I made a little circuit with FET's. I set it up so that the Atmega328 cuts off its own power when there is no activity for 30 seconds.


Default the gate of the P-FET (IRF9530) is pulled up to V+, which is connected to the batteries. This turns off the P-FET and Vs stays 0V. The pulse switch S2 connects the gate to ground and lets the P-FET conduct so Vs become equal to V+. This will power up the circuit that also contains the Atmega328. When the Atmega is turned on the output B2 (pin 5) turns high. This makes also the N-FET IRF540 conduct and makes sure the gate of the P-FET keeps grounded. This takes over the role of the pulse switch.

When there is no change in the dice state for 30 seconds the output B2 becomes low, which turns off the N-FET and the gate of the P-FET is again pulled up high to V+. Now the circuit (Vs) is cut off from the batteries.

(The IRF540 and IRF9530 are maybe a bit overkill (with a maximum drain current of 22 respectively 12A) but these I had lying around.)

I tend to learn how to use Atmel's power saving functions in the near future, but until then this hardware solution will serve its purpose nicely and maybe it can be useful for other applications.

woensdag 1 december 2010

Secret d'Icey

After building the first version of the secret dice in Deddies lab, it was time for an upgrade; Secret d'Icey!
Secret d'Icey has the same functionality as its bigger brother, but has some interesting upgrades: It is smaller, lighter, and has a nice chrome 'Icey' look (some coasters from the Ikea do the trick here)*.

 
The batteries are easy accesible without giving access to the secret stuff inside. So no auxillary power connection needed to be included here in case the batteries run flat. A three dimensional accelerometer instead of a homemade tilt sensor is used. Another new nice feature is the automated power off function. When the dice is not used (change of dice state) for 30 seconds the power is shut off automatically. The same webshop that provided the accelerometer also had in store a tiny (robot) controller with an Atmega328 on board. This little device is originally designed to control a small robot, but was also very suited for the Secret d'Icey. The dual H-bridge seems overkill, but the single transistors in the H-bridge proved to be very useful.
 





* Okay, at the moment this secret dice doesn't serve a higher purpose and is probably destined to stay a piece in the Deddies Lab hall of fame, so I may as well tell you the secret code: 6, 5, 4, 3, 2...... the last number is up to you.










Source:
- secret_dicey012a.c (winavr) 
- codevision-dice.c (codevision, included in secret_dicey012a.c)