PDA

View Full Version : CHEAP wifi modules, at last!



ardhuru
- 31st August 2014, 09:45
Couldnt decide where this post should go, but I thought Ethernet would be appropriate.

Has anybody noticed this new gem yet?

http://hackaday.com/2014/08/26/new-chip-alert-the-esp8266-wifi-module-its-5/

Seems very easy to use, and its cheap! Hoping to lay my hands on one soon...

Regards,

Anand

Normnet
- 31st August 2014, 09:58
I have two on order.
At present the documentation is in Chinese only however.
Google translator?


Norm

ardhuru
- 31st August 2014, 10:24
Sparkfun seems to have a basic minimalistic writeup.

Normnet
- 31st August 2014, 11:30
Sparkfun seems to have a basic minimalistic writeup.
A SparkFun search for ESP8266 draws a blank.
Link?

Norm

mackrackit
- 31st August 2014, 11:33
https://nurdspace.nl/ESP8266

pedja089
- 31st August 2014, 12:41
http://esp8266.com/index.php
http://hackaday.io/project/2879/logs

ardhuru
- 31st August 2014, 12:56
Thanks for the forum link, Pedja. Didnt realize they'd already have a forum dedicated to this chap.

BTW, there seem to be a couple of versions (different form-factors) available on ALiExpress. I notice a version that can also take external antennas.

Regards,

Anand

pedja089
- 31st August 2014, 16:06
It seems like that all firmware is in SPI FLASH memory, so there is no need for specific programmer. Compiler, firmware and some IoT example are available... So you can write your custom firmware... Or just write your own commands so PIC can do other task.
Also it doesn't require almost any external component's so chip it should be very easy to integrate WiFi into product.
I can't wait to get one and try it.

rsocor01
- 31st August 2014, 20:39
Excuse my ignorance here. But, how exactly does this work? Does it send data to a Web page that you need to set up first? Or, does it send data in form of a file to a remote server?

pedja089
- 31st August 2014, 23:21
For client app, you connect to your AP, like you do with laptop, mobile phone, tablet.
So you have access to internet.
Then you connect to some address, eg google.com on port 80. And then using HTTP commands request page. You can use GET or POST command to get web page. Or you can post data to PHP script, using that two methods.
Here is some HTTP examples http://www.jmarshall.com/easy/http/
Other way is to use EMAIL, you connect to SMTP server to send email. You connect to port 25 of your server, eg smtp.yahoo.com port 25, and then log in using BASE 64 protocol for password, and send email.
https://www.cs.cf.ac.uk/Dave/PERL/node175.html
You can use putty to learn how to handle communication with server.

If you are using module in AP mode, you connect to module with your tablet, or other device, and then create web page in pic, and than display it on your tablet.
To do this, PIC must handle basic HTTP protocol. This is like setup page on router or AP.

All this protocol are text based, so if you are familiar with using UART and parse string, this wouldn't be to hart to master. It isn't too hard. There is example with different module:
http://www.picbasic.co.uk/forum/showthread.php?t=13159&p=88906#post88906
http://mackrackit.com/mac/ichip/ichip.html
It's similar to GSM modem it isn't complicated as it might look.

rsocor01
- 1st September 2014, 00:09
Ooh, I see. Thank you for your nice explanation.

ardhuru
- 3rd November 2014, 12:55
Almost 2 months after placing my order, and almost after giving up hopes of delivery, the modules arrived today!

I tried googling for any reference to PBP and EN8266, but did not get anything meaningful.

Wondering if anybody has managed to make any progress in this direction?

towlerg
- 3rd November 2014, 17:11
Join esp8266.com (I'm assuming you made a typo), all the info available, bugs, translation, projects. Oh, I see somebody already said that, my bad.

George

ardhuru
- 3rd November 2014, 18:13
Oops! ESP8266 it is.

I did visit that forum, and its rich with information.

Quite a learning curve, though..

HenrikOlsson
- 3rd November 2014, 19:35
Got three in the mail today, ordered a couple of weeks back. Will have to wait and see when I get time to play with them....

ardhuru
- 3rd November 2014, 20:34
Great! Looking forward to your observations.

ardhuru
- 5th November 2014, 06:41
Well folks, this comes close enough to get you started.

http://www.instructables.com/id/Using-the-ESP8266-module/

HenrikOlsson
- 5th November 2014, 07:25
Yes, found that too and have now been able to "manually" connect to my WiFi and serve up a most basic web-page using the terminal program in MCSP and a USB to UART dongle (no PBP code involved yet).
Couple of random notes partly from info I've found and partly from experience.

My module is the little blue one with a 2x4 pin header on it.

* Make sure you use a dongle/adapter that outputs 3.3V, not 5V!
* If you have a red and a blue LED on the board it's a V090 (using 115200 baud), if you don't have the LEDs you have a V080 (using 57600). (See here (http://www.xess.com/blog/esp8266-is-alive/)
* On the V090 module the Ch_PD I/O needs to be tied to (or pulled up to) Vcc.
* The USB dongle I was using wasn't able to provide enough power at it's 3.3V Vcc setting. Had to use external power supply.
* Watch the Tx and Rx markings. Mine seems to reversed (ie I had to connect Tx on the module to Tx on the dongle) or I was just very tired and confused at the time. I haven't yet figured out if it's the module or the dongle that's marked incorrectly. Good thing is that nothing get damaged (as long as you're using 3.3V signals) so if it doesn't seem to want to talk to you you can always TRY reversing the connections.

Next step will be to make up some sort of test rig with a PIC with two USARTs, one for interfacing to the module and one for interfacing to the PC.

/Henrik.

ardhuru
- 5th November 2014, 15:58
Thats good valuable information, Henrik. Thanks.

ardhuru
- 6th November 2014, 09:39
Henrik, I'm trying to connect the module to a terminal emulator. I have a true serial port on my PC (not a USB-to-serial).

I understand I'll have to use a level shifter. But, would I also need to invert the signals? Or just resistor(s) in the Tx/Rx lines?

pedja089
- 6th November 2014, 10:21
You need MAX3232.

HenrikOlsson
- 6th November 2014, 10:37
Hi,
You'd need to invert and level shift them.
I'd recommend using something like this (http://www.mikroe.com/add-on-boards/communication/max3232/). (Many many alternatives available of course but make sure it's designed to work at 3.3V).

I'd like to clarify that the dongle I used isn't a "USB to RS232" one but a "USB to UART", this one (http://www.mikroe.com/add-on-boards/communication/usb-uart/) to be precise.

/Henrik.

EDIT: Oops, pedja089 posted while I was typing and getting distracted with other things....

ardhuru
- 8th November 2014, 17:01
Thanks, guys! Got the chap running. Extra thanks to Henrik for pointing out that Ch_PD I/O needs to be pulled high. I had missed that.

Serial comms with terminal work ok.

Can see the module on my Android.

COULD see the routers (mine, and ones in the vicinity) with the AT+CWLAP.

Could connect with my router after specifying SSID and the password.

BUT, after that, AT+CWLAP no more lists the routers around; module seems to hang with a "busy now' response to any query.

All other AT commands still work.

Wonder what is happenning? (Module is connected to my router, confirmed that using AT+CWJAP?)

Wonder how to erase my router from the module's eeprom? That might make the AT+CWLAP start listing the routers around again.

Perhaps time to enlist on the ESP82666 forum.

ardhuru
- 8th November 2014, 20:07
Okay, problem solved.

I had inadvertently given a wrong password for my router, and the module would keep on trying to log on continuously.

Used the AT+CWQAP, re-defined my SSID and password, and it works as it should.

ardhuru
- 25th November 2014, 05:57
Not trying to be pushy, but I wonder if you have had any success, Henrik?

I ran into a wall after getting the basic comms working (connecting to my router). Of course, the fact that I know nothing about TCP or HTML doesnt help, either.

Although, the module is now connected to the router (i can ping it remotely), I cant see it thru the browser.

HenrikOlsson
- 25th November 2014, 07:09
Hi,
No, I haven't worked on it, don't know what to do with them.... :-)
Simply getting them connected to your Wifi doesn't mean you can "browse to them" - there's a little more to it than that (but not much really). Unfortunatley I don't remember off the top of my head and I don't have access to my notes right now.

What exactly is it you want to do?

I'll see if I can get something simple cobbled together tonight perhaps.

ardhuru
- 25th November 2014, 07:18
Well, for starters, I would like to connect a pic to the 8266's UART outputting some data, and expect it to be seen in the browser. And then, perhaps, feed in data into the browser, to be read by the pic?

HenrikOlsson
- 25th November 2014, 21:52
Hi,
OK, this was and is a bit frustrating, trying to get this going on a PIC with only one USART. Anyway, this seems to work OK but it's meant ONLY as a startingpoint, I do NOT claim this to be the proper way of doing it.
Initially I did have HSERIN type stuff instead of the PAUSE statments but sometimes it just locked up and without any means of seeing what actually happened it got a bit a frustrating and I'm running out of time right now. So again, this does seem to work but it's not very robust nor elegant. When I get more time I'll rig something up with another PIC or get a bitbanged UART going for debugging purposes.

Oh, and since there is no connection back to the PC there's no way to see what IP the module gets assigned by the accesspoint so I used my accesspoints web interface to find that out. I found that if I did a "manual test run" first, ie using a serial terminal, it usually gets assigned the same IP number after that.

As I said, not elegant....



dummy VAR BYTE
Hits VAR BYTE

Main:
' Issue a module reset
HSEROUT["AT+RST", 13, 10]
' Module should respond with a bunch of data and finally 'ready'
HSERIN[WAIT ("ready"), dummy]

' Set the mode, module may respond differently depending on if it's
' already IN the current mode so we simply delay (not good practise).
HSEROUT["AT+CWMODE=3", 13, 10]
PAUSE 100

' Join the accesspoint, module should respond with 'OK'
' Replave mynetwork and password with actual SSID and password
HSEROUT["AT+CWJAP=", 34, "mynetwork", 34, "," ,34, "password", 34, 13, 10]
HSERIN[WAIT ("OK"), Dummy]

' Allow multiple connections, module should respond with 'OK'
HSEROUT["AT+CIPMUX=1", 13, 10]
HSERIN[WAIT ("OK"), Dummy]

' Open port 80 (normal port for HTTP), module should respond with 'OK'
HSEROUT["AT+CIPSERVER=1,80", 13, 10]
HSERIN[WAIT ("OK"), Dummy]

' Here we need to wait for a client to connect and request data.
' When that happens the module will outout the HTTP header on the
' UART, we'll trig on the GET keyword.
HSERIN[WAIT("GET"), Dummy]
Hits = Hits + 1

' Prepare to send 33 bytes
HSEROUT["AT+CIPSEND=0,33", 13, 10]
PAUSE 100
' Send the actual data
HSEROUT["<TITLE>PBP ESP8266 demo</TITLE>", 13, 10]
PAUSE 100

' Prepare to send 30 bytes
HSEROUT["AT+CIPSEND=0,30", 13, 10]
PAUSE 100
' Send the actual data
HSEROUT["<H1>Testing the ESP8266</H1>", 13, 10]
PAUSE 100

' Prepare to send 22 bytes
HSEROUT["AT+CIPSEND=0,22", 13, 10]
PAUSE 100
' Send the actual data
HSEROUT["<H3>Cool stuff!</H3>", 13, 10]
PAUSE 100

' Prepare to send 18 bytes
HSEROUT["AT+CIPSEND=0,18", 13, 10]
PAUSE 100
' Send the actual data
HSEROUT["Page visits: ",DEC3 Hits, 13, 10]
PAUSE 100

' Now disconnect
HSEROUT["AT+CIPCLOSE=0", 13, 10]
PAUSE 1000

Goto Main

ardhuru
- 27th November 2014, 17:45
Henrik, thanks a lot for sharing your work. It looks very interesting indeed.

I'm away from my base till mid next week. Cant wait to get back and give it a try.

I'll report my experience soon as I get back.

Regards.