zaterdag 5 februari 2011

Electronic watering can



 To get the necesarry carbon dioxide to oxygen conversion Deddies lab is accommodated with a young Ficus Lyrata. To not interrupt its attempt to become the biggest Ficus on earth it needs a weekly dosis of water. That combined with the lab's motto that everything deserves a microcontroller gave inspiration for a little project on a rainy sunday: An automated electronic watering can!

 No, it is not an R2D2 alike robot holding a watering can. Basically it is a 10 liter reservoir filled with water and a little pump that waters the plant once a week.

 
 To count the days and make the device extremely low on power consumption it uses a simple (mechanical) wall outlet timer that turns on the electronics once a day for only 15 minutes.* In this 15 minutes the day counter is incremented and on the 7th day the pump starts pumping up the water. That is unless their is enough water in the tank (guarded by mr. Duck) and some other preconditions have been met. If mr. Duck notices the water level is getting low, he pulls the rope indicating that no pumping is allowed anymore unless the tank is filled again.

* I could have used a more modern timer that will only turn on the watering can once a week. But as it was still a sunday I made it a kind of scrapheap challenge and used parts I had lying around instead of buying a new timer the next day.


An Atmega8 is used running on its own internal 1 MHz clock. A pushbutton is available to set the day that is most convenient for watering. Besides the timer mode their is also the possibility to give the plant an extra shot of water with the single shot pushbutton. This button is also useful when adjusting the voltage regulator that determines how long the pumps needs to be turned on. The single shot mode can test the amount of water that is pumped up. With the Aux In feature a external trigger signal can start the pump. That is unless the Timer Mode is disabled with the jumper. There is also an additional Aux Out that turns high when the pump is activated. 
Especially the Aux In and Out features can become useful when this watering can is part of a larger home automated system. Maybe we get plenty of 'rainy sunday afternoons' for Deddies lab to roll out this home automation plan.

When the hole thing was put together and ran the first tests I realized that an important feature was missing. Although mr. Duck indicates the water level is getting low and pumping is not allowed anymore there is still no (auditive/visual) signal to the outside world that the tank needs refilling. So, mr. Duck guards the pump but not the plant. So an addition to the electronics will be needed to fix this.


My Ficus Lyrata needs approximately half a liter per week. With a water reservoir that can contain 10 liters and has a minimum water level of 2 I have to fill the tank every 4 months. Not bad with the water tap at the other side of the house.

Schematics can be found below and C source code for Codevision AVR can also be downloaded.


woensdag 19 januari 2011

Microcontroller from hell

Isn't this the coolest bumper sticker ever? Okay, that is just a matter of opinion, but I think it is pretty awesome... And it is actually not on my bumper, but a wall decoration of Deddies lab for some time.

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)

donderdag 30 september 2010

Huge Secret Dice

For a friend's wedding we had to find a way to wrap a gift we were going to give to the happy couple. With inpiration from PICing4fun's microcontroller based secret box we decided to construct our own secret dice. As for the size, bigger was better, this gave us enough space to fit all the parts. Eventually a 20x20x20 cm impressive dice was handed over at the wedding accompanied by a handful of more or less meaningful hints that would reveal a secret code. We also did the kind request not to butcher the dice with a flame thrower or crowbar and suggested to figure out the clues during their upcoming honeymoon.


The basic idea is to turn the dice according the code. When the dice is turned exactly according the code with the right number on the dice facing up, the lit will be unlocked and reveal the goodies that are put inside. The lit is locked by a simple hobby servo, a clever constructed mechanical tilt sensor checks for the right state the dice is in and an always popular Atmega88 does the thinking.

 








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