Page 1 of 4

ESP32 Dosing Pump

Posted: Sun Jan 03, 2021 1:25 am
by morrisraybrooks
ESP32 Dosing Pump


Hi, I found you on YouTube and I love what you have done I have found a whole new avenue to explore and my plants never looked so good I thank you and my plants do too i have a few questions no the code for your PWM for the Dosing Pump im trying to hack a ph dosing pump im using a Milwaukee MC720 pH Controller and {{>>-->Dosing Pump--sucks} hooked to ESP32 as an Input to home assistant in stuck at can't figure out the PWM part {light:- Platform: monochromatic name: "$ {esphome_name} -1" output: pwm1 I'm so lost a video would be awesome thank you so so much for sharing your knowledge

Re: ESP32 Dosing Pump

Posted: Sun Jan 03, 2021 11:15 am
by LEDG
Ah, interesting one. I think you are on the right track. I haven't done this, nor have I tested this, but this is how I THINK it'd be done in ESPhome:

Code: Select all

# Configure the output
output:
  - platform: ledc
    pin: GPIO12
    id: pump
So I think you set it up as an output and then use a script to turn the output on and off for however long you need.

For starters, try turning it on for a set time and see how much liquid it pumps, then go from there. For example, if you turn it on for 3 seconds and it pumps 3mL, you know that it needs to be on for 1 second for every mL you want dispensed. You then write this into your script and tie it to an input number on your dashboard or something, so the script looks at how much you want pumped, then does the math and multiples it by 1000ms or whatever to determine how long to keep the pump on before shutting it off.

In pseudo-code (this isn't quite proper yaml), the script would look like:

- output.turn_on: pump
- output.ledc.set_frequency:
id: pump
frequency: "1000Hz"
- output.set_level:
id: pump
level: "50%" (might be able to template this to make it settable from an input number on your dashboard)
- delay (however long is required to dispense required amount)
- output.turn_off: pump

Re: ESP32 Dosing Pump

Posted: Mon Jan 04, 2021 12:46 am
by morrisraybrooks
thank you trying it now
here is my original it is 3 speed and works
just not on low

===================================================
esphome:
name: pwm_ph_pump
platform: ESP32
board: esp32doit-devkit-v1

wifi:
ssid: "tuna78killer"
password: "plumber1"

power_save_mode: none

# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Pwm Ph Pump Fallback Hotspot"
password: "g1paoAxMHsOb"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:
password: "1234"


ota:
password: "1234"

output:
- platform: ledc
pin: GPIO14
frequency: 10000 Hz
id: pwm_ph_pump

fan:
- platform: speed
output: pwm_ph_pump
name: "Network pwm_ph_pump "

Re: ESP32 Dosing Pump

Posted: Mon Jan 04, 2021 12:50 am
by morrisraybrooks
where im stuck at is how does one fire multiple levels of pwm through esphome coed i downloaded the admin and got blown away

Re: ESP32 Dosing Pump

Posted: Thu Jan 14, 2021 2:48 am
by morrisraybrooks
wheew finally got it working

Re: ESP32 Dosing Pump

Posted: Mon Jan 18, 2021 3:14 pm
by LEDG
morrisraybrooks wrote:
Thu Jan 14, 2021 2:48 am
wheew finally got it working
Nice!

What'd you end up with?

Re: ESP32 Dosing Pump

Posted: Tue Jan 19, 2021 4:25 am
by morrisraybrooks
i actually hacked into the supply form the dosing pump its self still using the ph sensor and controller but replaced the pump with way smaller and PWM controlled pump thanks to yall im using home assistant and a esp32 got it setup through a relay and too esp32's right now im trying to get timing working like on for 0.1 sec off for 5 min check status of binary_sensor: fire again till binary_sensor: reads closed

im going to load all code on one chip i have my revivor setup with float switches too this weekend im planning to do the wiring any ideas on the timing im still home a assistant nube any help would be appreciated


#==============================================
Editing: water_level_sensor.yaml

binary_sensor:
- platform: gpio
pin:
number: D4
mode: INPUT_PULLUP
inverted: True
name: "Dosing pump trigger"
device_class: window
filters:
- delayed_on: 10ms


esp32 # 2
#==============================================
Editing: esp32_ph_doser.yaml

output:
- platform: ledc
pin: GPIO14
frequency: 7000 Hz
id: pwm_ph_pump

fan:
- platform: speed
output: pwm_ph_pump
name: " pwm_ph_pump "

Re: ESP32 Dosing Pump

Posted: Wed Jan 20, 2021 5:17 am
by morrisraybrooks
never mind i got it finally figured out the script

Re: ESP32 Dosing Pump

Posted: Thu Jan 21, 2021 7:11 pm
by stud
morrisraybrooks wrote:
Mon Jan 04, 2021 12:46 am

wifi:
ssid: "tuna78killer"
password: "plumber1"
now change your Wifi Password =P

Re: ESP32 Dosing Pump

Posted: Fri Jan 29, 2021 5:57 pm
by morrisraybrooks
i cant get the second pump on line trying to figure out what im doing wrong
ones i add the second output: it wont upload i so suck at yaml i think its an
alinement issue

#==============================================
sensor:
# Uptime sensor.
- platform: uptime
name: ESP32_PH_Doser_sensor Uptime
unit_of_measurement: "hour"
# WiFi Signal sensor.
- platform: wifi_signal
name: ESP32_PH_Doser_WiFi_Signal
update_interval: 2s
unit_of_measurement: "db"
#==============================================
output:
- platform: ledc
pin: GPIO14
frequency: 9000 Hz
id: pwm_ph_up_pump

fan:
- platform: speed
output: pwm_ph_up_pump
name: " pwm_ph_up_pump "

#==============================================
#output:
# - platform: ledc
# pin: GPIO15
# frequency: 9000 Hz
# id: pwm_ph_down_pump

#fan:
# - platform: speed
# output: pwm_ph_down_pump
# name: " pwm_ph_down_pump "
#==============================================
switch:
- platform: restart
name: "ESP32_PH_Doser_restart"