Close

After-winter update

A project log for Yet another automated watering project.

Solar powered budget automated watering system.

labanssonLabansson 04/04/2017 at 20:170 Comments

So I pretty much finished this project up last spring and had it running during the summer. I had some trouble figuring out if the thing was working or not, when I checked it seemed as it was always wet outside (meaning it wouldnt open the watering valve) or I had forgotten the waterlevel since my last visit. It was always something that kept me from figuring out if it was working:-)

Anyways, here's what I ended up doing to finish the thing: After fiddling with the garden light and trying to figure out how to best connect everything I finally decided to just connect all 6 solars panel in series and connect them straight to all 6 batteries in series through a diode. I figured the solar panel would give such a small current that the batteries should not overcharge (I read somewhere that ni-mh batteries can handle a bit of over-charging if the current is low, they dissipate the extra power as heat in some way, thus protecting itself).

I also connected the positive of the solar panels through a voltage divider to an analog pin of the pic (so that I could mesure the voltage of the solar panels). Since i didnt want a current to flow at all times I connected the "ground" of the voltage divider to an input pin of the pic. When I measured the voltage of the solar panel I would reconfigure the pin as a low output, then measure the voltage through the voltage divider and when that was done I would configure the pin as an input again. This way the current only flowed when I did the measurement. I took the same approach to the moisture sensor, but this time I had the positive of the voltage divider connected to a gpio pin that was configured as a high output when I measured the moisture.

I had to fiddle a bit to get the ultra-low-power to work, but after some swearing and testing I managed to put the pic mcu to sleep. I had it wake up once every 20 seconds, increment a timer variable, write a dot to the uart to show that its alive and then go to sleep again. Looking at the code now I realise that I measure the voltage of the solar panels every time the pic wakes up. That might be a bit unnecessary, but a measurement is very fast, so I guess it doesnt matter that much.

Anyway, in the main loop the PIC checks if it has been more than 15 hours since the last watering. If it has been more than 15 hours and the sun panels read 0V (meaning its dark outside) it measures the moisture level. If the "moisture sensor" is dry it opens the valve for 5 minutes and then goes back to sleep.

When I measured the current consumption I noticed that the H-bridge had quite a high quiescent current. I solved this by sticking a MOSFET between the GND of the H-bridge chip and the "real" GND, so that I could "turn on" the H-bridge from the PIC mcu only when I was using it to run the motor in the valve.

When I was all done I measured the current consumption to 4uA in sleep and 400uA in full running (using the LFINTOSC at 32Khz). Thats not much. In fact, it seems too low, shouldnt just the voltage regulator quiescent current be higher than that? But thats what I have written in my notes. Hmm... I think I will have to measure that again, I might have screwed up the measurement somehow. I also measured the motorised ball valve current and when run at 5V it only consumed 50mA (that also seems low, it will be mesured again as well!).

Anyway, (maybe) I had the thing running all summer. Somehow the summer ended and the autumn came. I planned on bringing it inside all winter long and finally, last weekend, I came around to pick it up. It has been out all winter, maybe thats not so good. My next entry will be about how the thing is doing after the winter, I will do function tests and see what parts (if any) has failed and how I can improve on the design this summer.

I will also upload the schematic and the source code for the PIC microcontroller. I should have done that in this entry, but I dont have a schematic written down yet and the source code for the PIC looks like shit:-)

Discussions