Shop OBEX P1 Docs P2 Docs Learn Events
ESP8266 Huzzah — Parallax Forums

ESP8266 Huzzah

DavidZemonDavidZemon Posts: 2,973
edited 2015-05-18 14:52 in Propeller 1
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
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

  • Cluso99Cluso99 Posts: 18,069
    edited 2015-05-17 18:41
    I just have the ESP-01, ESP-07 & ESP-12 base boards. I think you have the ESP-12 based one.
    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.
  • Bill HenningBill Henning Posts: 6,445
    edited 2015-05-17 20:14
    I have a bunch of the 2x4 0.1" pin versions, and the one with the 2mm smt mount.... ESP-01 and 07?

    Have not had a chance to play with them yet.
  • Cluso99Cluso99 Posts: 18,069
    edited 2015-05-17 20:26
    I have a bunch of the 2x4 0.1" pin versions, and the one with the 2mm smt mount.... ESP-01 and 07?

    Have not had a chance to play with them yet.
    Your missing out here Bill ;) Lots of time to be lost for sure!
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2015-05-17 21:42
    I need to spend more time with Lua. It's also the performance choice for programs written for Canon cameras under CHDK.

    -Phil
  • ElectrodudeElectrodude Posts: 1,658
    edited 2015-05-17 22:25
    That looks really nice. Lua is my favorite scripting language, too.

    @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?
  • Cluso99Cluso99 Posts: 18,069
    edited 2015-05-18 04:17
    There are a lot of docs on the ESP8266.com website
  • DavidZemonDavidZemon Posts: 2,973
    edited 2015-05-18 06:17
    That looks really nice. Lua is my favorite scripting language, too.

    @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.
  • DavidZemonDavidZemon Posts: 2,973
    edited 2015-05-18 06:22
    According to the chip's product page, it's an "Integrated RISC processor".

    I'm going to assume from the lack of details that it is its own architecture, not ARM or MIPS or something else.
  • JonnyMacJonnyMac Posts: 9,105
    edited 2015-05-18 07:13
    I need to spend more time with Lua. It's also the performance choice for programs written for Canon cameras under CHDK.

    That's interesting. Do you mean for projects like Magic Lantern?
  • mindrobotsmindrobots Posts: 6,506
    edited 2015-05-18 08:01
    The processor on the board is a Tensilica Xtensa LX3 32bit, clocked at 80 MHz, and it has an SPI flash on the module/board.
    according to this site.

    Tools, sample applications and interest all seem to be coming online rapidly.
  • ElectrodudeElectrodude Posts: 1,658
    edited 2015-05-18 08:12
    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 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.
  • yetiyeti Posts: 818
    edited 2015-05-18 11:46
    https://nurdspace.nl/ESP8266 was one of the 1st places to find something about the ESP8266 modules, today the forums http://www.esp8266.com/ and the related wiki http://www.esp8266.com/wiki/doku.php and their space on github https://github.com/esp8266 seem to be the hotspots of the lively and constructive digitope...

    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.
  • TorTor Posts: 2,010
    edited 2015-05-18 14:22
    There's much more to the ESP8266 than it looked initially. It's as if it could challenge the "first $9 computer" claim by that other project (considering what these things go for on ebay and aliexpress).
  • DavidZemonDavidZemon Posts: 2,973
    edited 2015-05-18 14:22
    MicroPython would be great (though I think this is a good reason to learn Lua), but it appears that community hasn't quite finished the most important piece yet... wifi.

    https://github.com/micropython/micropython/tree/master/esp8266 lists wifi on the Todo list still :(
  • ElectrodudeElectrodude Posts: 1,658
    edited 2015-05-18 14:45
    yeti wrote: »
    https://nurdspace.nl/ESP8266 was one of the 1st places to find something about the ESP8266 modules, today the forums http://www.esp8266.com/ and the related wiki http://www.esp8266.com/wiki/doku.php and their space on github https://github.com/esp8266 seem to be the hotspots of the lively and constructive digitope...

    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.

    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.
  • localrogerlocalroger Posts: 3,451
    edited 2015-05-18 14:52
    ExpressIf has gotten major kudos from the maker community because they did make the ESP8266 development toolchain available, but it was in fact largely documented in Chinese so a lot of work has been necessary to make it accessible to English-speaking users who aren't familiar with ExpressIf's legacy coding style.
Sign In or Register to comment.