Last modified: 08.08.2021
My goal is change the hot-tub project so that I can change the temperature of the water flowing to the hot tub programmatically instead of having to set the heat before going into the hot tub. This could allow me later, to check how cold it is out side and determine how much the temperature needs to change according to that. I will continue using the system VoffCon to handle the commands via the internet. But additionally I will use google home and IFFFT to allow me to give voice commands while in the hot tub.
I could use a schematic with BC547 provided by Brjánn Guðjónsson to start with. I will probably need to tweek the values for R4 and C1 to configure the frequency to get a decently clean voltage.
Or maybe I could use a MCP4725 to do this.
Arduino Nano D5 pin connected directly to the valve green wire. V5 GND and 12V ground connected together. 12V+ connected to valve red wire. and 12V- connected to valve black wire.
I consider this test as a fail because the valve was very jittery. That is, the valve did change position, but never completely stopped. Alway continues little irritating corrections.
Using the RC filter (see image "RF filter") connected to D5 on a Arduino Nano. The test code makes the Arduino Nano read a value from the serial and writes that value to the D5 pin. Then nano will read a A1 pin which is connected to a feedback wire on the Valve.
This experiment failed. The voltage on the output Green wire went from low: 1.2V to high: 3.2V, but needs to go from 0V to 5V. The valve was little bit open and then just opened just a little more. Never completely open nor completely closed.
I tested powering the Esp32 with 12V via til VIN pin. This resulted in the on board voltage regulator heating up to 56° while just blinking one led, no wifi operations where even running. After little googling I found out this is a issue with the Esp32, it's probably best to be in the 5-7V range. The valve will run on 9V. So may be I'll try that. I would like to have only one power source powering the Esp32 and the valve. Maybe I can step down the voltage from 12V before connecting it to the VIN.
The experiment was a Fail. Because there are issues, like little jittering and out max output to the green wire is just over 4 volts, but should be max 5 volts.
If you want to see the experiment in action click here to see it's YouTube video.
Using the PWM to Voltage Converter module (see product PWM to Voltage Converter on aliexpress)
GND +12V │ │ │ │ ╔═══════════╗ ╔═════════════╗ │ │ ║ -ESP32- ║ ║ PWM to ║ │ │ ╔══════════════╗ ║ ║ ║ voltage ║ │ │ ║ Valve ║ ╔══════════╗ ║ ║ ║ converter ║ │ │ ║ ║ ║-HLK-PM01-║ ║ ║ ║ ║ │ │ ║ PWM Out-╟─(WT)─ ║ ║ ║ ║ ║ GND -╟──┘ │ ║ ERR -╟─(YW)─ ║+Vo (+5V)-╟───╢ VIN ║ ║ VCC -╟──────┴─(RD)─╢- VCC ║ ║ -Vo -╟───╢-GND GND -╟──────╢- GND GND -╟────────(BW)─╢- GND ║ ╚══════════╝ ║ D26 -╟──────╢- PWM VOUT -╟────────(GW)─╢- LIN ║ ╚═══════════╝ ╚═════════════╝ ╚══════════════╝
Ps. Instead of using 12V power supply you could any source ranging from 12v to 24V.
The experiment was a total Success. No jittering problems and the voltage range is from 0 - 5V volts.
Reading values from DS18B20 (see product DS18B20)
╔═══════════╗ ╔═══════════╗ ║ ESP32 ║ ║ DS18B20 ║ ║ ║ ║ Sensor ║ ║ ║ ║ ║ ║ GND -╟────────────────────────╢- GND -║ ║ 3V3 -╟──┬─────────────────────╢- VCC -║ ║ ║ │ ╔═══════════╗ ║ ║ ║ ║ │ ║-Resistor -║ ║ ║ ║ ║ └──╢- 4.7kΩ -╟──┬───╢- Signal -║ ║ ║ ╚═══════════╝ │ ╚═══════════╝ ║ G12 -╟────────────────────┘ ╚═══════════╝
The experiment was a Success. The sensor I used did not react quickly to temperature change but I think that will be ok if i use the PID library.
Create a program which can be used to mix the heat of the water flowing to the hot tub. Best would be to use a the PID library to do mix the water.
Get the temperature and wind outside so you can deside if the water flowing to the hot tub needs to be a little warmer or colder