Boa noite, acho difícil, alguém com pouca experiência conseguir fazer tudo isso funcionar de uma vez.
Mas com o andar das etapas sim. O projetista cresce com o projeto, entende?
Eu faria algo simples mas que atendesse logo de cara a primeira parte do projeto, que é marcar o tempo de parada, certo?. Só deixando bem claro que isso já é bem explorado na indústria: é o ANDON do sistema Toyota de produção.
Veja bem, não vai ser possível alta precisão porque vc terá pessoas “apertando” e “desapertando” o botão certo? As pessoas se distraem facilmente.
Então vamos lá:
Pega um Arduino e faz um Logger.
Basta ligar o Arduino e ele fica contando os segundos e gravando na EEPROM.
Ai vc pega um Push Button com Trava e liga ele em série com o positivo da fonte e o Arduino.
Ligou o Push Button ligou o Arduino (adiciona segundos ao tempo total);
Desligou o Push Button desligou o Arduino (a contagem pára);
Simples assim cara.
Para vc saber o total basta espetar o Arduino na USB com o Serial Monitor da IDE aberto, vai imprimir o resultado na tela exatamente assim:
Iniciando o Data Logger
Data Logger OK
Lendo EEPROM
address: 0 | value: 0
address: 1 | value: 255
address: 2 | value: 255
address: 3 | value: 255
address: 4 | value: 255
address: 5 | value: 255
address: 6 | value: 255
address: 7 | value: 255
address: 8 | value: 255
address: 9 | value: 142
address: 10 | value: 0
address: 11 | value: 0
address: 12 | value: 0
address: 13 | value: 0
address: 14 | value: 0
address: 15 | value: 0
address: 16 | value: 0
address: 17 | value: 0
address: 18 | value: 0
address: 19 | value: 0
address: 20 | value: 0
address: 21 | value: 0
address: 22 | value: 0
address: 23 | value: 0
address: 24 | value: 0
address: 25 | value: 0
address: 26 | value: 0
address: 27 | value: 0
address: 28 | value: 0
address: 29 | value: 0
address: 30 | value: 0
address: 31 | value: 0
address: 32 | value: 0
address: 33 | value: 0
address: 34 | value: 0
address: 35 | value: 0
address: 36 | value: 0
address: 37 | value: 0
address: 38 | value: 0
address: 39 | value: 0
address: 40 | value: 0
address: 41 | value: 0
address: 42 | value: 0
address: 43 | value: 0
address: 44 | value: 0
address: 45 | value: 0
address: 46 | value: 0
address: 47 | value: 0
address: 48 | value: 0
address: 49 | value: 0
address: 50 | value: 0
address: 51 | value: 0
address: 52 | value: 0
address: 53 | value: 0
address: 54 | value: 0
address: 55 | value: 0
address: 56 | value: 0
address: 57 | value: 0
address: 58 | value: 0
address: 59 | value: 0
address: 60 | value: 0
address: 61 | value: 0
address: 62 | value: 0
address: 63 | value: 0
address: 64 | value: 0
address: 65 | value: 0
address: 66 | value: 0
address: 67 | value: 0
address: 68 | value: 0
address: 69 | value: 0
address: 70 | value: 0
address: 71 | value: 0
address: 72 | value: 0
address: 73 | value: 0
address: 74 | value: 0
address: 75 | value: 0
address: 76 | value: 0
address: 77 | value: 0
address: 78 | value: 0
address: 79 | value: 0
address: 80 | value: 0
address: 81 | value: 0
address: 82 | value: 0
address: 83 | value: 0
address: 84 | value: 0
address: 85 | value: 0
address: 86 | value: 0
address: 87 | value: 0
address: 88 | value: 0
address: 89 | value: 0
address: 90 | value: 0
address: 91 | value: 0
address: 92 | value: 0
address: 93 | value: 0
address: 94 | value: 0
address: 95 | value: 0
address: 96 | value: 0
address: 97 | value: 0
address: 98 | value: 0
address: 99 | value: 0
address: 100 | value: 0
address: 101 | value: 0
address: 102 | value: 0
address: 103 | value: 0
address: 104 | value: 0
address: 105 | value: 0
address: 106 | value: 0
address: 107 | value: 0
address: 108 | value: 0
address: 109 | value: 0
address: 110 | value: 0
address: 111 | value: 0
address: 112 | value: 0
address: 113 | value: 0
address: 114 | value: 0
address: 115 | value: 0
address: 116 | value: 0
address: 117 | value: 0
address: 118 | value: 0
address: 119 | value: 0
address: 120 | value: 0
address: 121 | value: 0
address: 122 | value: 0
address: 123 | value: 0
address: 124 | value: 0
address: 125 | value: 0
address: 126 | value: 0
address: 127 | value: 0
address: 128 | value: 0
address: 129 | value: 0
address: 130 | value: 0
address: 131 | value: 0
address: 132 | value: 0
address: 133 | value: 0
address: 134 | value: 0
address: 135 | value: 0
address: 136 | value: 0
address: 137 | value: 0
address: 138 | value: 0
address: 139 | value: 0
address: 140 | value: 0
address: 141 | value: 0
address: 142 | value: 0
address: 143 | value: 0
address: 144 | value: 0
address: 145 | value: 0
address: 146 | value: 0
address: 147 | value: 0
address: 148 | value: 0
address: 149 | value: 0
address: 150 | value: 0
address: 151 | value: 0
address: 152 | value: 0
address: 153 | value: 0
address: 154 | value: 0
address: 155 | value: 0
address: 156 | value: 0
address: 157 | value: 0
address: 158 | value: 0
address: 159 | value: 0
address: 160 | value: 0
address: 161 | value: 0
address: 162 | value: 0
address: 163 | value: 0
address: 164 | value: 0
address: 165 | value: 0
address: 166 | value: 0
address: 167 | value: 0
address: 168 | value: 0
address: 169 | value: 0
address: 170 | value: 0
address: 171 | value: 0
address: 172 | value: 0
address: 173 | value: 0
address: 174 | value: 0
address: 175 | value: 0
address: 176 | value: 0
address: 177 | value: 0
address: 178 | value: 0
address: 179 | value: 0
address: 180 | value: 0
address: 181 | value: 0
address: 182 | value: 0
address: 183 | value: 0
address: 184 | value: 0
address: 185 | value: 0
address: 186 | value: 0
address: 187 | value: 0
address: 188 | value: 0
address: 189 | value: 0
address: 190 | value: 0
address: 191 | value: 0
address: 192 | value: 0
address: 193 | value: 0
address: 194 | value: 0
address: 195 | value: 0
address: 196 | value: 0
address: 197 | value: 0
address: 198 | value: 0
address: 199 | value: 0
address: 200 | value: 0
address: 201 | value: 0
address: 202 | value: 0
address: 203 | value: 0
address: 204 | value: 0
address: 205 | value: 0
address: 206 | value: 0
address: 207 | value: 0
address: 208 | value: 0
address: 209 | value: 0
address: 210 | value: 0
address: 211 | value: 0
address: 212 | value: 0
address: 213 | value: 0
address: 214 | value: 0
address: 215 | value: 0
address: 216 | value: 0
address: 217 | value: 0
address: 218 | value: 0
address: 219 | value: 0
address: 220 | value: 0
address: 221 | value: 0
address: 222 | value: 0
address: 223 | value: 0
address: 224 | value: 0
address: 225 | value: 0
address: 226 | value: 0
address: 227 | value: 0
address: 228 | value: 0
address: 229 | value: 0
address: 230 | value: 0
address: 231 | value: 0
address: 232 | value: 0
address: 233 | value: 0
address: 234 | value: 0
address: 235 | value: 0
address: 236 | value: 0
address: 237 | value: 0
address: 238 | value: 0
address: 239 | value: 0
address: 240 | value: 0
address: 241 | value: 0
address: 242 | value: 0
address: 243 | value: 0
address: 244 | value: 0
address: 245 | value: 0
address: 246 | value: 0
address: 247 | value: 0
address: 248 | value: 0
address: 249 | value: 0
address: 250 | value: 0
address: 251 | value: 0
address: 252 | value: 0
address: 253 | value: 0
----> current address: 9
O Data Logger registrou um total de:
21820 segundos.
Feito isso, teste uma semana em alguma das sua máquinas, depois parte para a próxima etapa.
Mas se pretende colocar em rede, já trabalhe com o Arduino certo Wemos é uma boa opção.
A escolha do Arduino depende de onde vc pretende chegar e sua verba.
Eu fiz esse código, mas vc deve melhorar ele.
Pode criar um botão para limpar a EEPROM por exemplo.
Ele grava na EEPROM +1 a cada 10 segundos.
O LED pisca indicando a contagem em segundos.
Eu testei em um MEGA 2560 e funcionou bacaninha.
#include <EEPROM.h>
// vamos usar o endereco 255 para armazenar o
// address em que estamos registrando a contagem
int address = EEPROM.read(255);
// valor a ser gravado no address corrente
int val = EEPROM.read(address);
// faz a contagem parcial
int contador_parcial = 0;
// somatorio dos valores gravados de address 0 ate address 254
int total_em_segundos = 0;
void setup() {
// use somente para limpar a EEPROM do Arduino
// deixe comentado durante o uso
// for (int i = 0 ; i < 255 ; i++) {
// EEPROM.write(i, 0);
// }
//inicia a serial a 115200
Serial.begin(115200);
// resultado sai na serial
Serial.println("Iniciando o Data Logger");
Serial.println("Data Logger OK");
Serial.println("Lendo EEPROM");
// neste ponto e realizado o somatorio
// lendo as posicoes de 0 a 253
for (int i = 0 ; i < (255-1); i++) {
total_em_segundos = total_em_segundos + EEPROM.read(i);
Serial.print("address: ");
Serial.print(i);
Serial.print(" | value: ");
Serial.println(EEPROM.read(i));
delay(60);
}
Serial.print(" current address: ");
Serial.println(EEPROM.read(255));
//
Serial.println("O Data Logger registrou um total de:");
// vezes 10 pq a cada 10 segundos gravamos na eeprom
Serial.print(total_em_segundos * 10);
Serial.println(" segundos.");
// indicador visual. LED piscando = logging
pinMode(LED_BUILTIN, OUTPUT);
pinMode(2, INPUT_PULLUP);
}
void loop() {
// LED blink
digitalWrite(LED_BUILTIN, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
delay(500);
// incremento do contador_parcial
contador_parcial++;
// caso chegue a 10
if(contador_parcial >= 10){
// update a eeprom
update_eprom();
contador_parcial = 0;
}
}
void update_eprom() {
if(val <= 255){
val++;
EEPROM.update(address, val);
} else {
address++;
EEPROM.update(255, address);
val = 0;
}
}
O Data Logger registrou um total de:
1950 segundos.
#include <EEPROM.h>
// vamos usar o ultimo endereco para armazenar o
// address em que estamos registrando a contagem
int address = EEPROM.read(255);
// valor a ser gravado no address corrente
int val = EEPROM.read(address);
// faz a contagem parcial
int contador_parcial = 0;
// somatorio dos valores gravados de address 0 ate address 253
int total_em_segundos = 0;
void setup() {
// use somente para limpar a EEPROM do Arduino
// deixe comentado durante o uso
// for (int i = 0 ; i < 255 ; i++) {
// EEPROM.write(i, 0);
// }
//inicia a serial a 115200
Serial.begin(115200);
// resultado sai na serial
Serial.println("Iniciando o Data Logger");
Serial.println("Data Logger OK");
Serial.println("Lendo EEPROM");
// neste ponto e realizado o somatorio
// lendo as posicoes de 0 a 253
for (int i = 0 ; i < (255-1); i++) {
total_em_segundos = total_em_segundos + EEPROM.read(i);
Serial.print("address: ");
Serial.print(i);
Serial.print(" | value: ");
Serial.println(EEPROM.read(i));
delay(30);
}
Serial.print("----> current address: ");
Serial.println(EEPROM.read(255));
//
Serial.println("O Data Logger registrou um total de:");
// vezes 10 pq a cada 10 segundos gravamos na eeprom
Serial.print(total_em_segundos * 10);
Serial.println(" segundos.");
// indicador visual. LED piscando = logging
pinMode(LED_BUILTIN, OUTPUT);
pinMode(2, INPUT_PULLUP);
}
void loop() {
// LED blink
digitalWrite(LED_BUILTIN, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
delay(500);
// incremento do contador_parcial
contador_parcial++;
// caso chegue a 10
if(contador_parcial >= 10){
// update a eeprom
update_eprom();
contador_parcial = 0;
}
}
void update_eprom() {
if(val < 255){
val++;
EEPROM.update(address, val);
} else {
address++;
EEPROM.update(255, address);
val = 0;
}
}
Espero que vc não perca seu emprego.