Uploaded January 2021 | Updated September 2026, 1 week ago
In this video tutorial, I'll explain how you can build your own "Smart Dice" - wireless cubes that use the MPU6050 linear accelerometer on a GY-521 board to detect which way up they are, and broadcast that information via an MQTT message to a Node-RED broker.
You can use these to build an escape room puzzle where players need to arrange a set of dice to make a certain total of the face-up sides, or rotate them in a particular way to follow a numeric sequence, for example.
I'm using a Wemos D1 Mini, ESP8266-based board which is ideal for portable escape room props, because:
- it's physically small
- it has a convenient battery shield to provide portable power from a single Li-Po cell
- it has built in Wi-Fi
- it runs at 3.3V logic, which means that there is no logic-level conversion required on the I2C wires between the processor and the (3.3V) sensor
However, you can also follow exactly the same steps described here to connect the MPU-6050 sensor an ESP32 board, or an Arduino UNO or Nano (even though that won't have Wi-Fi unless you add a suitable Wi-Fi shield). To demonstrate how you can create code that is portable between several different target devices, I'm also not going to use any third-party libraries designed for the MPU-6050 chip - instead I'll teach you how you can write and read values directly to any I2C component using the built-in, generic "Wire" library. This is useful information to know should you ever find yourself wanting to use an I²C component in a project and these is not an existing library available!
Components
---
GY-521 board (MPU-6050 chip), banggood.com/custlink/v33hSP1shT
Wemos D1 Mini (ESP8266 chip), banggood.com/custlink/v33RJLItSj
D1 Mini Battery Shield, banggood.com/custlink/mvGhSFfsh2
Total cost = ~$7
Timings
---
00:00:00-00:03:23 Introduction and Demonstration
00:03:23-00:07:17 Hardware Overview
00:07:18-00:19:02 Wiring and power requirements
00:19:03-01:00:07 Arduino/ESP8266/ESP32 Code
01:00:08-01:15:36 Node-RED flow
01:15:37-01:17:28 Wrapup
Code & Wiring Downloads
---
If you'd like to support me making more video tutorials explaining how to use tech in escape rooms and other playful settings, please check out my Patreon at patreon.com/playfultech, where you can also find code downloads, wiring diagrams, and additional resources for this and all my other tech projects.
In this video tutorial, I'll explain how you can build your own "Smart Dice" - wireless cubes that use the MPU6050 linear accelerometer on a GY-521 board to detect which way up they are, and broadcast that information via an MQTT message to a Node-RED broker.
You can use these to build an escape room puzzle where players need to arrange a set of dice to make a certain total of the face-up sides, or rotate them in a particular way to follow a numeric sequence, for example.
I'm using a Wemos D1 Mini, ESP8266-based board which is ideal for portable escape room props, because:
- it's physically small
- it has a convenient battery shield to provide portable power from a single Li-Po cell
- it has built in Wi-Fi
- it runs at 3.3V logic, which means that there is no logic-level conversion required on the I2C wires between the processor and the (3.3V) sensor
However, you can also follow exactly the same steps described here to connect the MPU-6050 sensor an ESP32 board, or an Arduino UNO or Nano (even though that won't have Wi-Fi unless you add a suitable Wi-Fi shield). To demonstrate how you can create code that is portable between several different target devices, I'm also not going to use any third-party libraries designed for the MPU-6050 chip - instead I'll teach you how you can write and read values directly to any I2C component using the built-in, generic "Wire" library. This is useful information to know should you ever find yourself wanting to use an I²C component in a project and these is not an existing library available!
Components
---
GY-521 board (MPU-6050 chip), banggood.com/custlink/v33hSP1shT
Wemos D1 Mini (ESP8266 chip), banggood.com/custlink/v33RJLItSj
D1 Mini Battery Shield, banggood.com/custlink/mvGhSFfsh2
Total cost = ~$7
Timings
---
00:00:00-00:03:23 Introduction and Demonstration
00:03:23-00:07:17 Hardware Overview
00:07:18-00:19:02 Wiring and power requirements
00:19:03-01:00:07 Arduino/ESP8266/ESP32 Code
01:00:08-01:15:36 Node-RED flow
01:15:37-01:17:28 Wrapup
Code & Wiring Downloads
---
If you'd like to support me making more video tutorials explaining how to use tech in escape rooms and other playful settings, please check out my Patreon at patreon.com/playfultech, where you can also find code downloads, wiring diagrams, and additional resources for this and all my other tech projects.










