You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
249 lines
4.8 KiB
Markdown
249 lines
4.8 KiB
Markdown
# Diagnostico De Problemas
|
|
|
|
Guia practica para resolver fallas comunes en Raspberry Pi, sensores EZO y
|
|
dashboard.
|
|
|
|
## Ver Estado General
|
|
|
|
```bash
|
|
systemctl status photobioreactor-api --no-pager
|
|
systemctl status photobioreactor-acquisition --no-pager
|
|
systemctl status nginx --no-pager
|
|
```
|
|
|
|
Logs recientes:
|
|
|
|
```bash
|
|
journalctl -u photobioreactor-api --since "10 minutes ago" -l --no-pager
|
|
journalctl -u photobioreactor-acquisition --since "10 minutes ago" -l --no-pager
|
|
```
|
|
|
|
## El Dashboard No Abre
|
|
|
|
1. Confirme IP de la Raspberry:
|
|
|
|
```bash
|
|
hostname -I
|
|
```
|
|
|
|
2. Confirme Nginx:
|
|
|
|
```bash
|
|
systemctl status nginx --no-pager
|
|
```
|
|
|
|
3. Pruebe localmente:
|
|
|
|
```bash
|
|
curl http://127.0.0.1/frontend/index.html
|
|
curl http://127.0.0.1/api/system/ezo
|
|
```
|
|
|
|
4. Desde otra computadora abra:
|
|
|
|
```text
|
|
http://IP_DE_LA_RASPBERRY/frontend/index.html
|
|
```
|
|
|
|
## No Aparece Un Sensor En `i2cdetect`
|
|
|
|
Detenga adquisicion:
|
|
|
|
```bash
|
|
sudo systemctl stop photobioreactor-acquisition
|
|
sudo rm -f /tmp/photobioreactor-i2c.lock
|
|
```
|
|
|
|
Revise bus:
|
|
|
|
```bash
|
|
i2cdetect -y 1
|
|
```
|
|
|
|
Direcciones esperadas:
|
|
|
|
| Sensor | Direccion |
|
|
|---|---:|
|
|
| DO | `0x61` |
|
|
| pH | `0x63` |
|
|
| EC | `0x64` |
|
|
| RTD | `0x66` |
|
|
|
|
Si no aparece:
|
|
|
|
- Confirme alimentacion.
|
|
- Confirme GND comun si no hay aislamiento galvanico.
|
|
- Confirme SDA y SCL.
|
|
- Confirme que el circuito EZO esta en modo I2C.
|
|
- Revise que no haya una direccion cambiada.
|
|
|
|
## Identificar Que Sensor Hay En Una Direccion
|
|
|
|
```bash
|
|
/opt/photobioreactor/sensors/EZOCommand/EZO_COMMAND /dev/i2c-1 0x63 300 i
|
|
/opt/photobioreactor/sensors/EZOCommand/EZO_COMMAND /dev/i2c-1 0x63 300 Status
|
|
/opt/photobioreactor/sensors/EZOCommand/EZO_COMMAND /dev/i2c-1 0x63 1000 R
|
|
/opt/photobioreactor/sensors/EZOCommand/EZO_COMMAND /dev/i2c-1 0x63 300 Cal,?
|
|
```
|
|
|
|
Cambie `0x63` por la direccion que quiera probar.
|
|
|
|
Ejemplos de identificacion:
|
|
|
|
```text
|
|
?I,pH,2.17
|
|
?I,EC,2.14
|
|
?I,RTD,2.12
|
|
?I,DO,2.XX
|
|
?I,ORP,2.14
|
|
```
|
|
|
|
Si aparece `?I,ORP,...`, ese modulo no es DO.
|
|
|
|
## Error: No Se Pudo Bloquear El Bus I2C
|
|
|
|
Significa que el helper no pudo tomar:
|
|
|
|
```text
|
|
/tmp/photobioreactor-i2c.lock
|
|
```
|
|
|
|
Solucion rapida:
|
|
|
|
```bash
|
|
sudo systemctl stop photobioreactor-acquisition
|
|
sudo rm -f /tmp/photobioreactor-i2c.lock
|
|
sudo systemctl start photobioreactor-acquisition
|
|
```
|
|
|
|
Si sigue fallando:
|
|
|
|
```bash
|
|
ls -ld /tmp
|
|
id photobioreactor
|
|
ls -l /dev/i2c-1
|
|
groups photobioreactor
|
|
ps -eo pid,user,stat,cmd | grep -E "EZO_ACQUIRE|EZO_COMMAND|acquisition.js" | grep -v grep
|
|
```
|
|
|
|
Prueba directa como usuario de servicio:
|
|
|
|
```bash
|
|
sudo -u photobioreactor /opt/photobioreactor/sensors/EZOCommand/EZO_ACQUIRE /dev/i2c-1 temperature ph ec
|
|
```
|
|
|
|
Si esta prueba responde JSON, el bus y permisos estan bien.
|
|
|
|
## Error: EZO_COMMAND No Existe
|
|
|
|
Si esta en `~` o en otra carpeta, esta ruta puede fallar:
|
|
|
|
```bash
|
|
./sensors/EZOCommand/EZO_COMMAND
|
|
```
|
|
|
|
Use la ruta instalada:
|
|
|
|
```bash
|
|
/opt/photobioreactor/sensors/EZOCommand/EZO_COMMAND
|
|
```
|
|
|
|
O compile desde el repositorio:
|
|
|
|
```bash
|
|
make -C sensors/EZOCommand
|
|
```
|
|
|
|
## El Servicio Dice 1/1, 2/2 O 3/3 Sensores
|
|
|
|
Eso significa que solo estan habilitados esos sensores en:
|
|
|
|
```text
|
|
/opt/photobioreactor/config/runtime.json
|
|
```
|
|
|
|
Ejemplo con tres sensores:
|
|
|
|
```json
|
|
{
|
|
"loggingRateSeconds": 5,
|
|
"historyRetentionDays": 30,
|
|
"enabledSensors": [
|
|
"temperature",
|
|
"ph",
|
|
"ec"
|
|
]
|
|
}
|
|
```
|
|
|
|
Despues de editar:
|
|
|
|
```bash
|
|
sudo systemctl restart photobioreactor-acquisition
|
|
```
|
|
|
|
## SSH Se Vuelve Inestable
|
|
|
|
Posibles causas:
|
|
|
|
- Alimentacion insuficiente.
|
|
- Bus I2C bloqueado.
|
|
- Sensor mal cableado.
|
|
- Frecuencia de adquisicion muy agresiva durante pruebas.
|
|
- Raspberry reiniciandose.
|
|
|
|
Revise:
|
|
|
|
```bash
|
|
dmesg | tail -n 80
|
|
journalctl -u photobioreactor-acquisition --since "30 minutes ago" -p warning --no-pager
|
|
vcgencmd get_throttled
|
|
```
|
|
|
|
Si `vcgencmd get_throttled` no devuelve `throttled=0x0`, hay indicios de
|
|
problemas de alimentacion o temperatura.
|
|
|
|
## Excel Pesa Mucho
|
|
|
|
Las graficas muestran solo el dia actual, pero Excel exporta el historico
|
|
disponible en CSV.
|
|
|
|
Con 4 sensores a 1 lectura por segundo:
|
|
|
|
```text
|
|
86,400 filas por sensor por dia
|
|
345,600 filas totales por dia
|
|
1,036,800 celdas en Excel si son 3 columnas
|
|
```
|
|
|
|
Por eso un Excel diario puede pesar decenas de MB. El CSV es mas eficiente.
|
|
|
|
## Prueba De Estabilidad
|
|
|
|
Para dejarlo corriendo:
|
|
|
|
```bash
|
|
sudo systemctl stop photobioreactor-acquisition
|
|
sudo rm -f /tmp/photobioreactor-i2c.lock
|
|
sudo systemctl start photobioreactor-acquisition
|
|
```
|
|
|
|
Revisar errores:
|
|
|
|
```bash
|
|
journalctl -u photobioreactor-acquisition --since "1 hour ago" -p warning --no-pager
|
|
journalctl -u photobioreactor-api --since "1 hour ago" -p warning --no-pager
|
|
```
|
|
|
|
Revisar crecimiento de CSV:
|
|
|
|
```bash
|
|
wc -l /opt/photobioreactor/logs/temperature.csv
|
|
wc -l /opt/photobioreactor/logs/ph.csv
|
|
wc -l /opt/photobioreactor/logs/ec.csv
|
|
wc -l /opt/photobioreactor/logs/do.csv
|
|
```
|
|
|
|
Con `loggingRateSeconds` en `5`, cada sensor debe sumar aproximadamente 720
|
|
filas por hora.
|