Skip to main content

Basic D-duino code (OLED, WifiManager)

In a previous blog post I introduced to you the D-duino ESP8266 boards. In this blog post, I’ll show you a small Arduino code which is providing the basic functionality for my next projects.

What’s in the box

I am using the awesome WifiManager library. I will handle the configuration and connection to a WiFi network. If  the ESP is unconfigured or the AP is not reachable, it will start an access point by its own. You can connect to this AP and a caption portal will open. Scan for networks, select one and enter the password. The configuration will be saved in the EEPROM. No need to set the credentials inside of your code.

Over-the-Air update is also implemented. This makes it very easy to update the code without connecting the MCU via USB to the host. It’s also faster than serial uploads.

Last part is of course the OLED display. I am using the ESP8266_SSD1306 library. It has some very nice features like progress bars, several graph commands (lines, shapes etc.), pictures and of text.

Read More

Use a ESP8266 to control your A/C via MQTT

We had some very (very!) hot days here in Sydney, up to 40 DegC over several days. After a day in the office, you open the door to your apartment and… 50 DegC 🙁 I looked for a solution to cool down home right after i left the office – with my phone – using MQTT 😉

Hardware

I am using three components for my project. The MCU, an adapter board and the IR-LED

NodeMCU

  • ESP8266
  • 4Mbyte ROM
  • On-board USB/UART

Grove Base Shield for NodeMCU

  • 5 Digital connectors
  • 2 I2C sockets
  • 1 Analog connectors (A0)
  • Power indicator LED

ShopWiki

Grove – Infrared Emitter

  • Voltage: 3.3-5V
  • Distance:10m

Shop | Wiki

 

Software

 

The Basics

The project is based on the Arduino core for ESP8266 and uses several additional libraries. I am using the platform.io IDE for development. The advantages are the fully integrated build and deployment process (via USB or over WiFi), the library manager and the code completion and linting. You can download my complete platform.io project here.

You’ll also need an MQTT server like RabbitMQ to send commands and receive the status. If you are familiar with Docker, you should read my previous post Dockerize RabbitMQ to get a server up and running in no time. If not: There are several binary pages on the RabbitMQ Website.

Read More