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 fsck.repair=yes 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

AT

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:

AT+CWMODE=1
AT+CWLAP

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


12. To connect to one:

AT+CWJAP="SSID","password"



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

13. Then find your IP address

AT+CIFSR



To disconnect for the AP, type

AT+CWQAP

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 https://github.com/guyz/pyesp8266.git

Then change into that directory and run the server code

python esp8266server.py /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.



  

90 comments:

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

    Basically press ctrl-a, z, then a

    http://arstechnica.com/civis/viewtopic.php?f=20&t=566236

    ReplyDelete
    Replies
    1. IEEE Final Year projects Project Centers in Chennai are consistently sought after. Final Year Students Projects take a shot at them to improve their aptitudes. IEEE Final Year project centers ground for all fragments of CSE & IT engineers hoping to assemble.Final Year Projects for CSE

      Spring Framework has already made serious inroads as an integrated technology stack for building user-facing applications. Spring Framework Corporate TRaining .

      Specifically, Spring Framework provides various tasks are geared around preparing data for further analysis and visualization. Spring Training in Chennai

      The Angular Training covers a wide range of topics including Angular Directives, Angular Services, and Angular programmability.Angular Training

      Delete
  2. I dropped minicom long time ago for screen:

    screen /dev/ttyUSB0 115200

    It made my life way simpler.

    ReplyDelete
  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).

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

    http://paulbyford.blogspot.co.uk/2016/03/updating-firmware-on-pimoroni-esp8266.html

    ReplyDelete
  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.

    ReplyDelete
  6. I get nothing. I followed the instructions and when I get to minicom, it comes up and I get nothing but help screens and other things pop up, no communication though. I went to the update firmware page and the reset.py script causes lights on the esp8266 but I get no indication of any kind in minicom. Across the bottom of minicom is 115200 8n1 | vt102 | offline | ttyAMA0

    ReplyDelete
  7. I wish to indicate because of you only to bail me out of this specific trouble. As a consequence of checking through the net and meeting systems that were not beneficial, I thought my life was finished.fire and safety course in chennai

    ReplyDelete
  8. Thank you so much for sharing this worth able content with us. The concept taken here will be useful for my future programs and I will surely implement them in my study. Keep blogging article like this.
    offshore safety course in chennai

    ReplyDelete
  9. I accept there are numerous more pleasurable open doors ahead for people that took a gander at your site.
    safety course in chennai

    ReplyDelete
  10. I was curious if you ever considered changing the layout of your site? It’s very well written; I love what you’ve got to say.
    nebosh course in chennai

    ReplyDelete
  11. Hello. This post couldn’t be written any better! Reading this post reminds me of my previous roommate. He always kept chatting about this.
    fire and safety course in chennai

    ReplyDelete
  12. Excellent Blog. I really want to admire the quality of this post. I like the way of your presentation of ideas, views and valuable content. No doubt you are doing great work. I’ll be waiting for your next post. Thanks .Keep it up!
    Kindly visit us @
    Luxury Boxes
    Premium Packaging
    Luxury Candles Box
    Earphone Packaging Box
    Wireless Headphone Box
    Innovative Packaging Boxes
    Wedding gift box
    Leather Bag Packaging Box
    Cosmetics Packaging Box
    Luxury Chocolate Boxes

    ReplyDelete
  13. Thanks for this amazing blog, I really appreciate with your blog. Ogen Infosystem provides one of the best Website Designing Services in Delhi.
    Website Designing Company

    ReplyDelete
  14. Aw, this was an incredibly nice post. Taking the time and actual effort to produce a really good article… but what can I say… I hesitate a lot and don't manage to get nearly anything done.
    kbc official winner

    ReplyDelete
  15. Hello Admin!

    Thanks for the post. It was very interesting and meaningful. I really appreciate it! Keep updating stuffs like this. If you are looking for the Advertising Agency in Chennai | Printing in Chennai , Visit Inoventic Creative Agency Today..

    ReplyDelete
  16. I really love your website.. Pleasant colors & theme. Did you create this website yourself? Please reply back as I’m wanting to create my very own blog and want to know where you got this from or just what the theme is named. Thanks! KBC Head Office Number

    ReplyDelete
  17. I am virtually impressed about the data you provide for your article. I have to say am enormously crushed by your whole story. It’s not easy to get such exceptional statistics these days. I sit up for staying right here for a long term.

    office.com/setup
    mcafee.com/activate

    ReplyDelete
  18. A backlink is a link created when one website links to another. Backlinks are important to SEO & impact for higher ranking. In my 7+ years seo Career i see, without backlinks a website doesn't rank higher on google SERP.

    Get Your 300+ High Quality DoFollow Backlinks Here!

    Order Now with Full Confidence & 100% satisfaction.

    ReplyDelete
  19. Oh my goodness! Incredible article dude! Many thanks, However I am encountering issues with your RSS. I don’t know the reason why I can't subscribe to it. Is there anybody else having the same RSS problems? Anyone that knows the answer can you kindly respond? Thanks!!
    Spot on with this write-up, I truly believe that this amazing site needs much more attention. I’ll probably be returning to read through more, thanks for the information!
    KBC Lottery Winner
    KBC Lottery Winner 2020
    KBC Winner List
    KBC Winner List 2020
    KBC Winner
    KBC Winner 2020
    kbc Lottery Winner 2020 List Today

    ReplyDelete
  20. Forex Signals, MT4 and MT5 Indicators, Strategies, Expert Advisors, Forex News, Technical Analysis and Trade Updates in the FOREX IN WORLD

    Forex Signals Forex Strategies Forex Indicators Forex News Forex World

    ReplyDelete
  21. Shield Security Solutions Provides Ontario Security Training, Security Guard License or Security License in Ontario. Get Started Today

    ReplyDelete
  22. The great website and information shared are also very appreciable. Black Parade Jacket

    ReplyDelete
  23. I am very much pleased with the contents you have mentioned. I wanted to thank you for this great article.
    Blade Runner 2049 Coat

    ReplyDelete
  24. Our the purpose is to share the reviews about the latest Jackets,Coats and Vests also share the related Movies,Gaming, Casual,Faux Leather and Leather materials available Indiana Jones Leather Jacket

    ReplyDelete
  25. Mostly I use to read the blogs and informative article on daily bases, but today i found your blog very interesting and unique, providing the information and helpful to others. Keep it up and waiting for your new updates thanks. We offer multiple services in digital marketing, some of our services are:

    Digital marketing Company in Delhi
    SMM Services
    PPC Services in Delhi
    Website Design & Development Packages
    SEO Services Packages
    Local SEO services
    E-mail marketing services
    YouTube plans

    ReplyDelete
  26. Nice Blog !
    Here We are Specialist in Manufacturing of Movies, Gaming, Casual, Faux Leather Jackets, Coats And Vests See Jim Morrison Leather Jacket

    ReplyDelete
  27. Nice Blog !
    Here We are Specialist in Manufacturing of Movies, Gaming, Casual, Faux Leather Jackets, Coats And Vests See Jim Morrison Leather Jacket

    ReplyDelete
  28. There are many marketplaces for buying and selling second hand mobile phones. But Quikads is a more used and best classified ads platform known as Second hand mobile market in Dhaka. In this market you will find all of your needs as electronics, home and decors, beauty & fitness vehicles and etc products.

    ReplyDelete
  29. This blog was very nicely formatted; it maintained a flow from the first word to the last. First Aid Usmle

    ReplyDelete
  30. The Great Packaging Ninjas Company (GPNC) is a USA company that manufactures custom and stock corrugated boxes, point-of-purchase displays, digital print and packaging, labels and flexible packaging, folding cartons, and protective packaging. The company also distributes shipping and moving supplies. We make exclusive Custom Candle Boxes in almost all the sizes and shapes you cannot even imagine. We have a wide range of custom sizes available for Candle Packaging Boxes; you have the liberty to choose among all or you can also get your Custom Printed Boxes size just as you want.

    CBD Bath Bomb Boxes
    Custom Kraft Boxes
    Custom Soap Boxes
    Custom pillow boxes
    Custom Sleeve boxes

    ReplyDelete
  31. I have 901N Router I make this one like to use as a mini firewall I used this router at least one year as a firewall but now this router stop working i tried several MS but can't fix this Mad Sweeney Denim Jacket

    ReplyDelete
  32. Thanks for being an employee who is as hungry for challenges and excellence as much as for recognition and promotions.
    Thank you for the fantastic blog you have been doing. Virgin River Coat

    ReplyDelete
  33. Looking so yummy. I will try your this recipe for sure. Check this amazing Tate Langdon Striped Sweater available in discount.

    ReplyDelete
  34. Bravo! Can you please also right such amazing posts related to mobile app development, we are emerging in the same domain contact us for more info and collaboration. For more details, visit top mobile app development company or contact us: +91-9717270746 or email us: sales@appsquadz.com

    ReplyDelete
  35. Famous Jacket selling the best Ray Fisher Jacket SHOP NOW......

    ReplyDelete
  36. Such a amazing content thanks
    we believe in what is shown must have given to the customers because product material matters the most so give a moment and check WandaVision Outfits

    ReplyDelete
  37. Thanks for sharing this articles this is really helpful for me. Check this amazing Men Daily Wear Leather Jacket available in special discount and with free shipping as well.

    ReplyDelete
  38. I think this is a very informative post and it is very useful and knowledgeable. Therefore, I would like to thank you for the efforts you have made in writing this post. Learn how to make an app like uber in android.

    ReplyDelete
  39. If you want to purchase flowers for any occassion here is flower bouquet online delivery service in UK.

    ReplyDelete
  40. You’re so interesting! I don’t believe I’ve truly read something like this before. So great to find someone with genuine thoughts on this issue. Really.. many thanks for starting this up. This website is something that’s needed on the internet, someone with some originality!

    CBSE Schools In Srikakulam
    CBSE Schools In Tirupati
    CBSE Schools In Vijayawada
    CBSE Schools In Visakhapatnam
    CBSE Schools In Vizianagaram
    CBSE Schools In West Godavari
    CBSE Schools In Hyderabad
    CBSE Schools In Adilabad
    CBSE Schools In Ameenpur
    CBSE Schools In Ameerpet

    ReplyDelete
  41. Appslure is an award-winning mobile app development agency building feature-packed and interactive mobile applications for startups, medium and large enterprises.

    ReplyDelete