smithops
@tsmith · Joined January 2026
Plant manager · automotive · 6 years in the field
- Topics
- 4
- Replies
- 35
- Points
- 0
Forum Replies Created
Paid neither, my maintenance tech did it in an afternoon with your snippet. Course is jumpy below 2 km/h so we only show it when speed_kmh > 2. First week: 6 alarms, all the same driver. Logistics is happy.
That’s the answer I needed. Safety interlocks stay in the PLCs where they already are, Edge buffers the meters, and the cloud does the reporting and alarms. I asked the integrator for the buffer size of their model, they came back with roughly two days at our polling rate, which is plenty. Finance is satisfied because the box is replacing a Pi we would have had to look after ourselves.
Fair. The integrator said we could also use a Raspberry Pi. Is that a real option or a hobby thing?
Running since last week on the reporting box that already does our shift reports. First Monday the figure was off a little because I used 1d buckets and we’d just moved to summer time, switched to 1h buckets and it matches the manual reading to 0.1 m³. Finance is happy, and nobody reads the meter on Sunday night anymore.
Two bugs, and a third waiting to happen. I did nearly this exact thing on a test rig years ago.
1. On the slave, each Wire.write() inside onRequest on AVR replaces the buffer instead of adding to it in some library versions, and the order of evaluation in (Wire.read() << 8) | Wire.read() on the master isn’t defined in C++, so the bytes can come out swapped.
2. The stray single byte shifts everything if the counts ever disagree.
Do it with one struct on both sides and one write:
struct __attribute__((packed)) Packet {
uint16_t m1, m2;
int16_t t_x100; // 23.47 C -> 2347, no float on the wire
uint8_t seq;
};
// slave
void onRequest() { Wire.write((uint8_t*)&pkt, sizeof(pkt)); }
// master
Packet p;
if (Wire.requestFrom(8, sizeof(p)) == sizeof(p))
Wire.readBytes((uint8_t*)&p, sizeof(p));
float t = p.t_x100 / 100.0;
Scaled integers avoid any float layout question if the slave ever becomes an ESP or an STM32. The seq byte tells you if you’re reading a stale packet. And on the ESP32 side, skip the key entirely if a reading is invalid instead of sending NaN, NaN isn’t valid JSON anyway.
It’s stored in FRAM, survives power cuts. It only goes back to zero when we flash new firmware.
Maybe you need a client certificate for the broker? We had to load one on our line PCs.
Room-level was the right call. Metre-level indoor positioning tends to sound good in a meeting and then becomes a maintenance job nobody wants.
What accuracy do they really need? Metre-level or room-level? That decides the whole hardware budget.
Lower the serial baud to 9600 and see if it stabilises?
Print the chip ID on a sticker on each box. When he calls you about “the one in room 4” you’ll want it.
Not a dead end at all, the “communicating” part just moves to a box next to it. We have a press line from the 90s that reports like this.
Hermetry Edge runs on licensed gateways and reads field devices on site, Modbus RTU over RS-485 and Modbus TCP among them, depending on the gateway model. So you put an analog-to-Modbus I/O module next to the skid: 4-20 mA input for the level, a digital input for the float, and a counter input for the pump pulses. Edge reads the module and each field device shows up in Hermetry as its own child device with readings, alarms and boards. The gateway dials out over TLS with its own certificate, you claim it with the code from its local Cloud page.
Pulse counting directly on the gateway’s own digital inputs depends on the model, so check the model’s specification first. If it doesn’t count, the I/O module does.
The alarm lamp comparator can stay as it is. Wire its output into a digital input too, so you see the lamp state remotely.
What you don’t get from analog gear: timestamps, local logic and buffering at the sensor. The gateway adds the time when it reads, and licensed gateways can buffer while the link is down, but how much depends on the model. Read Licensed gateways and Hermetry Edge before you pick one.
Logging and serial off plus DC/DC: 3.1 uA on the bench. Gateway now waits 5 minutes before disconnect, and the offline rule opens after 15 minutes. Zero offline alarms since Tuesday, and the battery estimate is back over two years.
Logging is on, CONFIG_LOG with the UART backend. And on the gateway side, the script sends v1/gw/disconnect for a tag if it hasn’t heard it for 60 s.
Hello and welcome. Meters nobody has read since handover sounds very familiar.

