This circuit lets you talk to an XBEE serial port with 5V power and just two signal lines: RX and TX.
/* 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); }
/* 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); } }
Title | Description | # | Cost | Link | Picture |
PCB XBEE Breakout | LucidTronix 5V Serial breakout board for the RX and TX XBEE pins | 1 | $4.0 | Link |
![]() |
Header | Female header 2mm spacing 10 pin fits the XBEE radio modules | 2 | $1.11 | Link |
![]() |
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 |
![]() |
BSS138 | MOSFET N-CH 50V 220MA SOT-23 Value: MOSFET N-Channel, Metal Oxide | 1 | $0.25 | Link |
![]() |
Capacitor | CAP CER 0.1UF 50V Y5V 0805 Value: 0.1µF | 2 | $0.1 | Link |
![]() |
Comments: