Go Down

Topic: ESP8266 (Read 76430 times) previous topic - next topic

rogerClark

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.


Freelance developer and IT consultant
www.rogerclark.net

westfw

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.

rogerClark

@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

Freelance developer and IT consultant
www.rogerclark.net

Erni

Quote
Are there any good tutorials about how you upload things like the LUA binaries.
This is how I did it:
Grab the binari here

https://github.com/nodemcu/nodemcu-firmware

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

Erni

#19
Nov 30, 2014, 12:11 pm Last Edit: Nov 30, 2014, 12:14 pm by Erni
A Lua webserver rtunning on the Esp8266 (Thanks to gerardwr from esp8266.com)

Code: [Select]

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><BR>")
    conn:send("TEMP : " .. t .. "<BR>")
    conn:send("NODE.HEAP : " .. node.heap() .. "<BR>")
    conn:send("TMR.NOW : " .. tmr.now() .. "<BR>")
    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:
Code: [Select]

  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

rogerClark

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.
Freelance developer and IT consultant
www.rogerclark.net

Paulware8

#21
Dec 10, 2014, 03:35 am Last Edit: Dec 10, 2014, 03:38 am by Paulware
I definitely recommend a cap across the 3.3V output and ground, but I haven't tried any firmware updates.

rogerClark

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

Freelance developer and IT consultant
www.rogerclark.net

westfw

Electrodragon has (some?) docs for 9.2.2: http://www.electrodragon.com/w/Wi07c#Updates

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


rogerClark

#24
Dec 11, 2014, 08:55 pm Last Edit: Dec 11, 2014, 08:58 pm by rogerClark
@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 ;-)

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
Freelance developer and IT consultant
www.rogerclark.net

westfw


rogerClark

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 ;-)


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...
Freelance developer and IT consultant
www.rogerclark.net

westfw

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 :-(

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

rogerClark

@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.




Freelance developer and IT consultant
www.rogerclark.net

Paulware8

#29
Jan 01, 2015, 12:49 am Last Edit: Jan 01, 2015, 07:44 am by Paulware
Today I updated my github project: https://github.com/Paulware/ESP8266

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.




Go Up