Mechatronics Exercises

# Educative escape room puzzle box

## Key

• This line was removed.
• Formatting was changed.

...

The goal is to create an escape room puzzle box with intuitive educational aspects. The first puzzle would be to input 8 bit values from various numerical systems as binary values. The user would be given for example a hexadecimal value on a display and would input the converted binary value to the device in the form of pressing buttons connected to LEDs. When a LED is on, this resembles a 1 from the binary value. There are 8 LEDs and 8 buttons. When the first stage is completed, a QR-code would be shown on the screen that would give the user the credentials for a wireless network broadcasted by the device. The user is then redirected to a webserver hosted on the device, prompting the user to solve another puzzle. This second puzzle of the puzzle box is deciphering an encrypted message given to the user. The puzzle is decrypted by rotating the box in a specific sequence. The box would be equipped with an accelerometer to sense the orientation of the device.

The original idea of the puzzle box project was to have the user perform various simple educative-themed exercises that would allow the user to proceed to the next challenge. The project was divided into two larger sections:

1. The first stage of the puzzle box is to perform various different numerical system translations. This means that the user would translate values given in some numerical system to a binary value. Let us take for example a translation from hexadecimal values to binary values; the hexadecimal value of A5 would translate into 10100101, 1010 from A, and 0101 from 5. At this stage of the project, the equipment needed for execution would be the following:

 Name Number OLED 1.3 Screen X1 Arduino MKR Wi-Fi 1010 X1 Button X8 LED X8 Resistor network DIL 16-8: 330 Ohm X1 Shift Register 74595 HC DIP16 X1 Li-Po battery 3.7V 2000mAh X1

The user would be given a value on the OLED screen, which the user then one way or another translate into binary format. To enter the answer, the user would press buttons that are wired together with the LEDs, where each LED stands for each element of the binary value. When one LED is on, it represents a 1 from the binary value, and when an LED is off, it represents a 0 from the binary value.

Fig. 1. LEDs as binary values

In this figure, the LEDs are all off, which would mean that the binary value would be 00000000.

1. The second part of the puzzle would have the user decrypt a message that is given to him/her by performing certain rotations of the puzzle box. The logic behind this is that each side of the box have pre-defined values corresponding to them. Say that the message given to the user to decrypt would be: s5 s1 s4 s2 s6 s5, this would mean that the user would have to rotate the box in the order side 5, side 1, side 4, side 2, side 6, and side 5, so that each side is facing upwards one at a time. The program would receive user inputs when it recognizes that a certain side is facing upwards for more than a second at a time, and based on this user input, it would extract a letter from the corresponding values, and since the message is pre-defined in the code, it knows what index from each value to choose. At this stage of the project, the needed equipment would be the following:

 Name Number OLED 1.3 Screen X1 Arduino MKR Wi-Fi 1010 X1 Li-Po battery 3.7V 2000mAh X1 Grove IMU 9 DOF X1

After the first puzzle is completed, the user is prompted with either a QR code, that when scanned, redirects the user to a Wi-Fi network and by connecting to it and visiting its website, this second part of the puzzle would be initiated. As the user turns the puzzle box in the correct orientation, the website would update itself and show the encrypted message so far. In the example above, if the user would turn the box in the correct order, the message would appear one character at a time, and reveal the answer:

N -> NE -> NEW -> NEWT -> NEWTO -> NEWTON

This part of the puzzle could be elaborated upon, it could be implemented like a question, where the deciphered message is the answer. For example: When was Galileo Galilei born? We know that the answer is 1564, so we cipher it into: s5[5], s1[5], s6[4], s2[5], the parentheses are for the program to know what index to choose from each side and the message given to the user to decipher would be: s5, s1, s6, and s2.

# Bill of Material

QuantityName
1VASTUSVERKKO SIL 10-9: 10kohm
1

TTL-LOGIIKKAPIIRI REG 74595 HC-PERHE DIP16

8

SULKEUTUVA KALVOKYTKIN NUPILLA 12x12mm

1

Grove IMU 9DOF (ICM20600, AK09918)

1

VASTUSVERKKO DIL 16-8: 330ohm

1

JST/PHR-NAARASLIITIN KAHDELLA PINNILLÄ

1

Li-Po AKKU 3,7V 2000mAh 6x44x63mm

8

Red LEDs

1

ARDUINO MKR WIFI 1010

1

Joy-IT OLED 0.96'', with I2C interface

1Perfboard

...

We created a wiring diagram on Tinkercad to simulate the electronic wiring of the components and to get a big better picture of the final product

här typ bild på vår slutliga wiring etc.???

Here is a 3D model for our puzzle box. The box consists of 6 parts (6 sides of a cube). Each side contains a number from 1-6 of which the numbers 1, 4, 5 and 6 will be inset by 2 mm into the surface and the numbers 2 and 3 will be through the surface (this way we make the printing process faster, easier and less vulnerable to errors). Sides with numbers 2 and 3 are identical (apart from the inset number) and they have a support beam, which will work as support for the removable bottom panel (side number 5) . The front side (side with number 1) will have a small gap so that we can fit the bottom panel (side number 5) nicely to the rest of the box. The top of the box (side number 6) has 8 holes for the LEDs and 8 holes for our buttons. Additionally a the top has a hole in the middle for our OLED-screen. The parts will be 3D-printed in our schools facilities. Below is a draft of all the parts and the final box. The dimensions our box is 140 x 140 x 140 mm^3 TÄHÄN TULLOO PIAN PÄIVITETYT KUVATImage Removedand the wall thicknes is 2,5mm.

# Programming

A Gitlab code repository has been created for the group to contribute towards the programming part of the project. Code for shift register is done and code for the ciphering algorithm in the second part of the puzzle is planned and written in python so far. AP and webserver functionality of Arduino works successfully.

Web server set-up and connection test:

Connection:

The cipher algorithm in the second puzzle of the project:

...

IMU

HTML for webserver

TO BE CONTINUED

...

CONTINUED

# Assembly

We started by planning what components we need and making the Tinkercad model. Then we started to acquire all the required components, so that we were able to plan the 3D-model and start programming the required codes separately for the Arduino, OLED-screen, IMU and the webserver. Next we got all the codes up and running and combined the different programming components in the repository into the main code. After a successful test of the together combined components we proceeded to soldering everything to a circuit board. Simultaneously we had the printer print our parts for the box. Lastly we assembled our box and electric components and made some finishing touches and test.

• We need to test the QR code readability on the display that we have, if it turns out to be hard to read the QR code, the credentials to the web server might have to be given on the display instead.
• Programming of IMU handling for the Arduino.
• Implement the ciphering algorithm.
• Write html for the webserver.
• Combine the different programming components in the repository into the main code.
• Testing everything when combined together.
• Planning and soldering everything to circuit board.
• Print the planned 3D model.
• Assembling the project and work on aesthetics.

# Encountered problems and challenges

• The Arduino might not be able to supply enough current to keep everything going at once. In which case, the challenge would be to find ways to cut down current draw and still keep up the functionality of the project.
• This broke our arduino → big problem
• We had to acquire a new Arduino MKR WIFI 1010 or 1000???
• Our first CAD-model was not printer friendly, so we had to change it and print all the sides of our cube separately in order to decrease printing time. The inset numbers would have been a problem when printing the sides horizontally. The same applies for the gap under number 1 and the support beams. The numbers 2 and 3 had to be printed as holes in order to be able to print the support beams so that they are on the inside of the cube.
• We didn't reserve enough time for the final testing of the combined components and left the printing and soldering to last minute.
• As mentioned in the to-do list, if the QR code is not readable on the OLED display, we might have to show the SSID, password and IP on the display instead.
• We do not own a soldering iron, and we have not bought cables or perf board yet. Hopefully, we can get access to these at the lab if the lockdown does not prevent this.
• We will not be able to physically get together and work on project before 18.3, so we are a little bit limited on time.
• If the OLED screen would have been I2C compatible, we could have connected We had to change our OLED screen to a I2C compatible to be able to connect it to the same pin as the IMU, but since it is SPI, we might not have enough pins to connect to. This way we didn't need as many pins.