El botón Reject de una estación de reprocesado no detecta pulsaciones rápidas. Además, ¿puede Forge contar estas por nosotros?
Traducido del English por IA ·
Tenemos una estación de reprocesado al final de una línea de paneles de puerta. Cuando un operario rechaza un panel, pulsa un botón grande tipo seta, y un ESP8266 (Wemos D1 mini) cuenta las pulsaciones y envía el recuento a Hermetry cada minuto. Lo graficamos por hora.Problema: cuando llegan dos o tres paneles seguidos, los operarios pulsan el botón rápidamente y el recuento sale bajo. Un conteo manual de un turno dio 47 rechazos, Hermetry recibió 39. El ESP lee el botón con digitalRead() en loop(), pero loop() también gestiona el WiFi, la publicación y un retardo de 50 ms para el antirrebote.Segunda pregunta: vi que mencionan Hermetry Forge para fabricación. ¿Podríamos usarlo para contar rechazos en lugar de desarrollar nuestra propia solución?
We have a rework station at the end of a door panel line. When an operator rejects a panel they press a big mushroom button, and an ESP8266 (Wemos D1 mini) counts the presses and sends the count to Hermetry every minute. We chart it per hour.
Problem: when two or three panels come in quick succession, operators tap the button fast and the count comes out low. Tallying by hand for one shift gave 47 rejects, Hermetry got 39. The ESP reads the button with digitalRead() in loop(), and loop() also does WiFi, the publish and a 50 ms delay for debounce.
Second question: I saw Hermetry Forge mentioned for manufacturing. Is that something we could use for reject counting instead of rolling our own?
Traducido del English por IA ·
¿Ayudaría poner un condensador en paralelo con el botón? Eso es lo que hice en un proyecto de timbre.
Would a capacitor across the button help? That’s what I did for a doorbell project.
Traducido del English por IA ·
Cap ayuda con el rebote, no con las pulsaciones perdidas. Si loop() está ocupado en otra parte durante 200 ms, un toque de 100 ms se pierde de todos modos.
Cap helps with bounce, not with missed presses. If loop() is busy elsewhere for 200 ms, a 100 ms tap is gone either way.
Traducido del English por IA ·
Owen tiene razón. La pulsación es más corta que tu bucle, así que el sondeo (polling) la pierde. Usa una interrupción para que el conteo se haga en el momento en que el pin baja, y haz el antirrebote por tiempo dentro de ella. Llevo años haciendo contadores de pulsos en medidores de gas de esta forma:
volatile uint32_t rejects = 0; // since boot
volatile uint32_t lastEdgeUs = 0;
void IRAM_ATTR onPress() {
uint32_t now = micros();
if (now - lastEdgeUs > 30000) { // ignore bounce within 30 ms
rejects++;
}
lastEdgeUs = now;
}
void setup() {
pinMode(D5, INPUT_PULLUP); // button to GND
attachInterrupt(digitalPinToInterrupt(D5), onPress, FALLING);
}
Quita el delay(50) de loop(). En la publicación, copia el contador con las interrupciones desactivadas brevemente.Hardware: en una planta industrial, el cable del botón suele medir varios metros y va junto a los cables de los motores. Añade una resistencia en serie de 1 kΩ y 100 nF en el pin del ESP o, mejor aún, alimenta el botón a 24 V y conéctalo a un optoacoplador. Si no, empezarás a contar rechazos fantasma.Envía un contador acumulativo, no «rechazos de este minuto»: {"rejects.total": 1532}. Si se pierde un mensaje, el siguiente sigue teniendo el total correcto, y un gráfico con la agregación increase te da los rechazos por hora.
Owen has it. The press is shorter than your loop, so polling misses it. Use an interrupt so the count happens the moment the pin falls, and do the debounce by time inside it. I’ve had pulse counters on gas meters for years done like this:
volatile uint32_t rejects = 0; // since boot
volatile uint32_t lastEdgeUs = 0;
void IRAM_ATTR onPress() {
uint32_t now = micros();
if (now - lastEdgeUs > 30000) { // ignore bounce within 30 ms
rejects++;
}
lastEdgeUs = now;
}
void setup() {
pinMode(D5, INPUT_PULLUP); // button to GND
attachInterrupt(digitalPinToInterrupt(D5), onPress, FALLING);
}
Remove the delay(50) from loop(). In the publish, copy the counter with interrupts briefly off.
Hardware: on a factory floor the button cable is often metres long next to motor cables. Add a 1 kΩ series resistor and 100 nF at the ESP pin, or better, run the button at 24 V into an optocoupler. Otherwise you’ll start counting phantom rejects.
Send a cumulative counter, not «rejects this minute»: {"rejects.total": 1532}. If a message is lost, the next one still has the right total, and a chart with the increase aggregate gives you rejects per hour.
Traducido del English por IA ·
¿Qué pasa con el contador acumulado cuando el ESP se reinicia? Vuelve a empezar desde 0.
What happens to the cumulative count when the ESP reboots? It starts at 0 again.
Traducido del English por IA ·
Correcto. Consérvalo en la memoria RTC entre reinicios, o envía también un contador de arranques y deja que el gráfico muestre la caída. Lo más sencillo es la memoria RTC.
Right. Keep it in RTC memory across resets, or send a boot counter as well and let the chart handle the drop. Simplest is RTC memory.
Traducido del English por IA ·
Sobre Forge: no hay una página de documentación para ello, así que no puedo decirte si cuenta los rechazos ni cómo activarlo. Lo que describe Lewis es lo que hacemos en nuestras líneas de empaquetado: contadores como telemetría y un gráfico de barras por hora con la agregación increase. Los supervisores lo revisan en el cambio de turno.
On Forge: there’s no doc page for it, so I can’t tell you whether it counts rejects or how you’d switch it on. What Lewis describes is what we do on our packing lines: counters as telemetry and a bar chart per hour with the increase aggregate. The supervisors look at it at shift change.
Traducido del English por IA ·
La versión por interrupción está en la estación desde el lunes. Recuento manual 52, Hermetry 52 en el turno del martes. También estaba publicando «rechazos de este minuto» y reiniciándolo a cero, así que dos mensajes perdidos la semana pasada se comieron rechazos en silencio; ahora es rejects.total, con el contador en la memoria RTC. Gracias por la nota de Forge, Keisha. Nuestro jefe me había pedido que «revisara Forge»; se lo comentaré a nuestro contacto comercial, pero el contador cumple su función hoy de todos modos.
Interrupt version is on the station since Monday. Hand tally 52, Hermetry 52 on Tuesday’s shift. I’d also been publishing «rejects this minute» and resetting to zero, so two lost messages last week had silently eaten rejects; it’s rejects.total now with the counter in RTC memory. Thanks for the Forge note Keisha. Our manager had asked me to «check Forge», I’ll pass that to our account contact, but the counter does the job today either way.
- Debes estar registrado para responder a este debate.
Únete a la conversación
Inicia sesión para preguntar y responder, dar me gusta a las publicaciones útiles y marcar la respuesta que resolvió tu problema. Cada aportación suma puntos y niveles.

