Hacker News new | past | comments | ask | show | jobs | submit login
ESP8266: A $5 microcontroller with wi-fi that runs Python (makezine.com)
286 points by rmason on Feb 22, 2016 | hide | past | favorite | 78 comments

A related crowdfunding project to facilitate MicroPython with this chip has already passed funding goals: https://www.kickstarter.com/projects/214379695/micropython-o...

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

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

Yup, NodeMCU is really easy. I used it to make a Philipps Hue clone. https://github.com/christophesmet/ledsgetIton

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

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

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...) or NodeMCU (http://www.ebay.com/itm/NodeMCU-LUA-WIFI-Internet-Developmen...), 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...). 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:


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.

So I agree that the WeMos Mini is definitely what you should buy, but the bare chips aren't that bad to work with. I've done quite a few and I usually just solder wires to each pad on the chip and then solder the other end(s) to a breadboard (something like this http://www.instructables.com/id/Getting-Started-with-the-ESP... ).

You also have to pull up CH_PD and pull down GPIO15, plus usually include a voltage regulator and/or smoothing cap, which adds enough hassle that WeMos is definitely worthwhile, but it's not really that bad if you only have the bare modules.

That's true, but you need to solder, as you say, six resistors and and a capacitor, which quickly becomes a tangle of wires. I prefer breakouts just because they're a very cheap and good way to avoid this.

Just two resistors works or three if you want deep sleep. Some people recommend pulling up/down some of the other pins, but it's always worked fine for me to leave them floating. I tend to do those with solder bridges instead of wires, so it doesn't get too messy. I also usually put an LDO regulator on the power input since I have more 5V supplies on hand and I skip the smoothing cap. The output from the regulators I use is plenty smooth and it works OK.

The WeMos is infinitely easier, especially because it has the FTDI chip built in, but it's not terrible to use the bare modules. I got on the ESP8266 bandwagon fairly early, so I got used to working with the bare modules since they were all I could get.

Yeah, I usually add the rest as well, for stability. I don't really use the FTDI programmer as programming it over the air is faster and more convenient.

Heh, similarly I haven't done much with the OTA programming because I keep my ESPs on an isolated WiFi network and it's a pain in the arse to access them directly from my workstation.

Ah, you're missing out, I love OTA. Very fast, and you don't need to move the ESP at all (if it's on the same network, anyway :P). Plus, you can keep the serial line open for debugging while flashing.

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) 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/

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.

No onboard USB kills it for me, especially at that price point. For something in that price range, I'm more interested in the ESP-210 - it's tiny and has USB-Serial built in.

Nice prototyping board! We've been working on a similar concept at ESProto - http://www.esproto.com/ - and have taken a few steps beyond your board. We've created the ESProto 1, and now the ESProto IoT. Both are being released as open source, and also sold as kits.

The ESProto 1 is designed to support the AI Thinker ESP-12F (FCC Certified) module, and give you space for an optional regulator, and prototyping space on board. We include jumpers and a push button for easily entering programming mode.

The ESProto IoT is our newest prototyping board, and couples the ESP-12F with a 5v Arduino Pro Mini to provide enhanced connectivity for sensors and peripherals, all in the form factor of the Arduino Uno.

Both boards use external USB for programming.

These things are too cool, and too much fun!

That looks interesting, but I can't find much information on your site, it seems to be a stockish install. Is there any more info somewhere?

Yes ... the website is a "work in progress" and we just got our second round of PCBs that we are testing. We're pushing to get the kits up there in the next couple of weeks.

In the mean time, the Github repo is at: https://github.com/Wovyn

We've got the initial KiCAD files up there, and are putting together our sample code, etc.

Very nice, I'm going to look at the files right now, thanks for making the available!

I used the bigger NodeMCU but WeMos D1 Mini is awesome. If you want to tinker and create a custom compact unit, consider buying a few copies of the "ESP8266 WeMos shield" from OSHPark: http://oshpark.com/shared_projects/rnk2lmmh

More info at: http://github.com/hallard/WeMos-shield

Have you tried the Olimex version as linked in the article? https://www.olimex.com/Products/IoT/MOD-WIFI-ESP8266-DEV/ope... I've purchased a few Olimex boards in the past and I've greatly enjoyed them.

I haven't, but it looks very interesting, thank you!

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

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

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 :)

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.

The demos look impressive, I urge everyone to back this project:


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

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.

You can even broadcast analog NTSC with it.


FYI ESP8266 doesn't run Python, but it runs MicroPython: https://github.com/micropython/micropython

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.

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

There is an excellent project named PlatformIO to program this and other chips: http://platformio.org/

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

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

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.

> 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

Yes, would be nice if you could connect it to aws iot. Any chances amazon would add tls 1.1, or would that maybe jeopardize their security certifications? (https://aws.amazon.com/compliance/published-certifications/)

you could always try it on Azure assuming you haven't built a ton out in AWS already...

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.

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/

If you're looking for improved TLS support, have a peek at esp-open-rtos[1], which is a re-implementation of the Espressif provided rtos sdk and is aiming to be fully open source. It ships with the mbed TLS implementation, which supports TLS 1.2.

[1] https://github.com/SuperHouse/esp-open-rtos

Assuming you're talking to your own server (or even mobile app), why not go with something lighter than full TLS?

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

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

[2] http://www.averagemanvsraspberrypi.com/2015/11/esp8266-node-...

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

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


The future is filled with tiny wifi devices!

And tinfoil, to isolate yourself from interference from external signals as everyone starts having 20+ Wi-Fi-connected devices in their homes ;). But yeah, I like how cheap wireless is now, it simplifies a lot of things.

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

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: (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.

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

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

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


cool chip! I can't find the SRAM size, anybody has an idea?https://nurdspace.nl/images/e/e0/ESP8266_Specifications_Engl...

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

64 KiB of instruction RAM, 96 KiB of data RAM 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.

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.

Thanks for the clarification!

The ESP8266 allows you to map up to 1MB of the attached SPI flash into memory and run code from it, at somewhat of a performance penalty compared to running from RAM. Some of the older modules don't have that much flash onboard though.

Very little, around 60kB free if writing programs in C language.

That's loads. Seriously, it's a huge amount. Most other comparable microcontrollers have about 2kB.

Interestingly, it looks like this is a von Neumann device! Which means that code and data live in the same address space. Memory map here:


Looks like it's got a whopping great 512kB internal SPI ROM device too, and indications are that it's reprogrammable.

You could totally run a unix on this; I've ported Alan Cox's Fuzix to the MSP430, which is substantially lower specced. Without an MMU you probably wouldn't get preemptive task-swapping, but Fuzix runs beautifully in cooperative multitasking mode. You even get the real Bourne shell (written by Bourne) and pipes.


Very tangentially related, but: if FRAM on the MSP430 saves its state on power loss, my mind went straight to Smalltalk. It's like hardware support for saving an image. Tho from an efficiency standpoint, smalltalk might be pushing it more than MicroPython is. That, and a smalltalk editor on a machine too small to fit a vi clone might be even more of a stretch. lol.

That's a very interesting idea. The smallest real Smalltalk I've seen ran on the 286 in protected mode. It's the only app I've ever seen that actually used segmentation usefully --- each object had its own segment descriptor, so it was limited to about 32768 objects. That's still way more than will fit in an MSP430.

[Aside: I wish they made MSP430s with more RAM. It's a lovely architecture, and I'm not just saying that because I'm sick and twisted and like devices with 20-bit registers. An MSP430 with a whole megabyte of RAM would be awesome.]

I do know of Timothy Budd's Little Smalltalk, which is an ultra-lightweight pedagogical Smalltalkish, which has a core image of ~90kB and 3500 objects; but that's still rather big...

How much you get depends on the version you get. The memory is external and some come with 512kB, some come with 4096kB.

cf https://gist.github.com/Coaxial/268c4198d09c2a712387 for flash and RAM for mos (all?) currently available ESP8266 versions

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.

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/

There was a good talk about these at LinuxConf AU: http://mirror.linux.org.au/linux.conf.au/2016/05_Friday/Wool...

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

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

Yes it can do these

Do you know if it can do promiscuous mode?

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

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?

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.

By "tracking", do you mean being able to check remotely where your pet currently is, or simply record its current location to some kind of storage, and being able to review that once you have physical access to the device? I.e. are you concerned about your pet getting lost, or do you just want to know where it has been?

If it's about remotely checking, then you will need some kind of communication, which is most likely going to be cell phone related (i.e. GSM, UMTS, LTS...). A GPS device does not send anything to the satellites, it merely (as a simplified explanation) receives time codes from multiple satellites and triangulates the current position from that.

If you only want to record, then GPS alone would be fine, obviously. Though there is "Assisted GPS" that makes use of cell phone technology to increase the accuracy/decreases the triangulation time. However, I do not know whether that can be leveraged from standalone GPS modules.

Have a look at goTenna (http://www.gotenna.com/). It uses 151-154 MHz radio waves to communicate upto 4 miles. Doesn't require mobile network. It's probably too large for your requirement, but may give you some ideas to DIY or adapt its PCB.

That's going to be a module, or set of modules, not a single chip. Doubt you'd get cell service in middle of nowhere Wyoming.

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


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

Sure. What latency do you need?

If you don't have any cycles (and disable mark/sweep), Python's reference counting will be deterministic. However, I doubt this implementation will be able to offer real-time capability :)

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact