I am currently working on a project that monitors water usage using Hall effect water flow sensor and when there are abnormalities in the usage the solenoid valve would automatically close. Now, the problem is I want to monitor the water usage and control the solenoid valve online, and I cannot seem to connect to the internet. I am having problem with the esp8266 I cant seem to make it work, And I cant find any code for reference regarding sending data and controlling valves.
Any tips on how to make this work?
Materials used:
Arduino Mega 2560
4 x Hall-effect water Flow sensor
4 x Solenoid valve
3 x Water Pressure sensor
Esp8266
this is rather vauge - have you tested the ESP8266 by itself with some basic programs, e.g. a simple webserver, etc to check it can connect to you local network etc
how is the ESP8266 connected to the Mega? e.g. upload a schemtic showing connections
sorry for being vague . I am still trying to work my esp8266 with some basic programs but I am really having a hard time. I just laid out my project to explain my plan properly but it made it confusing hahahaha sorry my bad
as of now I am trying the examples to get the hang of it.
Yes I have connected the Mega to the Esp8266
I want to make an app to monitor the water usage and turn the solenoid valve on and off and I am thinking of doing it over wifi. But i am still figuring out on how to make this happen
you would need to interface the sensor and solenoid value to the ESP8266 - how do you drive the solenoid valve, e.g. a relay?
the ESP8266-01 is very limited in the number of IO pins available
I also find having move the device between the programmer (to program it) and dev board (to run it) a pain - I tend to write code on an NodeMCU and then port it to the ESP-01 when working
at least you should use potential dividers on any signal from the Mega to the ESP or you could damage the ESP
how many solenoids do you have? what voltage do they require to drive them?
can you give links to datasheets on the sensors and solenoids?
you could probably do the whole project on a NodeMCU
the 3.3V ESP8266 probably would not drive the MOS FETs and would require an additional driver
as you already have the system working with the Mega and just require the webpage interface it may be simpler to add the EPS8266-01 communicating over a serial line Edit: this photo shows an arduino Mega connected to an ESP-01
The Mega is a 5.0V device so a potential divider is required on the Tx line to the ESP Rx (yellow wire)
an alternative may be a Mega-WiFi_R3_ATmega2560_ESP8266 which is a mega with a builtin ESP8266 so the hardware interfaceing problems are removed - however, having to switch the DIL switches ON/OFF between loading and running code is awkward
It would certainly simplify matters to use the NodeMCU - if that is what you have.
If you do not have one, then get the cheaper WeMOS D1 Mini instead - it has all the same usable functionality.
Unfortunately, your schematic on "circuito.io" is indecipherable, but interfacing should be quite practical and the clumsy Mega 2560 would not be necessary.
Yeah I just researched about it yesterday and it seemed much easier to use the nodemcu than the mega but I am pressed for time since I need to finish this by wednesday and usually the delivery time for the materials takes at least two weeks to arrive in my place