0

Hacking smart Rubik’s cube to control home appliances


Smartcube is an electronics appliances control project using a Bluetooth based Rubik’s cube and ESP32 WiFi module. Solve the Rubik’s cube and operate your electronics applicances.



INSPIRATION BEHIND PROJECT

I know we all are bored amid this coronavirus pandemic; most of us have plenty of time to work on our skills, or do fun things in my case working on electronics, which I would say is my passion.

I had purchased xiaomi’s Gikker’s cube long time back because I was fascinated to see that it was not a normal rubik’s cube but a smart cube with BLE technology in-built. The Rubik cube connects to an app called Supercube, which can teach you how to solve Rubik’s cube, and there are many fun variation, games, quizzes etc.


IDEA TO IMPLEMENTATION

As most of the such gadget, initially we are very fascinated but later it just collect dust kept lying around somewhere in cupboard.

Recently I started working on ESP32 modules , which are highly used in IoT field because it adds Wi-Fi to your project in some simple steps. After learning some basics of BLE and how it works on code front, I built some basic project application.

I came across one this amazing video on YouTube, which explained that data in this cube is not protected, and how the cube data is directly broadcast when you connect any BLE device for example a mobile.


BLOCK DIAGRAM

Block diagram rubix's cube
Block diagram

COMPONENTS

  1. ESP32
  2. Gikker’s Rubik cube
  3. Relay
  4. Bulb and bulb holder
  5. 5v power supply
  6. Breadboard, wires and jumpers

PREREQUISITES

  1. Arduino IDE with ESP32 core installed
  2. Basic terminology about BLE, service, and characteristics
  3. nrfConnect Nordic App

MAC ID OF RUBIX CUBE

Open nrfconnect APP and twist the Rubik’s cube. MAC ID will be displayed directly on nrfconnect app.


WORKING

I assume you already have basic knowledge of Arduino and how to use upload program to ESP32. After successful upload, open the serial monitor. ESP32 act as a master device and connected to Rubik’s cube.

ESP32 will connect to MAC ID specified in the code. It will determine required service and characteristics where moves of Rubik’s cube is broadcasted.

You can check the service and characteristic UUID in nrfconnect app

nrfconnect app

The solution stage data is already hardcoded in the Arduino code. You can code your required outcome in dosomething() function. I activated relay for 5 second in this example, you can add any other function of your choice.


CODE

Code : https://github.com/DhirajGehlot/smartCube/tree/master


PROJECT LOGS & EXAMPLES

  1. Blinking LED for 5 second: When the Rubik’s cube is completely solved, the led is activated. I did not have led to test this experiment so I planned to use led from relay.

2. Controlling servomotor (fixed rotation): When the Rubik’s cube is completely solved, the servo motor start performing fixed rotation which can be coded in the firmware.

3. Moving servomotor as per clockwise or anti-clockwise rotation: When the Rubik’s cube top face rotates clockwise; the servomotor rotates clockwise and vice-versa.

4. Controlling relay output: When the Rubik’s cube is completely solved, it activates the relay which in-turn activates the relay.


CONCLUSION

The application for this project is endless such as automatic door lock, password control home appliances and many other IoT applications.

Let me know your thought’s on comment. Do share on your social media.

Suraj Gehlot

Maker passionate about writing content on Technology IoT | AI/ML | Electronics | Education | Concepts | DIY

Leave a Reply

Your email address will not be published. Required fields are marked *