Connecting to a VSCP daemon using a ESP8266

For this setup the ESP-01 version was used. You can find it on ebay for a very low price. The pinput for the module is

where

Pin Decription
VCC Connect +3.3V here. Need a source that can supply >200mA so most USB ↔ serial adapters qill not do the job.
GND Connect to ground. If you use an external power source and an USB ↔ serial adapter remember to connect GND on the two together.
TXD Transmit data. Connect to receive data
RXD Receive data. Connect to transmit data
RST Restart module if grounded. You can leave unconnected
CH_PD Active high chip select. Connect to +3.3V
GPIO0 If grounded on startup modules enters flash mode. Can be left unconnected.
GPIO2 Should be tied to +3.3V at start up.

For my test setup I use +3.3V from the Odessa module as I am building some test code for it and using a cheap 3.3V USB ↔ serial TTL converter. As usual the test setup is kind of messy (as it should be)

As I did this setup on windows, finding a terminal program that send CRLF as line endings, which ESP8266 expects, was the hardest problem I encountered in setting up this. At last I used putty and terminated my lines with ctrl+m/ctrl+j manually.

So to test the module open up a terminal program with all handshake turned off. My modules was at 9600 baud but it looks like they can be on 57600 and 115200 also.

Check response

First check that you get a response from the module

 AT<CR><LF>

should return

OK<CR<<LF>

Common problems is setting rx/tx the wrong way, using the wrong baudrate, have a power source that delivers to little current.

Reset

If this works. Start by resetting the module with

AT+RST<CR><LF>

note that the command should be in uppercase even if the AT does not have to. So AT+rst does not work.

Setting mode

Now make sure that the module act both as an access point and a connecting unit. You do this by setting mode=3

AT+CWMODE=3<CR><LF>

Modes are 1=Sta, 2=AP, 3=both.

Check mode

You can check the current mode with

AT+CWMODE?<CR><LF>

Some say one needs to reset the module after this. I don't know if that really is needed. But if you get into problems do that.

List access points

Now you can list the access points you have with

AT+CWLAP<CR><LF>

which gives you a list of available access points.

Set multichannel

To connect to one you first enable multiple channels with

AT+CIPMUX=1<CR><LF>
Join access point

Then join one access point with

AT+CWJAP="sid","password"

Yes both enclosed in “rabbitears”.

Verify connection

You can verify that you are connected with

AT+CWJAP?<CR><LF>
Connect to VSCP Daemon with

Now connect to an active VSCP daemon with

AT+CIPSTART=4,"TCP","192.168.1.6",9598<CR><LF>

you will see the welcome message when connected

Send username

Send user name with

AT+CIPSEND=4,12<CR><LF>
user admin<CR><LF>
Send password

Send password with

AT+CIPSEND=4,13<CR><LF>
pass secret<CR><LF>

you should see that you are logged in at this point.

Get the interface list at the server

Get the interface list from the daemon with

AT+CIPSEND=4,16<CR><LF>
interface list<CR><LF>
Enter receive loop

Enter the receive loop so you receive all events coming in to the daemon

AT+CIPSEND=4,9<CR><LF>
rcvloop<CR><LF>
Quit receive loop

Quit the receive loop with

AT+CIPSEND=4,10<CR><LF>
quitloop<CR><LF>
Close VSCP session

Close the session with the VSCP daemon with

AT+CIPSEND=4,6<CR><LF>
quit<CR><LF>

By now I think you understand how this is working. Can't be easier. In multichannel mode you can have several channels open so you can have one channel that sends and one that receive events. Also note that the module remembers the access point you connected to and the credentials so on next restart it will connect automatically.

I will provide a sample for this using the Odessa module that connect CAN4VSCP and a VSCP daemon using wifi. Later I hope I would be able to provide a low cost CAN4VSCP module that do this as well.

More info is here and here and actually every where on the net.

Have fun!
/Ake

 
howto/esp8266_to_vscp_daemon.txt · Last modified: 2015/05/08 18:37 by akhe
[unknown button type]
 
Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki