megaAVR and the new $5 ESP8266 WIFI module

Go To Last Post
54 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Anyone else going to use any of the megaAVR's and this IC, I want to stick with megaAVR as I know them well.... also a massive support group for the WIFI IC is growing at http://www.esp8266.com

 

Hope to find people also interested.

 

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There's also the Mediatek MT7681 thats similar in features and price. It seems the major chip houses were expecting zigbee to be the next big thing whereas the Asians have listened to the market and the market wants wifi

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

rsloan wrote:
Anyone else going to use any of the megaAVR's and this IC, ...
https://www.avrfreaks.net/comment/1313861#comment-1313861

tinyAVR: https://www.avrfreaks.net/comment/1301831#comment-1301831

"Dare to be naïve." - Buckminster Fuller

Last Edited: Fri. Sep 12, 2014 - 08:16 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So what processor does it actually use?

 

Where is the datasheet?

 

Tool support?

 

There is nothing on the manufacturer's website: http://espressif.com/en/products/esp8266/

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Fri. Sep 12, 2014 - 07:45 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It's all bleeding edge at the moment. It's only been available for a month or so.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
So what processor does it actually use?
A Tensilica variant from Cadence.

awnell wrote:
Where is the datasheet?
https://nurdspace.nl/ESP8266#Translated_datasheet though there may be a better copy subsequent to that one.

awnell wrote:
Tool support?
A SDK on Windows from Espressif though there's third parties working on GCC for the ESP8266 community effort.

IIRC the stack is lwip.

"Dare to be naïve." - Buckminster Fuller

Last Edited: Fri. Sep 12, 2014 - 08:10 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is looking like an advert 'embedded' in a thread.  I'll let it go for now otherwise it will be recommended for a move to the trading forum

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

not an advert, just a link to information people are looking for.... esp8266.com is just a forum community, no ads, no selling

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

rsloan wrote:

not an advert, just a link to information people are looking for.... esp8266.com is just a forum community, no ads, no selling

 

I think you'll find a couple of the moderators take their role a little too seriously.  Too many cooks...

 

I have no special talents.  I am only passionately curious. - Albert Einstein

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've used ATmega32 + ESP8266 recently and after few days of testing I'm considering this project stable, that is I'm getting 99% uptime which is good enough for my purposes. Included source (WinAVR 20090313).

Short description: AVR reads data from SHT11 (temperature and humidity) and MPX6115A (pressure) and sends it every 5 minutes via ESP8266 to webserver where php script stores it to database.

There is no connection diagram, but connections are quite simple - ESP8266 is connected just with hardware UART lines and reset line (I've seen it stuck in "busy p..." state - reset is forced now in this situation). Keep in mind that ESP8266 is not 5V-tolerant, so few additional resistors may be needed.

Firmware should fit in ATmega8 after disabling few log lines (it's using 8.5kB FLASH memory).

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you for the usage report.

tomeko wrote:
There is no connection diagram, but connections are quite simple - ...
There's variety in the set of modules:

GitHub

/esp8266-wiki

Hardware_versions

https://github.com/esp8266/esp8266-wiki/wiki/Hardware_versions

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

(WinAVR 20090313)

Is there a statute of limitations on that? That's a 5-6 year old compiler.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If it ain't broke why fix it? cheeky

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm just not sure if newer version of avr-gcc/avr-libc would be able to compile same code without changes. I know it's pretty old, but I get used to this version (and included Programmers Notepad), it's lightweight and easy to setup.
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi guys... I am playing with an ESP8266...I have a question.... umm...while processing the incoming strings with\r\n terminations when you have multiple incoming lines...when do you know ESP has finished sending. Its time to process all the lines that have come in? Is there a rule of thumb? Should I just have a timer starting to count as soon as \r\n are received?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The esp8266 is just the chip - what software are you running on it? If we assume the default AT command code, you process each line as it comes. If it is a data packet, then you decode that. There is plenty of code out there for the arduino and other platforms.
Frame your question better so we can begin to understand your problem.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Welll I m using at attiny! I m thinking whenever I receive \r\n I should mark that as the end of string. The thing is I m dealing with small memory. I noticd though when http query comes in the module spits out multiple lines all ending with those two chars...each line coming at different times.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Use nodemcu - the 8266 has more free memory than your tiny! You can do the web grunt work in lua and talk to the tiny via serial if you so desire.
Every line has cr/lf. There's also a header for each line of the receive payload.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Except that I have a board with attiny1634 processing a few inputs and outputs. So yeah I need to process the incoming strings.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why so? The 8266 can handle the hard work and use a simple serial protocol to the tiny.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

But you have limited IOs there. Also I have no idea where to start if I was to code and compile new code for ESP8266. :(

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Have you not googled what nodemcu is? I don't think you're grasping what i'm suggesting. Simply load nodemcu onto your esp8266 board, write a bit of lua code, store it into flash. Use the tiny for i/o and use a simple serial protocol between them. Doing the web stuff in lua is much easier than on the tiny.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm looking forward to having a play.  Ordered last Sunday 7:30PM on eBay http://www.ebay.co.uk/itm/141491353331.  Email within 40 minutes to say dispatched.  Received in UK Saturday morning.  

 

Waiting for the more expensive http://www.ebay.co.uk/itm/171550120840?_trksid=p2059210.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT.

 

David 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I dont like the idea of writing a server on the ESP directly.

I have finally managed to write something in Xmega64A4U. I have a RX Fifo of 254 bytes to process the AT interface. I have successfully done a Hello World page so far. I have noticed however when I click on refresh "too fast" things go haywire abit. It seems the ESP delivers "Link" statement even before completing transaction for the first request. Need to do more experiments.

 

My goal was to really do this in Attiny1634 with 1KB SRAM. but it seems even that isnt really enough as I have a few other stuff in my code as well. So I am thinking to use AtXmega32E5 for this...Cheaper than ATmega32 and surely faster!!!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why don't you like the idea? It's virtually a no brainer as all the work has been done for you. I even found someone did a write up of something similar to what i proposed.
I've been writing some native modules for nodemcu and testing them by a handfull of lines of code to implement a dumb webserver. Instant gratification. I can either have it connect to my home router or work standalone. Magic!
This what i'm talking about:
http://www.esp8266.com/viewtopic.php?f=19&t=1363

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman.... u almost convinced me lol...I like a little bit of challange.

Umm...how reliable is it? Can you fail it with repeated fast refresh button clicks? Does the ESP recover from it?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Despite all the warnings regarding power supply for this module, i hooked mine up powered via USB. I ended up having lots of problems with reboots and stupid behaviour. I bit the bullet and soldered some stuff together to give it a good supply. Reliability increased significantly. Flashing now happens 100%. I also had issues with the wireless router so I tried another and that works much better. I'd suggest you try it for yourself. You only need to flash a prebuilt nodemcu image which only takes a minute and if you don't like it, reflash the original AT cmd code. I've yet to try lualoader for esp8266 (its for windows and i do my devel under osx/linux) but that should make the download easy.

[edit] Just tried the simple web server app and it seems to work rock solid. I also tried the lualoader and node flasher app under windows.

Last Edited: Sat. Jan 31, 2015 - 03:26 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:
Despite all the warnings regarding power supply for this module, i hooked mine up powered via USB. I ended up having lots of problems with reboots and stupid behaviour. I bit the bullet and soldered some stuff together to give it a good supply.
Good supply in the context of Olimex's board (module, power supply, etc.) is a DC-DC SMPS (Silergy SY8009A) 5Vdc to 3.3Vdc, 1.5A, 470microF input capacitor; USB limits the input capacitor to 10microF.

https://www.olimex.com/Products/IoT/ESP8266-EVB/resources/ESP8266-EVB_Rev_A.pdf (50KB)

via https://www.avrfreaks.net/comment/1442636#comment-1442636

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I used a recom r78 smps regulator powered from a separate psu.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Ok here is a page that I am currently able to deliver from the ESP! :D

I am in the process of parsing for the GET parameters to decipher the button clicks.

Its reasonably reliable. If the interface looses packets or handshakes, it at least recovers from it. So in the next click of fresh the page comes up.

The code so far for HTML in xmega is about 10KB and taking up RAM about static 400Bytes + dynamic allocation of <100Bytes for each new connections. I think ESP can do up to 4 incoming connections.

I am hoping I can provide MODBUS TCP server afterwards.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

AFAIK the ESP8266 running either the AT code or nodemcu can only cope with one server. You can have a number of client connections.
I've been having fun this weekend - i got the esp8266 sending kambrook rf data to turn on/off power point relays and receiving x10 rf data and oregon v3 weather rf data. I filled up the code space, so i had to cull out my modbus code.
I was just playing with the lhttp web server in lua running on the esp8266 so i modified it to load javascript files. You get around 64k of filesystem on the 512k eeprom so you can store a reasonable sized web page. I just need to figure out how to mod the lua code to handle ajax calls. Since the browser in this instance has more ram and cpu than the esp8266, you can do a lot of processing on the browser using javascript.
I also looked at mqtt. There was a free app on Android for doing this ( something useful for the crappy nexus 7 to do) and i loaded the mosquitto broker onto the wireless router. I could send messages from the tablet to the esp8266 and back again. Woo Hoo! Since i have the esp-01 modules, i got brave and soldered some wires onto the chip to get more I/o. I might buy some esp-12 modules to get more eeprom and I/o.
How much fun can a geek have???

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Wow!

Kartman wrote:
I might buy some esp-12 modules to get more eeprom and I/o.
The page and schematic for Olimex's development (larger) module states 2MB of SPI flash, 11 GPIO, and a 4bit SDIO 2.0 interface.

What's in an ESP-12 module?

TIA

www.olimex.com

https://www.olimex.com/Products/IoT/MOD-WIFI-ESP8266-DEV/open-source-hardware

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

http://www.electrodragon.com/product/esp8266-wifi-board-full-ios-smd/
There's a few gotchas with some of the i/o as some need to be pulled to a particular level to select the correct boot mode.
Other issues are limited code space and ram when running nodemcu.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

25dBm!

That's a fair amount of power for 802.11; will need a stout power supply or run it on a battery.

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Other places you read 19.5dBm. Maybe its becoming a pissing contest like audio? Connected to a access point, i've measured around 100mA but it is most likely pulsing higher. Thus the need for a good supply.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

HHm... I am power it with a LM1117 and its holding up fine...its also powering the xmega n the board...All running from a supply of 5V SMPS.

 

Last night I was able to get the ON/OFF buttons working. Now I am going to aim to make it more reliable.

 

Its a shame though that we can not run multiple servers (HTTP & MODBUS) on the one thing. Are we sure about this one? Is there some tweak we can do in the code?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

https://github.com/nodemcu/nodemcu-firmware/issues/112
Its the same story on the AT command firmware.

There's always the TI CC3200 and Atmel have some offering methinks. Pity they're not available on a board for $5.

You can always use a hacked wifi router - you can have a number of server sockets, heaps of memory and a real web server. The Arduino Yun is an example.

Last Edited: Mon. Feb 2, 2015 - 08:32 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Gahh... I thought I would fit all this into a 32K Xmega32E5....buttt....with all the other command prompt processing for the user and printf statements its almost 50K! So now I need another small pin package...and none exists in Xmega....so I am now considering the ATSAMD20E16/17. :(

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you do your user interface on the browser then all you need is a serial flash/eeprom to serve up a file with the html and javascript. Once loaded, the data is sent via get/put operations.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Another option is Google protobuf.

The AVR could send and receive a protobuf with the protobuf converted to JSON or HTML by the ESP8266.

Appear to be a number of ways.

Ref.

Google+

http://code.google.com/p/nanopb/

Protobuf in your AVR(Arduino)/ARM microcontrollers. Comes out to 5kb for encoding, 5kb for decoding. Fits perfectly in my Uno. 

Note: Google is not available for some; some Google creations are now on GitHub.

GitHub

/protobuf

Third Party Add ons

xfxyjwf edited this page on Nov 24, 2014

https://github.com/google/protobuf/wiki/Third-Party-Add-ons

...

Programming Languages

...

C: http://koti.kapsi.fi/jpa/nanopb/

...

Other Utilities

...

Alternate encodings (JSON, XML, HTML) for Java protobufs

...

(browse for more on JSON and such)

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hi all

im have an ESP8266 module .i want to connect it via ATMega32or16 and send some Order via my phone (android application/when i touch for example buttom of LED1 off then send a code to wifi module and wifi modoule give it and send to ATmega32 and micro power on some LED).

can i runnig this project on this device ?how ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

You might want to do a bit of Googling. There are a few sites with such projects. For just turning a led on or off, you don't need the AVR - you can load up Nodemcu onto the board. See www.esp8266.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As Kartman recommends; likely easier to create and maintain by Lua instead of HTML and C.

Python?!

What's cool is the creator of Micro Python is trying ESP8266 (work-in-progress) :

GitHub

/micropython

micropython/esp8266/

https://github.com/micropython/micropython/tree/master/esp8266

sanup2006 wrote:
... and send some Order via my phone (android application/when i touch for example buttom of LED1 off then send a code to wifi module and wifi modoule give it and ...
Via HTML and a web browser, Olimex has a button and relay example (scroll down about halfway) :

GitHub

/ESP8266

ESP8266/esphttpd/README.md

https://github.com/OLIMEX/ESP8266/blob/master/esphttpd/README.md

...

Use computer with WIFI and scan for WIFI networks ...

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:

You might want to do a bit of Googling. There are a few sites with such projects. For just turning a led on or off, you don't need the AVR - you can load up Nodemcu onto the board. See www.esp8266.com

thanks.

i cant read and type english well .

my question is that can i send and recive data from ESP8266 Serial WIFI Module with AVR ATMega32 ?

i have an Android application that shows 4 key on screen that when i touch on ne of them for example led1 power on.

i want to connect ESP8266 Serial WIFI Module to micro and recive data from mobile and proces data with ATMega32.

can i made this circuit .can this module connect with ATmega32 via Rx and Tx ?

 

excuse me if my inglish is not good

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

The short answer is yes you can use Atmega32 for this. BUT...you must note that it has only 1 USART port. Which means if you use that USART port to connect to an ESP8266, you will have no other to debug print on your pc. I usually have an USART port always reserved to debug print/user interface.

 

Also by the time you have coded for an ESP8266 to hold a decent web page you will need almost all of 32KB flash if not all of it. You can work around 2KB ram..thats all you need if you just want to view small pages.

 

So best choice is to look for something that has more than 1 USART port, min 2KB ram, min 32KB flash.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

tomeko wrote:

I've used ATmega32 + ESP8266 recently and after few days of testing I'm considering this project stable, that is I'm getting 99% uptime which is good enough for my purposes. Included source (WinAVR 20090313).

Short description: AVR reads data from SHT11 (temperature and humidity) and MPX6115A (pressure) and sends it every 5 minutes via ESP8266 to webserver where php script stores it to database.

There is no connection diagram, but connections are quite simple - ESP8266 is connected just with hardware UART lines and reset line (I've seen it stuck in "busy p..." state - reset is forced now in this situation). Keep in mind that ESP8266 is not 5V-tolerant, so few additional resistors may be needed.

Firmware should fit in ATmega8 after disabling few log lines (it's using 8.5kB FLASH memory).

Hi,

 

I went through your code to examine the ESP8266 communication routines, however something else caught my attention. Can you, please, explain me what is the purpose of converting the humid_val and temp_val from int to float and back to int? Did you use the union to save the space or is there some other reason?

 

Regards

Chupo_cro

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Chupo_cro wrote:

what is the purpose of converting the humid_val and temp_val from int to float and back to int? Did you use the union to save the space or is there some other reason?

 

Yes, although it doesn't saving much - it's copied from Sensirion app note for 8051.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

tomeko wrote:

Yes, although it doesn't saving much - it's copied from Sensirion app note for 8051.

So the union is to save the space. But what is the reason for converting the values from int to float and then back to int?

 

BTW, I have ordered ESP8266 and am waiting it to arrive. In the meantime I am looking for a way to specify the fixed local IP address to the module so I can use port forward to access it from the outside of the home network. I know the fixed IP could be assigned to the MAC address of the module but as I understand nodemcu firmware allows to specify the fixed IP within the local network subnet mask. However, I see it is 'Lua based firmware' so it is not clear to me if it still allows the ESP8266 to be contolled with AT commands sent from the AVR. Do you maybe know the way to assign the fixed IP to the module so it could be always accessed from outside of the local network?

 

Thank you for answering me

Regards

Chupo_cro

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Chupo_cro wrote:

what is the reason for converting the values from int to float and then back to int?

 

There is raw data from SHT11 - integers, then they are converted to floats and passed as pointers to function that calculates real values and then back to integers for easy printing (itoa() instead of e.g. %f printf).

 

I don't know if anyone is still working on AT command set, try to search for wifi_set_ip_info() calls.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You run either nodemcu or the at command code. It is easy to reflash the module to change code.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:

You run either nodemcu or the at command code. It is easy to reflash the module to change code.

I've seen nodemcu firmware. However it says it is 'Lua based FW', wouldn't after uploading that FW the ability to communicate with the module by sending the AT commands be lost? I'd like to do all the processing in AVR and to control the ESP8266 by sending AT commands. I've read the AT+SETIP command for specifying the fixed IP address could be included in open source AT firmware but I couldn't find any more specific data or some firmware where that has been already done :-/

Chupo_cro

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok guys...more update here.

I have finally made a lot of progress with my SAMD20E17A and the ESP8266. So far the code is just over 79KB and takes up 10K RAM. I have 3 web pages. Each page takes few GET arguments etc. User can save IO configuration/logic and WIfi configurations over the web interface. This is then saved in the flash emulated EEPROM. :D

 

So far...http traffic handling reliability is great. The code is such that if there is an issue it will time out and wait for next page request.

 

Here are some screen grabs

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The only problem i have now is getting this thing to reboot. For some reason SAMD20 does not like rebooting. I call NVIC_SystemReset().... and the micro just halts...it should restart from main...but it doesnt.