ESP8266

The esp8266 forum has been restructered

The LUA implementation is here:

www.esp8266.com

I have tried to use the LUA webserver with an ATtiny85.
The t85 does all the sensor reading and sends it to the esp8266 via seriel.
It works very well and very covenient because the t85 can run on the same 3.3V as the esp8266.

There is still a problem with the RAM usage but working on it
@Paulware
Which firmware do you use on the esp8266 ?

I don't modify the firmware on the esp8266, I just use them as I get them from the vendor. I believe that vendors ship them with firmware that allows them to respond to AT commands.

I created an Arduino program to store the SSID/Password in EEPROM on the atmega. That way other users can use it without needing to change the source code. My Arduino program allows me to set the SSID and password for my home network. by typing in the Serial monitor: ssid mySSID, where mySSID is the ssid of my home router. My Arduino program also allows me to set the password by typing in the Serial monitor: password myPassword, where myPassword is the password on your home router.

The first step when I get an ESP8266 is to determine what baud rate the device is set to. I do this by sending "AT" commands at various baud rates until it responds with "OK". Once it responds with "OK", I know I have the correct baud rate, and I will be able to set its parameters. First I set the baud rate to 19200. Then I set the other parameters to configure it as a UDP server. At that point I will be able to use it to fulfill a variety of functions such as a motor controller or a sensor. After setting the baud rate, I also set:

AT+CWMODE=3
AT+CIPMUX=1
AT+CIPSERVER=1,3333
AT+CIPSTO=120

once this is done, the esp8266 will get an ip address assigned by my home router and listen to port 3333 for a command. In this manner it can be used as a sensor or a device controller.

Here is a video of a rc car commanded by an android device, using the esp8266

Hey guys.

Coming late to the party....

I now have 3 of these, and I have downloaded and installed the sdk etc into a Linux VM etc.

But I find the documentation is really thin on the ground and I'm not sure how I even upload the results of the SDK compile into the device.

Are there any good tutorials about how you upload things like the LUA binaries.
And also compiling modified versions of the main source code.

I,e I'd like a version that has a lower default baud rate, as I'd need to use software serial, so 115200 is too fast.

I also think that this, thread is would be better off in the Microcontrollers section, as this device is a fully fledged Microcontroller as it supports SPI, etc.

I think it would get more exposure if it was moved.

My ESP8266's came with a 9600bps default speed (which took me a while to find!) and firmware that supports a new "AT+CIOBAUD" command for permanently changing the speed, as described here:
http://www.electrodragon.com/w/Wi07c#Updates

I'm also a bit frustrated by the state of the documentation (and I guess the implementation as well.) It feels ... primitive. Not that that's necessarily bad, since my general impression of most wireless modules is that they're horribly over-specified and bloated. It will be interesting to see what happens.

@westfw

Mine came working at 115200, but I udpated to the newer firmware just now and it seems OK

However one thing that went very wrong was the CPUpdate command, it ended up spitting out reems of jibberish characters and the only way to reset it seemed to be to upload the firmware again

I have installed a VM with Lununtu preconfigued with the toolchain and SDK, but I'm not entirely sure where to start writing my own firmware, as information is thin on the ground.

If I understand it correctly, It seems that its possible to upload the system software separately from the application software.

The builds that I did in the VM using the SDK example, seems to generate 2 files, both of which, (I think) need to be uploaded.

However I've not got as far as that yet

Are there any good tutorials about how you upload things like the LUA binaries.

This is how I did it:
Grab the binari here

Upload to the esp8266 (GPI00 connected to ground),
Rx/tx connected to a 3.3V FTDI serial/usb converter

I used ESP Flash Download Tool, see the picture

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.