Introduction: WiFly RN-XV Module - Wireless Arduino Board Tutorial - Intro
Have you ever wanted to make your arduino have wireless ability? Wanted to connect your robot to your wireless router for access via your local network? Follow this little tutorial I've put together and you'll be on your way in no time!
Things you'll need:
- Arduino Board (I use a Mega 2560)
- WiFly RN-XV Module (Purchase here)
- Dupont male to female cables (Purchase here)
- Download Comm Operator (Download here)
- Download Angry IP Scanner (Download here)
- View WiFly RN-XV Datasheet (View or Download here)
Below is information on the LEDs on the module. Each light provides information to you.
Solid Green Light: Connected through TCP.
Slow Blinking Green Light: IP address is assigned.
Fast Blinking Green Light: No IP address assigned.
No Green Light: NA
Solid Yellow Light: NA
Slow Blinking Yellow Light: NA
Fast Blinking Yellow Light: RX/TX Data Transfer
No Yellow Light: No activity.
Solid Red Light: NA
Slow Blinking Red Light: Associated, No internet detected.
Fast Blinking Red Light: Not associated.
No Red Light: Associated, Internet detected.
Step 1: WiFly RN-XV Module - Wireless Arduino Board Tutorial - 1 of 2 Steps
1. Lay all the parts out and download all the items I listed above.
2. The WiFly module will only be using the 3.3V and Ground pins from the arduino for now.
3. View the Datasheet to see where to connect the power and ground to the module using your dupont cables.
4. To start off, we need to put the module in ADHOC mode so we can connect to the module and edit the settings in the module. Connect a temporary cable to Pin 8 on the module from a 3.3V power source. I used a breadboard to split up the 3.3V power source.
5. Connect your arduino board to a power source either USB or DC power.
6. Disconnect the pin 8 jumper cable. Basically this cable force booted the module into ADHOC mode.
7. A new open wireless network will appear with the SSID of WiFly-GS*-**, the last three characters are random on each module to allow for multiple modules if needed.
8. Connect to this network and look at the network properties of the connection to see what the IP is. For me, I'm using Windows 8 and 126.96.36.199 was assigned to the module. All the other tutorials explained that the IP was 169.254.1.1 to connect to but was not true at all in my case.
9. Ok time to open up Comm Operator. It is a trial version so you have 30 days to use it. Just wait the 5 seconds and click Register Later.
10. Make sure that Clear and Add CR are the only check boxes checked.
11. Click on Open Connection, the chain link icon.
12. Click on the TCP Client tab.
13. Input the following settings: IP Address: (Whatever the IP address you got in Step 8) Connection Port: 2000 Click Open.
14. In Log Data, you should receive *Hello* The next commands below, only type what is in BETWEEN the " " marks. You will receive also entries in the data log that should be <4.00> This is the firmware version. This is normal.
15. Type "$$$" and press Enter to initiate the command sequence. You should receive CMD from the WiFly Module.
16. Type "factory Reset" and press Enter to clear any data put in and reset to factory default settings. You should receive Set Factory Defaults.
17. Type "save" to save the settings.
18. Type "reboot" to reset the module. Do Steps 11 through 15 and come back to Step 19.
19. Type "set ip DHCP 1" and you should receive AOK from the module.
20. Type "set wlan join 1" and you should receive AOK from the module.
21. Type "set wlan ssid (your network name)" and you should receive AOK from the module. Without the parenthesis, type your actual network name. If you don't know what it is, look at your computer's wireless list and see what you are connected to. For example, mine is Belkin.42EC
22. IF your connection is open, you'll skip this step. If you use a WPA encryption, type "set wlan phrase (your network password)". If you use a WEP encryption, type "set wlan key (your key here)" The key must be entered ASCII/HEX encoded and it MUST have exactly 26 characters. Use this to convert text to ASCII/HEX. You should receive AOK from the module. Without the parenthesis, type your actual network password. If you do not know what it is, look on your router if it's provided by your internet provider or if you know how to get into your router's settings, look in the security settings to see what the password is.
23. Type "save" to save the settings.
24. Type "join (your network name)" to reset the module. Without the parenthesis, type your actual network name. If you don't know what it is, look at your computer's wireless list and see what you are connected to. For example, mine is Belkin.42EC
25. The module will reset on its own and start connecting to the network. Close out Comm Operator. Use the LEDs as reference on what is going on. This connection process can take up to 10 minutes!!! If it last longer than 10 minutes, then something is wrong. Restart the steps. I will note here as well that you should only have the power and ground connected to the module.
Continue to the next step page to finish the process!
Step 2: WiFly RN-XV Module - Wireless Arduino Board Tutorial - 2 of 2 Steps
26. Once the green LED is flashing slowly, it has an IP address assigned.
27. Pull up Angry IP scanner to check to see if you notice any new IPs assigned to your router. You can also check your router's DHCP client list and you should see the WiFly listed. Look and see what the new IP that is assigned to the module. You'll need it. Your module is now connected! We are now going to setup the communication between Arduino GUI and the module.
28. Open up Comm Operator, click Open Connection, and change the IP to the new IP assigned to your module. The port stays the same. Click Open.
29. You should again receive *Hello*.
30. Type "$$$" and press Enter. You'll receive CMD from the module.
31. Type "set comm close 0" and press Enter. You'll receive AOK from the module.
32. Type "set comm open 0" and press Enter. You'll receive AOK from the module.
33. Type "set comm remote 0" and press Enter. You'll receive AOK from the module.
34. Type "set comm size 1460" and press Enter. You'll receive AOK from the module.
35. Type "set comm time 1000" and press Enter. You'll receive AOK from the module.
36. Type "set uart baudrate 115200" and press Enter. You'll receive AOK from the module.
37. Type "save" to save the settings.
38. Type "exit" and press Enter.
39. Close Comm Operator.
40. Connect Pin 2 UART_TX to a RX pin on your arduino board. Do not connect to Pin 0 or Pin 1. These are reserved pins. Can't really explain why but I just know it doesn't work properly.
41. Connect Pin 3 UART_RX to a TX pin on your board. If you forgot about the pins on the module, refer to the datasheet up top.
42. THAT IS IT!
In your Arduino Sketch, you'll use "Serial.begin(115200);" to communicate with your board now!
If you have any problems, feel free to comment below.