Difference between revisions of "Basic Test/Tutorial for ITEAD WIFI Shield REV2"

From ITEAD Wiki
Jump to: navigation, search
(Created page with "This is a basic test/tutorial for ITEAD WIFI Shield REV2 using an Iteaduino MEGA2560 with serial ports 0 and 2. It was written by David M on 19 April, 2014 and updated to ...")
 
(No difference)

Latest revision as of 09:48, 21 May 2014

This is a basic test/tutorial for ITEAD WIFI Shield REV2 using an Iteaduino MEGA2560 with serial ports 0 and 2. It was written by David M on 19 April, 2014 and updated to include entry of SSID and password on 3 May, 2014.

Configuration:

MEGA2560 connected to Arduino IDE serial monitor on PC via USB using hardware serial port 0. Ensure serial monitor is set to transmit with both CR and LF. WIFI shield connected to MEGA2560 via hardware serial port 2. Mount WIFI Shield on the MEGA2560 using the socket rows beside the standard UNO ones. Align WIFI shield so that its pin D0 connects with the MEGA2560 RX2 socket.

As well as the IDE on the PC have a TCP connect test program available e.g. SocketTest v 3.0.0. ... and a browser.

Purpose:

Facilitate developing an understanding of the WIFI Shield REV2 / RAK410 wireless module.

To use this sketch:

1. Set up the physical configuration

2. Open the Arduino IDE and serial monitor; set the monitor baud rate to 115200 and to "Both NL & CR"

3. In void set up() edit the sketch to enter the SSID and password and TCP port that you want to use when the WIFI shield is configured as an Access Point.

4. Upload the sketch

5. Press the re-set button on the WIFI shield and then press the re-set button on the MEGA2560

6. Enter your wireless network SSID and password when prompted.

7. Enter a command from the list presented on the monitor - start by entering "Direct".

8. In the "Direct" mode enter 'at' commands - start with "at+ascii=1".

9. Try entering sequences of commands as described in the RAK410-EVB User Guide starting at section 5.1.1

10. Enter "EndDirect" to terminate the "Direct" mode and allow a different command to be entered.

Once the above session is completed, configure the WIFI shield as a web server with TCP listening port and connect to a TCP tester and then a browser.


1. Press the re-set button on the WIFI shield and then press the re-set button on the MEGA2560

2. Enter the "ConnectStation" command. The sequence of 'at' commands and responses from the shield will be echoed to the serial monitor

3. Note the IP address that has been allocated to the WIFI shield

4. Open the TCP test program on the PC and set the IP and port details. Click Connect.

5. Assuming the TCP connection via WIFI has been successfully created, enter the "Transparent" command.

Note: The WIFI shield will return an error if you try to enter transparent mode without a TCP connection being present.

6. The WIFI module will now be in Transparent mode and will not accept further 'at' commands until re-booted.

7. Check that "conversation" works between the serial monitor and the TCP test program.

8. At the TCP test program click disconnect and then open a browser. Type in the WIFI shield IP address.

9. The client GET request issued by the browser will be echoed in the serial monitor.

10. From the serial monitor enter "Post". This will cause the MEGA2650 to respond with a basic web page.

11. The web page has two hot spots. Click one and observe the resulting GET request on the serial monitor.

12. Note that the hot spot request is interpreted by the MEGA2650 and displayed as an all caps message within the GET request echoed on the monitor

Finally set up an Access Point and connect to it with a mobile phone.

13. Press the re-set button on the WIFI shield and then press the re-set button on the MEGA2560

14. Enter the "AccessPoint" command. The sequence of 'at' commands and responses from the shield will be echoed to the serial monitor

15. From the mobile phone, connect to the WIFI shield wireless access point

16. From the phone browser connect to IP address 192.168.1.1. That will establish a TCP connection with the WIFI shield

17. From the serial monitor enter the "Transparent" command. You should see the GET request from the phone

18. From the serial monitor enter "Post". The web page will load on the phone.

19. Click a hot spot and observe the command returned to the serial monitor.

That's about it. The sketch does not use any libraries other than the plain vanilla Arduino base. It has been structured to facilitate experimentation.

High level commands for entry from the serial monitor can be readily added ... as can 'at' command sequences and html material.

There is a separate version of this sketch that is modified to work with the ITEADuino UNO - where use of a software serial port is required for communication between the UNO and the shield.

Downloading link of library for WIFI Shield REV2 with MEGA2560 v3 115200: http://blog.iteadstudio.com/wp-content/uploads/2014/05/Mega_v3_115200.ino

Downloading link of library for WIFI Shield REV2 with UNO rev0: http://blog.iteadstudio.com/wp-content/uploads/2014/05/UNO_rev0.ino