Windows GPIO input?


I trying to use node red under Windows to monitor status of a limit switch, is it currently open, or is it currently closed.

On raspberry pi with GIPO node this is super easy. On windows it seems pretty challenging for me to find something off the shelf.

There are quite a few USB serial analogue input breakout boards, but my current understanding is they converts a varying voltage input to a digital output. The limit switch does not output any voltage, and I can't just run 3V or 5V power pin to the limit switch for signalling.

Has anyone done anything similar prior? Or perhaps knows what such "USB Dongle" is called?

A lot of folk use Zigbee and off the shelf devices - then use MQTT for inputs and outputs.

Alternatively, there are many devices that can communicate over serial or Ethernet using varying protocols (custom protocol/modbus protocol/OPC/etc) but prices start rising at this point.
example: IoT Ethernet I/O Modules: ADAM-6000/6200 - Advantech

The other solution many do is to setup an ESP device (esp32 or esp8266) and use its GPIO then operate that via MQTT from Node-RED to the ESP.

1 Like

Undoubtedly, the best approach is to use a low-cost MPU to handle the GPIO. An Arduino or ESP device is easy to use and you can easily find off-the-shelf firmware that will handle most situations and sensors/switches without further programming.

This approach also protects your expensive laptop from being blown to smithereens by injudicious application of a 5v signal!

An ESP device is a few $ and has either WiFi or Bluetooth remote connections or serial/usb. Most Arduino's have only serial/usb.

1 Like

Thanks everyone, I was really hoping not to DIY everything, but seems ESP or Pico is the best there currently is

I'm sure there are pre-built MPU's you could buy. Would be more expensive of course. And you shouldn't need to DIY the sensor and switch interface programming, there should be existing firmware for that.

I agree that hooking up your expensive PC directly is a risk.

But as you're using NodeRed, a simple ÂŁ20 ESP device seems like a good option.

I am a big fan of the M5stickC-Plus for all kinds of tasks.

$10 M5StickC

$20 M5stickC-Plus

For example

While the flow and script I've created are a terrible overkill for what you're looking for, it would work perfectly.

There is a Grove port on the bottom of the M5StickC devices, which I've used as 2 GPi pins, to detect 0v contact closures.

The Arduino Script is configured for MQTT and Serial (via USB) communication, using a JSON structure.

I'm happy to share the script and sample Flow.

My longer term plan is to adapt my script to work with the smaller M5 Atom S3

Somewhat off the topic but ESPHome works with all types of ESP including the M5's even those with screens. It lets you have multiple include files so that you can reuse bits across devices. All my ESP devices run ESPHome now and it greatly simplifies things.

1 Like