Initial commit: ZNET Temperature Sensor ESP32 firmware
- PlatformIO project for Meshnology ESP32 LoRa V3 - DS18B20 dual sensor support for tank verification - OLED display for local temperature visibility - HTTP POST to ZNET Web API - WiFiManager for easy WiFi configuration - Offline buffering when network unavailable Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,153 @@
|
||||
# ZNET Temperature Sensor - ESP32 LoRa Gateway
|
||||
|
||||
## Project Overview
|
||||
|
||||
ESP32-based temperature monitoring system for e-coat paint tanks. Reads DS18B20 waterproof temperature probes immersed in the paint tank and sends data to ZNET Web for real-time monitoring and ML feature collection.
|
||||
|
||||
## Hardware
|
||||
|
||||
| Component | Model | Purpose |
|
||||
|-----------|-------|---------|
|
||||
| MCU | Meshnology ESP32 LoRa V3 | Main controller with WiFi, LoRa, OLED |
|
||||
| Temp Sensor | DS18B20 (x2) | Waterproof stainless steel probes in paint tank |
|
||||
| Display | Built-in 0.96" OLED | Local temperature display for operators |
|
||||
| Radio | Built-in SX1262 | LoRa 915MHz for future remote sensors |
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Build & Upload
|
||||
```bash
|
||||
# Install PlatformIO CLI
|
||||
pip install platformio
|
||||
|
||||
# Build
|
||||
cd ~/Nextcloud/Dev/znet-temp-sensor
|
||||
pio run
|
||||
|
||||
# Upload to ESP32 (connect via USB)
|
||||
pio run --target upload
|
||||
|
||||
# Monitor serial output
|
||||
pio device monitor
|
||||
```
|
||||
|
||||
### Configure WiFi
|
||||
1. Power on the ESP32
|
||||
2. Connect to WiFi network: `ZNET-TempSensor` (password: `znettemp123`)
|
||||
3. Browser opens captive portal - enter your WiFi credentials
|
||||
4. Device connects and starts posting to ZNET Web
|
||||
|
||||
### Configure API Endpoint
|
||||
Edit `include/config.h`:
|
||||
```cpp
|
||||
#define ZNET_API_URL "http://192.168.1.100:8000/api/v1/sensors/readings"
|
||||
```
|
||||
|
||||
## Wiring
|
||||
|
||||
### DS18B20 Connection (1-Wire bus, both sensors on same pin)
|
||||
```
|
||||
ESP32 GPIO7 ─────┬───────────── DS18B20 #1 DATA (yellow)
|
||||
│
|
||||
└───────────── DS18B20 #2 DATA (yellow)
|
||||
|
||||
ESP32 3.3V ──────┬───────────── DS18B20 #1 VCC (red)
|
||||
│
|
||||
└───────────── DS18B20 #2 VCC (red)
|
||||
|
||||
ESP32 GND ───────┬───────────── DS18B20 #1 GND (black)
|
||||
│
|
||||
└───────────── DS18B20 #2 GND (black)
|
||||
|
||||
4.7kΩ pullup resistor between DATA and VCC
|
||||
```
|
||||
|
||||
### GPIO Pinout (Heltec V3 / Meshnology)
|
||||
| Function | GPIO |
|
||||
|----------|------|
|
||||
| OneWire Data | 7 |
|
||||
| OLED SDA | 17 |
|
||||
| OLED SCL | 18 |
|
||||
| OLED RST | 21 |
|
||||
| LoRa SCK | 9 |
|
||||
| LoRa MISO | 11 |
|
||||
| LoRa MOSI | 10 |
|
||||
| LoRa SS | 8 |
|
||||
| LoRa RST | 12 |
|
||||
| LoRa DIO1 | 14 |
|
||||
| LoRa BUSY | 13 |
|
||||
|
||||
## Configuration
|
||||
|
||||
All configuration in `include/config.h`:
|
||||
|
||||
| Setting | Default | Description |
|
||||
|---------|---------|-------------|
|
||||
| `ZNET_API_URL` | - | ZNET Web API endpoint |
|
||||
| `DEVICE_ID` | `tank_gateway_1` | Unique device identifier |
|
||||
| `TEMP_READ_INTERVAL_MS` | 30000 | Reading interval (30 sec) |
|
||||
| `TEMP_MIN_VALID_F` | 32.0 | Minimum valid temperature |
|
||||
| `TEMP_MAX_VALID_F` | 150.0 | Maximum valid temperature |
|
||||
|
||||
## API Integration
|
||||
|
||||
### POST /api/v1/sensors/readings
|
||||
```json
|
||||
{
|
||||
"device_id": "tank_gateway_1",
|
||||
"device_name": "E-Coat Tank Gateway",
|
||||
"readings": [
|
||||
{
|
||||
"sensor_id": "tank_primary",
|
||||
"temperature_f": 85.5,
|
||||
"is_valid": true
|
||||
},
|
||||
{
|
||||
"sensor_id": "tank_secondary",
|
||||
"temperature_f": 85.3,
|
||||
"is_valid": true
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Response
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"readings_stored": 2,
|
||||
"alerts_generated": 0
|
||||
}
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
### Implemented
|
||||
- [x] Dual DS18B20 sensor reading with validation
|
||||
- [x] OLED display showing current temperature
|
||||
- [x] WiFiManager for easy WiFi setup
|
||||
- [x] HTTP POST to ZNET Web API
|
||||
- [x] Offline buffering when network unavailable
|
||||
- [x] Automatic sensor discovery (1-Wire)
|
||||
|
||||
### Future (Phase 3)
|
||||
- [ ] LoRa receive for remote sensor nodes
|
||||
- [ ] Battery-powered remote node firmware
|
||||
- [ ] Sensor agreement monitoring
|
||||
- [ ] Flash storage for offline buffer persistence
|
||||
|
||||
## Related Projects
|
||||
|
||||
- **ZNET Web**: `~/Nextcloud/Dev/znet-web` - Backend receives temperature data
|
||||
- **Baserow**: Table for lab temperature logs (to be created)
|
||||
|
||||
## Git Repository
|
||||
|
||||
- **Remote:** https://git.ecoat.us/leehughes/znet-temp-sensor.git
|
||||
- **Main branch:** `main`
|
||||
|
||||
## Change Log
|
||||
|
||||
| Date | Version | Change |
|
||||
|------|---------|--------|
|
||||
| 2026-01-24 | 1.0.0 | Initial implementation |
|
||||
Reference in New Issue
Block a user