Feedback!

XBEE 5V Breakout

Views: 8392 Difficulty: 2 Status: Complete
Screen_shot_2013-02-14_at_9.30.46_am

This circuit lets you talk to an XBEE serial port with 5V power and just two signal lines: RX and TX.

XBEEs are great radio modules. You can buy them from adafruit, sparkfun, and digi-key or your favorite electronics dealer. They cost around $20 dollars for the cheapest, lowest-range variety. Unfortunately, they require 3.3 volts, they don't fit easily into a breadboard, and they have a bunch of pins that are unnecessary if you only want to use them for serial communication at 9600 bps (bits per second). So we designed this breakout board, which lets you power them with 5V, stepping it down to 3.3V with an on-board voltage regulator. It pulls out the RX and TX pins necessary for serial communication and that is all. The 4 lines are accessed via a breadboard-friendly 0.1" spaced header. Don't worry about all those pins that you need Windows, and/or the command line to configure them :( If you do want to configure your XBEE see this tutorial from bildr. You will also need a tool like XBEE USB explorer from Sparkfun. Lots of other great example projects on Digi's (the company that makes the XBEEs) example page.
Also check out our XBEE LED Display tutorial which wirelessly sends text to our Heart Matrix LED display. You can send text from the Arduino serial port window, or from programs written in java or C++, anything that can access the serial port can send text out on the XBEE.

Unpopulated PCB

Screen_shot_2013-01-17_at_10.03.29_pm
The is the board showing the footprint for the voltage regulator the transistor and the 4x10K ohm resistor array.

RC Bot Video

This robot is controlled by the thumb joystick. The XBEE radio modules handle all the communication.

Transmit Code Test

Transmit 5 bytes. Wait about a second or so between each transmission.
/* LucidTronix xbee simple transmit 
 * http://www.lucidtronix.com/tutorials/23
 * just transmit five different bytes
 * good test to make sure serial communication
 * is working.
 */
void setup() {
  Serial.begin(9600);    //initialize serial
}

void loop() {
  Serial.write(250);
  delay(900);
  Serial.write(251);
  delay(1100);
  Serial.write(252);
  delay(500);
  Serial.write(253);
  delay(1000);
  Serial.write(254);
  delay(1500);
}

Receive Code Test

This code receives the 5 different bytes sent by the above transmitting code and lights a different LED depending on which one is being received.
/* LucidTronix xbee simple transmit 
 * See the accompanying transmission code
 * http://www.lucidtronix.com/tutorials/23
 * just recevies five different bytes
 * lights up different LEDs connected to pins
 * 2,3,4 and 5, depending on which byte was last received.
 * Good test to make sure serial communication
 * is working.
 */
int leds[]  = {2,3,4,5};
int num_leds = 4;
void setup() {
  Serial.begin(9600);    	//initialize serial
  for (int i = 0 ; i < num_leds; i++ )
    pinMode(leds[i], OUTPUT);  
  for (int i = 0 ; i < num_leds; i++ )
    digitalWrite(leds[i], HIGH);
  delay(2000); 
  for (int i = 0 ; i < num_leds; i++ )
    digitalWrite(leds[i], LOW);   
  delay(2000); 
  for (int i = 0 ; i < num_leds; i++ )
    digitalWrite(leds[i], HIGH);
  delay(2000); 
}

void loop() {   
  delay(20); 
  while (Serial.available()){
    int getData = Serial.read();  //if yes, read it
    for (int i = 0 ; i < num_leds; i++ )
      digitalWrite(leds[i], LOW);  
    if(getData == 10){
  	  digitalWrite(leds[0], HIGH);
	}else if(getData == 250){
  	  digitalWrite(leds[1], HIGH);
	}else if(getData == 251){
  	  digitalWrite(leds[2], HIGH);
	}else if(getData == 252){
  	  digitalWrite(leds[3], HIGH);
	}else if(getData == 253){
  	  digitalWrite(leds[1], HIGH);
          digitalWrite(leds[2], HIGH);
	}else if(getData == 254){
  	  digitalWrite(leds[0], HIGH);
          digitalWrite(leds[1], HIGH);
          digitalWrite(leds[2], HIGH);
          digitalWrite(leds[3], HIGH);
	}
    delay(20);
  }
}

Download EAGLE files and code

Download this project! Please enjoy. Use the comments section for questions or trouble with the code or the circuit.
Click Here to Download: Download EAGLE files and code

Parts

Title Description # Cost Link Picture
PCB XBEE Breakout LucidTronix 5V Serial breakout board for the RX and TX XBEE pins 1 $4.0 Link Screen_shot_2013-01-17_at_10.03.29_pm
Header Female header 2mm spacing 10 pin fits the XBEE radio modules 2 $1.11 Link Pppn101bfcn-rc
Voltage Regulator 3v3 SMD IC REG LDO 3.3V .15A SOT23 Up to 6V input output 3.3V 150mA (Max) Value: 3.3V 1 $0.46 Link Sot-23-3_pkg
BSS138 MOSFET N-CH 50V 220MA SOT-23 Value: MOSFET N-Channel, Metal Oxide 1 $0.25 Link Sot-23-3_pkg
Capacitor CAP CER 0.1UF 50V Y5V 0805 Value: 0.1µF 2 $0.1 Link 0805(6_0mm_thickness)
Permalink: http://lucidtronix.com/tutorials/23
Control the Heart Matrix LED display wirelessly, using XBEE radio modules....
Display numbers in big bright red LEDs use only 3 micro-controller pins and the 74HC595 shift registe...
The MCP79410 breakout board gives easy access to this cute little timekeeper....
The 74HC595 shift register controls a 10 LED Bar Graph....
Display 4 digits using only 3 MCU wires with the 4 x 7 Segment LED and shift register breakout board....
XBEE radio modules, force-sensitive resistors, and vibration motors allow you to give massages over r...
Wireless communication on the wearable wayfinder....
Control RGB LEDs with this daisy-chainable breakout board....