Skip to content

frickelzeugs/smart-meter-pin-entry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Smart Meter PIN Entry (ESP32-CAM)

A simple Arduino sketch for an ESP32-CAM that allows you to enter the PIN of your smart meter remotely via a web interface, instead of manually flashing the PIN using a handheld flashlight.
The ESP32-CAM also takes a photo of the meter after PIN entry, displays it on a small web server and optionally stores it on the SD card.

setup

setup

🎯 Goal of this project

Many digital electricity meters allow users to unlock certain display or data functions (e.g., consumption history) via a 4-digit PIN.
Entering this PIN is usually done through optical flashes using a flashlight.

Since this manual process can be:

  • inconvenient,
  • error-prone,
  • and requires standing directly in front of the device,

…I built a small helper tool using the ESP32-CAM that can perform the PIN entry automatically.

⚠️ Disclaimer

This project does not bypass, manipulate, or override any security mechanisms.
It simply automates the same optical input method the user could perform manually. Any modification of this project to perform automated PIN testing or brute-force attempts would be illegal and is strictly discouraged. Use this project only as intended and only with devices you are authorized to operate. The author assumes no responsibility for misuse or any consequences arising from the use of this project.

⚙️ How it works

The ESP32-CAM is mounted in front of the meter’s optical port. The sketch provides:

✔ Web interface

Enter your 4-digit PIN in a browser and trigger the PIN entry remotely.

✔ Optical PIN input

An LED connected to the ESP32-CAM blink-transmits each of the four digits using the meter’s documented optical input pattern.

✔ Photo capture

After the PIN is entered, the ESP32-CAM:

  • takes a picture of the display,
  • shows it on the web server,
  • and stores it on the microSD card (optional).

This makes it easy to verify whether the PIN entry was successful and to monitor the display state remotely.

🧰 Hardware & Requirements

You will need:

  • ESP32-CAM module
  • White LED for optical flashes
  • 330 Ω resistor (recommended)
  • MicroSD card (FAT32)
  • Stable 5 V power supply
  • A mounting method (tape, clamp, 3D printed holder, etc.)

Example setup:

hardware

🔧 Configuration

WiFi Credentials

Create a new file/tab secrets.h in the Arduino IDE with the following content:

const char* ssid = "YOUR_WIFI_SSID";
const char* password = "YOUR_WIFI_PASSWORD";

Timing Parameters

Different smart meter models may require different optical timing settings. You can adjust these constants at the top of the sketch:

int const BLINK_DURATION_MS = 200;        // Length of one flash
int const BLINK_PAUSE_DURATION_MS = 200;  // Pause between flashes
int const DIGIT_SPACE_DURATION_MS = 4000; // Pause between digits
int const WORD_SPACE_DURATION_MS = 500;   // Pause after the whole PIN

These values work well for my EMH eHZB meter, but other models may vary.

Further adjustments

If you need to make further adjustments to the PIN input logic (e.g. because your meter requires additional flashing signals), you can do this in the worker task here:

void vWorkerTask(void *pvParameters) {
  ...

  // the worker tasks work
  while (true) {
    if (pinEntryActive) {
      // PIN ENTRY IS DONE HERE
      ...
    

🌐 Web Interface

Once connected to your WiFi network, the ESP32-CAM hosts a small web page that allows you to:

  • Enter a 4-digit PIN
  • Start the PIN entry process
  • View the most recent display photo (or manually trigger an update of the photo)
  • This makes reading the display state convenient from anywhere in your network.

🚀 Flashing the ESP32-CAM

You can flash the project using Arduino IDE. Install the required libraries via Library Manager:

ESPAsyncWebServer
AsyncTCP

If you're new to the ESP32-CAM, the guide from RandomNerdTutorials is highly recommended:

➡️ How to upload code to the ESP32-CAM: https://randomnerdtutorials.com/upload-code-esp32-cam-mb-usb/

⚠️ Disclaimer

This project is intended only to automate the regular, user-accessible PIN entry of your own smart meter. It does not provide any method to circumvent, manipulate, or attack security mechanisms.

Use this code only:

on devices you are authorized to interact with, for legitimate and lawful purposes.

The author assumes no responsibility for misuse or any consequences arising from the use of this project.

About

Arduino sketch for the ESP32-CAM to enter your smart meter PIN using a web browser, instead of having to flashing the PIN by hand with a flashlight

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages