-
STM WiFi
HTTPGET and SOCKET
with RaspBerry Pi
SPWF01SA.11 and SPWF01SC.11


Home Page
WiFi page

           




-
Introduction


  • In this tutorial we show you the way to use the SOCKET and HTTPGET for send and receive data from STM WiFi mounted on  Silica BRANCA board and a PC with LINUX that is RaspBerry Pi.
    For do this we use:
    • An Access Point (AP)
    • A Web Server and Sochet Server that are on RaspBerry Pi. See Fig.1 below.

  • We suppose that you already know how to use the Silica BRANCA board that is an eva board for the STM WiFi  module named: SPWF01Sxxx
    If for you is the first time that using the Silica BRANCA board, please read here and also the Hands on Session that is here.
    The jumpers on the Silica Branca Board are show below.



  • A SOCKET introduction is here, please read it before to proceed.

  • A HTTPGET introduction is here, please read it before to proceed.

  • For more information concerning the SOCKET ad HTTPGET see the user manual of the SPWF01Sxxx
    .
  • On RaspBerry Pi where is a local Web Server for this reason we use: Apache2, PHP5, and MySQL, for more details see my tutorial here.
    On my RaspBerry Pi I have two files that are:
    index.html
    txt.tx
    This files are in the directory: /var/www

  • On RaspBerry Pi it is also necessary a socket server for receive the data send from the WiFi BRANCA board.
    For do this use the my Python program that is here and run it.

    You must see something like below.


  • Below there is an image (Fig.1) that explain the connections.




UP



-
SEND - WiFi BRANCA board send characters to RaspBerry Pi


  1. Run the socket server: server.py on your RaspBerry Pi, for more info read here.

  2. Now from TeraTerm, from the PC that is connected to WiFi BRANCA board, use the commands below.

AT+S.SOCKON=rpi1.station,32000,t,ind
 
 ID: 00
 
OK
AT+S.SOCKW=00,5
Ciao
OK
AT+S.SOCKW=00,4
bye
OK
AT+S.SOCKW=00,1
@
OK
AT+S.SOCKC=00
 
OK

NOTE:
Change rpi1.station with the name of your RaspBerry Pi that is shown using the command nmap.
The blue characters are not displayed on TeraTerm, see below.



The blue characters are displayed on RaspBerry Pi, see below.



 

UP




-
RECEIVE - WiFi BRANCA board receive a file from RaspBerry Pi


In TeraTerm type this command:
AT+S.HTTPGET=192.168.1.2,/txt.txt
You must see an answer similar to the below.
In the red box there is the contents of the file txt.txt



NOTE:

Change the IP: 192.168.1.2
with the IP of your RaspBerry Py.

For more information concerning the command: AT+S.HTTPGET
see the user manual of the
SPWF01Sxxx.

UP



-
Conclusions


This example is a starting point for implement an automatic link from STM WiFi and RaspBerry Pi.
I have scheduled to substitute the PC with a STM32 mcu.
Stay tuned on: http://www.emcu.it/WiFi/WiFi.html or follow me on
TWITTER.




UP