Posts tagged ‘MQTT’

FHEM: Battery powered Home Automation remote display using small OLED and MQTT

This is the successor of my MQTT remote display. It is battery driven and can so be placed where you want.

The main component is a Pololu U1V11F3, a step up/down converter with 3V3 output and an Enable input pin. Unfortunately the Enable pin is already clamped to Vin via a 100K resistor. For me I had to remove the small SMD resistor to have the circuit powered off normally. The R6/100K is located directly to the Enable in Input connectors of the Pololu board.

The Enable pin is then connected to GND via an 1M resistor to ground. Do not leave the Enable pin floating, it will sense a finger tip already and switch to on/off by accident.

Then I added a momentary switch and a 47K resistor between Vin (the battery Plus) and the Enable pin. If the switch is pressed, the converter starts and gives 3V3 on it’s Output pin. This powers the ESP12 and the OLED display. But only as long as you press the switch. So I added a Diode from GPIO14 of the ESP-12 to the Enable pin.

In the code, GPIO14 is set as output and immediately set to high. This will enable the converter even when the switch is released.

After some code cycles, the GPIO14 output is set to low and the power of the converter is shut down.

The converter will not drain the battery in shutdown mode. But you need to press and hold the switch 2 or 3 seconds until the code powers the Enable pin.

FHEM: Home Automation remote display using small OLED and MQTT

I wanted to have a small display with some essential Home Automation data. So I buy an 1.3″ OLED display with I2C interface and started to look for some existing code for an ESP8266. The display should be feed using WiFi and be portable, so I can place it where needed.

I started with ESPeasy, as there is already support for multiple pages with text lines. Unfortunately the code is written to show sensor data of directly connected sensor only. No option to publish free text or data from a Home Automation system. The ESPeasy code will save the text to flash memory on every change when using the Web GUI. The flash memory would wear out after some month with my use case.

Finally I decided to start my own code. First I had to find out that the OLED display is not an SD1306 but a SH1106 one. Although some people state that these are more or less the same, the SD1306 libraries did not work for me. Then I found which works well for me.

Starting with SSD1306UiDemo.ino I added WiFi and MQTT libaries and code.

My code will show 6 lines of text on two frames (3 lines each). The frames will change every 5 seconds. The content of the text lines is published by a FHEM server. As there was no easy way to integrate the display using a MQTT_DEVICE definition in FHEM, I wrote my own perl mqttmsg sub function and used the FHEM notify definition to publish changes to the display.

a small video

Continue reading ‘FHEM: Home Automation remote display using small OLED and MQTT’ »

fhem: Lampe (220V) mit sonoff über WiFi schalten

itead hat mit dem sonoff Modul einen sehr günstigen ESP-8266 basierten WLAN Stromschalter im Programm. Kostet derzeit bei itead unter 5$, allerdings mit ca. 8$ Versand. Wenn man aber gleich vier davon bestellt, lohnt sich das gegenüber anderen China-Versendern, die diese Modul für ca. 10$ verkaufen.


Das Ding lässt sich wunderbar mit einer eigenen Firmware flashen, wenn man einen 4-Pin Header einlötet und einen USB-TTL Konverter mit 3.3V hat.


Continue reading ‘fhem: Lampe (220V) mit sonoff über WiFi schalten’ »