ESP8266

A Lua webserver rtunning on the Esp8266 (Thanks to gerardwr from esp8266.com)

if(t==nil) then
  t=12
end
srv=net.createServer(net.TCP) srv:listen(80,function(conn)
    conn:on("receive",function(conn,payload) print(payload)
    conn:send("HTTP/1.1 200 OK\n\n")
    conn:send("<html><body>")
    conn:send("<h1>Erni's ESP8266</h1>
")
    conn:send("TEMP : " .. t .. "
")
    conn:send("NODE.HEAP : " .. node.heap() .. "
")
    conn:send("TMR.NOW : " .. tmr.now() .. "
")
    conn:send("</html></body>")
    conn:on("sent",function(conn) conn:close() end)
  end)
end)

The idea is to test an update of the variable t, that is shown in the page.
I do this from an ATtiny 85 via Serial:

  Serial.print("t=");
  Serial.println(count);

FYI
There are lots of info on the ESP8266 forum:
http://www.esp8266.com/
Among other things a new SDK released friday

I'm having mixed results.

I managed to update the AT firmware to v.9.2 which works fine, and tried LUA
But LUA kept rebooting every 5 seconds.

Also I can only upload via the old XCOM util, nothing else seems to work correctly for me.

I am powering from 5v via a LM1117T 1amp regulator, and people have suggested I need a capacitor, to remove supply voltage fluctuations.
However I have not had time to check if this is the problem

I can't seem to upload via the python util, esptool.py, even the AT firmware only gets to 98% then fails.

People have also suggested that I need to pull some gpio lines to 3.3v through 1k resistors, as currently they are just floating. But other tutorials I have read, don't seem to need this.

Also, the build process in the Lubuntu vm is not that clear.

E.g. Why is source code in a folder called app

Why does the build process produce multiple binaries

If all binaries need to be uploaded, what addresses do the binaries need to be uploaded to?

As far as I can see, there is severe lack of documentation

I guess its early days, but at the moment I don't think I have time to figure out how to use this device.

I definitely recommend a cap across the 3.3V output and ground, but I haven't tried any firmware updates.

I've been doing some work with this device for a commercial prototype (as I had some handy)

And I have got the build and upload process working fairly well

There is a VirtualBox image on Espressif's own site

http://bbs.espressif.com/viewtopic.php?f=5&t=2

and I have downloaded the latest SDK 0.9.3 from the www.esp8266.com which contains some examples

Unfortunately the API doc on www.esp8266.com is for 0.9.1 (though some claim is for 0.9.2) its definitely not for 0.9.3 as there some new functions and also changes to existing function arguments etc

I've still not found the docs that describe why the main code appears to be in user_init() and why there is a drivers folder

Or quite why most code seems to be flashed in separate blocks, often 0x00000 and 0x40000

I have posted a question about all of this to esp8266.com

The device is supposed to have an ADC on pin 6 TOUT, but on my board it doesnt go anywhere, so I've been trying to solder to the chip, but so far even though the wire appears to be attached I'm not getting any decent readings when I call system_adc_read();
This is an undocumented (as yet) new feature only in 0.9.3

Its definitely an interesting device, but whether its worth developing on, is a different matter.

i.e unless the documentation gets a lot better etc

Electrodragon has (some?) docs for 9.2.2: ESP8266 - ElectroDragon Wiki

The way that info is scattered around, I can't tell whether groups are competing or cooperating :frowning:

@westfw

As far as i can see, The stuff in ElectroDragon appears mainly to be about the AT firmware version 0.9.2 rather than the SDK .

But I agree, information is scattered a around a lot. The esp8266.com forum is not that active, e.g. After 3 days no one replied to my question about the basics of using the code from the SDK lib, e.g why they have a user folder and a separate driver folder, and why there is no main() function.

I can guess that like the Arduino, main() is in a library can calls user_init(), and I suspect the driver folder files could equally well be put in the user folder.

But this lack of core knowledge makes building for this platform quite challenging.

Since my last posting, I have managed to get the ADC to work, but I had to solder a wire directly onto the esp8266, which was quite difficult and is not very robust, due to the small surface area for the solder.
Hence I have used hot glue to hold the wire in place. It's messy but it works :wink:

There is a new undocumented API call to read the ADC which supersedes the previous way to access the ADC and seems to reliably read values between 0 and 1V

However I still have a lot of work ahead of me, to send the ADC value to a web service at regular intervals.
This is because there all the SDK provides is basically tcp socket level functionality.

I guess sooner or later someone wil wrap this into a class perhaps, but no one seems to have done it yet.

I have also ordered some ESP-12 variants, which are breakout modules which run all the GPIO pins and adc etc, to the edge of the module. $4 each on Aliexpress, but goodness knows how long they will take to arrive. Definitely not before Christmas

Edit.

I did try to get the PC tool chain working the other day, using Cygwin , following instructions on the web, but gave up as I had multiple issues. But I think in the near future someone will get a reliable PC tool chain working

Here's a link with many of the available variants pictured and linked:
http://www.aliexpress.com/item/ESP8266-serial-WIFI-industry-milepost-type-ESP-12/32240399719.html

Hi @westfw

I now have 3 x ESP-07 and. 4 x ESP-12 on order from separate suppliers, eBay and aliexpress, so I will update the forum when they arrive.

I've been doing some general experimentation in the code examples, that people have put in GitHub, and its interesting to see how people copy from examples without really knowing why they have added various bits of code.

E.g. I couldn't figure out why some calls to the OS messaging were being made in one example. Or even why an empty system callback function was in the code.

But I've realised that as there is no comprehensive documentation, that all people are doing is copying big chunks of code, often whole files, from the examples to their code, and you end up with redundant code which just serves to confuse :wink:

I did seem to uncover some things that don't seem to be documented, e.g if you create a new process callback function and then call the API to set it to get called by the OS, it doesn't seem to get called with system events e.g. IDLE unless you make an initial call to send an OS message to tasks of the same priority.

I suspect that the code that sends the message has been put in, as this is a known feature by the manufacturer, and may be a workaround.

Anyway, I will post more later...

My "working" ESP-01 seems to have died. Minutes ago it was doing fine, and I was trying to get "transparent mode" working, or seeing whether it had some of the other AT commands from previous networking products. Then it hung up, and now it's drawing nearly 1A from the power supply, and not sending any test to the serial port at all :frowning:

(My, what poorly commented source code! Sigh.)

@westfw

Umm, that doesn't sound good.

Have you tried reflashing it ?

Any idea what you could have done to cause it to start drawing an amp?

My ESPis still going OK, and I have another 2 on standby.

Actually.I though I had ESP-03's but I think I have 3 off ESP-01.
I've got ESP-03's on order.

I've really not been doing anything groundbreaking, just modifying the http server so that it always switches to AP mode, and I've modified the CGI for the index page so that it can show the ADC value on that page.

I need to wire in another push button onto the onlin free GPIO line left on my ESP-01, which is GPIO2 so that I can get the firmware to go into AP mode if this button is pressed (at GND) when the firmware starts.

i.e I want to be able to set the SSID and connection params to my network using a web UI and then reboot the device to use those params.

I'm sure someone must have done this before, but I"ve not seen any code for it.

Today I updated my github project: GitHub - Paulware/ESP8266: All things related to ESP8266 low cost device

I received the pcb back from China for a small footprint (2 in / 1.25 in), which connects an atmega328 to an ESP8266 running at 9600 baud on D11/D12.
The eagle schematic for this pcb is located in the Schematics/ESP8266Tiny directory.
I created an arduino sketch with supporting files located in the ESP8266UDP_CommCheck directory.

The Arduino project has a serial menu so you can set ssid/password from the Arduino IDE. Ssid and password are stored in EEPROM as well as the unique key which identifies this particular network node. The unit will respond to a udp broadcast from the network master, which could be done from a raspberry pi or an android device.

This device can make a very nice sensor for temperature/water or allow you to drive relays.

Hi everyone, looks like you guys have done some great work on this new chip already, does anyone know if the ESP8266 offers power management features?

Happy New Year!

AFIK

The ESP8266 has 2 low power modes, but I have to tried either.

I'm not sure if the AT command set supports either, but as the AT firmware is open source, its quite possible to enhance and recompile and reflash the device.

In fact, its almost impossible to use the device in the first place without reflashing it, because there is no way to know what firmware it comes with from China.

Of course if you buy a board from PaulWare he would put the correct firmware in th esp8266 I presume :wink:

Anyway, back to power modes.

Deep sleep seems to be the most used method, and the API function causes deep sleep for a predefined length of time.

Theoretically you can also do wake on interrupt, but I've not seen any code that demonstrates how to do that.

From what I recall, on wake from deep sleep is virtually the same as power cycling the device, I.e I don't think internal ram vars are retained, but it is possible to store stuff in flash albeit with a limited number of write cycles.

I think there may be another less drastic low power mode, but I have not investigated it, so is could be wrong about its existence. Note there is a lot of conflicting information out there about the ESP8266

So take everything you read with a pinch of salt.

Paul

Btw have you seem the new 0.1 in pitch esp8266 modules that are appearing on eBay recently?

Not exactly Arduino compatible, but they at least plug into a breadboard

I've only used the ESP-01, and used the firmware that the vendors have provided.
Can you post a link to the ebay modules?
thanks

After reading through these posts, I became interested in these chips. I've seen the ESP-01's on Ebay for about $2.70 a piece. I might check these out...

http://www.ebay.com/itm/2-69-each-ESP8266-ESP-01-5x-Simple-Serial-WIFIArrive-1-10-BizDays-/281470224472?pt=LH_DefaultDomain_0&hash=item4188eec858

IMHO ESP-01's are quite limited unless you are need absolutely the smallest device.

I think there is only one usable GPIO line, unless you use RX and TX serial lines as GPIO

A better bet is the ESP-03 or even better the ESP-12.

I have all 3 types and only the ESP-12 has the analog input line to a pin on the PCB and also its the only one that has GPIO16 to the PCB, and GPIO16 is needed if you want to use the onboard deep sleep mode without needing an external processor to control this device.

If you are just buying for testing, an even better option is the 0.1 inch pitch boards which have recently become available.

I thought these 0.1 pitch boards, which will plug into a breadboard were on ebay, but now that I've looked I can't see them, but perhaps they are only on ebay.com or another ebay site, ie. not on my local ebay.com.au

Take a look on www.esp8266.com in the general discussion forum, you can probably find a link in there is you are interested.

Or you could use the atmega328 for gpio (like an arduino), and use the esp8266 for network traffic.
I connect them together in a small footprint (1.5 inc * 2 inch) pcb, and use the Arduino ide for programming.

My eagle schematic (using 3.3V regulator) is located in the github directory: ESP8266/Schematics/ESP8266Tiny at master · Paulware/ESP8266 · GitHub.

For this purpose the ESP-01 is adequate.

Ahh, great, thank you guys for the information. I mainly wanted to just run some tests with one of these chips. Right now all my sensor nodes use RFM12B's with an attiny85. All the nodes work great and the power saving features of the both these chips is very good, coin batteries last a long time(over a year now).

While my sensor nodes are small, I wish I could get them even smaller, I have a plant water level sensor, but I used an old walwart housing for it. All the components fit snug, but it's very noticeable next to the plant.

I was hoping to miniaturize the nodes I already have, with comparable power saving features and possibly using less components.

I am not sure ... can be ethernet shield replaced with this ESP8266?