ESP8266 Huzzah
DavidZemon
Posts: 2,973
Just bought two of these ($10 each) and they arrived this week. Lua is a wonderfully easy language to learn (I was up and running in minutes) and the IDE is a snap to use. Within about 30 minutes, I was able to solder the headers on, connect to serial, download the IDE, and create a Lua script that connects to my house's wifi at startup.
I have no idea what to do with this thing. But it's cool! I'd like to find some way to use it with the Propeller... but I can't think of a good reason to do that when it has such a powerful CPU already on the board.
I might create a programmable thermostat though. That'd be fun.
Anyone else pick up one of these yet? What have you done with it?
For anyone curious, here's my startup script
I have no idea what to do with this thing. But it's cool! I'd like to find some way to use it with the Propeller... but I can't think of a good reason to do that when it has such a powerful CPU already on the board.
I might create a programmable thermostat though. That'd be fun.
Anyone else pick up one of these yet? What have you done with it?
For anyone curious, here's my startup script
function connectToWifi () function checkConnection () status = wifi.sta.status() if 5 == status then print("Connected! " .. wifi.sta.getip()) else print("Connecting...") tmr.alarm(0, 1000, checkConnection) end end if 5 == wifi.sta.status() then print("Already connected as " .. wifi.sta.getip()) else print("Connecting...") wifi.setmode(wifi.STATION) wifi.sta.config("mySuperSecretWifiSSID", "mySuperSecretWifiPassword") wifi.sta.connect() tmr.alarm(0, 100, checkConnection) end end connectToWifi()
Comments
I setup a "page" on LiveSpeak to simulate reading some sensors. I also found a version where you can set a pin on/off from any web app.
There is a lot of Lua info and examples out there.
And the base ESP boards are ~$3 which is cheap enough to place in lots of projects.
Have not had a chance to play with them yet.
-Phil
@SwimDude0614:
In your script, you should make the status variable in function checkConnection local to the function by using "local status = ..." instead of just "status = ..." to avoid polluting your environment, possibly interfering with any other variables inside other functions that aren't local that might happen to be called status. Locals in Lua are local to the function, if statement, loop, block, etc. that they are declared in (but not necessarily assigned), and have to be explicitly declared as local or they will just end up in the environment hash table, costing hash lookups every access as opposed to dirt-cheap register indexes, and polluting your environment.
EDIT: Does anyone know the specs on the processor? Mainly, which architecture, how fast, and how much ram? I can't find them - am I blind or do I not actually want to get this due to lack of documentation?
Thanks! I was hoping local would be the implicit and you'd have to explicitly declare things as global. That's a very interesting design decision to go the other way around.
I'm going to assume from the lack of details that it is its own architecture, not ARM or MIPS or something else.
That's interesting. Do you mean for projects like Magic Lantern?
Tools, sample applications and interest all seem to be coming online rapidly.
I'm guessing it has to do with the fact that Lua started out as a configuration file language (sort of like JSON) and then was later turned into a full Turing-complete scripting language. If you define a function to help declare settings, you don't want the settings to be local, because if they were the host program wouldn't be able to read them out of the environment table.
Asking hackaday about esp8266 duplicates much of the news about interesting projects in a central place and this way serves as handy starting point for the curious: http://hackaday.com/tag/esp8266/
The most important vertices seem to be:
* 32 bit CPU, 80 MHz (160 MHz is possible), 64k RAM
* SPI flash (512k bytes seem to be a wide spread choice)
* IO (I2C, SPI, PWM and more), count depending on the module chosen
* WiFi
* a free gcc based SDK is availalble ... https://github.com/pfalcon/esp-open-sdk and easily builds from sources on Linux
Alternative firmware...
* LUA ... https://github.com/nodemcu/nodemcu-firmware
* micropython ... https://github.com/micropython/micropython
...builds fine on/with the free sdk.
* starting with Arduino-1.6.4 (http://hackaday.com/2015/05/13/arduino-ide-becomes-more-open-less-snarky/), the esp8266 toolchain easily can be added to the IDE(?) via the new "boardsmanager", so arduinolike C++ coding in this well known environment is easily available too.
https://github.com/micropython/micropython/tree/master/esp8266 lists wifi on the Todo list still
Why can't the company just release documentation instead of forcing everyone to reverse engineer it? Or is there a manual somewhere but it's in Chinese or something?
Lua works on a processor with only 64K ram? I wonder how hard it would be to get Lua to work on a Propeller 1?
@SwimDude0614:
Everyone should learn lua. It is in general a very simple, powerful, and well designed language.