Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

🎲 PowerDice ESP32 Home Assistant MQTT

🧾 Description

An IoT device based on the XIAO ESP32C3 and ADXL345 accelerometer publishing dice roll events via MQTT to Home Assistant.

For more information, see: https://www.printables.com/model/1587364-powerdice-smart-iot-dice

Vibe-coded — use at your own risk.

🏗️ Environments

The project supports two deployment environments with different levels of system integration:

🐳 Docker (deprecated setup)

MQTT uses an external broker (NanoMQ). The broker and HA are deployed as separate containers.

👉 View Docker setup

🍓 Raspberry Pi (current setup)

Runs entirely on Home Assistant OS using the built-in Mosquitto MQTT broker add-on.

👉 View Raspberry Pi setup

🔌 Hardware

Wiring diagram

View full-size diagram: https://circuitcanvas.com/p/bfxgqpgykhrte89nrw1

⚡ Wiring

XIAO Pin Connection Target Description
3V3 ADXL345 (VIN) Power supply
GND ADXL345 (GND) Ground
D0 (GPIO2) → (via a voltage divider) BAT+/BAT- Battery voltage monitoring
D1 (GPIO3) ADXL345 (INT1) Activity interrupt (wake-up)
D4 (GPIO6) ADXL345 (SDA) I2C data line
D5 (GPIO7) ADXL345 (SCL) I2C clock line

⚠️ Important notes

In my setup, the wiring schematic differs slightly (see Printables images), as I used 4× 100kΩ resistors instead of the values recommended by Seeed Studio.

For best compatibility and accuracy, follow their design:

  • Voltage divider: use 2× 220kΩ resistors

🛡️ Security considerations

This project is a baseline implementation and does not include TLS/SSL, certificates, or hardened MQTT configuration.

You are responsible for:

  • securing MQTT (authentication, ACLs) — see how
  • securing Home Assistant access — see how
  • network isolation where required
  • adapting security to your threat model

👍 Support

If this project helped you, consider leaving a star on GitHub ⭐

About

Smart IoT Dice source code

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages