So this ESP8266 thing. Uses and firmware route? - Page 1
Forum section: electronics / projects

author: Buriedcode
author_rank: Super Contributor
timestamp: March 04, 2016, 03:44:24 pm
content: Ok, so even though I instinctively was quite cynical about the 'internet-of-things' I thought I might as well pick up one of these modules and see if I can find a use for it.So far, I haven't. Also everything I can think of that 'would be really useful connected to WiFi and the internet' is usually done on a PC/tablet/phone. And any standalone applications would require a fair bit of power as this thing can peak at 300mA (transmitting full pelt). So, right now for me, its just a novelty (albeit a cool one, I'll admit). So, if one ignores the hype...I've hooked it up, and used the AT commands to connect to my network, set up a basic webserver, all the typical 'test' things. Clearly the stock firmware is limited to basic operations, but oh-so easy to use. So I guess the next step is custom firmware to get at the CPU and its peripherals. It seems that there are multiple ways to use this:NodeMCU: Firmware that can run LUA scripts. I'm a noob when it comes to scripting languages, but seems popular and apparently scripts can be uploaded to the ESP module via browser, only requires the firmware to be flashed once. Handy for quick one-off tests/ideas.MicroPython: Whilst I'm just learning python, I'm guessing its the same idea as above. Embedded python interpreter running on the CPU, so one can quickly knock up small scripts and upload them to the module. I haven't seen that many examples of usage, so maybe its still in development?Arduino IDE: I've somehow managed to avoid using the Arduino IDE, using Arduino boards by erasing the bootloader and just writing in C with AVRstudio. But it was inevitable that I'd get to use it eventually, plus I think I've earned it (went from PIC assembly, to C for PIC and AVR, to higher level languages...). It seems you're actually writing the firmware here, so has to be flashed for every project, but appears to have the nice simple Arduino libraries giving more versatility, but still without writing C to bare-metal (my preferred method for 8/16-bit devices.. but maybe not for 32).I know all of this has been covered by many others, and a quick google shows there are hundreds of projects for this thing - most seem to be rather pointless 'temp sensor and button connected to wifi!!' so has anyone got a cool and *useful* project using this? Also, which of the above dev methods is generally the 'least hassle' - by that I mean, least bugs, whilst providing access to more of the CPU's features (I2S, SPI, ADC etc..). Right now I'm leaning towards using Arduino's IDE, as there are plenty of example projects using that. But as always with micro's, I'm short on applications >.< Not sure if its an age thing or just that it really isn't as useful as people make outBuriedCode

author: kripton2035
author_rank: Super Contributor
timestamp: March 04, 2016, 03:58:34 pm
content: I've also tried the AT commands, the nodemcu and arduino IDEno questions anymore : the arduino ide is the way to go, lots of libraries available, almost no time you build what you needthe AT commands are too limited (and you need an arduino to control it : wait there IS an arduino inside this chip ! why use two ?the nodemcu seems bad implemented, the module stops functionning from time to time, ok for very simple educational IOT but not more.

author: AlessandroAU
author_rank: Regular Contributor
timestamp: March 04, 2016, 04:48:50 pm
content: Check out some of the cool projects on this channel regarding the ESP8266https://www.youtube.com/user/CNLohr/videosAlso, I would have to agree, the arduino IDE is the way to go if you want to play around with these devices easily.

author: wblock
author_rank: Regular Contributor
timestamp: March 04, 2016, 07:15:42 pm
content: Quote from: kripton2035 on March 04, 2016, 03:58:34 pmAgreed.QuoteMy experience with them has been good as long as I used Arduino on them. Half a dozen in continuous operation for the last three or four months as temperature sensors. There are several versions of the NodeMCU as it has improved with age. Probably some poorly-made clones, too.

author: ajb
author_rank: Super Contributor
timestamp: March 04, 2016, 07:43:30 pm
content: Documentation is a bit of a pain because you've got Arduino, NodeMCU, and a couple flavors of (native) Espressif toolchains, so figuring out how to do something in one of those inevitably turns up information from the others which isn't exactly helpful, and none of the development solutions have stellar documentation to begin with. Of them, Arduino is probably the best documented, but only because it's the same as every other Arduino (for better or for worse).I've used a couple as wireless ArtNet to DMX nodes, for which I adapted an ArtNet-controlled neopixel example project that came with one of the Espressif SDK packages to spit out DMX. You don't have a lot of access to the hardware peripherals, even with the Espressif SDK, as far as I could figure out, so it's a bit of a pain to do anything that requires precise timing and such--I wound up with 1ms break and MAB times, which is stupid, but does the job. In the end, they worked okay, but would occasionally (like, once every day or two, roughly) stop receiving ArtNet for some reason, which I wasn't ever able to troubleshoot properly for a number of reasons.I played around with NodeMCU for a bit, but had a hard time doing anything useful without it crashing--seems to be very easy to trip over a watchdog or run out of memory with the interpreter on top of everything else.I have another project that uses the ESP8266 to access NIST time servers I've been doing in Arduino. Honestly I think it's the best way to get something useful done with the module on its own. It skips the overhead of NodeMCU, and doesn't require as much time as figuring out the SDK. If you plan to do more than a couple of projects with it, the SDK is probably worth the investment, though.Unless you have an imminent project in mind, it may be worth waiting to see how the ESP32 turns out; the hardware looks to be much more powerful which should make it possible to do a lot more without having to add a larger MCU to the project.

author: StuUK
author_rank: Frequent Contributor
timestamp: March 04, 2016, 08:14:00 pm
content: Tried all the variations I could find and stuck to using the arduino ide as it was the most stable/flexible

author: zapta
author_rank: Super Contributor
timestamp: March 04, 2016, 08:32:55 pm
content: Quote from: kripton2035 on March 04, 2016, 03:58:34 pmSame here. The AT commands are hard to work with and the LUA runs out if memory.

author: TheDirty
author_rank: Frequent Contributor
timestamp: March 05, 2016, 03:24:33 am
content: I played with nodemcu on a couple and did the same demo web pages with some simple expansions. Also struggling to think of anything useful. Anything I want to do remotely I can do better with a simple RF module like an nrf or rfm module. There's nothing practical I can think of that I would want to monitor or control over the net. I have some home automation things, but again, it's easier picking up a remote I made than pulling out my phone and logging into a web page to control my fireplace or a couple lights.I'm thinking trying to do home power usage datalogging. That doesn't need to be accessed quickly and a nice webpage graph would work well.

author: kkessler
author_rank: Regular Contributor
timestamp: March 05, 2016, 06:02:29 am
content: I would suggest using the native tool chain and look at the Sming project (on Github); for an ESP8266, it is fairly well documented (lots of example). It gives you an Arduino-like programming experience while using a normal IDE like eclipse and not that Arduino IDE thing.

author: Buriedcode
author_rank: Super Contributor
timestamp: March 05, 2016, 02:22:37 pm
content: Quote from: TheDirty on March 05, 2016, 03:24:33 amAlas, in terms of projects, thats what I'm thinking. Whilst 'home automation' can be very useful, I was never comfortable with the idea of many devices on the wifi network... I always thought it would be best to have a low datarate, custom low power 433MHz system for things like sensors, lighting and power sockets, with one 'control hub' acting as the master, which itself could be connected to WIFI if needs be. As 433MHz modules, or even the NRF24L01, are so cheap and can be very low power, they make much more sense for battery powered sensors, or 'ON/OFF' control.I'm sure there are more prudent applications, such as linking ones phone to a piece of hardware wirelessly, where bluetooths datarate won't cut it. Perhaps someone has made a multiple wireless camera security system? With one ESP8266 as an AP and several as clients, it can be on a separate WiFi network (as to not eat up the bandwidth on the home WIFI). Even that would require power to each camera... so one might as well use Ethernet with PoE.Thanks for all the replies, I'll go down the Arduino IDE route. Next on the agenda, probably changing the colour of an WS2812B strip! (seems popular, plus... we all like things that light up in pretty colours!). I'm assuming people use either the SPI or the I2S for that, as both are quite handy for arbitrary waveforms.

author: bitseeker
author_rank: Super Contributor
timestamp: March 05, 2016, 02:52:13 pm
content: I also opted for the Arduino IDE, making it easier to hop between platforms. Going with the native toolchain would probably enable you to get more out of the ESP, but I haven't gotten to that level yet.Regarding power consumption, unless you need the device to be on all the time, you'll want to check out more about the various sleep modes of the ESP. If you only wake it up periodically, it can run for quite some time on batteries.

author: kripton2035
author_rank: Super Contributor
timestamp: March 05, 2016, 03:27:06 pm
content: I also thought of some nrf24 modules, but you need an mcu to control it it cannot work aloneand most of the time you will use ... an inexpensive arduino for that !so why use a radio module and an arduino when you can have both in the same chip ?that's what lead me to the esp8266 for these IOT things.

author: bitseeker
author_rank: Super Contributor
timestamp: March 05, 2016, 04:23:04 pm
content: Exactly. Most of the things I consider using an Arduino for need network access or more storage. So, I find myself going with the ESP instead.

author: ajb
author_rank: Super Contributor
timestamp: March 05, 2016, 04:35:12 pm
content: Quote from: Buriedcode on March 05, 2016, 02:22:37 pmI don't think it's possible to generate the one-wire signalling needed for the WS2812B from the ESP8266. I could be wrong, but from everything I've read about the various hardware peripherals it seems you simply don't have precise enough control over any of the hardware to make it work. I don't know if it's actually that the hardware is that limited, or if the libraries simply haven't exposed a sufficient level of control. The LED strips that use SPI (WS2811?) should be easy, though. If you really wanted to drive a one-wire strip you could probably tack on a little 8-pin micro to handle the timing and feed it data via SPI... Hopefully the ESP32 and its SDK will allow for better control over hardware. I considered and rejected a number of ESP8266 projects due to silly limitations like this.

author: Buriedcode
author_rank: Super Contributor
timestamp: March 05, 2016, 04:52:11 pm
content: Well, SPI can be used, although it is rather inefficient because each 'byte' you send via SPI is only 2 bits for the WS2812B. *Most* MCU implementations of I2S just send bytes back to back, with padding if you choose a different word length. The ESP8266 has a DMA, which makes continuous streaming possible at high speed.The trouble with using things like arduino wiring language, or higher level languages is the abstraction. I suspect some libraries 'bit bang' the WS2812B protocol, which is a poor way of doing things, esecially in a high level language. Using the I2S, or SPI module would just mean setting it up, pointing to a memory location, and let it run independent of CPU.

author: kripton2035
author_rank: Super Contributor
timestamp: March 05, 2016, 05:12:59 pm
content: I read a one wire 18b20 with no problem on an esp8266I use the arduino libraries of course.

author: Rasz
author_rank: Super Contributor
timestamp: March 05, 2016, 05:34:07 pm
content: Quote from: ajb on March 05, 2016, 04:35:12 pmhttps://github.com/cnlohr/esp8266ws2812i2swith ESP8266 you get ~1996 top of the line PC level of performance, about pentium 166-200MHz. Only limitations are your skill (arduino lol) and lack of ram. One of the better examples of performance is mp3 streaming.https://github.com/espressif/ESP8266_MP3_DECODER

author: cezar
author_rank: Contributor
timestamp: March 07, 2016, 07:58:54 am
content: one of the best examples I've seen so far is generating a RF tv signal - even with NTSC colours encoded. chechout videos from this guy:https://www.youtube.com/user/CNLohr/videos

author: Fungus
author_rank: Super Contributor
timestamp: March 07, 2016, 09:49:06 am
content: Quote from: Buriedcode on March 04, 2016, 03:44:24 pmYep. The power consumption is a bit of showstopper. It's not really a "peak" either, it consumes that much most of the time.For comparison: The NRF24L01 has similar transmission range and it only uses 13mA.

author: FlippFuzz
author_rank: Newbie
timestamp: March 07, 2016, 11:40:40 am
content: What's the throughput of this?Thinking of attaching a camera to a wheel robot, and driving all around my house with itNot sure if this has enough bandwidth to stream mjpegs at a passable rate.

author: Fungus
author_rank: Super Contributor
timestamp: March 07, 2016, 12:54:12 pm
content: Quote from: FlippFuzz on March 07, 2016, 11:40:40 amVery low (a few kb per sec)Quote from: FlippFuzz on March 07, 2016, 11:40:40 amNope. Not even close.

author: Dielectric
author_rank: Regular Contributor
timestamp: March 07, 2016, 04:08:30 pm
content: I've got a bunch of the 12-series modules, and after thrashing a little I ended up using Eclipse-Arduino which is totally cool and everyone should do it. It pulls in the Arduino libraries so you can rip off the MQTT, Blync, etc libraries that are out there, but shields you from the awfulness of the Arduino IDE. Since the plugin uses Arduino in the background, it is fairly agnostic about the toolchain and board support so it actually built and worked for me on the first try, which I certainly didn't expect. Think about that; it's the Espressif toolchain being wrapped by Arduino but bypassed by Eclipse.Sure, lots of people don't like Eclipse but it's actually pretty dang cool and the plugin author is adding stuff all the time.http://eclipse.baeyens.it/I started messing with Lua, but ultimately I didn't feel like learning something that isn't C-ish. I'd rather learn Python.

author: edavid
author_rank: Super Contributor
timestamp: March 07, 2016, 04:46:01 pm
content: Doesn't anyone build clocks any more? The ESP8266 is perfect for that - you can easily make them self setting, and add any kind of Chumby-style info display that you like.

author: Buriedcode
author_rank: Super Contributor
timestamp: March 07, 2016, 05:05:01 pm
content: Quote from: Fungus on March 07, 2016, 09:49:06 amYeah, all these different modules seem to fit their own 'niche'. 433/343Mhz modules for very basic 'on/off' control (although with decent channel coding, PDM/PPM/manchester can be robust) and low duty cycles, NRF24L01's for perhaps higher burst rate, but still very low power (again, low duty) and the ESP8266 for the convenience of wifi/internet and much higher bandwidth.In order to get the power consumption down for the ESP, one would of course have to use deep sleep or standby modes. But for sensors it would take a few seconds to connect to the network, send its stuff and go back to sleep. With a peak of 300mA whilst transmitting, and a 3 second total powered up time, thats still not a patch on the above low bandwidth types. Not bashing the ESP here, its just anything 'WIFI' given its direct sequence spread spectrum, its never going to be 'low power' when its doings its thing, but that not what its intended for. If one was to have lots of home automation, or many remote sensors in an area, for gathering large amounts of data, I'd still go with a low bandwidth network, with just the ESP on the master side.Which brings me to an application I did think off, something almost in the true 'spirit' of IoT (machine-machine data dathering): national sensor networks for things like air pollution, maybe light pollution, meteorological data. Cheap self contained modules that one could give out to the public, letting them piggy back on their homes wifi (not using up bandwidth, just taking measurements every 10-20 minutes) that allows governments and research bodies to gather masses of data straight to their servers, without any intermediate 'controllers' or maintenance. They would still require power, but the bidirectional capability of it to connect to 'the web' means they can be pinged, updated, and modified on the fly, by checking for status updates every time it wakes up.Whilst there are many 'weather stations' about, there must be a demand for large scale measurements where a large number of cheap sensors over a wide area trumps having a few expensive ones. I know air quality is a hot topic in some parts of the world (India, China, and probably even London).So aside form that, I'm leaning less towards the 'make something wireless' side of applications, and more the fact it can directly communicate with a server anywhere in the world (albeit wirelessly, within a WIFI zone). I have quite a few of these ESP's, and I might start adding them into projects, with the WIFI off: Using the CPU for the main tasks, and a switch to turn WIFI on for data dumps, updating firmware, updating an RTC with google time and general tinkering. The small cost, and sheer convenience of being able to walk up to a device, flick a switch, whip my phone out and see what's going out without have to faff-about with cables is good enough for me. Bluetooth could do this just as easily for single point-point data, but if involves grabbing updates from a server, or indeed, dumping logs to a server, it could do that directly. So I guess we could add 'luxury wireless debugging' to the list of apps.

author: wblock
author_rank: Regular Contributor
timestamp: March 07, 2016, 06:27:11 pm
content: Quote from: edavid on March 07, 2016, 04:46:01 pmThat's on my list, and I have the parts, it's just that dealing with time zones and daylight savings changes has put me off. NTP isn't bad by itself, though.A USB host setup would be nice for attaching a keyboard to configure server and other settings. Don't know if anyone has done that yet.

author: homebrew
author_rank: Frequent Contributor
timestamp: March 07, 2016, 07:21:15 pm
content: I would suggest to stay away from these ESP8266 modules, especially the original -1 boards.Ok, they are dirt cheap and they work fairly well, but they have some serious issues one should be considering when designing a new product.1) No FCC license! Yeah, I know, the newer module have this (to my knowledge quite questionable) "Contains FCC xxxx" sticker. So turning your nice little prototype into a product might end up in a nightmare ...2) Not ANYWHERE enough capacitance on the module itself to deal with the ripple-current when transmitting. Having built a small WSN-Node with one of these, I needed a whopping 1000uF capacitor across the module to stop my reset-IC from tripping as soon as I wanted to transmit data albeit an 800mA on-board step-down regulator and 400uF X7R already on-board.So just be careful!

author: Dielectric
author_rank: Regular Contributor
timestamp: March 07, 2016, 08:25:59 pm
content: Ha, for a couple of bucks, I assume they're spewing broadband and pissing off the ham guy up the road with the 100ft tower and EME rig. That FCC number is almost certainly hijacked. On mine, there's an FCC logo etched into the shielding. I bet you those shields are cranked out by the zillions and no one even knows what the labeling stuff is supposed to mean. Or maybe it's legit and I need to take a coffee break?Sorry ham guy, but I really like my DIY garage door monitor and sump pit trigger. I'll try to keep it to indoor usage. OTOH, this trace antenna probably isn't getting out past the mailbox.

author: Rasz
author_rank: Super Contributor
timestamp: March 07, 2016, 11:10:28 pm
content: Quote from: Fungus on March 07, 2016, 12:54:12 pmtry 40mbit of real data over ~70mbit wifi link.Quote from: edavid on March 07, 2016, 04:46:01 pmthats what phones are forQuote from: Dielectric on March 07, 2016, 08:25:59 pmhttp://www.esp8266.com/wiki/lib/exe/fetch.php?cache=&media=esp-12_fcc1.jpg

author: Fungus
author_rank: Super Contributor
timestamp: March 08, 2016, 11:30:56 am
content: Quote from: Buriedcode on March 07, 2016, 05:05:01 pmI think NRF24L01s with some sort of NRF24L01->internet bridge connected to your router would make a lot more sense in most situations people are proposing for the IOT.An NRF24L01 with good power management could run for years on a CR2032. An ESP8266 wouldn't even be able to power itself on with that.(Kickstarter, anyone?)

author: Fungus
author_rank: Super Contributor
timestamp: March 08, 2016, 11:36:57 am
content: Quote from: Rasz on March 07, 2016, 11:10:28 pmI'm just going by what I read on google:https://encrypted.google.com/search?q=esp8266+throughputMost people say a few tens of kilobytes in practice.

author: kkessler
author_rank: Regular Contributor
timestamp: March 08, 2016, 07:39:30 pm
content: Quote from: wblock on March 07, 2016, 06:27:11 pmI ran into those same issues when I built a clock with the ESP8266, and the best I could come up with was talking to a Raspberry Pi running Node-Red though MQTT. The Pi would broadcast out the TZ with a little piece of Javascript, and the clock would pick up the TZ change on daylight savings time. It gets its first live test this weekend.I looked at Google Location services to solve the TZ issue, but I have coded to Google APIs in NodeJS, and they are just too complicated (especially the auth components) for me to implement in a uC.

author: kkessler
author_rank: Regular Contributor
timestamp: March 08, 2016, 07:52:30 pm
content: Quote from: Fungus on March 08, 2016, 11:30:56 amHas anyone looked at the NRF51822 Bluetooth LE SOCs for an application like this? Bluetooth could be a bit more standard and flexible protocol than Shockburst, and it is a complete ARM processor rather than and add-on piece to another uC. There was a Kickstarter project, Bluz, which I bought and just received that I'm going to experiment with, but I think I would just get the much less expensive Waveshare-like modules to incorporate into a real project.

author: FrankBuss
author_rank: Unknown
timestamp: January 29, 2017, 03:04:23 am
content: I wrote an article about how to use the NodeMCU module. I would say it is even easier than Arduino, once it is all installed and running:https://www.eevblog.com/forum/projects/how-to-setup-a-rapid-development-environment-for-nodemcu-and-lua-scripts/msg1123918/

author: kripton2035
author_rank: Super Contributor
timestamp: January 29, 2017, 08:56:55 am
content: it's easier than the arduino to setup, yes. but then you have less possibilities and less libraries.the more disturbing was that this thing was not stable when I tried it, too many hangs of the module without reason.I switched back to the arduino IDE for all esp8266 things.

author: FrankBuss
author_rank: Unknown
timestamp: January 29, 2017, 10:13:18 am
content: There are 50 libraries which you can include:https://nodemcu-build.comBut right, with if the Arduino IDE for the ESP8266 is fully compatible, probably then there are a lot more for it. But I guess the low level things which uses the AVR registers directly could be a problem.No hangs so far, but if there is an error, like calling an undefined function, it just says PANIC on the COM port and restarts. But this is not very different from null-pointer crashes on the Arduino. The MicroPython thing looks good, too.

author: kripton2035
author_rank: Super Contributor
timestamp: January 29, 2017, 12:04:28 pm
content: I did not try micropython and it seems promising, but I remember trying to scan wifi network and for no reason, the board hang up after some 10s minutes. did the same program with the arduino (it takes some 10 lines or so) and the arduino did work nicely.as I did it, there were almost no libraries for nodemcu, so the choice was fast.

author: Buriedcode
author_rank: Super Contributor
timestamp: January 29, 2017, 02:43:29 pm
content: Oh wow, resurrecting posts!I will have to try NodeMCU again, but since I first posted, I've just used the Arduino IDE to play about with it. Websockets, small embedded webpages, controlling RGB LED's.. using 433MHz modules to receive and transmit data from various devices around the house, frankly I haven't found a need to use anything more than the Arduino IDE. I'm sure if newer versions of NodeMCU is more stable I'll get used to it,I have a template sketch for the ESP that handles when its an AP, client etc.. and seems stable enough to run for days without a hiccup. In fact, the ESP8266 actually got me using the whole Arduino environment (AVR, SAMD21, ESP8266) - as I said in my first post, I avoided it for years because I was quite happy just programming AVR's with GCC, but I've been somewhat converted! (also write many of my own libraries). Now I just need to get one of those fancy shmancy ESP32s...