Thursday, 4 February 2016

Getting started with the Pimoroni ESP8266 IOT pHAT

The ESP8266 pHAT from Pimoroni for adding wifi to your Raspberry Pi projects.  Here's a brief 'quick-start guide'. If you're going to use the pHAT on a Pi Zero, it can be easier to do the config on a full-size Pi then just transfer the pHAT and SD card when you're all done.

1. Start with a fresh install of Jessie

2. sudo apt-get update

3. sudo apt-get upgrade

4. sudo apt-get install minicom

5. We need to stop the Pi using the Serial port for console messages. Edit /boot/cmdline.txt to remove 'console=ttyAMA0' from the line. You should be left with:

dwc_otg.lpm_enable=0  console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

6. sudo raspi-config. Go to Advanced Options => Serial and set it to disabled.

7. Shutdown the Pi

8. Solder the header onto the pHAT. Attach to the Pi and power up.

9. Now we can connect to the ESP8266 via a serial connection. Run minicom -b 115200 -o -D /dev/ttyAMA0

10. To test, type


and hit enter/return as normal. Then type ctrl+j 

You should see the reply OK

11. Now you can start putting the ESP8266 to work. There's a useful list of AT commands here, but to get started try:


which will list all the wifi Access Points that it can see.

12. To connect to one:


Obviously replace SSID and password of the network you're trying to connect to!

13. Then find your IP address


To disconnect for the AP, type


Don't forget the ctrl-j after each command. 

To quit minicom, type ctrl+a then q

14 As a more advanced test, you can set up your Pi as a simple web server.  Download this really useful python code:

 git clone

Then change into that directory and run the server code

python /dev/ttyAMA0 115200 "SSID" "password"

You should see a whole bunch of familiar AT commands being executed. When everything has finished, fire up your web browser and connect to the IP address just allocated to your PI/ESP8266.

You should see the system date displayed:

Once you're finished developing, transfer everything over to your Pi Zero.



  1. The following forum posts explains how to set minicom to send the linefeed (ctrl-j)

    Basically press ctrl-a, z, then a

  2. I dropped minicom long time ago for screen:

    screen /dev/ttyUSB0 115200

    It made my life way simpler.

  3. Great guide. I have followed all steps and everything works until I try the example server code, connection to my WiFi router completes but when I try and browser to the IP address nothing is returned (browser times-out).

  4. Great post Richard. It inspired me to continue your work and write a post on how to flash the firmware on the pHAT:

  5. after I typed "AT+CWMODE=1" the esp8266 disappeared from my wifi devices and all i get is error messages from minicom. I do not know what happened. Is there any way to reset it? It is now not getting recognized by any of my Pi's.