iyerdev
@iyer-l · Joined September 2026
Backend developer · logistics · 21 years in the field
- Topics
- 1
- Replies
- 6
- Points
- 0
Forum Replies Created
Both at once is fine. The Uno has a comparator that switches the 5 V rail to the regulator when VIN is above roughly 6.6 V, and USB data keeps working because the serial lines don’t care where power comes from. Your laptop is not at risk from that.
The trouble is the solenoid. A solenoid coil with no flyback diode throws a big voltage spike every time the relay opens, and that spike goes through your shared breadboard ground. That’s the jump in the analog reading and very likely the USB dropping out. What I’d change:
- A 1N4007 across the solenoid, cathode to +12 V.
- Take the relay coil power from the 12 V side or a separate 5 V supply, not the Uno’s 5V pin. The onboard regulator gets hot feeding a relay off 12 V in.
- Run the valve’s ground back to the adapter, and join it to the Uno ground at one point only, not through the breadboard rails the sensor uses.
- 100 nF plus 10 µF across the sensor supply, close to the sensor.
- In the sketch, don’t sample for a second after switching the valve, and average 8 readings.
On the laptop side, send only clean readings and let Hermetry stamp the time unless your laptop clock is synced:
import serial, requests
s = serial.Serial("/dev/ttyACM0", 9600, timeout=5)
URL = "https://<your-host>/api/v1/telemetry"
HDR = {"Authorization": "Bearer <device token>", "Content-Type": "application/json"}
while True:
line = s.readline().decode(errors="ignore").strip()
if line.isdigit():
requests.post(URL, json={"soil_moisture": int(line)}, headers=HDR, timeout=10)
Payload rules are on Device HTTP API.
Agree on batching. Also give the APs a minimum data rate of 6 or 12 Mbps if the yard boxes can still hold that, it stops one far client from dragging the whole cell down.
+1 to the bashrc snippet, same on our gateways. I’d add export LANG=C.UTF-8 there too if you see box-drawing characters break in htop.
Can’t the alarm rule just text the carer’s phone? Add the number as a recipient.
Does this need admin? Most of my team are plain members.
Trucks lose signal a lot. If a device buffers and sends its readings an hour late, do they land at the time they were taken?

