thompsonplc
@lthompson · Membre depuis mai 2025
Automation engineer · pharma · 14 years in the field
- Sujets
- 7
- Réponses
- 65
- Points
- 0
Toutes mes réponses sur les forums
The readings stored before the fix keep the wrong value, so if that night matters, export it and correct it by hand.
Traduit de English par IA ·
Vous n’avez pas du tout besoin de tokens par appareil dans le firmware. Séparez le problème en deux.Wi-Fi : conservez WiFiManager. Ajoutez un champ personnalisé dans le portail si vous voulez un nom d’appareil convivial, sinon utilisez l’adresse MAC.Token : laissez le nœud demander le sien. Dans le profil de l’appareil, ouvrez l’onglet Provisioning, réglez la stratégie sur Allow creating new devices, enregistrez, puis cliquez sur Create key et copiez le secret (il n’est affiché qu’une seule fois). Cette clé et ce secret sont identiques pour les 12 builds. Au premier démarrage, le nœud se connecte avec le nom d’utilisateur provision et un mot de passe vide, s’abonne à v1/provision/res et publie sa demande. La réponse contient son token d’accès ; vous le stockez dans la NVS, et ensuite il se connecte normalement.
// first boot only, after Wi-Fi is up
mqtt.setServer(host, 8883); // WiFiClientSecure, TLS
mqtt.connect(clientId, "provision", "");
mqtt.subscribe("v1/provision/res", 1);
String req = String("{"deviceName":"aq-") + mac6 +
"","provisionDeviceKey":"pk_xxx","provisionDeviceSecret":"ps_xxx"}";
mqtt.publish("v1/provision/req", req.c_str());
// in the callback: parse credentialsValue when status == "SUCCESS",
// prefs.putString("tok", value); then reconnect with the token as username
Deux points nous ont posé problème sur un site pharmaceutique. Les nouveaux appareils créés de cette façon atterrissent en quarantaine : ils se connectent, mais leurs données sont rejetées tant qu’un administrateur ne les a pas activés. Prévenez donc le responsable de l’organisation de les chercher. Et le nom doit être unique : une seconde demande avec le même nom renvoie device_exists, car elle ne délivre jamais deux fois un identifiant. Ne effacez donc pas la NVS à la légère. Les détails figurent sur Adding and claiming devices.
You don’t need per-device tokens in the firmware at all. Split it in two problems.
Wi-Fi: keep WiFiManager. Add one custom field in the portal if you want a friendly device name, otherwise use the MAC.
Token: let the node ask for its own. On the device profile open the Provisioning tab, set the strategy to Allow creating new devices, save, then Create key and copy the secret (it’s shown once). That key + secret is the same for all 12 builds. On first boot the node connects with username provision and an empty password, subscribes to v1/provision/res and publishes its request. The answer carries its access token, you store that in NVS and from then on it logs in normally.
// first boot only, after Wi-Fi is up
mqtt.setServer(host, 8883); // WiFiClientSecure, TLS
mqtt.connect(clientId, "provision", "");
mqtt.subscribe("v1/provision/res", 1);
String req = String("{"deviceName":"aq-") + mac6 +
"","provisionDeviceKey":"pk_xxx","provisionDeviceSecret":"ps_xxx"}";
mqtt.publish("v1/provision/req", req.c_str());
// in the callback: parse credentialsValue when status == "SUCCESS",
// prefs.putString("tok", value); then reconnect with the token as username
Two things bit us on a pharma site. New devices created this way land in quarantine, they connect but their data is dropped until an admin activates them, so tell whoever owns the org to look for them. And the name must be unique, a second request with the same name gets device_exists because it never hands out a credential twice. So never wipe NVS casually. Details are on Adding and claiming devices.
Traduit de English par IA ·
Kstewart a raison. Il y a une passerelle Basics Station dans le labo QA à l’étage au-dessus, enregistrée dans notre organisation par l’équipe QA. C’est elle qui a capté mes trames « sporadiques », ma carte de développement n’en a jamais transmis une seule. Je l’ai empruntée pour le banc, j’ai retiré la carte mono-canal et l’astuce de canal. Le join passe du premier coup, les uplinks toutes les 60 s sur les huit canaux. L’astuce 868.1 a d’ailleurs fonctionné entre-temps, pour mémoire.
Kstewart got it. There is a Basics Station gateway in the QA lab on the floor above, registered in our org by the QA team. That’s what heard my « sporadic » frames, my dev kit board never forwarded a single one. Borrowed it for the bench, removed the single-channel board, removed the channel hack. Joins first time, uplinks every 60 s on all eight channels. The 868.1 trick did work in between, for the record.
Traduit de English par IA ·
Aoife, le Pi n’a malheureusement pas de veille profonde. C’est une machine Linux : elle tourne ou elle est éteinte. Donc tu coupes tout ce que tu peux et tu fais travailler la radio le moins possible.Ce que je ferais, par ordre de gain :
- Pi :
dtoverlay=disable-wifietdtoverlay=disable-btdans config.txt, HDMI désactivé (tvservice -osur les anciennes images), LED d’activité éteinte. Sur un Zero, cela ramène à environ 80 mA. - GPS : couper le moteur GNSS entre deux positions (
AT+CGPS=0, puisAT+CGPS=1). Un démarrage à chaud sur le SIM7600 prend quelques secondes. - Cadence : 30 s en mouvement, 15 à 60 min à l’arrêt. Décide selon la vitesse ou la distance depuis la dernière position.
- Lots : mémoriser les positions et envoyer un message toutes les quelques minutes sous forme de tableau avec ts. Le GPS fournit une horloge correcte, donc les horodatages sont fiables. Un appel HTTPS au lieu de dix consomme moins de temps radio et ne coûte qu’un message du quota mensuel au lieu de dix.
[{"ts": 1757683200000, "values": {"lat": 52.95231, "lon": -1.14972, "speed_kmh": 31.5}},
{"ts": 1757683230000, "values": {"lat": 52.95410, "lon": -1.14701, "speed_kmh": 33.0}}]
Comme l’appareil ne communique que toutes les quelques minutes, règle la règle de connexion de son profil sur Recent message avec un intervalle attendu correspondant à ta cadence à l’arrêt, sinon il apparaîtra hors ligne toute la nuit.Si une semaine est une exigence stricte, la réponse honnête est un microcontrôleur (ESP32 ou nRF) qui dort et réveille le modem, ou un circuit temporisateur comme le TPL5110 qui coupe l’alimentation de tout le Pi entre deux cycles. Une carte Linux qui tourne à vide à 80 mA n’y arrivera jamais avec 10 Ah.
Aoife, the Pi has no deep sleep, sadly. It’s a Linux box, it’s either running or off. So you cut everything you can and make the radio work less.
What I’d do, in order of payoff:
- Pi:
dtoverlay=disable-wifianddtoverlay=disable-btin config.txt, HDMI off (tvservice -oon older images), activity LED off. On a Zero that gets you to roughly 80 mA. - GPS: switch the GNSS engine off between fixes (
AT+CGPS=0, thenAT+CGPS=1again). A warm start on the SIM7600 is a few seconds. - Rate: 30 s while moving, 15 to 60 min while parked. Use speed or the distance from the last fix to decide.
- Batch: buffer fixes and send one message every few minutes as an array with ts. GPS gives you a correct clock, so the timestamps are trustworthy. One HTTPS call instead of ten is less radio time, and it costs one message out of the monthly quota instead of ten.
[{"ts": 1757683200000, "values": {"lat": 52.95231, "lon": -1.14972, "speed_kmh": 31.5}},
{"ts": 1757683230000, "values": {"lat": 52.95410, "lon": -1.14701, "speed_kmh": 33.0}}]
Because the device only talks every few minutes, set its profile’s online rule to Recent message with an expected interval that matches your parked rate, otherwise it shows offline all night.
If a week is a hard requirement, the honest answer is a microcontroller (ESP32 or nRF) that sleeps and wakes the modem, or a timer chip like a TPL5110 that cuts power to the whole Pi between runs. A Linux board idling at 80 mA will never get there on 10 Ah.
No register trick, I’m afraid. As far as I remember the sleep mode table in the 328P datasheet, the analog comparator is only a wake source in idle (and ADC noise reduction), not power-down. In power-down only the external interrupts, pin change, TWI address match and the watchdog wake it. Your idle current is the clocks running.
Move the comparator outside. A nanopower comparator with push-pull output into INT0 (D2) lets the 328P sit in power-down at a few µA. TLV3691 draws about 75 nA, and the reference can be a micropower 2.5 V shunt. Add hysteresis with a resistor from output to the + input, a few hundred mV at the battery side, otherwise a battery hovering at 11.8 V will wake you a hundred times a night as the load changes.
attachInterrupt(digitalPinToInterrupt(2), wake, FALLING);
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
sleep_enable(); sleep_cpu(); // wakes on INT0 only
// on wake: read ADC once for the real value, send it, sleep again
Aoife: you can use the bandgap internally, but the comparator itself still can’t wake power-down, so it doesn’t help here.
On the Hermetry side I’d still send a heartbeat once a day with the voltage. Then an offline alarm on the profile tells you a sensor died, which a wake-only design never would. Put the low-voltage alarm rule on bat_v with some hysteresis too.
Monitor was on « Newline ». Both NL & CR and NAME and UART went through at once. Kevin, the baud was fine, AT mode is always 38400 on these.
Traduit de English par IA ·
J’ai fait ça sur un lot de SG90 pour un montage pédagogique. La modification :
1. Ouvrez le boîtier, retirez le pignon de sortie. Coupez ou limez la petite languette en plastique située sous celui-ci, qui heurte la butée de fin de course.
2. Le potentiomètre sous l’axe de sortie est le retour de position. Dessoudez-le et placez à sa place deux résistances de 2,2 kΩ en diviseur fixe (les extrémités sur les pastilles externes, le milieu sur la pastille du curseur). Le servo croit maintenant toujours être au centre.
3. Remontez. Désormais, la largeur d’impulsion règle la vitesse et le sens au lieu de la position : environ 1,5 ms l’arrêtent, plus court tourne dans un sens, plus long dans l’autre. Trouvez la valeur d’arrêt exacte par essais, la tolérance des résistances la décale.
Pour ta deuxième question : non, il ne connaît plus sa position, comme un FS90R. Pour un store, c’est important ; fais donc ce que Keisha a dit : ajoute un contacteur à lames souples ou un micro-interrupteur en position entièrement ouverte et entièrement fermée, et compte le temps ou ajoute un encodeur bon marché entre les deux. Honnêtement, un SG90 est aussi faible pour un vrai store : un moteur pas à pas 28BYJ-48 avec une carte ULN2003 te donne la position gratuitement et plus de couple.
Côté carte : ajoute blind.set avec un paramètre Number de 0 à 100 dans l’onglet Commands du profil de l’ESP32, niveau Basic. Le Slider envoie la valeur une seule fois au relâchement, et non pendant que tu le déplaces, ce qui convient à un moteur. Fais publier à l’ESP32 sa position réelle sous blind_pct et lie la Current value du Slider à celle-ci, pour que la carte affiche où se trouve réellement le store.
Alimente le servo ou le moteur pas à pas avec sa propre alimentation 5 V, et non avec la broche de l’ESP32.
Did this to a pile of SG90s for a teaching rig. The mod:
1. Open the case, take out the output gear. Cut or file off the little plastic tab on its underside that hits the end stop.
2. The potentiometer under the output shaft is the position feedback. Unsolder it and put two 2.2k resistors in its place as a fixed divider (ends to the outer pads, the middle to the wiper pad). The servo now always thinks it’s at centre.
3. Reassemble. Now the pulse width sets speed and direction instead of position: about 1.5 ms stops it, shorter turns one way, longer the other. Find the exact stop value by trial, resistor tolerance shifts it.
To your second question: no, it no longer knows where it is, same as an FS90R. For a blind that matters, so do what Keisha said, add a reed switch or microswitch at fully open and fully closed, and count time or add a cheap encoder in between. Honestly, an SG90 is also weak for a real blind, a 28BYJ-48 stepper with a ULN2003 board gives you position for free and more torque.
On the board side: add blind.set with a Number parameter 0-100 to the ESP32’s profile Commands tab, Basic tier. The Slider sends the value once on release, not while you drag, which suits a motor. Have the ESP32 publish its real position as blind_pct and bind the Slider’s Current value to it, so the card shows where the blind actually is.
Power the servo or stepper from its own 5 V supply, not the ESP32’s pin.
USB-RS485 with auto direction plus 680 R bias resistors at the Pi end: zero CRC errors over 10,000 polls. Children show up in Hermetry as mixer-11 to mixer-16. Ciaran, thanks.
120 R at both ends. No bias resistors anywhere, I’d assumed the PIC boards had them.
Traduit de English par IA ·
J’ai examiné une conception similaire pour un sous-traitant l’an dernier, voici donc le raisonnement pour le rapport.Séparez les éléments publics des éléments secrets. Le bundle CA est public ; le certificat serveur est un certificat public que l’on vérifie avec un bundle CA normal, donc le conserver sur la carte ne pose pas de problème. Le mot de passe WiFi et le jeton de l’appareil sont des secrets, car ils identifient précisément cet appareil.Les secrets sur un support amovible échouent pour deux raisons : retirer la carte ne laisse aucune trace, et la carte est souvent copiée sur d’autres cartes (« clone simplement la carte »), ce qui fait que plusieurs appareils partagent un même identifiant. Hermetry n’autorise qu’une session par appareil ; deux cartes avec le même jeton se déconnectent donc sans cesse mutuellement, et vous verriez une prise de contrôle dans l’onglet Log de l’appareil.Concernant X.509 : pour vos propres cartes, ce n’est pas disponible. Les certificats clients doivent provenir de l’autorité de certification des appareils de Hermetry, et l’envoi de votre propre CA pour des appareils tiers n’est pas proposé ; cette voie concerne les appareils sous licence qui génèrent leur clé et envoient eux-mêmes une CSR. Votre ESP32 utilise un jeton d’accès ou MQTT basic.Ce que je ferais sur un ESP32 :1. Le même binaire pour chaque carte convient. Placez le jeton dans la NVS lors du provisionnement (une petite commande série au premier démarrage), et non sur la carte.2. Activez le chiffrement de la flash et le chiffrement de la NVS, afin qu’un dump de la flash ne révèle pas le jeton.3. La carte ne sert qu’à l’enregistrement des données et au bundle CA.4. Dans Hermetry, un appareil et un jeton par carte ; changez le secret si une carte disparaît. Cela met immédiatement fin à ses sessions.La limitation concernant les certificats est décrite dans la dernière section de Device certificates.
Did a review of a similar design for a contractor last year, so here’s the reasoning for the report.
Separate public stuff from secret stuff. The CA bundle is public; the server certificate is a public one and you verify it with a normal CA bundle, so keeping that on the card is fine. WiFi password and the device token are secrets, they identify this exact device.
Secrets on removable media fail on two counts: removing them leaves no trace, and the card usually gets copied into other boards (« just clone the card »), and then you have several devices sharing one credential. Hermetry allows one session per device, so two boards with the same token keep kicking each other off, and you’d see takeover in the device’s Log tab.
On X.509: for your own boards it’s not available. Client certificates must come from Hermetry’s device certificate authority, and uploading your own CA for third-party devices is not offered; that path is for licensed devices that generate their key and send a CSR themselves. Your ESP32 uses an access token or MQTT basic.
What I’d do on an ESP32:
1. Same binary for every board is fine. Put the token in NVS at provisioning (a small serial command on first boot), not on the card.
2. Turn on flash encryption and NVS encryption, so a flash dump does not give up the token.
3. Card only for data logging and the CA bundle.
4. In Hermetry, one device and one token per board; rotate the secret if a board goes missing. That ends its sessions at once.
The certificate limitation is on Device certificates, last section.
The pH jumping with the EC probe in is a ground loop. Both EZO circuits share the Pi’s ground and the EC probe drives current through the water, which shifts the pH reference. Atlas sells an isolated carrier board for exactly this, put at least one of the two on it.
Traduit de English par IA ·
Uniquement entre le téléphone et l’antenne-relais, et la version 2G de cette protection est faible, ce qui explique que l’astuce du van fonctionne. Au-delà du cœur de réseau de l’opérateur, c’est de l’internet en clair. Considérez la liaison radio comme non fiable.
Only between the phone and the tower, and 2G’s version of it is weak, which is why the van trick works. After the operator’s core it’s plain internet. Treat the radio as untrusted.
Until something like that exists, do the zone decision on the robot. That’s also what the personnel tracking solution expects: the tracker or its gateway reports the zone name, and Hermetry’s rules work on that. I run exactly this for carts in a warehouse, ESP32 scanning fixed BLE tags.
every 2 s: scan 1.5 s, keep RSSI per known tag (EMA, alpha 0.3)
best = tag with highest smoothed RSSI
switch zone only if best beats the current zone's tag by 6 dB
for 3 scans in a row (stops flapping at borders)
publish on change and every 60 s:
{"zone": "F3-east", "zone_id": 32, "zone_rssi": -71}
Send both: zone as text for tables and the alarm, zone_id as a number because text keys have no chart history and you’ll want « where was it at 14:00 ».
For the kitchen corridor: give each cleaner a server attribute forbiddenZone = « F0-kitchen » and an alarm rule on the robot profile where zone equals that attribute. Per-device thresholds from attributes work for text too with ==. Same pattern the tracking solution uses, described on Personnel tracking.
Polygons: no workaround on the map that I know of. Map the polygon to tag zones instead, one zone per forbidden area.
Traduit de English par IA ·
Bien. Prévoyez tout de même un remplacement pour cet Edison : il n’est plus produit depuis des années et les pièces de rechange deviennent de plus en plus difficiles à trouver.
Good. Plan a replacement for that Edison though, it’s been out of production for years and spares get harder to find.
Aoife has the core of it.
Cutting the solenoid only puts the directional valve into its rest position. Depending on the valve type that can trap air in the cylinder (closed-centre 5/3 valves do exactly that), so the cylinder can still move when someone opens a fitting, or hold a load that drops later. A stuck valve spool is the other failure: power off, valve doesn’t move. Pneumatic energy is stored energy, and for safe access you want it gone, not held. The dump valve exhausts the supply to atmosphere so the cell ends up at zero pressure. The safety relay usually also monitors the dump valve’s feedback (a pressure switch or a position contact), so a dump valve that fails to vent stops the cell from restarting. The two parts cover different failures. How much of this you need follows from the risk assessment and the required performance level under ISO 13849, which is your engineer’s job to document.
On Hermetry Safe: there’s no doc page for it, so I won’t guess what it does. Whatever it does, I would never put a cloud platform into the safety function itself. Even the personnel tracking page calls that solution an information tool, not a certified safety system. Emergency stop, safety relay and dump valve stay hardwired.
What works today and is useful: monitoring. Wire the safety relay’s auxiliary contact and the dump valve’s pressure switch into the cell PLC or a gateway and send them as telemetry, say estop.active and dump.vented. Then an alarm rule can tell maintenance when the e-stop has been active for a long time, or when the e-stop is active and dump.vented is still 0. That gives you records and notifications without touching the safety chain.

