The Melnor 53280 is a great 4 valve timer that costs less than $50. The control unit is separate from the valve assembly, a 7 pin cable connects the two, so we don't have to throw away everything. It is very energy efficient as it uses a latching solenoid to control the valves.
Why the hack:
- The controller is unreliable unit and will fail withing a year. Some diagnostic would be useful when traveling and fixing instead of replacing is a fun thing to do.
- 2 acres with a garden and many newly planted trees, 12 pipes and counting.
- The Melnor's interface is very cumbersom
- The weather in WA is unpredictable, probes would be great
- the Melnor control unit is a black box, it will be nice to have some insight of what's going on and upgrade it on a whim
- build hardware and software to consolidate the timing setup of all 3 units into one web interface
For the implementation I chose the esp32, because it talks BLE, WIFI native and can do LORA easily, it's easy to program, I know it well enough and it is way, way OP for this purpose, which adds a certain humor to the project.
The initial idea is to have a control unit outside powered by battery and talking BLE to a webserver unit inside that talks to the router via wifi.
Making a web server on the esp32 is super easy thanks to a bunch of good examples and libraries, graphing the whole thing is also super easy, either using google graph API or graphly.io
The portion that controls the valve needs to auto synch its time with the interweb, manage the triggering of events, queue up those events in case they are concurrent, that queue is controlled by the available voltage to form the pulse.
Woods AMMW1 analog multimeter
Analog is more responsive and easier to see from the corner of the eye what's happening
DSO 138 oscilloscope
very cheap and does the job
Sigma T12 soldering station
fast and cheap soldering, doesn't lose heat
Disassembly of the Control Unit was easy, methodically unscrew each screw inside the white silicone, cut the white silicon at the edges and pry open the lid with a constant force.
Control cable on the far right, red, white,green,blue, brown, unused,unused, you can see the ground line on the PCB, 3rd pin from the top. The quartz is that tin can at the top, I can't see the model number but whatever it is, it sucks given the amount of drift every month. The big flat chip next to it is a TI MCU, according to the datasheet, it includes an LCD driver so it has tons of IO, ADC and ... is ultra low power for 1$, the ESP32 will have a hard timing matching that.
At the bottom there are fairly large capacitors which are probably responsible for that control double 16V pulse and loads of small SMD caps to keep the MCU alive when the battery is nearly empty. The many many transistor in the bottom left rail are probably used as switches to send the 16V pulse to the proper wire, and a couple of diodes sprinkled around which I think are there to prevent electricity from backing up and frying the MCU when the solenoid switches.
Callin Calin explained that U2 and L1 form a buck converter which role is to control the feeding of the capacitor and signal to the MCU when it's full and ready to send the signal.
Overall it looks minimalist and, being someone who knows little about electronic and spends most of his time in software land, I find it elegant.
The other side of the PCB with buttons and LCD, the LCD fell off, it was not even attached, very interesting choices in this box!
with the button contacts at the bottom and the row of LCD contacts
The LCD panel somehow gets signal via this gray rubber line on...
The controller is connected via a cable to the valve assembly. The plug is 10mm in diameter and has 7 pins.
How does it control which valve open and close?
Let's start with finding out which pin does what.
Red = 1
White = 2
Purple = ground
Green = 3
Blue = 4
Checking with a voltmeter we can see that the colors of the male plug which is on the controller's side match, the ground is brown on the controller.
In case you buy these plugs from a 3rd party and the cables have different colors, here is the pin configuration, ground (brown) is in the center
Next, let's see what voltage need to be applied to trigger the valve. Since the controller runs on 1.5V battery in series, the controller has 3V at its disposal at full capacity, the unit can live for a very long time on two batteries so my guess is 1V is all that's needed to trigger the valves.
Note: get a clamp for soldering...
I don't have an oscillo so I'm using a logic analyzer and a cheap volt meter.
Let's start with the logic analyzer, connect the red wire to channel 1 and the brown wire to gnd and turn on valve 1 in manual mode gives us this:
The controller has a latency of 1 second from command to signal and 5 seconds before shut down. Why? no idea, but we shall respect that.
Voltage ? The voltmeter jumps to -3V for two bleeps when opening the valve and +3V when closing the valve. I don't understand that so I'll move on directly to poking the valve unit with the ESP32...
Poking it didn't work because the esp wasn't pushing enough current so I went back to measuring the controler signal and for that, I bought a 29$ oscillo.
The controller sends two square waves at -16V to open the valve and two square waves at +15V to close it, delta Time about 2 seconds. So they accumulate electricity to get from the battery's 3V to the control signal of 15V, this explains why there is such a latency between command and valve responding: it takes time to charge a capacitor.