These days, connecting your microcontroller project to a WiFi network is pretty easy — you connect up an ESP8266 to your microcontroller project and pretend it’s a WiFi modem, using these old-school-style AT commands. But what do you do if you need to flash new code into the microcontroller? You can’t reprogram the micro remotely through the ESP8266 because those stupid AT commands get in the way.
The solution? By flashing the esp-link firmware into your ESP8266, you talk directly to the microcontroller over WiFi as if it were connected by a serial cable: the ESP8266 becomes a totally transparent WiFi-serial bridge. Now, with a serial bootloader and an ESP8266 in Wifi-to-serial bridge mode, you can reflash your microcontroller wirelessly, and then telnet in to interact with and debug the system remotely. Once you’ve fixed the bugs, you can re-flash the microcontroller: all over WiFi, without having to climb up a ladder to reach your IoT attic-temperature sensor.
To flash a connected Arduino, for instance, all you need to do is convince AVRDUDE to use the network instead of a locally-connected USB-serial cable: avrdude -p m328p -c arduino -b 115200 -P net:192.168.1.123:23 -U:yourHexFile.hex
. The ESP8266 passes the data straight through its TX and RX lines to your microcontroller and everything works as if it were wired.
Configuration to allow the ESP8266 to join your WiFi network takes place on a self-hosted webpage that uses [Sprite_tm]’s esp-httpd standalone server, which makes setup pretty painless. And then after that you can simply telnet to the ESP8266 at port 23 and type away, or do anything else you would with a wired serial connection.
Although the simple bridge mode came first, esp-link looks like it’s growing to be a one-stop shop for all your IoT or microcontroller + WiFi needs. In addition to the serial bridge code, there is also a REST-based microcontroller-to-internet mode and there is bi-directional MQTT support in the wings. We haven’t had a chance to dig into these yet, so if you have, let us know in the comments.
If you want to dig in deeper, head over to [Jeelabs]’ blog for a slightly outdated tour of the project written by the code’s author, [Thorsten von Eicken]. For the most up-to-date development news, follow the very active development of esp-link in this thread on the esp8266 forums.
Wow. Not only this, it also makes a RS485-WiFi bridge for a fraction of a commercial cost – just add a transceiver with direction auto-detection. Shame I don’t have an ESP on my hands right now, I’ll have to build a long RS485 transmission line with many sensors the day after tomorrow and it’d seriously rock to debug it wirelessly, or make a simple extension without adding 30m of wires for a single sensor.
You could always buy routers and flash them with Openwrt and add a package to be used as serial over IP. I remember buying quite a few TL-WR741 for as little as 15 EUR.
That still makes it 3EUR vs 15 =)
No, it made 15 vs 100+ eur for a box that did the same, installed with some machines, still working 4 years later.
Add a box and power supply to your ESP and you will not save that much, if you still want to stay with the same application. Add WiFi vs Ethernet issues and I would still use a router if I had to do it again.
Different applications call for different approaches, of course, but it is not like before the ESP you could not get something on-line for reasonable low cost.
183c on aliexpress now for the esp-01.
Man, the cool stuff just keeps rolling in I can’t keep up! Next step: the WiDuino – a Pro Mini with an ESP8266 on the same board :-)
Somebody please do this!
There is http://fishino.it/en/ , but it’s much bigger than Pro Mini, and cost is … too much IMHO. But it has nice capabilities if you’re making wireless data logger or something like that.
Maybe this ?
http://www.aliexpress.com/snapshot/6897249207.html?orderId=69139420825555
Check out: http://www.aliexpress.com/item/WeMos-D1-WiFi-uno-based-ESP8266-for-arduino-Compatible/32455782552.html
It’s an ESP8266 on an Uno
The board in those links is essentially a Uno with the ATMega replaced by an ESP8266, everything else, including the USB to UART circuit. Which means it won’t work with any libraries that access the Arduino hardware directly. What Christopher is talking about is adding an ESP8266 to a Pro Mini, which is currently missing the UART circuit but might have enough room for an ESP8266 on its underside. Such a board would be truly Kickstarter-worthy.
@#$%^ ignore the “everything else”. Hackaday, when are we going to get an edit button? You have some of the best minds on the planet reading this blog, surely you can find someone capable of doing a little PHP scripting for you…
Hackaday is a WordPress based site (although you wouldn’t know it to look at it). So I guess that hacking the commenting system isn’t that trivial – it’s probably some add-on written by someone else.
Adding an ESP8266 just to serve as a serial wireless bridge to an 8-bit AVR seems a bit of a pointless waste, though.
The ESP8266 is more powerful than the “main” microcontroller! Why not just use the ESP8266 itself to run your application?
Look at all the stuff the “main”microcontroller does. Can the ESP do it? There is your answer.
Exactly. Only 1 ADC, no hardware i2c, greatly reduced PWM, no 2-wire…the list goes on and on. My current project is a WiFi 3d printer controller which is why I’m so interested in the Pro Mini/ESP8826 combo (it’s what I’m currently using myself); the ESP8826 wouldn’t have the GPIO/ADC pins let alone support for any of the low-level hardware code in Teacup. It’s a much more powerful chip, as you say, but it was built for a specific application and it’ll take time for many of existing libraries to be ported. A Pro-Mini/ESP8266 combo, on the other hand, is doable right now and would require nothing more than a PCB design.
@Myndale I remember seeing some (not arduino user so i did not bother remembering where) but my best bet is that you can make a simple pcb to connect the 2 together. it should be small enough to fit multiple of them in the 5×5 smallest PCB batch.
Sort of similar to http://www.esp8266.com/wifio?? Anyone want to help make this happen let me know!!! :-) WIFIO is basically a Pro Mini with a a few extra pins, a few extra at one end and a few more at the other and all the inbetween ones are Pro Mini
How about the Cactus Micro? Mashup of an Arduino Leonardo (Atmega32U4) and an ESP8266-03 board.
This just made 4 of my projects even better. I need to buy these esp boards by the dozen.
Thanks for posting!
I actually was getting ready to duplicate this capability tonight. Glad I procrastinated and checked hackaday first!
Using it on an evaluation board to test out the BNO055 on a robot. This will let us evaluate the sensor and monitor data remotely, real-time witout having to write any code for our ultimate target.
Quick demo: https://youtu.be/ssxibpOCFhI
Now if someone creates a virtual serial port driver, it’d be the perfect tool for remote programming!
On Linux, a possible idea is to start from this: http://fuse.sourceforge.net/doxygen/cusexmp_8c.html
This will bring a new character device. The example only do a loopback, but I think this should be possible to send/receive TCP payload instead.
Looks like they already exist, I haven’t used any myself yet.
http://pcmicro.com/netserial/
http://www.fabulatech.com/serial-port-redirector.html
.
a more comprehensive list: https://en.wikipedia.org/wiki/COM_port_redirector
I believe that most tools on the list are for redirecting physical serial port existing on the system. What is needed is a tool that create a new virtual serial port on the system.
AT least half of the ones in the wiki can redirect com over TCP.
bit.ly is not a mask its an awesome tool to see where your traffic is coming from… and considering 80% of visitors are new visit the site daily, its not that known YET…. and running a site for free and putting the massive amount of time and effort into it that I do and get this type of response…
There are plenty of tools to check your traffic which don’t involve trying to get people to click to something else other than your link.
I for one avoid links through such websites.
Me too.
Richard, I appreciate your effort and I’m glad that the esp8266.com website exists, I’m sorry if I sounded too harsh. I can understand the need to advertise the site, but using url shorteners is usually seen in a bad way (spammy) in comment threads and when I see one I just avoid clicking on it.
Never really saw it that way! I just hate trying to link to my content with huge URLS…. hmm I will rethink this strategy! Or I just make my own short URL code on esp8266.com and then voila problem solved! I have added some shortened once but I rewrite .htaccess by hand to do it :-(
Don’ make it look like you are running a charity, You have ads setup on esp8266.com and so you do get ad revenue from running that site and putting a useless comment on every HAD thread about esp8266 linking to your site is your way of promoting your site.
The discussion link that you had put in your comment was already given in the main article, So what was your point of putting it again ? I doubt you even read main post completely before proceeding with your regular ritual of putting a comment on every esp8266 hackaday post.
Oh, poor you.
You’ve revealed your emotional rather than logical nature
Advertising, what am I selling? This is an awesome site for ESP8266 people and the bit.ly link was a direct link to the massive thread dedicated to this exact article. I encourage people with any project to talk to me about it and see if we can get a dedicated area setup for it…. not many other sites are so inclined…
I avoid shortlinks as far as possible. You do not know where they go. From this point of view Richard’s post is no advertisement, just an ugly cryptical text string :-)
Sorry this is a little late, but just for future reference, you can add a + to the end of a bit.ly link and it’ll take you to a page which allows you to see the destination and when people have been clicking on it.
What, if anything, prevents a random outsider from connecting to this wireless serial bridge?
The wifi password.
The network password. Once you’ve configured it. Like every other WiFi device in the world. https://cloud.githubusercontent.com/assets/39480/8261427/6caf7326-167f-11e5-8085-bc8b20159b2b.png
I am terribly behind on all the info about esp’s. The last one I had got pretty hot and I think it had quite an amp draw (~150mA?).
Are there any “low energy” versions yet?
Is there a comprehensive guide to the various types and recommendations which not to buy?
I have a couple of the very basic ones I got when the esp craze began.
The power consumption is going to be somewhere between 20-70mA with spikes to 300mA when transmitting. I think that’s pretty typical for any wifi radio.
In terms of which module types to get, the esp-12, esp-13 and wroom-02 versions have much better RF than any of the others. Also, PCB antenna typically beats ceramic antenna. I see 10dB better rssi using a -12 over a -03. I would get the -12e or the newest -12f (hard to find in the US right now). These have all the gpio brought out and good RF.
This is great.
Very helpful indeed. it’s good to hear someone’s experience with the different module designs. I had assumed the ceramic ones were best. oops
Thanks for the info.
there is a “low energy” mode which is supposed to periodically wake up on a synchronized time with the router telling it if there are any packets. You need a router capable of that and I am not sure if anyone used this mode so far…. it is supposed to average ~1mA if no data is transmitted or received.
other than that you are left with shut-down modes which mean device reinitialization and WiFi connection every transmission.
There is what’s called “modem sleep”, which uses the Wifi DTIM interval (supported by almost all APs) to turn the receiver off for several beacon intervals (100ms) at a time. While the esp is in that mode, it uses ~20mA. When the receiver is on it uses ~70mA. Going down to ~1-2mA requires turning the processor off, i.e., really just keeping memory and a timer powered and so far I’ve been unable to get into that mode. I believe that as long as there’s a peripheral enabled (such as UART) it can’t go into that mode ’cause there’s nothing to react to any input on the peripheral.
right….i thing i was remembering the TI chip.
Personally i don’t find the ESP that suited for low power. It takes long to start(~0.5 seconds) and connect to wifi, so anything battery operated has to require very occasional data transmission and deal with big delay.
Thank you all for you comments and suggestions!
I’d love if there were a wired version of the ESP8266. Wireless isn’t always the best option and doesn’t work with all wireless networks, and then one could mix-and-match depending on usage and location. (Yes, I know, there are other Ethernet chips like the Enc28j60, but then you have two code bases)
It is highly unlikely that somebody will do that, the END is there and performs really well. I don’t think there is a market for Ethernet connected low complexity devices any more. I do agree that most problems are easier to solve via Ethernet.
* ENC
Microchip makes a Ethernet to SPI bridge for interfacing ethernet with a micro controller.
http://amzn.to/1YvYPGE
They are only $2.79 qty 1 if you want to buy the IC.
http://www.microchipdirect.com/ProductSearch.aspx?keywords=ENC28J60/SS
And libraries are available
https://github.com/jcw/ethercard
nice
I’m trying to use port tcp/2323 to provide html to the browser, problem is that after outputting the code through Serial.println() the Arduino is not able to close the tcp connection and the browser keeps loading… any idea ?
I flashed transparent bridge 2 binary files in my esp (01) module and it was done successfully but i dont find the wifi network of my module in the taskbar.
Could you assist me!
which programmer shoud i use to flash a Sparkfun pro micro (ATmega32u4) via ESP8266?
Everything is nice, but do you have a FULL working program with a schematic. I am new to ESP, and i would like to have a full project to replace my RS232 and RS485 with ESP connection. I will build it and LEARN from there.
Thank you
I would like to make the following communication ArduinoTX->ESP8266->ESP8266->ArduinoRX. I can do it with Xbee’s but they are expensive. Ha anyone seen a prebuilt ESP firmware to do this?