Project Commodus

by Northstrix in Circuits > Microcontrollers

924 Views, 2 Favorites, 0 Comments

Project Commodus

IMG_20210614_194302.jpg

Commodus is a Latin word that means suitable, convenient, beneficial, advantageous. I chose this word as the name of the project because I believe that this project can be very "Commodus" if practically applied in the right way.

Supplies

  • ESP8266 x2
  • Arduino x1
  • 16x2 LCD Displays x2
  • I2C LCD Adapters x2
  • 24x2 LCD Display x1

Install the Drivers and Configure Arduino IDE *optional

If you've never flashed ESP8266 before you'll need to configure Arduino IDE and install drivers to upload the firmware to the boards, you can find drivers here:

CH340 driver: https://sparks.gogo.co.nz/ch340.html

CP210x driver: https://www.silabs.com/developers/usb-to-uart-brid...

In case you don't have Arduino IDE, you can download it here:

https://www.arduino.cc/en/software/

Configuring IDE isn't a part of this tutorial, you can read about it here:

https://randomnerdtutorials.com/how-to-install-esp...

Get the MAC Address of the Receiver Board

mac.png

To get the MAC address of the board upload this code to the board.

#include <ESP8266WiFi.h>

void setup(){
  Serial.begin(115200);
  Serial.println();
  Serial.print("ESP Board MAC Address:  ");
  Serial.println(WiFi.macAddress());
}
 
void loop(){
}

Then open the serial monitor, and reboot the board.

If done correctly, you should see the MAC address in the console.

The MAC address of this board is 40:F5:20:33:9A:F5

Change the Address of One of the I2C LCD Adapter

IMG_20210614_165745.jpg
Untitled.png

To avoid the bus collision each adapter must have its own address.

The address of the adapter can be changed by bridging the contact(s).

You can connect up to 8 displays without any hassle by bridging contacts on 7 adapters.

Build a Circuit

I've included both schematic and circuit diagrams for the receiver.

You don't need to connect anything aside from the USB cable to the transmitter.

Schematic Diagram

esp8266.png

Circuit Diagram

esp8266_2.png

Get the Displays' Addresses

i2cdisp.png

To get the displays' addresses, upload this sketch to ESP.

https://playground.arduino.cc/Main/I2cScanner/

Then open the Serial Monitor, and set the baud rate to 9600. If you've done everything right, you should see the display's addresses.

Generate the Keys

ezgif-3-ef64ec5ae448.gif

Triple DES requires three 56-bit keys. You can generate the keys by any means possible.

I can only suggest a program to do so https://defuse.ca/passgen.htm

Download the Firmware

You can download the firmware here: https://github.com/Northstrix/Project_Commodus

The firmware for both receiver and transmitter is in the "ESP8266" folder.

You can download the DES library here: https://github.com/fcgdam/DES_Library

You can download the LiquidCrystal_I2C.h here: https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library

Modify the Receiver's Firmware

Find the key and substitute it with the one you've generated.

Note that the key is in hexadecimal format.

  byte key[] = { 
                  0x3E, 0x0A, 0x6F, 0xB6, 0x1D, 0xA6, 0x88, 0x66,
                  0xDB, 0xCF, 0x4E, 0x5A, 0x31, 0xF5, 0x6A, 0x6E,
                  0xB8, 0x01, 0x9F, 0xCC, 0xBC, 0x06, 0x73, 0xFE,
                };

Modify the Transmitter's Firmware

Substitute the MAC address of the receiver board with the one you've got from step 2.

Find the key and substitute it with the one you've generated.

uint8_t broadcastAddress[] = {0x40, 0xF5, 0x20, 0x33, 0x9A, 0xF5};
  byte key[] = { 
                  0x3E, 0x0A, 0x6F, 0xB6, 0x1D, 0xA6, 0x88, 0x66,
                  0xDB, 0xCF, 0x4E, 0x5A, 0x31, 0xF5, 0x6A, 0x6E,
                  0xB8, 0x01, 0x9F, 0xCC, 0xBC, 0x06, 0x73, 0xFE,
                };

Upload the Firmware to the Both Boards

IMG_20210616_111823.jpg

For the sake of avoiding confusion with the ports, I would recommend you connecting and flashing one board at a time.

Open the Serial Monitor of the Transmitter Board

espsm.png

Connect the transmitter to the USB port.

Select the port to which the board is connected.

Open the Serial Monitor.

Set the baud rate to 115200.

Reboot the board.

If you did everything right you should see the menu.

Run Some Tests

IMG_20210614_183748.jpg

Now it's time for a little user's guide.

Choose the option in the menu, enter its number to Serial Monitor and press the "Enter" button on your keyboard.

If you've chosen to enter the data for some part of the display, then enter the data you want to encrypt and send to the receiver and press the "Enter" button on your keyboard.

By the way, don't forget to adjust the contrast.

Make Sure the Keys Are Matching on Both Devices

IMG_20210610_193449.jpg

If you're getting something like this instead of the stuff you've entered, make sure the keys are matching on both devices.

Using Arduino As a Display Driver

ard.png

In case you run out of I2C LCD adapters, like I did, you can use an Arduino to drive the display.

You can download the firmware here: https://github.com/Northstrix/Project_Commodus

The firmware for the receiver, the transmitter, the Arduino is in the "ESP8266+Arduino" folder.

Make sure to disconnect the "purple" wire while flashing both Arduino and ESP.

Also, don't forget to repeat steps 10 and 11.

Filling up the display connected via Arduino is a little bit different.

To fill the display you need to call option 7 four times.

First time: Enter the data for the first 16 segments of the upper row.

Second time: Enter the data for the last 8 segments of the upper row.

Third time: Enter the data for the first 16 segments of the bottom row.

Fourth time: Enter the data for the last 8 segments of the bottom row.

Practical Application

Triple DES, ESP NOW, and stuff like that might sound good on paper, but still mean nothing without the real-world application.

Electronic Shelf Label

IMG_20210614_195228_hdr.jpg

Although Triple DES isn't enough for some "extremely important" stuff like encrypting the financial transactions or encrypting government communications, it's still a decent cipher for "not so important" stuff, especially if the hardware that implements it costs like a cup of coffee in Starbucks.

I don't think that the ESL used by a small business will be the world's primary target for cyberattacks.

Secure One-way Communication Channel

IMG_20210614_181252.jpg

Even though this device is still vulnerable to the "Replay attack", the chances that someone will decide to waste a lot of time to exploit it are negligible.

And there's still no way to find out what you were sending without either obtaining the key or performing the "chosen-plaintext attack" with every presumable pattern or just standing in front of the device and resending every captured package.

Electronic Stuff Label

IMG_20210614_182509.jpg

Simple and useful.

Conclusion

IMG_20210614_173208.jpg
IMG_20210614_182922.jpg
IMG_20210614_194245.jpg
IMG_20210614_194723.jpg

This project doesn't use one of the most sophisticated encryption schemes in the world, but it also doesn't cost like a military jet.