You are on page 1of 9

RE EDUCATION (//WWW.ARDUINO.CC/EDUCATION) PRO (//WWW.ARDUINO.

CC/PRO) RESOURCES COMMUNITY HELP SIGN IN

Arduino Forum (https://forum.arduino.cc/index.php) > Forum 2005-2010 (read only) (https://forum.arduino.cc/index.php#c12)

> Hardware (https://forum.arduino.cc/index.php?board=62.0) > Troubleshooting (https://forum.arduino.cc/index.php?board=46.0)

> Connecting LilyPad Arduino to LilyPad Xbee (https://forum.arduino.cc/index.php?topic=28738.0)

Go Down Pages: [1]


PRINT (HTTPS://FORUM.ARDUINO.CC/INDEX.PHP?ACTION=PRINTPAGE;TOPIC=28738.0)

Topic: Connecting LilyPad Arduino to LilyPad Xbee (Read 10426 times)


s://Forum.Arduino.Cc/Index.Php?Topic=28738.0;Prev_next=Prev#New) - Next Topic (Https://Forum.Arduino.Cc/Index.Php?Topic=28738.0;Prev_next=Next#New)

inesAD Connecting LilyPad Arduino to LilyPad Xbee (https://forum.arduino.cc/index.php?topic=28738.msg212796#msg212796)


Mar 10, 2009, 03:10 pm (https://forum.arduino.cc/index.php?topic=28738.msg212796#msg212796)
Guest

Hi! I'm trying to have two circuits, each one with a LilyPad Arduino connected to a LilyPad Xbee, in order to have a
wireless connection between the two circuits.

I'm powering the LilyPad Arduino and connecting the TX, RX, + and - pins between the LilyPad Arduino and the LilyPad
Xbee. Both circuits are working well, but there aren't wireless communication. Anyone knows what I may be doing
wrong?

7027%26value3%3D3%26zone%3D560%26extra%3Dcontextualmatch%3Dnolimitation%7Clivetax%3D0%7Ccookietax%3D0%7Ccb%3D0bd0cc856e%7Ch_value%3D809017795d66402115

darudude Re: Connecting LilyPad Arduino to LilyPad Xbee (https://forum.arduino.cc/index.php?topic=28738.msg212797#msg212797)


Mar 10, 2009, 04:23 pm (https://forum.arduino.cc/index.php?topic=28738.msg212797#msg212797) #1
Guest

did you program the xbee's correctly?


did you program the arduino correctly?

could we see the arduino code, and the xbee configuration?

inesAD Re: Connecting LilyPad Arduino to LilyPad Xbee (https://forum.arduino.cc/index.php?topic=28738.msg212798#msg212798)


Mar 10, 2009, 06:02 pm (https://forum.arduino.cc/index.php?topic=28738.msg212798#msg212798) #2
Guest

First I had this code working using Arduino and Xbee Shield with Xbee, know I'm trying to make the code work with
LilyPad Arduino and LilyPad Xbee, but I don't know if I need to do anything that I haven't done.

I'm working in Arduino 11 because de FrequencyTimer library doesn't work with recent versions of Arduino.

One Arduino has this code:

#include <FrequencyTimer2.h>

#define A { \
   { 1, 1, 1, 1},  \
   { 1, 1, 1, 1}, \
   { 1, 1, 1, 1}, \
   { 1, 1, 1, 1},  \
   }

#define B { \
   { 0, 0, 0, 0},  \
   { 0, 0, 0, 0}, \
   { 0, 0, 0, 0}, \
   { 0, 0, 0, 0},  \
}
RE EDUCATION (//WWW.ARDUINO.CC/EDUCATION) PRO (//WWW.ARDUINO.CC/PRO) RESOURCES COMMUNITY HELP SIGN IN
#define C  { \
   { 1, 0, 0, 0},  \
   { 0, 1, 0, 0}, \
   { 0, 0, 1, 0}, \
   { 0, 0, 0, 1},  \
}

#define D { \
   { 1, 0, 0, 1},  \
   { 0, 1, 1, 0}, \
   { 0, 1, 1, 0}, \
   {1, 0, 0, 1},  \
}

#define E { \
   { 0, 0, 1, 0},  \
   { 0, 1, 0, 0}, \
   { 0, 1, 0, 0}, \
   { 0, 0, 1, 0},  \
}

byte col = 0;
byte leds[4][4];

// pin[xx] on led matrix connected to nn on Arduino (-1 is dummy to make array start at pos 1)
int pins[9]= {-1, 3, 4, 6, 7, 11, 12, 8, 9};

// col[xx] of leds = pin yy on led matrix


int cols[4] = {pins[5], pins[6], pins[7], pins[8]};

// row[xx] of leds = pin yy on led matrix


int rows[4] = {pins[4], pins[3], pins[2], pins[1]};

byte propria[3][4][4]={
 A,C,B
};

byte anima72[3][4][4]={
 D,E,B
};

int pattern = 0;
int frame = 0;

//

int incomingByte = 0; // vari?vel para a serial data

int contador=0;

int relo=0;

void setup()
{
 Serial.begin(9600);
 
for (int i = 1; i <= 8; i++) {
   pinMode(pins, OUTPUT);
 }

 // set up cols and rows


 for (int i = 1; i <= 4; i++) {
   digitalWrite(cols[i - 1], LOW);
 }

 for (int i = 1; i <= 4; i++) {


   digitalWrite(rows[i - 1], LOW);
 }
 clearLeds();
RE EDUCATION (//WWW.ARDUINO.CC/EDUCATION) PRO (//WWW.ARDUINO.CC/PRO) RESOURCES COMMUNITY HELP SIGN IN
 // Turn off toggling of pin 11
 FrequencyTimer2::disable();
 // Set refresh rate (interrupt timeout period)
 FrequencyTimer2::setPeriod(2000);
 // Set interrupt routine to be called
 FrequencyTimer2::setOnOverflow(display);

void loop()
{
  //LIGA?ÌO
 if (Serial.available() > 0) { //caso exista info "em linha de espera" ler
   incomingByte = Serial.read();
   delay(100);
   Serial.print ('L');
   Serial.flush();
 }

else{
 Serial.print ('L');//modo dormente
 }

 //AC?ÌO

 if (incomingByte == 72 && contador<4){


 
    Serial.print ('L');
   setPattern(anima72[frame]);
   frame++;
  
   if(frame >= 3){
     frame=0;
     contador++;
   }

 }
 else{
    setPattern(propria[frame]);
  
   frame++;
  
   if(frame >= 3){
     frame=0;
   }
  
   relo++;
   if (relo>10){
     relo=0;
     contador=0;
   }
  
 }
 delay(2000);
}

//

void clearLeds() {
 // Clear display array
 for (int i = 0; i < 4; i++) {
   for (int j = 0; j < 4; j++) {
     leds[j] = 0;
   }
 }
}

void setPattern(byte p[4][4]) {


 for (int i = 0; i < 4; i++) {
   for (int j = 0; j < 4; j++) {
     leds[j] = p[j];
   }
 }
RE E D U C A T I O N ( / / W W W . A R D U I N O . C} C / E D U C A T I O N ) PRO (//WWW.ARDUINO.CC/PRO) RESOURCES COMMUNITY HELP SIGN IN

// Interrupt routine
void display() {
 digitalWrite(cols[col], LOW);  // Turn whole previous column off
 col++;
 if (col == 4) {
   col = 0;
 }
 for (int row = 0; row < 4; row++) {
   if (leds[col][3 - row] == 1) {
     digitalWrite(rows[row], LOW);  // Turn on this led
   }
   else {
     digitalWrite(rows[row], HIGH); // Turn off this led
   }
 }
 digitalWrite(cols[col], HIGH); // Turn whole column on at once (for equal lighting times)
 delayMicroseconds(900);  // Delay so that on times are longer than off time = brighter leds
}

And the other has this code:

#include <FrequencyTimer2.h>

#define A { \
   { 1, 1, 1, 1},  \
   { 1, 1, 1, 1}, \
   { 1, 1, 1, 1}, \
   { 1, 1, 1, 1},  \
   }

#define B { \
   { 0, 0, 0, 0},  \
   { 0, 0, 0, 0}, \
   { 0, 0, 0, 0}, \
   { 0, 0, 0, 0},  \
}

#define C  { \
   { 1, 0, 0, 0},  \
   { 0, 1, 0, 0}, \
   { 0, 0, 1, 0}, \
   { 0, 0, 0, 1},  \
}

#define D { \
   { 1, 0, 0, 1},  \
   { 0, 1, 1, 0}, \
   { 0, 1, 1, 0}, \
   {1, 0, 0, 1},  \
}

#define E { \
   { 0, 0, 1, 0},  \
   { 0, 1, 0, 0}, \
   { 0, 1, 0, 0}, \
   { 0, 0, 1, 0},  \
}

byte col = 0;
byte leds[4][4];

// pin[xx] on led matrix connected to nn on Arduino (-1 is dummy to make array start at pos 1)
int pins[9]= {-1, 11, 3, 6, 8, 9, 7, 4, 12};

// col[xx] of leds = pin yy on led matrix


int cols[4] = {pins[8], pins[7], pins[6], pins[5]};

// row[xx] of leds = pin yy on led matrix


int rows[4] = {pins[4], pins[3], pins[2], pins[1]};
byte propria[3][4][4]={
RE E D U C A T I O N ( / / W W W . A R D U I N O . C D,E,B
C/EDUCATION) PRO (//WWW.ARDUINO.CC/PRO) RESOURCES COMMUNITY HELP SIGN IN
};

byte anima76[3][4][4]={
 A,C,B
};

int pattern = 0;
int frame = 0;

//

int incomingByte = 0; // vari?vel para a serial data

int contador=0;

int relo=0;

void setup()
{
 Serial.begin(9600);
 
for (int i = 1; i <= 8; i++) {
   pinMode(pins, OUTPUT);
 }

 // set up cols and rows


 for (int i = 1; i <= 4; i++) {
   digitalWrite(cols[i - 1], LOW);
 }

 for (int i = 1; i <= 4; i++) {


   digitalWrite(rows[i - 1], LOW);
 }

 clearLeds();

 // Turn off toggling of pin 11


 FrequencyTimer2::disable();
 // Set refresh rate (interrupt timeout period)
 FrequencyTimer2::setPeriod(2000);
 // Set interrupt routine to be called
 FrequencyTimer2::setOnOverflow(display);
}

void loop()
{
   //LIGA?ÌO
 if (Serial.available() > 0) { //caso exista info "em linha de espera" ler
   incomingByte = Serial.read();
   delay(100);
   Serial.print ('H');
   Serial.flush();
 }

else{
 Serial.print ('H');//modo dormente
 }

 //AC?ÌO

 if (incomingByte == 76 && contador<4){


 
    Serial.print ('H');
   setPattern(anima76[frame]);
   frame++;
  
   if(frame >= 3){
     frame=0;
     contador++;
   }

 }
 else{
RE E D U C A T I O N ( / / W W W . A R D U I N O . C  C /EDUCATION) PRO (//WWW.ARDUINO.CC/PRO)
  setPattern(propria[frame]); RESOURCES COMMUNITY HELP SIGN IN
  
   frame++;
  
   if(frame >= 3){
     frame=0;
   }
  
   relo++;
   if (relo>5){
     relo=0;
     contador=0;
   }
  
 }
 delay(2000);
}

//

void clearLeds() {
 // Clear display array
 for (int i = 0; i < 4; i++) {
   for (int j = 0; j < 4; j++) {
     leds[j] = 0;
   }
 }
}

void setPattern(byte p[4][4]) {


 for (int i = 0; i < 4; i++) {
   for (int j = 0; j < 4; j++) {
     leds[j] = p[j];
   }
 }
}

// Interrupt routine
void display() {
 digitalWrite(cols[col], LOW);  // Turn whole previous column off
 col++;
 if (col == 4) {
   col = 0;
 }
 for (int row = 0; row < 4; row++) {
   if (leds[col][3 - row] == 1) {
     digitalWrite(rows[row], LOW);  // Turn on this led
   }
   else {
     digitalWrite(rows[row], HIGH); // Turn off this led
   }
 }
 digitalWrite(cols[col], HIGH); // Turn whole column on at once (for equal lighting times)
 delayMicroseconds(900);  // Delay so that on times are longer than off time = brighter leds
}

The objective is that the two LED matrix have different animations and when they are near each other, the animations
exchange from one matrix to the other.

inesAD Re: Connecting LilyPad Arduino to LilyPad Xbee (https://forum.arduino.cc/index.php?topic=28738.msg212799#msg212799)


Mar 11, 2009, 03:26 pm (https://forum.arduino.cc/index.php?topic=28738.msg212799#msg212799) #3
Guest

The project is now working  


It had a stupid mistake, I thought that the RX on the LilyPad Arduino should connect to the RX on the LilyPad Xbee and
the TX to the TX, but that's not true, the RX connects to TX and the TX to the RX.

Thanks to everyone that have tried to help anyway.

faludi Re: Connecting LilyPad Arduino to LilyPad Xbee (https://forum.arduino.cc/index.php?topic=28738.msg212800#msg212800)


(https://forum.arduino Mar 11, 2009, 09:24 pm (https://forum.arduino.cc/index.php?topic=28738.msg212800#msg212800) #4
.cc/index.php?
RE E D U C A T I O Naction=profile;u=1584)
Glad you worked it out! PHere's
(//WWW.ARDUINO.CC/EDUCATION)
a collection of Common XBee Mistakes Rthat
RO (//WWW.ARDUINO.CC/PRO)
I created to provide
ESOURCES
a checklist ofHpossible
COMMUNITY ELP SIGN IN
fixes for radio unhappiness: http://www.faludi.com/projects/common-xbee-mistakes/
(http://www.faludi.com/projects/common-xbee-mistakes/)

By the way, while generally you'll hook up TX to RX and vice versa, there are certain devices out there that label their
(https://forum.arduino.c pins differently, like the GM862, so always check the data sheet, or simply try swapping the connections if you're not
c/index.php? sure.
action=profile;u=1584)
--Rob
Newbie
Posts: 22
Karma: 1  [add]
(https://forum.arduino.c
c/index.php?
action=karma;sa=applau
d;uid=1584;a114b32140=7
551cc4a5bfbc7df0878bbe
0e9f507e5)

inesAD Re: Connecting LilyPad Arduino to LilyPad Xbee (https://forum.arduino.cc/index.php?topic=28738.msg212801#msg212801)


Mar 11, 2009, 10:08 pm (https://forum.arduino.cc/index.php?topic=28738.msg212801#msg212801) #5
Guest

Thanks. By the way, I've found the solution to my problem precisely on your list.

luxxnatura Re: Connecting LilyPad Arduino to LilyPad Xbee (https://forum.arduino.cc/index.php?topic=28738.msg212802#msg212802)


Sep 12, 2010, 03:54 am (https://forum.arduino.cc/index.php?topic=28738.msg212802#msg212802) #6
Guest

Does anyone know of any solid tutorials on working with the Lilypad Xbee?  I'm trying to get a project up and running,
and I'm not sure if I'm doing things correctly.  I have some questions, perhaps someone could answer them?

In this project there is a performer who will be wearing the Lilypad.  There will be 6 buttons, each corresponding to a
different video effect/treatment to a video running in Processing.  So, couple questions:

1) The Lilypad Arduino and the Lilypad Xbee board will be essentially next to each other in the costume.  I'll connect the
buttons to pins on the LParduino, and then are the only connections between the two boards rx, tx, power and
ground?  Are there any connections I am overlooking?

2) the Lilypad Xbee will communicate with an Arduino Duemilanove with Xbee shield connected to the computer.  This
is where it receives the instances of button presses, and tells Processing what to do.  Does this Xbee need to be
connected to an Arduino or can it be connected via Sparkfun's USB Explorer breakout board?  As I'm writing this, I'm
thinking that's a bit of a silly question, since I need to be able to tell the Xbee what to do...  except that I'm thinking this
Xbee should still be able to receive the data and send it via USB to the Arduino program that is running.  Is that correct?

I hope I'm clear with my questions!


Thanks in advance!

PaulS Re: Connecting LilyPad Arduino to LilyPad Xbee (https://forum.arduino.cc/index.php?topic=28738.msg212803#msg212803)


(https://forum.arduino Sep 12, 2010, 02:06 pm (https://forum.arduino.cc/index.php?topic=28738.msg212803#msg212803) #7
.cc/index.php?
action=profile;u=16084 Quote
)
❝ are the only connections between the two boards rx, tx, power and ground?  Are there any connections I am overlooking?

(https://forum.arduino.c Those are the only connections needed.


c/index.php?
action=profile;u=16084) Quote

Brattain Member ❝ This is where it receives the instances of button presses


Posts: 93,654
Karma: 3065  [add]
It receives whatever the Lilypad sent when a button was pressed. Pressing a button and sending data are not coupled
(https://forum.arduino.c
on the Lilypad unless your code couples them.
c/index.php?
action=karma;sa=applau
Quote
d;uid=16084;a114b32140=
RE
7551cc4a5bfbc7df0878bb
Does
EDUCATION (//WWW.ARDUINO.CC/E D Uthis
C AXbee ❝
T I Oneed
N ) to be
P Rconnected
O ( / / WtoWanWArduino
. A R D or
U can
INOit .be
C connected
C / P R O )via Sparkfun's
R E S O UUSB
R C Explorer
ES Cbreakout
O M M Uboard?
NITY HELP SIGN IN
e0e9f507e5)
Seattle, WA USA
The Explorer breakout board is sufficient. The XBee is receiving messages over the air and converting them to serial
data, or receiving data from the serial port and broadcasting it. There is no processing, and, therefore no Arduino
required.

The art of getting good answers lies in asking good questions.

luxxnatura Re: Connecting LilyPad Arduino to LilyPad Xbee (https://forum.arduino.cc/index.php?topic=28738.msg212804#msg212804)


Sep 12, 2010, 11:57 pm (https://forum.arduino.cc/index.php?topic=28738.msg212804#msg212804) #8
Guest

Perfect!
Thanks Paul!

jenifer Re: Connecting LilyPad Arduino to LilyPad Xbee (https://forum.arduino.cc/index.php?topic=28738.msg212805#msg212805)


Jan 18, 2011, 04:12 pm (https://forum.arduino.cc/index.php?topic=28738.msg212805#msg212805) Last Edit: Jan 18, 2011, 04:41 pm by jenifer Reason: 1 #9
Guest

Hello Hello!

I was hoping someone might be able to shed some light on a project I am working on.  The basic idea is this;
1) there is one performer, wearing a few sensors (flex, pressure, gyro, accel)
2) there are lilPad products involved (lpXbee, lpArduino)
3) the idea is that data received from the sensors will control/generate musical parameters within a software system.

I got the how to get data to the software....


but not how to get data to the point where the software can see/read it (UDP, OSC)

So, what I am wondering is....


1) Is 1 xBee enough?
(data from sensors on performer, sent wireless to computer nearby)
( as the one that sends? or do you need one that sends and one that receives?)

2) Is there a solid basic starter code (like blinking an LED) that I can use as a tester to configure my lpXbee?

3) correct order?
lilyPad liPower (3.5V) to lpArduino to lpXbee?
or power to xB then arduino?  

-the person above mentioned that she was working with a lpXbee *next to* a regular lilyPad..... is that necessary?
(reply later.... i see that the lpXB is a shield... not an arduino)

More info:
I also have the standard decimilinove and the nano.

I also have the liPower with the lp, and the lp arduino (and the xb w lp)

Thanks for the assistance in advance


`jenifer

luxxnatura Re: Connecting LilyPad Arduino to LilyPad Xbee (https://forum.arduino.cc/index.php?topic=28738.msg212806#msg212806)


Jan 18, 2011, 05:48 pm (https://forum.arduino.cc/index.php?topic=28738.msg212806#msg212806) #10
Guest

Hi Jennifer,
I can answer a few of your questions, but not so much on the software side (you would have to elaborate on this).

1) you will need two Xbee radios, one which is connected to your computer via FTDI breakout board (one of these:
http://www.sparkfun.com/products/9716) and a second which is used on the Lilypad Xbee board.  The one on the LP
Xbee board transmits the data wirelessly to your computer.

2) You have to configure the Xbees before you can use them.  You have to set it so that one listens to the other.  A
decent tutorial (including starter code) can be found here: http://www.ladyada.net/make/xbee/arduino.html

3) I apply power to the Xbee because it has a voltage regulator which outputs 3.3V, which I then use to power the
Lilypad and any sensors.

I hope this helps some!

jenifer Re: Connecting LilyPad Arduino to LilyPad Xbee (https://forum.arduino.cc/index.php?topic=28738.msg212807#msg212807)


Guest Jan 21, 2011, 12:03 am (https://forum.arduino.cc/index.php?topic=28738.msg212807#msg212807) #11
RE EDUCATION (//WWW.ARDUINO.CC/EDUCATION) PRO (//WWW.ARDUINO.CC/PRO) RESOURCES COMMUNITY HELP SIGN IN
Thank you for such clear answers.
I have a few follow-ups.

So, if I understand correctly:


the lilyPad arduino is connected to the FTDI which is connected to the computer via a USB a-to-b cable
AND
the XBee is on a separate lilyPad (being the lilyPad breakout board)

I am trying to go wireless (hence the XBee) so i am a bit confused on if the USB to computer connection is just for
uploading the data, or if it always remain that way.  Ultimately I will be sewing the circuits and wearing them.....

A little context:
I am building a pair of gloves that I want to wear to perform.
I would like to have a wireless connection to my computer via the XBee
I am thinking I should strap on both of the lilyPadboards (the arduino and the xbee)... true?  

Thanks again for your effort  


`j

luxxnatura Re: Connecting LilyPad Arduino to LilyPad Xbee (https://forum.arduino.cc/index.php?topic=28738.msg212808#msg212808)


Jan 21, 2011, 12:40 am (https://forum.arduino.cc/index.php?topic=28738.msg212808#msg212808) #12
Guest

The Lilypad Arduino is not connected to the computer, it will be part of your wearable setup.  I just realized that I
posted the wrong Sparkfun link in my previous message (re: FTDI breakout board).  The only time you need the
breakout board is when you are uploading code to your Lilypad Arduino.  When you are done, you disconnect it.

What you want is the Xbee Explorer:


Explorer http://www.sparkfun.com/products/8687 . It is on this device that you will put
one of your Xbee radios, and it will stay connected to your computer during your performance.  

So, you basically have two setups: one stationary (Xbee Explorer w/Xbee radio + computer) and the other wearable
(Lilypad Arduino + Lilypad Xbee w/ Xbee radio + sensors/actuators + batteries).

Go Up Pages: [1]
PRINT (HTTPS://FORUM.ARDUINO.CC/INDEX.PHP?ACTION=PRINTPAGE;TOPIC=28738.0)

Jump to:
===> Troubleshooting   Go

You might also like