terenceang

terenceang

Apple //e

Besides some yellowing of the casing, I acquired a well-loved 1984 Apple //e in good cosmetic condition. This set belongs to a member of Retro Computing SG, which he kindly donated to me. The set comes with a monitor and…

ESP8266 – Ikea Molgan light Hack – added retries to prevent battery drain.

I was on holiday over the weekend and the unit works like a charm, I was notified of all activities detected by the PIR set above my main door. With wifi_station_set_auto_connect(TRUE) the constant tries to connect to a missing AP or wrong password will run the batteries flat in no time. Default retries is now set to 4 in which after that the ESP8266 will go in deep sleep to conserve power. https://github.com/terenceang/esp8266-PIR

HTTPS and REST protocol.

Programming the ESP8266 to use REST protocol directly is a more practical solution in most case as not everyone have a MQTT broker to work with. The problem is most notification service now uses SSL for security reason, and the ESP8266 stack can’t seem to work with HTTPS servers. Did some test with google.com,  on port 80 and a non secure connection, my code works fine. The ESP connected and return a page. On a secure connection, on port 443 it fails on handshake. I think the current SSL stack in the ESP8266 sdk cannot handle strong encryption, or the certificates…

ESP8266 – Ikea Molgan light Hack – Software and actual usage.

After hacking the hardware, the next part is programming the firmware. The basic flow control is simple. boot log on wifi get time from NTP server (pool.ntp.org) format text with timestamp log on to MQTT broker publish formated text to MQTT broker go into deep sleep. Full source available on GitHub. After I have a decently working firmware, it is time to put everything together. I added a capacitor to the power rails to stabilize and eliminate false trigger. I think the sudden power draw by the ESP8266 somehow caused the BISS0001 to reset and kept the light on. I…

ESP8266 – Ikea Molgan light Hack – Hardware.

The first ESP8266 project I worked on is a wifi PIR detector. My original plan was to use an cheap Ebay PIR and 3D printed case for this project but I happen to have a spare Ikea Molgan PIR light lying around, I opened it up and take a peek inside and decided to work this hack with it, overall this is an attractive and cheap unit. (SGD$9.90)   Removing the top dome was easy as it is friction fitted and held together with some tape, upon closer examination, it uses the same parts as most cheap Ebay PIR, just…

ESP8266 – Native SDK.

nodemcu is a wonderful piece of code but it don’t work well on my ESP-01, it will go into a boot loop with just a few lines of code. Initially I though it was my mistake but it does that even with published examples. Moving on, I took a bit of time to set up esp-open-sdk and started to work on what I think will be a base for my future ESP8266 projectts. My basic code is based on tuanpm’s native mqtt library and stdout which reclaims the RX pin for use as GPIO3. The code basically logs on to my wifi…

ESP8266 – $3.08 Wifi MCU

Measuring 25mm x 15mm, this tiny board pack quite a punch in terms of features. Made by espressif, this device have become very popular with engineers and hobbyist all over the world. There are many varieties of the ESP8266, I bought the cheapest of the lot for only $3.08 each from ebay with free shipping. Received the ESP-01 after about 2 weeks wait and I eagerly tested it by loading nodemcu on to it and runing the code below, it logged on to my AP with ease. ip = wifi.sta.getip() print(ip) --nil wifi.setmode(wifi.STATION) wifi.sta.config("SSID","password") ip = wifi.sta.getip() print(ip) --192.168.1.128