Arduino Forum upgrade scheduled for Monday, October 20th, 11am-4pm (CEST). Sorry for the inconvenience!
Pages: [1]   Go Down
Author Topic: New XBEE WiFi modules  (Read 5164 times)
0 Members and 1 Guest are viewing this topic.
Louisville, KY
Offline Offline
Full Member
***
Karma: 0
Posts: 101
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You can now purchase the new XBEE WiFi modules from their online store:
http://www.digi.com/products/wireless-wired-embedded-solutions/zigbee-rf-modules/point-multipoint-rfmodules/xbee-wi-fi.jsp#overview


See Press release here:
http://www.engadget.com/2011/07/29/xbee-grows-up-delivers-wifi-to-diyers-and-arduino-enthusiasts/

Quote
Ideal for energy management, wireless sensor networks and intelligent asset management, the XBee Wi-Fi offers 802.11 b/g/n networking and flexible SPI and UART serial interfaces. Because the module includes the 802.11 b/g/n physical layer, baseband MAC and TCP/IP stack, developers can add Wi-Fi to their products simply by connecting to the XBee Wi-Fi's serial port. The XBee Wi-Fi is fully tested at manufacture and comes with modular certification for the U.S., E.U., Canada and a number of other countries, further reducing the time to market, development expense and design complexity.
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 234
Posts: 14296
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What is the max baudrate?
Prices ?
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Louisville, KY
Offline Offline
Full Member
***
Karma: 0
Posts: 101
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

They sell for $49.

The max baud rate for serial interface is 230,400.

You can also use SPI the manual states "SPI Clock rates up to 3.5 MHz are possible"

Here is the documentation:
http://ftp1.digi.com/support/documentation/90002124_B.pdf
Logged

Sheffield --- UK --
Offline Offline
Sr. Member
****
Karma: 0
Posts: 377
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

wow , that could be a nice little add on for the people who already have xbee shields.
Logged


Dallas, Texas
Offline Offline
God Member
*****
Karma: 0
Posts: 861
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

They must be pretty popular. Mine won't ship until the first week of September. I plan to use these with an FIO eventually but with a shield for starters.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 21
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I may have to look into this because I have heard nothing but good things from the XBee lineup.  I actually had a question regarding these products if you dont mind my asking.  I currently am using a bluetooth stackable shield to transmit data to my android phone.  I use a bluetooth terminal on the phone and listen to the device.  The software on the device simply prints to the Serial pins and the bluetooth shield transmits that information.

The shield isn't all too reliable, especially the switches that they have installed on them are weak and lose continuity from time to time.

With these wifi shields, do you essentially telnet to the device address and listen?  I guess I am not too familiar with exactly how these work.
Logged

Dallas, Texas
Offline Offline
God Member
*****
Karma: 0
Posts: 861
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The modules will communicate using UDP or TCP so you should be able to telnet between them. Source and destination IP address as well as ports are programmable. Until I get some to play with, that's about all I know.

FYI, the Development Kit has two modules and two USB interface boards. The modules are one with u.fl antenna connector and one with pcb antenna. I'm not crazy about the pcb antenna modules because they cannot be easily changed to a different termination like the other modules. I ordered an additional RPSMA module for my use. IMO, at $149, the Development Kit is not a bad deal since the USB interface boards give you lots of access to the modules through various pin headers and do some level shifting for interface to 5V logic. The individual wifi modules are $49.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 21
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The modules will communicate using UDP or TCP so you should be able to telnet between them. Source and destination IP address as well as ports are programmable. Until I get some to play with, that's about all I know.

FYI, the Development Kit has two modules and two USB interface boards. The modules are one with u.fl antenna connector and one with pcb antenna. I'm not crazy about the pcb antenna modules because they cannot be easily changed to a different termination like the other modules. I ordered an additional RPSMA module for my use. IMO, at $149, the Development Kit is not a bad deal since the USB interface boards give you lots of access to the modules through various pin headers and do some level shifting for interface to 5V logic. The individual wifi modules are $49.

Great thanks a lot for the reply.  I looked at the development kit and at the moment it is looking a bit too pricey for my tastes, especially with the rest of the project's cost at the moment.  I assume that I will be ok with the singular module and just connect to it through my wireless network at home?
Logged

Dallas, Texas
Offline Offline
God Member
*****
Karma: 0
Posts: 861
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I assume that I will be ok with the singular module and just connect to it through my wireless network at home?

The modules can join a wireless network. They have registers that can be be programmed with the SSID, etc. If you have a way to connect with the original xbee modules serially, you can use xctu to program the registers on these modules. I have a separate order in for a RPSMA module that might ship before the development kit. I'll post my progress with that when I receive it.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 21
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ahh right right, I was looking at the XBee Explorer USB in regards to programming the registers and installing drivers/firmware etc etc.  So looks like i need a xbee wifi, xbee shield, and xbee explorer?
Logged

Dallas, Texas
Offline Offline
God Member
*****
Karma: 0
Posts: 861
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Ahh right right, I was looking at the XBee Explorer USB in regards to programming the registers and installing drivers/firmware etc etc.  So looks like i need a xbee wifi, xbee shield, and xbee explorer?

Examine carefully the current available from the shield/explorer that you have or plan to get. The wifi modules can consume around 280mA depending on the mode they are in and the 3V3 regulators on some of the boards are kind of wimpy.
Logged

italy
Offline Offline
Full Member
***
Karma: 3
Posts: 227
Muuuuu
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Where can I find an example of code for arduino and this wifi adapter?
Thanks!
Logged

Wellington, New Zealand
Offline Offline
Sr. Member
****
Karma: 1
Posts: 404
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Roving Networks has had a XBee compatible WiFi module out for a while now.  Its $35 and available here from SparkFun - RN-VX WiFly. Add an XBee shield for $10 from Seeedstudio and you're away laughing.

Max data rate is 460Kbps over serial. Supports 802.11b/g, WEP, WPA, and WPA2.  TCP, UDP, and built in support for DHCP, DNS, ARP, ICMP, Telnet, FTP, HTTP client.

I've had one running for a few weeks now, easy to set up and connect as a client to my wireless network (802.11g with WPA).

Picture: WiFly is receiving UDP packets every second with the current download rate from my DSL router. Uno is displaying the rate on the OLED display and the analog meter.


* wifly.jpg (59.19 KB, 640x368 - viewed 46 times.)
Logged


Offline Offline
Full Member
***
Karma: 1
Posts: 200
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi dhunt,

if you're written up the code/project anywhere I'd like to read it.
Logged

Wellington, New Zealand
Offline Offline
Sr. Member
****
Karma: 1
Posts: 404
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi novice,

I haven't done a write-up yet because the project isn't finished.  I have a nice old brass meter from an old ship that I'm going to mount the project in (without the oled display), along with a smaller slave meter for upload status.

Here's the sketch at the moment:
Code:
#include <Wire.h>
#include <NewSoftSerial.h>

void sendChar(char ascii);

NewSoftSerial wfSerial(11, 12);

#define OLED_address  0x3c
extern unsigned char myFont[][8];

uint8_t oled_row=0; // Current oled write row

const uint8_t meterPin = 9; // analog meter pin

#define WF_MAX_MSG_SIZE 64
#define WF_EOM 255 /* End of message marker character */
#define NUM_STEPS 19 /* Number of steps when moving meter */

char buf[WF_MAX_MSG_SIZE];

int ind=0;
int step;
int meterMin=0;
int meterMax=0;

void setup()
{
    Serial.begin(9600);
    Serial.println("Starting");

    wfSerial.begin(9600);
 
    Wire.begin();
    init_OLED();
    delay(10);
    clear_display();
    delay(50);
    sendcommand(0x20);            //Set Memory Addressing Mode
    sendcommand(0x02);            //Set Memory Addressing Mode ab Page addressing mode(RESET) 

    sendcommand(0xa6);   //Set Normal Display (default)

    setXY(0,0);
    sendStr("Bandwidth 1.0\n\r");
    incRow();

    pinMode(meterPin, OUTPUT);

    /* Test meter */
    int ind;
    for (ind=0; ind<255; ind+=10) {
analogWrite(meterPin, ind);
delay(100);
    }
    analogWrite(meterPin, 255);
    delay(1000);
    for (ind=250; ind>0; ind-=10) {
analogWrite(meterPin, ind);
delay(100);
    }
    analogWrite(meterPin, 0);
}

void loop()
{
    /* Currently stepping meter towards meterMax? */
    if (step) {
        /* Take next step */
        delay(100);
analogWrite(meterPin, map(step, NUM_STEPS, 0, meterMin, meterMax));
step--;
    }

    /* Check for UDP data */
    if (wfSerial.available() > 0) {
        uint8_t ch = wfSerial.read();

/* Got end of message marker? */
if (ch != WF_EOM) {
    /* collect all the input in the buffer */
    if (ind < (WF_MAX_MSG_SIZE-1)) {
        buf[ind++] = ch;
    }
} else {
    /* Got a full message, deal with it
     * Message format is a string "%6.2f KB/s",
     * e.g. "1038.27 KB/s"
     * Note: Currently the first character in the string
     * is a carriage return '\r' so the oled display line
     * resets to column 0 before printing the string.
     */
    buf[ind] = 0; // Null terminate the buffer
    ind = 0; // reset ind for next buffer

    /* Update Oled with new rate */
    sendStr(buf);

    /* Work out where the meter needs to move to,
     * have it move in a series of smaller steps so
     * the movement is smooth. Max is 2047 (5V).
     */
    long kbps = atoi(buf);
    meterMin = meterMax; /* Old position */
    meterMax = map(kbps, 0, 2047, 0, 255); /* New position */
    step = NUM_STEPS; /* Move there in this many steps */
#ifdef DEBUG
    Serial.print(kbps,DEC);
    Serial.print(" -> ");
    Serial.println(meterMax,DEC);
#endif
}
    }
}

/*
 * OLED commands
 */

//=======================
void sendcommand(unsigned char com)
{
  Wire.beginTransmission(OLED_address); //begin transmitting
  Wire.send(0x80);//command mode
  Wire.send(com);
  Wire.endTransmission();    // stop transmitting
}

//==================================
void clear_display(void)
{
    unsigned char i,k;
    for(k=0; k<8; k++) {
setXY(k,0);
for(i=0; i<128; i++) {
    sendByte(0);
}
    }
}

//===================================
void sendByte(unsigned char data)
{
    Wire.beginTransmission(OLED_address); // begin transmitting
    Wire.send(0x40);//data mode
    Wire.send(data);
    Wire.endTransmission();    // stop transmitting
}

void incRow()
{
    oled_row++;
    if (oled_row > 7) {
        /* scroll up one line */
oled_row = 0;
setRow(oled_row);
    } else {
setRow(oled_row);
    }
}

void setRow(uint8_t row)
{
    Serial.print("setRow(");
    Serial.print(row,DEC);
    Serial.println(")");
    sendcommand(0xb0+row); //set page address
    oled_row = row;
}

void setCol(uint8_t col)
{
    sendcommand(0x00+(8*col&0x0f)); //set low col address
    sendcommand(0x10+((8*col>>4)&0x0f)); //set high col address
}

//===================================
void setXY(unsigned char row,unsigned char col)
{
    Serial.println("setXY()");
    setRow(row);
    setCol(col);
}

//==================================
void sendChar(char ascii)
{
    unsigned char i=0;

    for(i=0;i<8;i++) {
sendByte(myFont[ascii-0x20][i]);
    }
}

//==================================
void sendStr(const char *string)
{
#ifdef DEBUG
    Serial.print("sendStr(\"");
    Serial.print(string);
    Serial.println("\")");
#endif

    while(*string) {
if (*string == '\n') {
    incRow();
} else if (*string == '\r') {
    setCol(0);
} else if (*string >= 0x20) {
    sendChar(*string);
}
*string++;
    }
}

//=================================
void init_OLED(void)
{

    sendcommand(0xae); //display off
    delay(50);
    sendcommand(0xaf); //display on
    delay(50);
}

It also uses the attached data.c file for the oled font (from SeeedStudio).

The oled display is a 128x64 grove module from SeeedStudio with an I2C interface (i.e. only needs two pins to drive it). The oled functions in the sketch are mostly straight from the SeedStudio sample sketch. The meter is a 5V analog meter from SparkFun.

I have a python script running on a machine collecting the upload and download byte counts from my Dlink router via SNMP and then sending the Rx rate via to the WiFly via a UDP message every 2 seconds.  I'm considering having the Arduino actually do the SNMP queries directly to the Dlink router instead, but it will be a bit of a pain to build the query and decode the response - maybe I can cheat and just use a canned query message and pull the result from a hard-coded offset in the response.

I configured the WiFly by switching the XBee shield to hardware serial mode and USB UART mode, then used the serial monitor from the Arduino IDE and sent the "$$$" string to switch the WiFly to config mode (no CR/NL for this). I set the following options:
Code:
set ip dhcp 1 // enable DHCP mode

set wlan join 1 // automatically connect to the wireless network
set wlan ssid <my wireless network SSID>
set wlan phrase <my WPA password>
set wlan hide 1 // hide my WPA password
set wlan chan 0 // scan all channels to find network

set ip proto 1 // UDP only (this also disables telnet for config)
set ip flags 0x40 // enable UDP pairing mode
set ip host 0.0.0.0 // for pairing mode
set ip localport 2042 // port to accept UDP messages on
save // save the new config
reboot

* data.c (4.09 KB - downloaded 30 times.)
Logged


Pages: [1]   Go Up
Arduino Forum upgrade scheduled for Monday, October 20th, 11am-4pm (CEST). Sorry for the inconvenience!
Jump to: