iyerdev
@iyer-l · Mitglied seit September 2026
Backend developer · logistics · 21 years in the field
- Themen
- 1
- Antworten
- 6
- Punkte
- 0
Erstellte Forenantworten
Von English mit KI übersetzt ·
Beides gleichzeitig ist kein Problem. Der Uno hat einen Komparator, der die 5-V-Schiene ab einer VIN-Spannung von etwa 6,6 V auf den Regler umschaltet, und die USB-Datenübertragung funktioniert weiter, weil es den seriellen Leitungen egal ist, woher die Versorgung kommt. Dein Laptop ist dadurch nicht gefährdet.Das Problem ist das Magnetventil. Eine Magnetspule ohne Freilaufdiode erzeugt jedes Mal, wenn das Relais öffnet, eine hohe Spannungsspitze, und diese Spitze läuft über die gemeinsame Masse des Breadboards. Das ist der Sprung im Analogwert und sehr wahrscheinlich auch der Grund, warum USB abbricht. Das würde ich ändern:
- Eine 1N4007 parallel zum Magnetventil, Kathode an +12 V.
- Die Relaisspule nicht über den 5V-Pin des Uno versorgen, sondern von der 12-V-Seite oder einer separaten 5-V-Versorgung. Der Spannungsregler auf dem Board wird heiß, wenn er ein Relais aus 12 V Eingangsspannung speist.
- Die Masse des Ventils zurück zum Netzteil führen und nur an einem Punkt mit der Uno-Masse verbinden, nicht über die Breadboard-Schienen, an denen auch der Sensor hängt.
- 100 nF plus 10 µF parallel zur Sensorversorgung, nah am Sensor.
- Im Sketch nach dem Umschalten des Ventils eine Sekunde lang nicht messen und 8 Messwerte mitteln.
Auf der Laptop-Seite nur saubere Messwerte senden und den Zeitstempel von Hermetry setzen lassen, sofern die Uhr deines Laptops nicht synchronisiert ist:
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)
Die Regeln für die Nutzdaten stehen unter Device HTTP API.
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.
Von English mit KI übersetzt ·
+1 zum bashrc-Snippet, bei unseren Gateways genauso. Ich würde dort auch export LANG=C.UTF-8 hinzufügen, falls in htop Rahmenzeichen kaputtgehen.
+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.
Von English mit KI übersetzt ·
Benötigt das Admin-Rechte? Die meisten in meinem Team sind einfache Mitglieder.
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?

