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:
I also checked the
show verbose output during upload to show more detail for debugging purposes.
Now we need to go and download the software in the boards manager:
Find the ESP8266 community sotware and install it:
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
You may see a popup about security, depending on your settings. Allow the install via the security settings.
The installation should now 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:
Upload sketch to ESP8266
Load up the blink sketch for the ESP8266
Select the new port that should exist: (cu.usbserial)
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
Click the upload button and watch the logs. Hopefully it should complete successfully.
The ESP8266 should start blinking intermittently after.
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.