New File
Danish & English
This commit is contained in:
20
MEP_Sniffer.ino
Normal file
20
MEP_Sniffer.ino
Normal file
@@ -0,0 +1,20 @@
|
||||
#include <HardwareSerial.h>
|
||||
|
||||
// Brug UART2 (GPIO16 = RX, GPIO17 = TX)
|
||||
HardwareSerial MEP(2);
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200); // Til debugging
|
||||
MEP.begin(9600, SERIAL_8N1, 16, 17); // MEP-porten: RX=GPIO16, TX=GPIO17
|
||||
|
||||
Serial.println("🔍 Starter MEP-sniffer...");
|
||||
}
|
||||
|
||||
void loop() {
|
||||
while (MEP.available()) {
|
||||
byte b = MEP.read();
|
||||
if (b < 0x10) Serial.print("0");
|
||||
Serial.print(b, HEX);
|
||||
Serial.print(" ");
|
||||
}
|
||||
}
|
||||
113
README_DA.md
Normal file
113
README_DA.md
Normal file
@@ -0,0 +1,113 @@
|
||||
# 🔌 Echelon 83331 MEP Sniffer med ESP32
|
||||
|
||||
Et projekt til at aflæse rådata fra MEP-porten på Echelon 83331 elmåleren ved hjælp af en ESP32. Data læses i RAW-format for senere parsing og dekryptering med lokal krypteringsnøgle.
|
||||
|
||||
## 🎯 Formål
|
||||
|
||||
- Læs måledata direkte fra elmålerens MEP-port.
|
||||
- Undgå afhængigheder som SaveEye, cloud eller MQTT.
|
||||
- Gem og parse data 100 % lokalt.
|
||||
- Send senere data til Home Assistant via REST API.
|
||||
|
||||
---
|
||||
|
||||
## 🔌 Hardwaretilslutning
|
||||
|
||||
### 📟 Komponenter
|
||||
- ESP32 DevKit (WROOM anbefales)
|
||||
- RJ12-hunstik eller MEP-adapter
|
||||
- Evt. logikniveaukonverter (hvis MEP-port er RS-232 og ikke TTL)
|
||||
- Jumper wires
|
||||
|
||||
### ⚙️ MEP RJ12 Pinout (standard):
|
||||
|
||||
| Pin | Signal | ESP32 GPIO eksempel |
|
||||
|-----|------------------|---------------------|
|
||||
| 1 | GND | GND |
|
||||
| 2 | VCC (3.3/5V) | 3.3V / 5V (tjek målerens spænding) |
|
||||
| 3 | TX fra måler | GPIO16 (RX) |
|
||||
| 4 | RX til måler | GPIO17 (TX) |
|
||||
| 5–6 | Ikke i brug | – |
|
||||
|
||||
> ⚠️ Dobbelttjek spænding og signaltype – hvis RS-232 bruges, skal du sætte en MAX3232 imellem ESP32 og måler.
|
||||
|
||||
---
|
||||
|
||||
## 📊 Forventet dataoutput
|
||||
|
||||
Når dekodningen er aktiv og korrekt krypteringsnøgle er implementeret, forventes følgende output fra måleren:
|
||||
|
||||
| Felt | Enhed | Beskrivelse |
|
||||
|-----------------------------|-----------|--------------------------------------------|
|
||||
| `meterType` | String | Målerens type (fx "MEP meter") |
|
||||
| `meterSerialNumber` | String | Målerens serienummer |
|
||||
| `wifiRssi` | dBm | Signalstyrke (kun relevant for WiFi-modul) |
|
||||
| `activeActualConsumption` | Watt (W) | Øjeblikkeligt aktivt forbrug |
|
||||
| `activeActualProduction` | Watt (W) | Øjeblikkelig produktion (fx solceller) |
|
||||
| `activeTotalConsumption` | Wh/kWh | Akkumuleret forbrug siden opsætning |
|
||||
| `activeTotalProduction` | Wh/kWh | Akkumuleret produktion |
|
||||
| `reactiveActualConsumption`| VAr | Øjeblikkeligt reaktivt forbrug |
|
||||
| `reactiveActualProduction` | VAr | Øjeblikkelig reaktiv produktion |
|
||||
| `rmsVoltage` (L1-L3) | Volt (V) | RMS spænding per fase |
|
||||
| `rmsCurrent` (L1-L3) | mA / A | RMS strømstyrke per fase |
|
||||
| `powerFactor` | % | Effektfaktor (fx 98 = 0.98 cos(φ)) |
|
||||
|
||||
> Bemærk: Nogle værdier er afhængige af målerens firmware og opsætning
|
||||
|
||||
---
|
||||
|
||||
## 🔍 ESP32 Sniffer-kode (Arduino C++)
|
||||
|
||||
Brug denne kode til at logge rå data fra måleren i HEX, så det kan analyseres:
|
||||
|
||||
```cpp
|
||||
#include <HardwareSerial.h>
|
||||
|
||||
HardwareSerial MEP(2); // UART2
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
MEP.begin(9600, SERIAL_8N1, 16, 17); // RX=GPIO16, TX=GPIO17
|
||||
|
||||
Serial.println("🔍 Starter MEP-sniffer...");
|
||||
}
|
||||
|
||||
void loop() {
|
||||
while (MEP.available()) {
|
||||
byte b = MEP.read();
|
||||
if (b < 0x10) Serial.print("0");
|
||||
Serial.print(b, HEX);
|
||||
Serial.print(" ");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
👉 Når ESP32 er tilsluttet og måleren sender data, vises byte for byte i Serial Monitor (115200 baud).
|
||||
|
||||
---
|
||||
|
||||
## 🔐 Krypteringsnøgle
|
||||
|
||||
Projektet vil senere anvende elmålerens **private krypteringsnøgle** (hvis krævet) til at:
|
||||
- Autentificere sig mod måleren
|
||||
- Dekryptere binære data til forståelige værdier
|
||||
|
||||
### 🔒 Sikkerhedstiltag
|
||||
- Nøglen bliver **hardcoded i firmware**.
|
||||
- Ændringer kræver OTA eller fysisk opdatering – **ingen åben adgang** i web eller serial interface.
|
||||
- Brug af nøglen håndteres i separat kodeblok ved parsing.
|
||||
|
||||
---
|
||||
|
||||
## 🧪 Næste trin
|
||||
|
||||
1. Brug denne sniffer til at logge et datasæt fra måleren.
|
||||
2. Sammenlign værdier med dit kendte forbrug/spænding for at forstå datastrukturen.
|
||||
3. Vi implementerer parsing + kryptering, og REST-opdatering til Home Assistant.
|
||||
|
||||
---
|
||||
|
||||
## 📬 Kontakt
|
||||
|
||||
> Udviklet og vedligeholdt af [Thomas Emil](https://www.linkedin.com/in/thomas-emil-b3497995/).
|
||||
> For tekniske spørgsmål, kontakt via GitHub Issues eller ESP32-antenne-tanker 💡
|
||||
113
README_EN.md
Normal file
113
README_EN.md
Normal file
@@ -0,0 +1,113 @@
|
||||
# 🔌 Echelon 83331 MEP Sniffer with ESP32
|
||||
|
||||
A project for reading raw data from the MEP port of the Echelon 83331 electricity meter using an ESP32. Data is read in RAW format for later parsing and decryption with a locally stored encryption key.
|
||||
|
||||
## 🎯 Purpose
|
||||
|
||||
- Read measurement data directly from the meter's MEP port.
|
||||
- Avoid dependencies like SaveEye, cloud services, or MQTT.
|
||||
- Store and parse all data 100% locally.
|
||||
- Later send data to Home Assistant via REST API.
|
||||
|
||||
---
|
||||
|
||||
## 🔌 Hardware Connection
|
||||
|
||||
### 📟 Components
|
||||
- ESP32 DevKit (WROOM recommended)
|
||||
- RJ12 female socket or MEP adapter
|
||||
- Optional logic level shifter (if MEP port uses RS-232 instead of TTL)
|
||||
- Jumper wires
|
||||
|
||||
### ⚙️ MEP RJ12 Pinout (standard):
|
||||
|
||||
| Pin | Signal | Example ESP32 GPIO |
|
||||
|-----|---------------|--------------------|
|
||||
| 1 | GND | GND |
|
||||
| 2 | VCC (3.3/5V) | 3.3V / 5V (check meter specs) |
|
||||
| 3 | TX from meter | GPIO16 (RX) |
|
||||
| 4 | RX to meter | GPIO17 (TX) |
|
||||
| 5–6 | Not used | – |
|
||||
|
||||
> ⚠️ Double-check voltage and signal type – if RS-232 is used, insert a MAX3232 between ESP32 and the meter.
|
||||
|
||||
---
|
||||
|
||||
## 📊 Expected Data Output
|
||||
|
||||
Once decoding is active and the correct encryption key is implemented, the following output is expected from the meter:
|
||||
|
||||
| Field | Unit | Description |
|
||||
|----------------------------|----------|------------------------------------------|
|
||||
| `meterType` | String | Meter type (e.g., "MEP meter") |
|
||||
| `meterSerialNumber` | String | Serial number of the meter |
|
||||
| `wifiRssi` | dBm | Signal strength (only relevant for WiFi) |
|
||||
| `activeActualConsumption` | Watt (W) | Instantaneous active consumption |
|
||||
| `activeActualProduction` | Watt (W) | Instantaneous production (e.g., solar) |
|
||||
| `activeTotalConsumption` | Wh/kWh | Accumulated consumption |
|
||||
| `activeTotalProduction` | Wh/kWh | Accumulated production |
|
||||
| `reactiveActualConsumption`| VAr | Instantaneous reactive consumption |
|
||||
| `reactiveActualProduction` | VAr | Instantaneous reactive production |
|
||||
| `rmsVoltage` (L1–L3) | Volt (V) | RMS voltage per phase |
|
||||
| `rmsCurrent` (L1–L3) | mA / A | RMS current per phase |
|
||||
| `powerFactor` | % | Power factor (e.g., 98 = 0.98 cos(φ)) |
|
||||
|
||||
> Note: Some values depend on the meter's firmware and configuration.
|
||||
|
||||
---
|
||||
|
||||
## 🔍 ESP32 Sniffer Code (Arduino C++)
|
||||
|
||||
Use this code to log raw data from the meter in HEX format for analysis:
|
||||
|
||||
```cpp
|
||||
#include <HardwareSerial.h>
|
||||
|
||||
HardwareSerial MEP(2); // UART2
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
MEP.begin(9600, SERIAL_8N1, 16, 17); // RX=GPIO16, TX=GPIO17
|
||||
|
||||
Serial.println("🔍 Starting MEP sniffer...");
|
||||
}
|
||||
|
||||
void loop() {
|
||||
while (MEP.available()) {
|
||||
byte b = MEP.read();
|
||||
if (b < 0x10) Serial.print("0");
|
||||
Serial.print(b, HEX);
|
||||
Serial.print(" ");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
👉 Once connected and receiving data, bytes will appear in the Serial Monitor (baud: 115200).
|
||||
|
||||
---
|
||||
|
||||
## 🔐 Encryption Key
|
||||
|
||||
The project will later use the meter’s **private encryption key** (if required) to:
|
||||
- Authenticate with the meter
|
||||
- Decrypt binary data into readable values
|
||||
|
||||
### 🔒 Security Measures
|
||||
- The key will be **hardcoded in firmware**.
|
||||
- Changes require OTA or physical update – **no access via web or serial interface**.
|
||||
- Key usage will be handled in a dedicated parsing section.
|
||||
|
||||
---
|
||||
|
||||
## 🧪 Next Steps
|
||||
|
||||
1. Use this sniffer to log a data dump from the meter.
|
||||
2. Compare values with your known usage/voltage to identify structure.
|
||||
3. We will implement parsing + decryption, and REST push to Home Assistant.
|
||||
|
||||
---
|
||||
|
||||
## 📬 Contact
|
||||
|
||||
> Developed and maintained by [Thomas Emil](https://www.linkedin.com/in/thomas-emil-b3497995/).
|
||||
> For technical questions, reach out via GitHub Issues or ESP32 RF-beams 💡
|
||||
Reference in New Issue
Block a user