I’ve been trying to get more into home automation recently. As I dive deeper into it I’ve realised that I should start looking into small, self-contained devices that can communicate with my home assistant.

Having done some reading, the ESP8266 seems like a good place to start. This guide will help you program an ESP8266 (and will serve as a record for me for when I inevitably forget how this is done in a few weeks).

Download and install Arduino IDE

The Arduino IDE is available from https://www.arduino.cc/en/Main/Software

We need to get the board for the ESP8266 so we can upload a sketch to it. Open the preferences menu in the Arduino IDE and add the following to the additional boards manager:

    http://arduino.esp8266.com/stable/package_esp8266com_index.json

I also checked the show verbose output during upload to show more detail for debugging purposes.

01 add board to board manager

Now we need to go and download the software in the boards manager:

01_1 install software for board

Find the ESP8266 community sotware and install it:

01_2 install software for board

Now we need to install the FTDI drivers. These are available from http://www.ftdichip.com/Drivers/VCP.htm

Pick the version that’s right for your mac osx version (mine was 2.4.2 at the time of writing), download it and install

02 install FTDI drivers

03 add board to board manager

You may see a popup about security, depending on your settings. Allow the install via the security settings.

04 allow installation in security settings

The installation should now complete.

05 installation complete

Upon completion, if the Arduino IDE is still open, restart it before continuing.

Setup your board and chips

Switch the jumper to higher voltage mode (5v) on your USB to TTL. This seemed to be required to power mine and allow it to be flashed Wire up the board in accordance with the following image and diagram and then plug in the USB:

06 wiring the boards up

07 wiring the boards up

Upload sketch to ESP8266

Load up the blink sketch for the ESP8266

08 load the sketch

Select the new port that should exist: (cu.usbserial)

09 select the port

I found an issue with the default setup here where it had the built in LED set to 2. I had to change it to 1

10 switch the LED to 1

Click the upload button and watch the logs. Hopefully it should complete successfully.

11 completed upload

The ESP8266 should start blinking intermittently after.

12

Keep sketch for after restart

If you leave all of the connections in place and restart, you will lose the sketch on the ESP8266 and you will need to re-upload it.

  • Power off (remove USB)
  • Remove GPIO0 from ground (to stop programming mode)
  • Start back up and test

The ESP8266 should now work on startup. It should now blink and keep the sketch installed after any reboot.