ESP8266 with node red

Hi
I have RPI3b and I use it as a water level detector with the ultrasonic sensor HC-SR04 and it works fine
And now I'm thinking yo use instead of RPI to use the ESP8266.
Please advise me if it can be used to give the same functionality of the RPI and can see the dashboard via mobile

Thank you in advance

certainly the esp8266 can work well with the HC-SR04 to send measurements. Typically it ill send the data to another device like a gateway (eg Pi) that then serves up a dashboard - but the esp can host small web pages itself - but that is outside the scope of this forum as at that point it has nothing to do with Node-RED.

Here's a link to a tutorial I wrote for my IoT students.
It covers using an ultrasonic sensor (HC-SRF05) with a Wemos D1 Mini (ESP8266) and sending the distance reading, via MQTT, to Node-RED running on a Raspberry Pi.

http://resources-area.co.uk/node-red-flows/ultrasonic_distance_sensor.pdf

PS:
I wrote this tutorial nearly two-years ago and have just seen the MQTT topics begin with a leading forward slash (/). That is not a preferred method, so you may want to remove them. Hope that makes sense?

I assume you mean viewing the dashboard via the 4/5G mobile network. There are a lot of security concerns to be handled. Already has been discussed & covered in this forum, use the search function to find more

1 Like

...have a look at tasmota (https://tasmota.github.io/docs/#/) for using the esp along with a SR04.
Tasmota offers integration with mqtt, hence integrating with node-red is a piece of cake.

However, running node-red on the esp is not an option.
You would need to run an instance of node-red (and mqtt-broker) elsewhere (possibly still on the Pi or in in a docker on your NAS).

I mean within the wifi rang of my router

Dears
The point is can the esp8266 do the same job of reviewing the dashboard of level measurements by mobile with the wifi range without using MQTT because I need to remove the RPI and put the esp8266 instead of it

I'm not sure what you mean by this. If you are asking if the esp8266 can be used as a dashboard to display your measurements, the answer is a conditional yes but you would have to code it yourself.

The esp8266 can not run Node-RED. It can easily send data to NR. I (and many more people) have multiple sensors that the esp2866 reads and then sends (via MATT) to a node-red instance. Then I use node-red to create a dashboard to view. This is all done in my local network. If I need data from a remot location, I use Telegram or a cloud based MQTT broker - I do not open my local network to the outside.

1 Like

Here's a very ROUGH sketch of a possible network diagram.

To view the Node-RED flow/dashboard from your mobile phone you would just need to enter the URL for Node-RED in your phone's browser.

Note:
Depending on the model of RPi you have, you can connect it to the router by ethernet cable or WiFi.

Alternatively, you could operate the Wemos D1 Mini (ESP8266) in standalone mode.
This would involve connecting the Utrasonic sensor and an OLED panel (to act as your display) to the Wemos (as shown on page-3 of my tutorial). You wouldn't have a dashboard in this arrangement - just a basic multi-line text display. You also wouldn't need MQTT (as it's standalone). Hope this makes sense.

1 Like

As already suggested above, you could use a compatible OLED display for displaying the measurement values, which can be attached directly to the GPIOs on the esp.
With the latest version of tasmota, driving an OLED or LCD is possible, hence the ability to display the measurements in Text-mode is possible as well.
This would not require any coding, but some configuration only.Each tasmota device has its own Web interface, where the measurements from the sensors are also displayed, as text.

...getting the same UI experience from the esp, like with node-red dashboard is a bit complicated and you will have to do a lot of coding yourself.

But all of this would be without node-red and therefore not in the scope of this forum..

1 Like

Hi
I just dont want to use the RPI in this experiment,I want to use the HCR04 sensor directly to the ESP and send the node red code to the ESP and open the dashboard by mobile from local wifi router.

node red code simply does not work/run on the esp

1 Like

Well as @hominidae said you can't run Node-RED on an ESP8266.

You have two options...
(1) Run the ESP8266 in standalone mode with a very basic OLED text screen.
(2) Have a master (e.g RPi) on your network that runs Node-RED and provides a nice dashboard.

Sorry - I have no more suggestions for you.

the esp can run a simple web page so you could make it serve up a micro web page/dashboard - but it would have nothing to do with Node-RED.

2 Likes

Thanks to all for the advices
If the ESP cannot help with my experment ,in this case can I use RPI zero instead of the RPI3??

It would need to be the RPi-ZERO-W (as that is the version that has WiFi). Also need a router.

Although the RPi-Z-W is not as powerful as the Pi-3B it should handle the MQTT traffic from your SRF-04 or SRF-05 without any problems. My IoT students have one each and do all sorts of things with them.

1 Like

...another option, without node-red but with nice graphics interface with ESP devices and sensors is Blynk (https://blynk.io/en/developers)..
You can install the local server on a Pi (https://github.com/blynkkk/blynk-server) and use Arduino IDE to code the ESP side, while the UI can be configured in the iOS/Android App,
I am using it with node-red and the blynk webservice node and local blynk server. But both will not fit on a Pi-zero, I am afraid.

1 Like

I think Tasmota as you suggested earlier is the easiest, the distance value is directly shown in the interface. Takes 5 minutes to get it working; flash firmware, setup the GPIO, done.

1 Like

Yep. and then it's no more Node-RED related, other forums may be a better support source

1 Like