More ESP/datalogger bullshit
I didn’t want to solder the board directly to my protoboard, so that I could immediately transfer it back to the jumper leads if I’d soldered something up incorrectly. So I knew I wanted some sockets for whatever the pin headers are called, but searching for that on the modern internet? Fucking impossible.
It turns out they’re called XBee sockets, after another IoT module I guess, but searching for that gave me exactly what I wanted, and even better I was able to order them through my local electronics shop (they only had the rails of pin headers, not the sockets, in-stock). It took them a couple of days to arrive, and they’re 30-odd pins long so I just cut them down to size, soldered them in place, and off I went wiring things up.
While I was there I connected up three different colored LEDs, through 480ohm resistors (which I think is fine? They came with the Arduino kit I had to buy to get an Arduino at all locally, which I desperately needed immediately for the uno2iec project before the focus wore off). I had previously figured out which pins I could use for outputs and how to do it, so I felt pretty confident about that.
Four more XBee sockets for the MAX3232 to plug into, wire that up, and it’s time to test. It worked first go!
I wasn’t happy with the mechanical hold on the MAX3232, so I zip-tied it together with the NodeMCU ESP8266 board, and while it’s not the tidiest thing (see photo), it works and it’s out of the way.
One of the pins I chose for output starts out high on boot and doesn’t go low until my software starts, but that actually works out perfect for my uses:
The red LED is solid red on boot, flashes 10% of every second if it can’t connect to wifi, 50% of every second if it can connect to wifi but it can’t connect to the NTP server.
The yellow LED flashes briefly every 15 seconds if it hasn’t heard from the inverter for 15 seconds.
The green LED flashes briefly every 15 seconds when it sends a packet to collectd.
So now if it stops working, I’ll have some visual indicator of why, without needing to disconnect it (thus rebooting it and quite possibly erasing the problem) and hook up a USB to it. I can look at it and go “ahh, it can’t connect to NTP” or something, at least that’s the idea.
Thus far it’s worked quite well, it hasn’t skipped a beat except for one erroneous report first thing in the morning, where it reported substantially more output than the inverter is capable of. Unfortunately this seems to be super rare, so tracking down where the bug is is going to be difficult. I’m betting it’s a bug in my code though.