Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
I want to have automatic control for my pump, wirelessly.
A transmitter unit fitted in the water tank would sense the water level and transmit the data to a receiver unit attached to the pump starter to turn it off/on.
Also an override unit would allow me to turn the pump on/off according to my will and will also display the water level.
How do I write the code for the wireless transmission part ?
I want to know about how to code the wireless transmission-receiving part of the system. For the sensor an ultrasonic sensor can be used to output the water levels. so, the code goes like this : if(waterlevel <= minimum ) turn pump on; if(waterlevel = maximum) turn pump off; I now want to know how to send the instruction from the transmitter module (that will be attached with the tank) to the receiver module (that will be attached to the pump switch) wirelessly over my home network.
First of all I would recommend to play around with Web Server example to understand how the server hosting works. Also, the ip adders is assigned randomly to the ESP so you definitely need to write a rule in your WiFi router in order to assign a static ip to the ESP. But you can try to use mDNS to assign a name to your esp. For example http://pump.local/path. You can find some instructions here. If you are looking for simplicity you can use Blynk. It is a fully automated and free service that allows you to control you ESP from anywhere where there is a internet connection. And it also can display different variables such as the water level in your case.