Skip to content

Latest commit

 

History

History
161 lines (118 loc) · 6.69 KB

README.md

File metadata and controls

161 lines (118 loc) · 6.69 KB

Byte Brigades Embedathon

Team Byte Brigades's submission for IEEE Embedathon 2025.
Team members :-

Idx Name Roll No. Contact
1 Mukul 231EE134 mukul.231ee134@nitk.edu.in
2 Soham 231EE142 soham.231ee142@nitk.edu.in
3 Ratan 231EC146 ratan.231ec146@nitk.edu.in

Milestone 1: How we got the values from esp32's NVS

Step 1. EXTRACTING NVS DATA USING HEX EDITOR

  1. First install esptool.py
pip install esptool
  1. Get the whole firmware that was loaded onto the esp32-id ;)
python -m esptool --port com11 read_flash 0x0 0x400000 firmware_backup.bin
python -m esptool --port com11 write_flash 0x0 firmware_backup.bin

Step 2. Converting the bin data to a usable format

Using Preference Library

 line0: �?=18141312131254144313133
 line1: �?=1711131213131415111313121312131
 line2: �?=16131211141314141312131213121
 line3: �?=16131225541413124313133
 line4: �?=1652111413141452111413161
 line5: �?=1613121213131414131212131312131
 line6: �?=521312131213141413121313343
Code
#include <Preferences.h>
Preferences preferences;
void setup() {
  Serial.begin(115200);
  if (preferences.begin("Passwords", true)) { // 'true' is for read only mode
   
    for (int i = 0; i <= 6; i++) {
      String key = "line" + String(i); 
      String storedValue = preferences.getString(key.c_str(), "default_value"); 
      Serial.println(" " + key + ": " + storedValue);
    }
  } else {
    Serial.println("Failed to open preferences.");
  }
  preferences.end();
}
void loop() {
}

Milestone 2: How we sent to and decrypted the message on another PC

Step 1. (Sort of) Manual Decryption

From the Problem Statement Document:

A mysterious sequence of digits, such as 13125216175, has
been transmitted by the ESP32. It appears to encode a hidden
visual pattern.
The sequence alternates between two roles, guiding the
structure of the pattern.
Your task is to interpret these numbers and reconstruct the
encoded representation.
  • visual pattern indicated that there was definitely use of plotting techniques
  • The sequence alternates between two roles, guiding the structure of the pattern. This meant we needed to alternate between the two symbols here we took as * and
  • For the even index we used * and for odd index
  • We used the pattern for each line and got the outut LAKHTARUS which is the reverse of SURATHKAL
  • So now we know to expect LAKHTARUS on the receiving computer.

Step 2. Actually sending the data to the second PC

a. ESP32

  • On the ESP we have a websocket running which takes the Key values from NVS of the ESP and converts it to readable format using the Preferences library.
  • It then sends the data to the computer which decrypts it.
  • This is the code which does this.

b. Receiving PC

  • On the Receiving PC we have a python script which has 2 main functionalities.
  • First part of the script deals with receiving the data from the websocket. Once it's received it, it stores it in a string and prints out that string for verification purposes.
  • Second part of the script deals with decrypting the data received from the websocket. Once we have stored the received data in a string, we parse through it and print * and according to the rules established in manual decryption part.
  • Upon performing this action, this is the output received.

c. Running the code

** To run this code follow the following steps:

  1. Change the ssid and password in transmit_password_websocket to the ssid and password of your network.
  2. Upload the code in transmit_password_websocket onto your ESP32.
  3. Press the reset button on your ESP32
  4. Clone the repo to a location of your choice on the receiving pc and change directory to that location
  5. Run /final_task/milestone2/receive.py

d. Output

WhatsApp Image 2025-01-12 at 1 33 10 PM


Milestone 3: Displaying the output on the LED matrix display

Step 1: Receiving and Deciphering the message on the PC

Same as whatever was done in milestone 2. The message is received over WiFi and deciphered. Upload the updated ESP32 code onto your ESP. Located in ./final_task/milestone3/transmit_password_websocket/transmit_password_websocket.ino

Step 2: Resending decrypted data back to ESP32

The decrypted data is converted to a list of 20 matrices, each one representing a single letter. Since our word is "LAKHTARUS", only 9 of the 20 letters are used. Each letter is a matrix of 1s and 0s, 1s representing a star and 0s representing a space.
This data is sent to the ESP32 server.

Step 3: Converting this List to a usable format for LED Matrix

The data is received in a JSON format, and the data is reconstructed into a matrix of size 8x160 (8x8 per letter) consisting of 1s and 0s where 1s represent LED ON and 0s represent LED off.
We have a temporary matrix of 8x8 which iterates throught the columns of the first long matrix. At each iteration we send the output of the temp matrix to our LED matrix for display. When the temporary matrix is full of 0's, it resets back to the beginning.

Step 4: Utilizing the LED Matrix

  1. Connect according to pin diagram;

Pin Diagram

  1. Using this test all we could run all leds one by one

  2. Now, we discover an issue with the LED Matrix. We cannot display the whole letter at once. We can demonstrate this using an example. Let's say you wanna turn on points((1,2),(1,6),(3,4))
    To do this, we need to turn on column 2,4 and 6. We will also need to turn on row 1 and 3. However, when we do this, we turn on (1,4), (3,2) and (3,6). To prevent this we use scanning

  3. So, we turn on necessary LED's in only one row at once. First line is turned on, and after a tiny delay of 1ms, second line is turned on and so on. This effectively appears as a whole to our eyes because of our human image retention time of 16ms. So we effectively achieve a sliding text effect on our LED matrix.

  4. Done!!!

Outputs

milestone2_output.mp4
milestone3_output.mp4

References