I got automatic watering working almost a month ago.  Then I broke it:

  • Turns out there was a problem with the water valves in the house.  These had to be fixed.
  • As I got more familiar with RF69 traffic / library, I realized RF69 messaging is best done to completion within (a tight) loop().  I had spread out the RF69 messages into functions in which I would loop through expecting a specific message.  The challenge with this is the Controller sent/received messages in an unpredictable way because the Controller is dealing with both MQTT traffic and commands as well as RF69 traffic.

The Goal

The goal of this post is to document the implementation of the first beta of the Watering Puck. 

Thanks To Those That Went Before

The Valves

I decided it made the most sense to use off-the-shelf solenoids from Orbit and a 24VAC power supply.  24VAC is the standard used in irrigation systems.  

Orbit Valve Box Base (YouTube video description

 I also got a “professional looking” enclosure, base and 24VAC Power (all Orbit products).  I watched this video on getting the wiring straight.

The Relays

I am using these three relays.  The cost was  ($13 for 4)/4 + $8 shipping (I ordered 4)  = $11.25 (high shipping cost).

Always looking for a good explanation on how relays work.  I found dial2fast’s How Does a Relay Work Youtube video to be very clear.  The DC current flows through copper coils inside the relay.  This generates a magnetic field which moves the switch to the other side.  NO (Normally Open) moves the arm from the open circuit to closing the circuit and letting the 24VAC flow through the valve.  

This image from 12VoltPlanet works for me:

NewImage

Since I am not smarter than a 5th grader, I thoroughly enjoyed these videos on how electricity can be used to create a magnetic field as is done within this relay.  In UniServeScienceVIDEO’s Magnetic Field Demonstrations Youtube video, there are three demonstrations that are fun to watch.  Jeff Regester’s Magnetic Field of a Coil of Wire Youtube video demonstrates a compass spinning when electricity goes through the coil.  I like both. UniServe’s is great in that it shows the motion of the magnetic field.  Jeff;s is awesome because it shows the standard physics class example.

Powering the Feather using the 24VAC

I want to run the Feather off the same 24VAC Power supply being used by the valves.  I’ll do this by adding a way to smooth out the AC waves into a flat DC line as well as a way to down shift the power from 24VDC to 5 VDC and connect the Feather through the USB port.  

First Attempt

My first attempt used this setup:

  • Rectifier circuit to convert AC to DC.  I’m thrilled to see the need for the rectifier circuit…of course, I couldn’t leave home without it if I’m ever taking AC to DC…I spent time understanding peak detection/rectifier circuits when I designed and built the Ladybug Shield.  Based on this experience, and the great advice in Dave’s excellent EEVBlog #490 Peak Detector Circuit.  I am going to use the very simple diode + capacitor peak detection circuit Dave talks about at the beginning of his video.  I am not doing any precision measuring as was the case with the EC circuit of the Ladybug Shield.  Rather, I just want to get the signal ready as input to the DC-DC Buck Converter.  While the diode will eat up about .7V, I don’t need to adjust anything because I’m not interested in the actual DC value.  Sure this method of rectification leaks current and drifts over time.  However, for this scenario that is ok.
  • DC-DC Buck Converter – The VDC output after using the rectifier circuit measured 40V. 
My first attempt “sort of” worked.  The DC signal was very noisy.  I was having trouble at this point with the electronics of the watering puck so I decided to do a better job with going from 24VAC to 3.3VDC.

Second Attempt

  I decided to use the schematic I found on RAYSHOBBY.NET:

NewImage

Since I easily forget how different components – such as diodes – do their magic, I thought Sparkfun’s diode tutorial was helpful. 

Parts I need:
  • D2 – 1N5819 Schottky Diode (Digikey)
  • C1 – 100µF / 50V Capacitor (Digikey)
  • L1 – 150 µH / 800mA Inductor (Digikey)  …argh I forgot to order this, so I ran down to our local electronics store.
  • IC1 – MC34063 (Digikey)

Parts I have:

  • D1 – Diode
  • C2 – 220µF/6.3V Capacitor
  • RT – 30K Resistor
  • RB – 10K Resistor
  • CT – 100pF Capacitor
  • RSC – 2 1 Ω Resistors
As I put this together on a prototype board, I realize my skill at layout of these simples skills could use a lot more practice. hmm.. I went put together two prototypes….
IMG 6101          NewImage
…and yet…sadly…I did get to see the inside of a capacitor…hmmm…
on to my third attempt.

Third Attempt

This time I’m going back to the first attempt – that is using the DC-DC Buck Converter.  However, the rectifier design I’ll use will be the more effective full wave rectifier.  Afrotechmods did an excellent YouTube video on this type of rectifier.

 

NewImage

The above image shows the difference between using a half-wave and full-wave rectifier.  The full-wave rectifier uses both the positive and negative parts of the AC to recharge the capacitor.  Much better.  I’ll use that technique.

Capacitor Size

What size of capacitor should I use?  Afrotechmods shows a design with a 1µF capacitor when there is no load:

Pasted Image 9 2 17 4 27 AM

The voltage will be 3.3V, the amount of current drawn will be about 35mA.  I guesstimate 35mA based on the RFM69 tests I did in a previous post.  Using the formula noted in this post:

NewImage

I = .035A

t = 1/60 Hz  = .0167s (NOTE: See DOH! below…)

for the ripple I’ll use 1V.

C = .035 * .0167 / 1 = .0005845  = 585 µF.  I need a capacitor that is at least 585µF that can handle around 50V.  I found this 680µF/50V capacitor at my local electronics shop.  The voltage ripple I should see V = .035*.0167/.00068 = about .86V.  Even better!

So crafty me…I built one:

IMG 6116

but…

Simpson DOHum… I screwed up for the time period.  Full wave is at 120 Hz, not 60 Hz.  So:

t = 1/120 = .0083

C = .035 * .0083 / 1 = .0002905  = 291 µF.  

DOH-DEE-DOO..I’m leaving the 680µF capacitor.  Overkiil, but from what I can tell should mean even less ripple.

 

The Firmware 

Arduino Sketch

The firmware code, WateringPuck2017_v3.ino, is located at this GitHub location.

Logic Pins

I needed to make sure I used available logic pins…Looking at the Feather m0’s logic pins

 I’m going to NOT use:

  • any pin between A0 and TX1
  • pin 13 since it is used by the LED
  • the SCL and SDA pin
ChallengesBringOpportunites And YIPPEE!!!! It all works…