FRDM-KL25Z WiFly Access Point iPhone Android Controlled Zumo RC Tracked Vehicle

Introduction

Note: This page incomplete. I will complete it in few days.

First of all I must tell you that I'm very new to mbed platform, I started to write code with mbed 2-3 weeks ago. Also I'm not a native English speaker. For that reason, please forgive my grammatical and engineering related mistakes and please let me know about them.

I had some unused parts at home and I decided to use them to make a RC tracked vehicle with them. I liked the mbed platform so much, so I decided to used mbed for the job. I bought and used FRDM-KL25Z with mbed for the project. At the end the project turned out to be a very stable and very fun RC vehicle project with iPhone and Android controller.

I didn't see any examples about making WiFly module works as an access point and saw some questions about this. Therefore, I decided to write a step by step tutorial about this complete project. I think many steps of this tutorial will be seen very easy for most of developers in this community, so I tried to divide the tutorial in many steps so you can skip the ones that you don't need. Hope this tutorial will be helpful to you.

Here are some pictures about the project:

FRDM_Zumo_RC_1FRDM_Zumo_RC_2 FRDM_Zumo_iPhone

Required Parts:

1. Assembling Zumo:

For assembling Zumo, all you need to do is follow this step by step guide from Pololu:

Next to Arduino pinouts, there are 2 other pinout lines which are connected o the same pins. I soldered some headers to these pins too for connecting jumpers easily later. Because FRDM will be connected to Zumo shield upside down, unless you use stackable female headers for FRDM pins, you won't access any other FRDM pins and you need to access the pins in order to connect the WiFly Module. You can examine the pictured of my Zumo RC system to understand this better.

2. Understanding Zumo Shield:

There is a nice schematics documentation about the shield here: http://www.pololu.com/file/0J591/zumo_shield_schematic.pdf.

Zumo Shield consists of:

1. TI DRV8835 Dual Motor Driver

  • Motor supply voltage: 2–11 V
  • Logic supply voltage: 2–7 V
  • Output current: 1.2 A continuous (1.5 A peak) per motor

2. Piezo Buzzer

Piezo buzzer can be controlled with PWM output.

3. LSM303DLHC I²C 3-axis accelerometer and 3-axis magnetometer

  • Operating voltage: 2.5 to 5.5 V
  • Supply current: 10 mA
  • Output format (I²C):
    • Accelerometer: one 12-bit reading (left-justified) per axis
    • Magnetometer: one 12-bit reading (right-justified) per axis
  • Sensitivity range (configurable):
    • Accelerometer: ±2, ±4, ±8, or ±16 g
    • Magnetometer: ±1.3, ±1.9, ±2.5, ±4.0, ±4.7, ±5.6, or ±8.1 gauss

4. Pushbutton

5. 7.5 V boost regulator for powering the FRDM from the Zumo’s 4 AA batteries

6. LED

7. General-purpose prototyping areas and an expansion area at the front for connecting additional sensors

Pinouts and Jumpers

When you connect the FRDM properly (by placing it with considering 6-8-8-10 headers) pinouts are given below:

DescriptionFRDM Pin
Right Motor DirectionPTC9
Left Motor DirectionPTA13
Right Motor PWMPTD5
Right Motor PWMPTD0
Buzzer Choice 1PTC8
Buzzer Choice 2PTA12
3-axis accelerometer-magnetometer SDAPTE0
3-axis accelerometer-magnetometer SCLPTE1
  • Piezzo buzzer and 3-axis accelerometer-magnetometer are *NOT* connected to the given pins above initially. You need to connect specific jumpers for this. Description of jumpers are given in the below picture:

Zumo Jumpers

3. Connecting FRDM to Zumo Shield:

Since Zumo shield is designed for Arduino UNO or Leonardo and FRDM is a little longer than Arduino UNO or Leonardo, if you assemble the Zumo blade to Zumo chassis, FRDM doesn't fit to Zumo Shield. You need to lever up your FRDM to make it fit to Zumo Shield. For that reason, I placed an Arduino Stackable Header Kit (https://www.sparkfun.com/products/10007) between FRDM and Zumo Shield.

4. Upgrading WiFly Firmware

For making WiFly an Access Point you need a WiFly Firmware 4.0 or higher. Roving Networks has a very nice User's Guide documentation which includes every command set that I will use here and so much more: /media/uploads/can90/rn-wiflycr-ug-v1.2r.pdf

For connecting WiFly to your computer and communicate with its serial port, you can use this code:

Import programWifly_configure

Configure wifly module

written in the mbed WiFly Interface handbook: http://mbed.org/cookbook/WiflyInterface and connect the WiFly to your computer through mbed, or you can buy Xbee Explorer USB (https://www.sparkfun.com/products/8687) and connect it very easily to your computer or you can choose a different method. Just keep that in mind that WiFly uses 9600 baud rate if you haven't changed it. Also I suggest you to use Tera Term for Windows and CoolTerm for Mac OS X for sending and receiving commands.

After making the connection, first check your WiFly's firmware. If your WiFly's firmware is 4.0 or higher, then you won't need to upgrade your firmware. For checking your WiFly's firmware and upgrading the firmware you can apply the commands in the below table one by one:

CommandDescription
$$$Enter Command Mode
scan 10scan available wireless network
set wlan ssid <ssid>set wireless ssid to join@
set wlan auth <auth#>set authentication mode@@
set wlan phrase <phrase>set wlan password@@@
set wlan join 1set join wireless network automatically
set ip local 2101set listen port number
set ip protocol 2set protocol to TCP IP
saveSave settings
rebootReboot module
$$$Enter Command Mode
set ftp address 0Redirect the module to the new IP address
set dns name rn.microchip.comEnter new IP Address
saveSave settings
ftp updateUpgrade WiFly's Firmware
factory RESETReset the module to the factory default state
rebootReboot module

@ Replace <ssid> with your wireless network name

@@ Replace <auth#> with:

  • 0 for Open (Default)
  • 1 for WEP-128
  • 2 for WPA1
  • 3 for Mixed WPA1 and WPA2-PSK
  • 4 for WPA2-PSK
  • 5 for Not used
  • 8 for WPE-64

@@@If you use WPA type for authentication, you will need to use set wlan phrase <phrase>. If you use WEP type for authentication, you will need to use set wlan key <key>. You need to replace <phrase> or <key> with your wireless network's password.

  • Note that, after entering the command "ftp update", you should wait for WiFly to download the firmware and update itself. This process will be shown in serial communication window. If this process fails, don't work and enter "factory RESET" command, you can use your WiFly module like you always do without any difference. Also let me know about any problem that you face about updating your WiFly module's firmware. I will try my best to solve it.
  • I used this method to upgrade two WiFly modules (RN-XV WiFly - Wire Antenna and RN-XV WiFly - RPSMA) without any problem.

5. Connecting WiFly to FRDM

You only need rx/tx pins to connect the WiFly Module to FRDM. You can choose any Serial rx/tx pin for that. Serial rx/tx pins are indicated in Pinouts documentation of mbed:

http://mbed.org/handbook/Pinouts

I also connected reset and TCP connection indicator pins just for making the hardware compatible with the Wifly class, which can be found in WiflyInterface Library:

Import libraryWiflyInterface

mbed official WiflyInterface (interface for Roving Networks Wifly modules)

You will only need Wifly folder in WiflyInterface library for this project. Aster giving the necessary information, here is my preferred setup for connecting WiFly Module and FRDM mbed:

WiFly PinFRDM Pin
VCCP3v3
GNDGND
RX(DIN)PTD3
TX(DOUT)PTD2
RESETPTC8
GPIO6PTC7

6. Powering the System

You have

  • You can use 4 AA batteries for this. Place the batteries inside your Zumo's battery holder. Batteries can be Alkaline or rechargeable type. Zumo's battery holder connects them serially.
  • You can use a LiPo, Li-Ion or any other type of battery that you prefer and connect the battery's "+" and "-" outputs to Zumo Shield's batter charge connector pins. You can see where those pins are located on Zumo Shield by looking at the below image:

Zumo Connectors

Be careful while connecting the battery. Pay attention to "+" sign near battery charging connector pins on Zumo Shield to connect the battery in a right way.

7. FRDM-KL25Z mbed Code

You can find the code at this link:

Import programFRDM-KL25Z_WiFly_Access_Point_Mode_Zumo_RC

FRDM-KL25Z WiFly Access Point iPhone Android Controlled Zumo RC Tracked Vehicle mbed Code

I will try to explain the code briefly.

8. iPhone Application Code

9. Android Application Code

10. Complete System User Guide


1 comment on FRDM-KL25Z WiFly Access Point iPhone Android Controlled Zumo RC Tracked Vehicle:

13 Sep 2014

Could you explain how do you sent data from iPhone/Android to RN-XV WiFly Module?

Please log in to post comments.