lorenz-h / open-desk-lamp

An alternative firmware for the Xiaomi Mi Desklamp based on Micropython. No more cloud connection needed.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Open Desk Lamp

The Xiaomi Desklamp is an affordable connected Lamp that uses an ESP8266 Microcontroller internally. Unfortunately, users are required to register for the Xiaomi Home Service and the lamp communicates with Xiaomi servers. This project replaces the lamp's original firmware with privacy focussed firmware based on Micropython. Pinouts for the custom ESP8266 board and other information was taken from fvollmers's open-desk-lamp-firmware project, which is written in C and lacks IoT functionality.

Hardware

The most difficult aspect of this project was soldering the connections onto the microprocessor to flash the new firmware. TO open the lamp you need to peel back the rubber standoffs and remove three screws (indicated in orange below):

After opening the case you will find two PCBs. We are interested in the larger one, which holds the rotary encoder and the microprocessor. First, you need to pull of the knob from the rotary encoder. This requires quite a bit of force. I wrapped the knob in tape and pulled it off using pliers. After you have removed the knob you can remove the three screws holding the PCB in place. After turning the PCB over you should see the four pads that we need to solder to, as indicated below:

The soldering was by far the most nerve-wracking step of this project. The contacts are very close together and in proximity to small resistors on the board, so it is important not to overheat the board and take things slow. After successfully attaching all four leads we can connect them to a serial adapter.

Flashing Micropython

To put the ESP8266 into write mode you need to pull GPIO 0 to GND. Remember to remove the pulldown after you have completed the flashing, as no WiFi hotspot will be created if the pin is still pulled low. A complete installation guide can be found in the Micropython Docs.

Setup

After installing Micropython, transfer all files in this repository (excluding README.md and the docs folder) onto the ESP. This can be done using the Micropython webrepl tools. If all files were successfully transferred the lamp should create a WiFi hotspot called open-desk-lamp with password open-desk-lamp after you power-cycle it. Connect to the hotspot using one of your other devices and enter 192.168.0.1 in your browser's address bar. At that point, you can enter the credentials that the lamp will use to connect to your home wifi.

Usage

The lamps status can be read at /status using GET

About

An alternative firmware for the Xiaomi Mi Desklamp based on Micropython. No more cloud connection needed.


Languages

Language:Python 89.8%Language:HTML 7.8%Language:CSS 2.5%