wilsonmaker
@wilson-m · Se unió el julio 2025
Maker · home automation · Nottingham · new to IoT
- Temas
- 14
- Respuestas
- 71
- Puntos
- 0
Respuestas de foro creadas
Traducido del English por IA ·
¡Ja, tuve exactamente esto con mi sensor del invernadero en enero pasado, así que por una vez puedo responder!El Arduino guarda int en complemento a dos. -0,5 °C por 100 da -50, y -50 en 16 bits es 0xFFCE. El bit más significativo es el signo. Leído como sin signo son 65486, por 0,01 da su 654,86. Leído como con signo es -50, por 0,01 da -0,5. Los mismos bytes; el codec solo tiene que saber que son con signo.Así que en su codec cambie el formato de u16be a i16be y mantenga la escala. Añada un vector de prueba para un valor negativo para que no vuelva a colarse:
{ "at": 0, "field": "temperature", "fmt": "i16be", "scale": 0.01, "unit": "°C" }
"tests": [
{ "name": "positive", "fport": 1, "hex": "0960", "expect": { "temperature": 24.0 } },
{ "name": "below zero", "fport": 1, "hex": "FFCE", "expect": { "temperature": -0.5 } }
]
En el lado del Arduino, use int16_t en lugar de int, para que siga ocupando 2 bytes si pasa a una placa de 32 bits. Luego pulse Check y Publish. El nombre de la clave y la unidad no cambian, así que puede publicarse como una nueva revisión del mismo codec. Referencia: Write your own codec
Ha, I had exactly this with my greenhouse sensor last January, so I can answer for once!
The Arduino stores int as two’s complement. -0.5 °C times 100 is -50, and -50 in 16 bits is 0xFFCE. The top bit is the sign. Read as unsigned that’s 65486, times 0.01 gives your 654.86. Read as signed it’s -50, times 0.01 gives -0.5. Same bytes, the codec just has to know they’re signed.
So in your codec change the format from u16be to i16be, keep the scale. Add a test vector for a negative value so it never sneaks back:
{ "at": 0, "field": "temperature", "fmt": "i16be", "scale": 0.01, "unit": "°C" }
"tests": [
{ "name": "positive", "fport": 1, "hex": "0960", "expect": { "temperature": 24.0 } },
{ "name": "below zero", "fport": 1, "hex": "FFCE", "expect": { "temperature": -0.5 } }
]
On the Arduino side use int16_t instead of int, so it stays 2 bytes if you move to a 32-bit board. Then Check and Publish. The key name and unit stay the same, so it can go out as a new revision of the same codec. Reference: Write your own codec
Traducido del English por IA ·
El Sonoff Basic lleva un ESP8266 dentro. Puedes grabarle tu propio sketch a través del conector de 4 pines con un adaptador USB-serie (3.3 V, ¡no 5 V!). Después, es solo otro dispositivo Hermetry.
The Sonoff Basic has an ESP8266 inside. You can flash your own sketch on it through the 4-pin header with a USB-serial adapter (3.3 V, not 5 V!). Then it’s just another Hermetry device.
Traducido del English por IA ·
¿Qué es una pasarela de un solo canal frente a una normal? ¿Es solo más barata?
What’s a single channel gateway vs a normal one? Is it just cheaper?
Traducido del English por IA ·
Hoy hice de 1 a 4. Wi-Fi/BT/HDMI desactivados, GPS apagado entre fijaciones, 30 s en movimiento, 30 min aparcado, envío cada 5 min. El medidor marca ahora unos 95 mA de media. Debería durar unos cuatro días. También tuve que cambiar el perfil a Recent message, porque se ponía en offline cada noche, cosa que pensé que era un error. TPL5110 pedido para la próxima versión.
Did 1 to 4 today. Wi-Fi/BT/HDMI off, GPS off between fixes, 30 s when moving, 30 min when parked, sending every 5 min. Meter now reads about 95 mA average. Should be roughly four days. Also had to switch the profile to Recent message, it was flipping to offline every night, which I thought was a bug. TPL5110 ordered for the next version.
Traducido del English por IA ·
Sí, los dos están encendidos. El script es un bucle con time.sleep(30), nada rebuscado.
Yes, both on. The script is a loop with time.sleep(30), nothing clever.
Traducido del English por IA ·
Primero hice la modificación del SG90 por terquedad: gira, y en mi caso el valor de parada fue 1,47 ms. Apenas podía levantar la persiana, así que cambié al 28BYJ-48 como dijo Laura, con un microinterruptor arriba para el homing. El slider funciona, Current value sigue a blind_pct. El SG90 ahora hace girar un molinillo de papel en mi escritorio.
Did the SG90 mod first because I’m stubborn: it spins, stop value was 1.47 ms on mine. It could barely lift the blind though, so I switched to the 28BYJ-48 like Laura said, with a microswitch at the top for homing. Slider works, Current value follows blind_pct. The SG90 now spins a paper windmill on my desk.
Traducido del English por IA ·
¡Serial.write + flush y el medidor respondió a la primera! 9 bytes, 233.1 V. No tenía ni idea de que print lo convertía en texto. Ahora voy a escribir la potencia (registro 0x000C) y luego paso al ESP32.
Serial.write + flush and the meter answered first time! 9 bytes, 233.1 V. I had no idea print turned it into text. Writing power (register 0x000C) next, then it goes over to the ESP32.
Traducido del English por IA ·
Revisé el menú del medidor, 2400 8N1 y mi Serial.begin(2400, SERIAL_8N1). Así que no es eso.
Checked the meter menu, 2400 8N1 and my Serial.begin(2400, SERIAL_8N1). So that’s not it.
Traducido del English por IA ·
Ja, entonces lo que estaba dormido era el Wi-Fi, no la Pi. Voy a revisar la mía ahora.
Ha, so the Wi-Fi was asleep, not the Pi. Checking mine now.
Traducido del English por IA ·
Creo que hay una opción de apagado de pantalla en raspi-config, ¿quizás es eso lo que lo pone en suspensión? En el mío el HDMI se apaga a los 10 min.
I think there’s a screen blanking option in raspi-config, maybe that’s putting it to sleep? Mine turns the HDMI off after 10 min.
Traducido del English por IA ·
siguiendo esto, quiero esto también para mi cosa del interfono jaja
following, I want this for my intercom thing too lol

