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
Tyler, please don’t, eight 120 ohm resistors in parallel load the line to 15 ohm and nothing will talk.
Owen: at 9600 baud a bit lasts about 104 µs. On 30 m of cable a reflection goes up and back in well under a microsecond, so it has died out long before the receiver samples. Termination is about long cables and high baud rates, and you are nowhere near that. That’s David’s answer too.
What you’re missing is biasing. Between frames nobody drives the line, and an unbiased line floats near 0 V differential, so noise looks like start bits. That gives exactly the random, different-meter-each-time errors you see. Many cheap USB dongles have no bias resistors. Put them at the master end: about 680 ohm from A (+) to 5 V and 680 ohm from B (-) to GND. If you later add 120 ohm termination at both ends, bias is no longer optional at all.
Also, in this order:
- Use twisted pair, and run a third wire as signal ground/common. Speaker cable has neither the twist nor the impedance.
- Daisy-chain, no star. Short stubs at each meter.
- In pymodbus, a response timeout of 1 s and one retry, and a short pause between meters.
On the Hermetry side, if a poll fails, send nothing for that meter in that round instead of a 0 or the old value. Then the chart has a small gap rather than a fake reading.
And whoever uses the board needs the permission to run widget commands, or the Switch just says no. Caught a colleague out at work.
Traduit de English par IA ·
Ça a du sens. Alors ce sera les passkeys.
Makes sense. Passkeys it is then.
Traduit de English par IA ·
Notre propriétaire a activé « Exiger la vérification en deux étapes pour chaque membre » le mois dernier. Le lien par e-mail permet-il de contourner cela, ou les utilisateurs ont-ils toujours besoin du second facteur après avoir cliqué dessus ?
Our owner switched on « Require two-step verification for every member » last month. Does the e-mail link get people around that, or do they still need the second factor after clicking it?
Traduit de English par IA ·
D’abord le matériel. Utilisez un optocoupleur : pont redresseur (ou un PC817 avec une diode inverse aux bornes de la LED), résistance série de 1 kΩ, 10 µF en sortie pour que l’ondulation alternative n’apparaisse pas comme 50 impulsions par seconde. Côté transistor vers D5 avec INPUT_PULLUP, de sorte que la broche passe à LOW pendant la sonnerie. Antirebond dans le code, envoyer ring: 1 sur le front descendant, et ring: 0 lorsque c’est calme depuis 2 s.Ensuite, je passerais la règle d’alarme. Une alarme a un cycle de vie (ouverte, acquittée, effacée) et les alarmes s’accumuleraient pour chaque coursier. Une règle de la carte Rules convient mieux :
When: A value changes, device "intercom-d1", value "ring", becomes 1
Then: Tell people [x] Members
Message: "Someone is at the street door"
Les membres la reçoivent dans la cloche, par notification push là où ils l’ont activée (l’application, ou un navigateur avec les notifications push activées), et dans chaque application de messagerie qu’ils ont liée sous Mon profil > Applications de messagerie. Donc, une fois que votre administrateur a connecté la plateforme, chaque personne lie son propre compte et cela vous fait une notification sur votre téléphone, avec ou sans l’application. Les destinataires d’une règle de la carte Rules ne reçoivent jamais d’e-mail ni de SMS ; pour les SMS, il vous faudrait un flux avec un bloc Notify et des numéros de téléphone.Un point à savoir : la même notification adressée à la même personne est retenue pendant un délai de 10 minutes. C’est acceptable pour une sonnette, mais si deux coursiers arrivent dans un intervalle de 10 minutes, le second n’apparaît que sous forme de « (+1) » sur la notification suivante. Détails : Notifications from rules and flows.
Hardware first. Use an optocoupler: bridge rectifier (or a PC817 with a reverse diode across the LED), 1 kΩ series resistor, 10 µF across the output so the AC ripple doesn’t show up as 50 pulses a second. Transistor side to D5 with INPUT_PULLUP, so the pin goes LOW while it rings. Debounce in code, send ring: 1 on the falling edge, and ring: 0 when it’s quiet again for 2 s.
Then I’d skip the alarm rule. An alarm has a lifecycle (open, acknowledge, clear) and you’d have alarms piling up for every courier. A Rules card rule fits better:
When: A value changes, device "intercom-d1", value "ring", becomes 1
Then: Tell people [x] Members
Message: "Someone is at the street door"
Members get it in the bell, by push where they’ve set it up (the app, or a browser with push on), and in every chat app they linked under My Profile > Chat apps. So once your admin connects the platform each person links their own account and that’s your phone ping, app or not. Rules card recipients never get e-mail or SMS, for SMS you’d need a flow with a Notify block and phone numbers.
One thing to know: the same notice to the same person is held back for a 10-minute cooldown. Fine for a doorbell mostly, but if two couriers come within 10 minutes the second one only shows up as « (+1) » on the next one. Details: Notifications from rules and flows.
Traduit de English par IA ·
Clic sur une ligne d’un tableau, Définir les paramètres du tableau avec la ligne cliquée, et le graphique à côté suit la ligne. Cinq minutes. Bien.
Row click on a table, Set board parameters with the clicked row, and the chart beside it follows the row. Five minutes. Good.
Traduit de English par IA ·
Un groupe peut-il retirer une autorisation ? Nous avons des Utilisateurs qui doivent voir les appareils et les alarmes, mais ne jamais acquitter quoi que ce soit.
Can a group take a permission away? We have Users who should see devices and alarms but never acknowledge anything.
Add a revision block too, the second version always comes.
Traduit de English par IA ·
Gardez un utilisateur factice dans chaque organisation pour ce contrôle, vous en aurez à nouveau besoin après les changements de rôles.
Keep a dummy User in each org for that check, you’ll want it again after role changes.
Traduit de English par IA ·
Concernant le firmware : Hermetry ne signe jamais le firmware, vous signez les images dans votre propre build et n’enregistrez que la clé publique. Faites cela, et activez le secure boot ainsi que le chiffrement flash sur le S3, cela couvre le côté box.
On firmware: Hermetry never signs firmware, you sign images in your own build and register only the public key. Do that, and turn on secure boot plus flash encryption on the S3, that covers the box side.
Traduit de English par IA ·
Trouvé. J’ai modifié les identifiants des pompes dans Avancé pour qu’ils correspondent à nos clés, et 9 symboles sur 11 se sont connectés tout seuls. Les deux autres sont des vannes qui renvoient 1 lorsqu’elles sont fermées ; je les ai inversées avec une expression.
Found it. Changed the pump ids under Advanced so they match our keys and 9 of 11 symbols connected on their own. The other two are valves that report closed as 1, I inverted those with an expression.
Traduit de English par IA ·
J’ai dessiné une petite station de surpression ce matin. Le placement des symboles et des tuyaux a été rapide. Ce qui m’a déstabilisé : il n’existe nulle part dans le designer un champ permettant d’indiquer quelle valeur d’appareil une pompe affiche. Est-ce que je ne vois pas quelque chose ?
Drew a small booster station this morning. Placing symbols and pipes went fast. What threw me: there is no field anywhere in the designer to say which device value a pump shows. Am I blind?
Traduit de English par IA ·
Brian a raison, et il te manque aussi le préfixe de l’organisation. J’ai monté à peu près la même chose pour une chambre froide l’an dernier.1. API Keys (Developer menu) > New API Key. Sous Module permissions, donne uniquement un accès en lecture seule à la télémétrie, rien d’autre. Définis une liste d’adresses IP autorisées sur celle du bureau et note la date d’expiration : par défaut 90 jours, un an au maximum. Mets un rappel dans l’agenda, la nôtre a expiré un samedi.2. Tous les chemins de gestion se trouvent sous le tenant :
GET https://<host>/tenant/<tenantId>/api/telemetry/latest?kind=iot_device&entityId=<deviceId>&keys=level_pct
Authorization: Bearer sk_live_...
La réponse ressemble à {« latest »: {« level_pct »: {« ts »: …, « value »: 91.2}}}. Compare le ts avec le précédent pour ne pas faire biper deux fois sur la même mesure.3. Gère le 429 et attends le nombre de secondes indiqué par Retry-After. Interroge toutes les 30 s environ, le réservoir ne se remplit pas en 5 s.L’autre solution, si tu veux un résultat instantané : fais du Pi un device à part entière, crée une règle sur le réservoir qui lui envoie une commande lorsque level_pct dépasse 90, et laisse le Pi attendre sur GET /api/v1/rpc avec son propre token de device. Plus de pièces mobiles, pas de polling. Pour un buzzer, je prendrais la clé API. Les conventions sont décrites dans REST API basics.
Brian’s right, and you’re also missing the organisation prefix. I set up nearly the same thing for a chiller room last year.
1. API Keys (Developer menu) > New API Key. Under Module permissions give it read-only telemetry, nothing else. Set an IP allowlist to the office’s address, and note the expiry, default is 90 days, a year at most. Put a reminder in the calendar, ours expired on a Saturday.
2. Every management path sits under the tenant:
GET https://<host>/tenant/<tenantId>/api/telemetry/latest?kind=iot_device&entityId=<deviceId>&keys=level_pct
Authorization: Bearer sk_live_...
Answer looks like {« latest »: {« level_pct »: {« ts »: …, « value »: 91.2}}}. Compare the ts with the previous one so you don’t buzz twice on the same reading.
3. Handle 429 and wait the Retry-After seconds. Poll every 30 s or so, the tank doesn’t fill in 5.
The other route, if you want it instant: make the Pi a device itself, have a rule on the tank send it a command when level_pct rises above 90, and let the Pi wait on GET /api/v1/rpc with its own device token. More moving parts, no polling. For a buzzer I’d take the API key. Conventions are on REST API basics.
Traduit de English par IA ·
Testez d’abord le SPI seul, en boucle (loopback), sans puce. Retirez le MCP3008, reliez MOSI (GPIO10, broche 19) à MISO (GPIO9, broche 21) avec un cavalier, puis lancez :
wget https://raw.githubusercontent.com/raspberrypi/linux/rpi-6.6.y/tools/spi/spidev_test.c
gcc -o spidev_test spidev_test.c
./spidev_test -D /dev/spidev0.0 -v -p "HELLO"
Si RX affiche les mêmes octets que TX, la partie Pi fonctionne. Si RX ne contient que des 00 ou des FF, le SPI ne tourne pas vraiment.Mon intuition porte cependant sur votre code : spi.open(0, 1) utilise la sélection de puce CE1, soit GPIO7 sur la broche 26. La plupart des tutoriels MCP3008 câblent CS sur CE0, soit GPIO8 sur la broche 24. Si votre CS va à la broche 24, la puce n’est jamais sélectionnée, sa sortie flotte, et vous obtenez 0 avec de temps en temps 1023 quand vous la touchez. Déplacez le fil sur la broche 26 ou remplacez le code par spi.open(0, 0). J’ai fait exactement cette confusion sur un banc de test au travail.Le fait que le canal 1 donne la même valeur est révélateur : une puce non sélectionnée renvoie les mêmes données parasites sur chaque canal.
Test SPI on its own first with a loopback, no chip. Pull the MCP3008 out, put a jumper from MOSI (GPIO10, pin 19) to MISO (GPIO9, pin 21) and run:
wget https://raw.githubusercontent.com/raspberrypi/linux/rpi-6.6.y/tools/spi/spidev_test.c
gcc -o spidev_test spidev_test.c
./spidev_test -D /dev/spidev0.0 -v -p "HELLO"
If RX shows the same bytes as TX, the Pi side is fine. If RX is all 00 or FF, SPI isn’t really running.
My bet though is in your code: spi.open(0, 1) uses chip select CE1, which is GPIO7 on pin 26. Most MCP3008 tutorials wire CS to CE0, GPIO8 on pin 24. If your CS goes to pin 24, the chip is never selected, its output floats, and you get 0 with the odd 1023 when you touch it. Either move the wire to pin 26 or change the code to spi.open(0, 0). I’ve done this exact mixup on a bench at work.
Your channel 1 reading the same is the giveaway: an unselected chip gives the same junk on every channel.
BLE positioning gets you 2-3 m on a good day. For half a metre you’re looking at UWB.

