Practical IoT Cryptography on the ESP8266 using Arduino

I’ve been working with ESP8266 for a while, building some devices, and one of the features that lacked for a while was encryption. Upon a brief search on “ESP8266 encryption” I stumbled upon this Hackaday article by Sean Boyce. It was implemented using the old Lua/NodeMCU, and since I thought it was well explained I decided to port it to Arduino.

Encryption scheme

I won’t explain in details the encryption theory since it’s covered by the original article. Long story short, messages are encrypted using AES-128-CBC which requires two additional pieces of data to produce ciphertext: an encryption key and an initialization vector (iv).

AES-CBC encryption/decryption scheme simplified
Continue reading “Practical IoT Cryptography on the ESP8266 using Arduino”

Recovering an I2C bus

I have been using ESP8266 in some of my personal projects for a while. When I need more input/output/analog pins, I use an Arduino Nano as I/O expansion programmed as an I2C slave. I chose I2C as a communication protocol because I often use other I2C peripherals such as RTC and alphanumeric LCD. So far so good.

However, on my last project I was facing a problem: the I2c bus stopped working after uploading a new firmware to the ESP. When booting, no devices were being recognized, and the bus would work again only if I power cycled the system.

When I probed the bus, I noticed the SDA line was stuck at a low level due to one of the peripherals.

SDA line being held low
Continue reading “Recovering an I2C bus”

SLA battery recovery with DA PIMP Plus

Here at work we’ve got a no-break that’s been untouched since it was bought 5 years ago. This wouldn’t be a major issue, except it is an enormous 10 kVA 3-phase no-break that uses 80 sealed lead acid (SLA) batteries.

IMG_20181018_201320.jpg
80 “dead” batteries

A quick measurement shows us they have around 5-7 Volts, so they’re definitely “dead”. When searching for a way to recover them, I came across the video below that tells to open them up, refill with rain water, and then apply pulsed voltage to make them usable again. According to the video, the batteries “die” due to a chemical process called sulfation that happens inside the cells when the battery is left unused for a long time, and prevents them from being recharged.

Continue reading “SLA battery recovery with DA PIMP Plus”