
ESP8266: A $5 microcontroller with wi-fi that runs Python - rmason
http://makezine.com/2015/04/01/esp8266-5-microcontroller-wi-fi-now-arduino-compatible/
======
Dowwie
A related crowdfunding project to facilitate MicroPython with this chip has
already passed funding goals:
[https://www.kickstarter.com/projects/214379695/micropython-o...](https://www.kickstarter.com/projects/214379695/micropython-
on-the-esp8266-beautifully-easy-iot/posts/1485145)

The new ESP8266 source code will be made available on GitHub right after the
crowdfunding campaign closes..

------
kickscondor
The ESP also runs Lua (by way of NodeMCU), JavaScript (Smart.js, Espruino and
JerryScript), Lisp ([https://github.com/yesco/esp-
lisp](https://github.com/yesco/esp-lisp)) and even a form of BASIC
([http://www.esp8266basic.com/language-
reference.html](http://www.esp8266basic.com/language-reference.html)). I'm
sure more are out there - seems like something new pops up every few days.

~~~
ParanoidShroom
Yup, NodeMCU is really easy. I used it to make a Philipps Hue clone.
[https://github.com/christophesmet/ledsgetIton](https://github.com/christophesmet/ledsgetIton)

It's surprisingly easy connect to a WiFi and get a TCP server running

~~~
ochoseis
FWIW - There was a related project front page a few weeks back talking about
this:
[https://news.ycombinator.com/item?id=10899798](https://news.ycombinator.com/item?id=10899798)

------
StavrosK
By the way, I have to warn people who are thinking about trying this chip (as
I have done in other comments):

The bare chip won't be very useful to you, unless you want to design your own
PCB. Instead, I would recommend a breakout board. There are two major types:

Something like the WeMos D1 Mini ([http://www.aliexpress.com/item/D1-mini-
Mini-NodeMcu-4M-bytes...](http://www.aliexpress.com/item/D1-mini-Mini-
NodeMcu-4M-bytes-Lua-WIFI-Internet-of-Things-development-board-based-
ESP8266/32529101036.html)) or NodeMCU ([http://www.ebay.com/itm/NodeMCU-LUA-
WIFI-Internet-Developmen...](http://www.ebay.com/itm/NodeMCU-LUA-WIFI-
Internet-Development-Board-Based-on-ESP8266-/291505733201)), which are very
full-featured and include onboard USB programmers and fancy things like that,
but are a bit bulky. The NodeMCU I linked is solid, the WeMos is also great as
it's much smaller and only includes the useful pins.

The alternative is a bare breakout board, which is the minimum that you need
to make the ESP breadboard-friendly and so you don't have to solder a bunch of
resistors on the chip. This is best when you want to work at a lower level,
and have the minimum hardware required for the ESP to work on the board, with
everything else going in your circuit.

There are breakout boards on ebay like this one
([http://www.ebay.com/itm/1Set-ESP8266-WiFi-Module-Breakout-
Bo...](http://www.ebay.com/itm/1Set-ESP8266-WiFi-Module-Breakout-Board-
Adapter-Plate-for-ESP-07-ESP-08-ESP-12-/181784198861)). STAY AWAY FROM THESE.
They don't include all the necessary components, so the ESP won't work
reliably without extra pullups, and they take up the entire breadboard space.

Because I was burnt by these, I designed my own and made it open-source:

[https://github.com/skorokithakis/tiny-
ESP8266-breakout](https://github.com/skorokithakis/tiny-ESP8266-breakout)

It's easier to work with, leaves room on the breadboard and includes all
necessary resistors/caps and an optional voltage regulator. It's also very
small. There's a dirtypcbs link on the github repo so you can just order 40 of
these for $14 if you like, or you can just download the KiCad schematics
(KiCad is awesome and open-source) and get it fabricated at your favorite PCB
house.

Back to our regularly scheduled programming. Feel free to copy/paste this
comment whenever there's an ESP discussion, I think it's a good primer for
people who don't have ESP experience.

~~~
SEJeff
How can you forget something like the Adafruit Huzzah[1]? It is so nice with
the ESP8266. We use it in home-assistant ([http://home-
assistant.io](http://home-assistant.io)) for things like this temperature
sensor[2].

    
    
        [1] https://www.adafruit.com/products/2471
        [2] https://home-assistant.io/blog/2015/10/11/measure-temperature-with-esp8266-and-report-to-mqtt/

~~~
StavrosK
I forgot it because I don't have one :-P I think the wemos is better, to be
honest. About the same size, half price and includes an FTDI chip just in
case.

------
robert_foss
I've personally built hardware[1] and software[2] around the ESP8266 and it is
a wonderful little chip. The low price point ($2 including shipping from
China) and the very active community around it really makes it stand out.

[1]
[http://memcpy.io/esp8266-apa102-bulb.html](http://memcpy.io/esp8266-apa102-bulb.html)

[2] [http://memcpy.io/user-friendly-setup-of-
esp8266-gadgets.html](http://memcpy.io/user-friendly-setup-of-
esp8266-gadgets.html)

------
zw123456
I have actually done a fair bit of dev work on this chip (a custom C++ IDE),
it is a neat little device, with the emphasis on little. That is both a plus
and a minus. Plus, it is cheap, minus, it is little, not a lot of processing
power there. (forget Python if you are doing anything serious).

The way I worked around it is put all the processing in the cloud and
basically the vpn passes straight through it. Interestingly, it actually is
being used in a number of consumer products, but for very basic iot apps (I
believe there is a wifi enable light socket and an automobile ODB link device
things like that).

Fun device to mess with :)

~~~
dbcurtis
Have you even tried MicroPython on it? Granted, you need to consider
performance -- where you need it, and where you don't. But is is quite easy in
MicroPython to create a C-extension module for performance critical
components, and have the luxury of a Python REPL loop for debugging high-level
logic.

~~~
zw123456
Interesting idea. The client wanted C, but that could make dev work easier
perhaps.

~~~
nathancahill
Great, but don't say "forget Python if you are doing anything serious", unless
you just read the title and not the article. The article pretty clearly talks
about MicroPython.

------
ff7f00
You can even broadcast analog NTSC with it.

[http://www.rtl-sdr.com/broadcasting-color-analgoue-ntsc-
tv-w...](http://www.rtl-sdr.com/broadcasting-color-analgoue-ntsc-tv-with-an-
esp8266/)

------
ptspts
FYI ESP8266 doesn't run Python, but it runs MicroPython:
[https://github.com/micropython/micropython](https://github.com/micropython/micropython)

~~~
dbcurtis
I have some experience using MicroPython on the PyBoard (not the ESP8266).
MicroPython is a very nice implementation of Python 3.X. A few differences
because of the need to be _extremely_ parsimonious with RAM usage -- mostly
only noticed if trying to inherit from built-in types. Nothing that is onerous
to avoid. MicroPython is an outstandingly good project IMHO, with a great
community.

~~~
ntoll
Damien George, the creator of MicroPython, is an extraordinarily talented
individual. He's also extraordinarily generous having volunteered a
substantial block of time and effort to get MicroPython running on the
upcoming BBC micro:bit (a million of which will be delivered to the UK's 11 &
12 year olds).

------
coaxial
There is an excellent project named PlatformIO to program this and other
chips: [http://platformio.org/](http://platformio.org/)

A ton of work went into it and setting up the toolchain is as simple as `pip
install -U platformio`.

~~~
StavrosK
I consider PlatformIO a must have at this point. It's made code deployment so
much more easier and scriptable, I love it.

------
rocketcity
Now all we need is for AWS IoT to support TLS 1.1 with symmetric keys.
Currently the ESP8266 arduino libraries only support TLS 1.1 which is not
compatible with the TLS 1.2 minimum for AWS IoT. I am super excited for this
board and would love to be able to kick of lambda functions automatically in
response to device events. If anyone from the IoT team comes across this
please make this a priority, all of us makers will thank you.

~~~
jjawssd
> Now all we need is for AWS IoT to support TLS 1.1 with symmetric keys.

Making the ESP8266 libraries support TLS 1.2 is a better idea

~~~
ecesena
Discussion here:
[https://github.com/esp8266/Arduino/issues/43](https://github.com/esp8266/Arduino/issues/43)

------
thechut
While this is a very cool chip for hobbyists, it is quite hard to do real TLS
with this chip making it basically useless for commercial applications.

It CAN do TLS but it leaves very little left over if you have any kind of real
business logic.

~~~
simcop2387
TLS is one of the reasons I'm really hopeful for the ESP32 that's supposed to
have a good bit of hardware help for doing TLS and such.
[http://esp32.net/](http://esp32.net/)

------
ochoseis
I feel like the title is a misnomer given the article is called "ESP8266: This
$5 Microcontroller with Wi-Fi is now Arduino-Compatible," and on that front
it's really easy to get started with these [0]! ESP8266 boards abound on
AliExpress, the easiest of which to get started with are NodeMCU variants. One
example with seemingly good documentation is the Wemos D1 Mini [1] that comes
with a USB-to-serial chip onboard. Here's another decent reference I found to
getting started with them [2].

[0] GitHub repo for plugging into the Arduino IDE:
[https://github.com/esp8266/Arduino](https://github.com/esp8266/Arduino)

[1]
[http://www.wemos.cc/wiki/doku.php?id=en:d1_mini](http://www.wemos.cc/wiki/doku.php?id=en:d1_mini)

[2]
[http://www.averagemanvsraspberrypi.com/2015/11/esp8266-node-...](http://www.averagemanvsraspberrypi.com/2015/11/esp8266-node-
mcu-setup.html)

------
paddi91
If you're looking for great projects with the ESP8266 have a look at
[https://aisler.net/search?query=ESP8266](https://aisler.net/search?query=ESP8266)

------
ck2
Somewhat remotely related, I've been playing with this tiny wifi router on a
usb stick for a week now with OpenWRT and it is amazing for $10

[https://wiki.hackerspace.pl/projects:zsun-wifi-card-
reader](https://wiki.hackerspace.pl/projects:zsun-wifi-card-reader)

The future is filled with tiny wifi devices!

~~~
Relys
I ordered a couple of these as well but GearBest is taking their sweet time
shipping...

~~~
ck2
It's that Chinese spring holiday I think?

Though mine seems to have come from Singapore.

Once you get a tracking number you can enter it into this box and see the
progress until it gets on a cargo ship:

[http://113.105.65.70:8032/xflquery.aspx](http://113.105.65.70:8032/xflquery.aspx)
(use chrome translate)

The number they give you will also work in DHL tracking system.

Mine took 48 hours to ship and then 17-18 days to get here.

The tracking stops once it hits the ocean though, blind from there.

~~~
Relys
Thanks for the reply. After a month I ended up canceling my order. I'll just
pay a bit extra from Amazon.

------
yanovskishai
I advice checking out this tutorial
[http://www.whatimade.today/esp8266-easiest-way-to-program-
so...](http://www.whatimade.today/esp8266-easiest-way-to-program-so-far/) I
found it very helpful

------
yitchelle
Neil Kolban has written a nice book on this if you want to do some initial
research before taking the plunge on this device.

[https://leanpub.com/ESP8266_ESP32](https://leanpub.com/ESP8266_ESP32)

------
headgasket
cool chip! I can't find the SRAM size, anybody has an
idea?[https://nurdspace.nl/images/e/e0/ESP8266_Specifications_Engl...](https://nurdspace.nl/images/e/e0/ESP8266_Specifications_English.pdf)

EDIT: 2015 article, maybe put that in the title?

~~~
windexh8er
64 KiB of instruction RAM, 96 KiB of data RAM
[https://en.wikipedia.org/wiki/ESP8266](https://en.wikipedia.org/wiki/ESP8266)

For whatever reason the Make dead-tree-edition of the original article posted
has a "Table of Boards" in it and they list the ESP8266 as having 1MB of
"Memory".

It's also a new article. It's recently run in the February/March 2016 edition
of Make: Super (Cheap) Computers.

Edit: While the OPs link is not the new article, it is in the current edition
of Make. I was /confused as I had picked it up in the airport and was looking
into the ESP8266 referenced in it.

~~~
simcop2387
The 1MB is likely referring to the SPI flash device that the ESP-01 modules
use. Many of the other boards feature larger SPI flash chips up to 4MB, and I
believe it's possible in theory to boot of an SD card with them too if you
remove the flash chip.

~~~
windexh8er
Thanks for the clarification!

------
julian_1
Esp8266 also runs Lua, which provides first-class co-operative co-routines and
is a really nice way to do cooperative multi-tasking.

I've been playing with a Esp8266 NodeMCU configuration where one co-rountine
monitors and maintains the wired-access connection, another CR blinks the
activity led on a timer, and another presents a telnet-like command interface
listening on a tcp/ip socket.

The entire OS layer has been avoided, yet there is almost no loss of
functionality.

------
canadaduane
I'm working on an ESP8266-to-Arduino bridge much like the GrovePi project. If
you're interested in driving 5V sensors or actuators, or getting more digital
or analog pins, it will be useful: [http://www.esproto.com/2016/02/20/esproto-
iot-coming-soon/](http://www.esproto.com/2016/02/20/esproto-iot-coming-soon/)

------
nickzoic
There was a good talk about these at LinuxConf AU:
[http://mirror.linux.org.au/linux.conf.au/2016/05_Friday/Wool...](http://mirror.linux.org.au/linux.conf.au/2016/05_Friday/Wool_Museum/Free_as_in_cheap_gadgets_the_ESP8266.webm)

... they're a very exciting device and incredibly cheap, and the supplied SDK
libs look very nice, even though they aren't quite fully open source.

The NodeMCU boards are very useful even if you're not interested in Lua, they
add power, USB and breadboard friendly headers in a smallish package.

I've started messing around with different ways to program them for
educational purposes: [http://nick.zoic.org/etc/flobot-graphical-dataflow-
language-...](http://nick.zoic.org/etc/flobot-graphical-dataflow-language-for-
robots/)

------
theophrastus
"with Wi-Fi"-onna-chip always has me wonder: can it handle wireless security
(WEP, WPA, WPA2, ..)? because having to dedicate an open access point is often
prohibitive.

~~~
coaxial
Yes it can do these

~~~
nolite
Do you know if it can do promiscuous mode?

~~~
makomk
In theory it can, though you might need to downgrade to an older SDK version.

------
mmanfrin
Question to those who know the landscape of little microcontrollers well: if I
wanted to build a small pet tracking chip (gps and cell, probably) that would
work way out in the boonies (like middle-of-nowhere-Wyoming), where should I
look? Am I right to be thinking gps+cell, or is this something where I could
get away with just GPS (and somehow track where that GPS is pinging from)?

And would something like a tumble generator provide enough power?

~~~
Gibbon1
I think there are dog trackers on the market that use GPS + Cell. At least
there are motorcycle trackers.

Generally the problem with WiFi is if it's close enough to work the dog can
usually hear you. You could use a directional antenna but an extra 10db isn't
going to buy you much. And at 2.4GHZ WiFi gets attenuated rapidly when not
line of sight. Same is true for anything else in the 900MHz/ 2.4GHZ bands.
Cellular gets around this by putting their antennas up high to clear local
clutter (buildings, trees, hills, etc).

Problem with Cellular is the power drain and the monthly bill. On the other
hand, probably will work. Cellular coverage is pretty good everywhere now. If
you want to mess about I think there are modules with Cellular and GPS.

You also might be able to use a 900MHz solution[1] where you just send a ping
of the GPS coordinates every so often. If you up the power to the max allowed
(Like 20-30db) and drop the data rate down to a few hundred/thousand bits per
second. You could probably go two to three miles. I think your current choices
here are some sort of FSK radio or the newer LoRa radio. The reason is FSK
radios and LoRa both allow you to turn the bandwidth way way down. The lower
the bandwidth the better the signal to noise for the same transmit power.

[1] The lower the transmit frequency better it will propagate through clutter
on the ground. But lower frequency means a bigger antenna.

PS: If you're messing with RF using module or manufactures dev board is the
way to go. It's very hard to tune the RF path and antenna without experience
and a spectrum analyzer.

PSS: I've found the transceivers from SemTech to be pretty bulletproof. They
have their own power regulators on board which makes them insensitive to being
powered by crappy supplies.

------
donpdonp
also note that an upgraded part, the ESP32 is in the works from the same
manufacturer.

[http://makezine.com/2015/12/09/meet-esp32-new-big-brother-
to...](http://makezine.com/2015/12/09/meet-esp32-new-big-brother-to-iot-board-
esp8266/)

------
forgotAgain
Is it possible to do real time programming in a garbage collected language?

~~~
HeyLaughingBoy
Sure. What latency do you need?

