Skip to main content

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

Install rtl-sdr on a C.H.I.P

Check your hardware

First you should make sure that your rtl-sdr stick is properly connected to your c.h.i.p and that your power source is suitable to drive the chip plus the rtl-sdr. Some of them are consuming more than 500mA (which isĀ out of specĀ for USB2.0) which can cause the system crashing if under load.

Connect your rtl-sdr to the c.h.i.p, login and run lsusb -t. You should see an output like the one on the screenshot below. The last two lines are the rtl-sdr stick.

Read More

Setup a C.H.I.P in Headless mode (no screen)

So you got your C.H.I.P but unfortunately you can’t connect to a Display and you don’t have a keyboard available? This guide should help you to get started. You will connect the C.H.I.P to your wi-fi, update the software and install a vnc server to use the gui.

Initial connection

Connect you C.H.I.P via USB to your Computer.

Open your favourite terminal program and connect to the comport with 115200Ā baud. For windows you can use putty. On OSX i suggest using cu.

On OSX i am using this commandĀ sudo cu -l /dev/cu.usbmodem1423 -s 115200

If you’re connected and you don’t see any login screen just hit enter once

Login with the default credentials (chip/chip)

Read More