Node-Red ESP32 comms

I'm considering building a physical IoT control panel for my 2 yr old son, he loves buttons & lights!

My initial thoughts were to use an ESP8266 with Tasmota and communicate via MQTT with Node Red. The ESP8266 would only report the state of buttons/switches via MQTT and light up LEDs according to MQTT commands, I want all the logic in Node Red and I'd prefer to use MQTT.

Now comes the part that I'm having trouble with, I'd like to use more than one analog input but the ESP8266 only has one. I have a few ESP32 which have more analog inputs but I can't find good support for Tasmota. I did find some support for Firmata on the the ESPs via UDP, but does Node Red have a node that supports Firmata via UDP? Does a UDP-Serial software converter work?

Any suggestions?

Nice project! :slightly_smiling_face:

What do you need the analog inputs for? If you just want to use them as common switches, you can use a PCF8574 or MCP23017 to get additional digital I/Os.

For analog inputs you could use something like the MCP3008 or similar.

You can also have a look at ESPEasy as an alternative to Tasmota.

1 Like

I was wanting to do a combination lock thing with 3 potentiometer inputs. Adjust the knob until the LED lights up on all three and that unlocks some other function, then randomize the values for the next time.

I found a download for ESPEasy32_R20100, and I believe I flashed it but there's no AP to connect to for config and the serial output mentioned something about missing files from a windows user directory path. Then I gave up on that route.

All I know the current ESP32 build of ESPEasy is “experimental”.
Missing windows files is more related to the serial terminal build into the flash tool. Perhaps try a different serial terminal like miniTerm. To connect to the esp. Then you can use commands to set your WiFi AP and password. Using the AP you perhaps have to be a little bit more patient. After flashing the ESP does a lot of things and has to be rebooted once by power up or reset button. But not to early as ESPEasy formats the flash and prepares the default config
Rule of thumb if you can’t connect via serial and cannot read the terminal output: Flash, wait 2-5minutes, do a reset. Wait again and perhaps one more reset (in case the auto-reset after flashing faild) Then the AP should show up (soon).

1 Like

Honestly, unless you need the ready-made OTA, I'd skip all the framework firmware like Tasmota, ESPeasy, etc and just hand code it. Depends on your experience with writing code for the ESP of course. I use the Arduino IDE and it is pretty easy with loads of info online.

The framework firmwares are great when you want to put in a sensor platform somewhere that might be wired in or inaccessible but they can get in the way when you want to do something bespoke.

2 Likes

If you need a prototype (including wifi, mqtt and home convention) perhaps you take a look at my Christmas project.

The code for controlling 3 gpios (with pwm) is only a few lines. All the protocol stuff is done by the great homie esp8266/32 library.
If you start perhaps consider to skip the Arduino IDE and take a look at vs-code + platformio. Looks more complex on first sight but all the coding tools are great especially for beginners.
Don’t get confused: Arduino IDE is using the Arduino Framework. With platformio you “can” use the Arduino Framework too only with the more powerful vs-code ide.

I think I will end up rolling my own Arduino code. I already have another project with my own MQTT code using the PubSubClient by Nick and ESP32 OTA all working so I'll just create my own MQTT<->IO framework.

1 Like

m_elias,

I have used the ESPHome plug-in for Node Red to support my ESP8266 and ESP32 devices. Works great. Avoids writing Arduino code, and once programmed, supports OTA updates.

2 Likes

@arcs_n_sparks How do I get started with flashing my first esp32 on Windows? Does it need a configuration file to work as a dumb hardware interface controlled via MQTT?

What firmware are you using? Most of the pre-built firmwares like ESPeasy, Tasmota, etc have their own methods and instructions in order to bootstrap, once installed, you can usually update over WiFi (OTA).

Custom firmware that you write yourself is uploaded via the tools provided by either the ESP development framework or the IDE you are using (e.g. Arduino IDE).

m_elias,

Yes, it needs a YAML configuration file. In the ESPHome plug-in, you add a new device and it generates a skeleton YAML file. You edit that file to incorporate what you need (SSID, password for wireless, MQTT broker I.P. address, etc....). Unless your device incorporates an on-board USB interface, you will need a USB to serial interface to talk to the UART (be careful about voltage). Below is a YAML file for an ESP8266 connected with a DS18B20 temperature sensor.

esphome:
  name: garage_bench
  platform: ESP8266
  board: nodemcuv2

wifi:
  ssid: "my SSID"
  password: "my PASSWORD"


captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

dallas:
  - pin: D1

# Individual sensors
sensor:
  - platform: dallas
    address: 0x8000000A38B8EB28
    name: "garage bench temperature"
    
switch:
  - platform: gpio
    pin: D4
    inverted: yes
    name: "LED"


      
    
mqtt:
  broker: 192.168.1.155

@arcs_n_sparks Thanks for the run down. I think at some point I should spool up a HA VM but for this project I'll probably just roll my own firmware.