-
1There are three pieces to the WUPB (Wireless UPB) ecosystem: bridge, device, and programmer
For all sketches, edit ESP32UPBsecrets.h as to your specific network details (IP addresses, WiFi connection). You'll also need an MQTT server, even just an RPi or ESP32.
First, the bridge.
Parts:
RS232 PIM with a DB9 (either SAI or PCS. HAI would require different cable for its RJ14)
ESP32S, specifically, aka "ESP32-WROOM", *not* ESP32-S3 or ESP32C or any other ESP32-letter. I've used both the 38-pin and the D1 Mini-32 type (not the 8266, but the ESP32). The 30-pin on a breakout board can be handy too
Watch the breakout boards as some LOOK like they're Arduino form factor but aren't quite, so they don't fit neatly into Arduino cases.TTL-to-RS232 converter like https://www.amazon.com/Anmbest-Converter-Connector-Raspberry-Microcontrollers/dp/B07LBDZ9WG (that's an example, never actually bought that particular one I don't think). Note that the PIM requires DTR to be high (see PIMDescriptionV1.7.pdf actual page 19). This will require some detective work with a voltmeter and a bodge wire on your adapter. I'll attach some pictures of my examples. I recommend DB9M, either to attach directly to the PIM or use a short DB9 M-F cable. Mixing and matching types on RS232 can lead to confusion as to Tx and Rx pins.
Handful of Dupont jumper cables. Any real Arduino nerd will have a pile.
USB power supply, as used for phone charger
Short USB cable from the charger to whatever USB plug the ESP32 has (micro USB, USB-C)
Assembly:
Wire DB9 converter to 3v3 and ground on ESP32, Rx to D19, Tx to D18. If your particular board doesn't have those or you REALLY want to change it you can just change the sketch.
Software:
Open and upload wupb_bridge_13
Watch serial monitor for complaints. at default DEBUG_LEVEL 1 you should see UPB line traffic (like hit a light switch so it sends data) as Line -> MQTT 12345678...
If no traffic, swap 18 and 19 in sketch or your wiring, re-upload. Happens to me all the time and I've been doing this for years.I recommend once it shows data, to disconnect it from the computer and put it aside for a minute. with many ESP32's on the desk it's easy to get them confused and upload a sketch to the wrong unit.
-
2Second, the device
Parts:
Second ESP32S as above
Momentary pushbutton switch
Assembly:
Switch on pin 18 and ground
Software:
Upload set_eeprom_140t_new_device. this sets the EEPROM as if it were an SAI US140-T, as device 254 (unprogrammed)
Upload demo_device. this is the actual code for the US140, and the demo is the bare minimum code required to act as a WUPB device. It will turn the onboard LED on and off as the load.
Verify it has loaded by opening http://my.sub.net.254 in your browser. It should have a web page, albeit with a message at the bottom about "error 255". Clicking Clear error will remove that.
Clicking "On" and "Off" under "Currently (whichever)" should turn the LED on and off.
Clicking "Enter setup mode" should blink the LED, as should pressing the pushbutton for about five seconds. -
3Third, the WUPB programmer
Parts:
third ESP32S as aboveUpload PIM_emulator_for_WUPB_programming_1
Do not open the serial monitor as UPStart will need to use that port. Launch UPStart. Disconnect it from existing PIM, and configure UPStart to use whatever port (e.g. COM4, /dev/ttyS0, whatever) to which the PIM emulator was just uploaded.
To add device to network, put device into setup mode. Either launch its web interface as above and choose "enter setup mode", or press and hold the momentary switch on pin 18 for about five seconds. The onboard LED should start blinking.Add the device in UPStart. It may fail to find the module in setup the first time; Retry should resolve this. UPStart's serial interface can be persnickety.
Assuming it added successfully, the device can be turned on and off from UPStart, programmed to respond to links, whatever.
dremugit
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.