Intro to my ESP8266 adventures

Since the Arduino abstraction layer has been ported to the esp8266 I decided to get onboard and start using it for all the networking projects the arduino needs a helper to accomplish.  In short the esp8266 is a little 80Mhz 32bit microprocessor from Espressif that has built in wifi.  It’s a bit of a power hog, but other than needing chunky 3.3v power there’s really not many downsides.  The chip has a very small number of IO for those used to throwing a beagle bone or arduino mega at a problem, but being fast and having SPI or i2c means those can pretty easily be overcome.

esp8266_wide
ESP-01 module (first one people took to)

I’ve been wanting to do some home automation things for a while, and up until now I was adamant that I would run ethernet cables to wherever there needed to be sensors.  After actually trying to run power around my nice, old, heavy, plaster house I’ve found I’m not a fan of plasterwork.  I also found that even the cheapest things you can hook to ethernet are more expensive than one of these esp8266 modules (except maybe one).  There are many of these little modules out there (most using the designation esp-xx) and there are more every day.  All modules use the same chip and bootloader so any dev board could be reprpgrammed to use any code.  This means that when they start showing up in production devices that you can upload your own code to control someone else’s hardware as long as you find what pins go where.

NodeMCU_DEVKIT_1.0
NodeMCU 1.0, my board of choice

There are may ways to program the esp modules.  Lua is surprisingly popular (surprising to me) and done by the NodeMCU people.  Of course the official SDK uses C (there is, sigh, an open source version too).  There is Micro Python for the esp, but it seems very limited at this point.  I use Arduino because the library and community support for it is so easy to access.

I cribbed the part of the circuit from the NodeMCU that makes it not need buttons (resistors on underside)

My favorite (see link below and new article) board to develop on is the NodeMCU 1.0 (or V2) board, it has all the pins broken out, a nice power regulator that you can supply from USB, and a built in usb to serial converter on it.  The other thing they did was use the control lines of the usb-serial chip to hold the lines on the esp high or low as needed to program it.  I liked this behavior so much I copied that part of their schematic to my own board that takes an ftdi friend.  Unfortunately the two control lines it needs are both transmit lines and even adafruit’s ftdi friend doesn’t have solder jumpers for that so I cut a trace and bridged it myself.  My goal was to have something standards compatible and I just ended up inventing my own standard… D’oh.

The push that I needed to get going was from another blog I follow (actually probably from hackaday reposting something he did that prompted me to follow him directly).  He had been using mqtt as a transport protocol to network things together.  I like mqtt for a few reasons, not the least of which it is easy to set up on a pi.  I also like that OpenHAB has a hook for it, but seriously it has hooks for everything so that is probably going to be my main controller.  In the case you need a lot of I/O I would probably SPI/i2c slave an arduino mega and have my own transport protocol for that data (although in practice I usually use the UART SerialCommand library).  There is the ability to do it the other way around, slaving the esp to the arduino and using it as a wifi chip, but now that I’ve seen the esp in action the idea of using clunky AT commands does not appeal to me.

NodeMCU 0.9, not as breadboard friendly

There’s the layout, what my intentions are, and now come the projects.

LED Display (proof of concept)

LED Display (for i3Detroit)

Bistable relay

RTC (set by NTP)

Current sensor

Power node (integrates current reading and relay like the Ubiquiti stuff)

Flow meter (for reading water flow, hot and cold)

Sump Level (probably IR distance and potted in epoxy when done)

Temp and humidity sensor (probably an esp-01 and a dht-22)

Wall control panel v2

PIR motion sensor (same code as condensate pump alarm)

New favorite modules

Setting up a raspberry pi mqtt server to display the IP and hostname on a Nokia LCD

All my code for this stuff will be uploaded here, I already have some of these projects done and will change these listed projects to links once I’ve written the articles.

Tags:

11 Responses to “Intro to my ESP8266 adventures”

  1. ESP8266 LED Display | Evan's Techie-Blog Says:

    […] Hacks, repairs, arcade games, sci-fi, and some very bad ideas with possibly humorous consequences « Intro to my ESP8266 adventures […]

  2. ESP8266 flow meters | Evan's Techie-Blog Says:

    […] The rest of this series can be gotten through from the home page here. […]

  3. ESP8266 Temp and Humidity sensor | Evan's Techie-Blog Says:

    […] The rest of this series can be gotten through from the home page here. […]

  4. ESP8266 Bistable Relay | Evan's Techie-Blog Says:

    […] The rest of this series can be gotten through from the home page here. […]

  5. ESP8266 RTC and NTP | Evan's Techie-Blog Says:

    […] The rest of this series can be gotten through from the home page here. […]

  6. little esp modules | Evan's Techie-Blog Says:

    […] The rest of this series can be gotten through from the home page here. […]

  7. ESP8266 control panel upgrade | Evan's Techie-Blog Says:

    […] here is my hub for all things esp8266. […]

  8. ESP8266 control panel (input muxing) | Evan's Techie-Blog Says:

    […] The rest of this series can be gotten through from the home page here. […]

  9. ESP8266 control panel upgrade | Electronics Infoline Says:

    […] here is my hub for all things esp8266. […]

  10. Eco Plug (ESP8266) hack, finally! | Evan's Techie-Blog Says:

    […] The rest of this series can be gotten through from the home page here. […]

  11. Pinball 7-segment LED reverse engineering | Evan's Techie-Blog Says:

    […] looks like it could pretty easily be reverse engineered to drive with simple GPIO from, say, an esp8266.  The layout is as […]

Leave a comment