-->
Page 1 of 1

Need some guidance on adding an esp8266 to a water dispenser

PostPosted: Fri Jul 22, 2022 5:00 pm
by Friendroid
The water dispenser consists of a DC motor that is powered by an 18650 cell and is turned ON by a small chip that pulls the gate of an N-Channel mosfet HIGH when a momentary pushbutton is pressed (shorting Pin2 of the chip to ground). The following press turns the pump off.

I would like to have an esp8266 turning the mosfet ON once a day for a few minutes. I chose the esp8266 because of its low deep sleep current and because I'd like to play with its WiFi capabilities.

But I would like to start easy: when I power the device, I'd like to be able to visit a webpage on my phone and set for how long the gate of the mosfet should be HIGH and how long should the deep sleep be. After pressing OK, the device should dispense water and go to sleep. Once it wakes up again, there is no need for WIFI to be ON again (only if I power OFF and power ON again).

As far as I understand, I'd have to set a flag just after setup is completed, so the next time the esp8266 wakes up, it will know it's not "first boot". I am not sure how to do this, do I need to write it to EEPROM then read it back after waking up?

I'd appreciate some help because I'm not very proficient in C++.

Thank you

Re: Need some guidance on adding an esp8266 to a water dispe

PostPosted: Tue Aug 16, 2022 9:49 am
by rooppoorali
You can use arduino IDE for the coding part. You have to make a web server using ESP8266 like this:
https://randomnerdtutorials.com/esp8266-web-server/

Re: Need some guidance on adding an esp8266 to a water dispe

PostPosted: Tue Aug 16, 2022 3:53 pm
by AcmeUK
How To Save Values On Arduino With EEPROM
I presume that you will need to run a separate program first to initialise the memory location.
Or, you could have that as one of the options on your web page.