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

Shop |Ā Wiki

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

New toys – ESP8266 Modules

Yeah, new hardware to tinker with: a ESP-01 and a NodeMCU Board šŸ™‚

Specs

The ESP8266 is a powerful and cheap SoC (System on a Chip) with onboard WiFi (b/g/n) capabilities. It has 16 GPIO pins, UART, i2c, SPI andĀ QSPI for external flash memory.

ESP-01 Module

esp-01
ESP-01 Module

This very cheap module consist of o ESP8266, A PCB-Trace antenna and an external 1MB flash chip. It’s not breaking out every GPIO pins – justĀ 2 (GPIO0 & 2).

This module has 8 pins: VCC & GND for power, RXD & TXD for serial communication, RST for reset (yeah, really :p ), CH_PD for chip enabled/disable and GPIO0 & GPIO3. This chip is intended for small projects or as a Serial-Wifi bridge.

Be aware: The module has no onboard logic-level-converter. So if you hook up this board to more than 3.3v, you will most likely see magic smoke !

You can get these board for ~3-6 AUD$ from eBay.

 

NodeMCU v2

NodeMCU (ESP8266)
NodeMCU v2

This module is a complete development board. It is utilising a ESP-12E which is basically a ESP8266, 4MB flash and an antenna on one small pcb. This pcb is soldered to the devboard which is powered by usb (3.3v step-down-converter), a USB-Bridge for easy programming and 2 buttons (reset and flash). You can use 10GPIO pins for your own projects – every of this pins is able to provide you i2c, 1-Wire and pwm functionality.

Again: The module has no onboard logic-level-converter for the GPIO pins!

It comes preflashed with the NodeMCU firmware (www.nodemcu.com) which enables you to program this module in LUA. It costs about 8-13 AUD$ on eBay.

 

Outlook

As i have some experience with Arduinos, i’ll most likely try to use the Arduino IDE to program this little friends –Ā  (https://github.com/esp8266/Arduino)

My first Project will be a Wifi-Remote-Controller (infrared bridge) for my Daikin AC