Zigbee is a wireless personal area network that transmits and recieves sequence of charecters. It is configured using XCTU software. All digital pins of arduino can be used for serial communication using serial software library. Zigbee with arduino, we can send and recieve one charecter per second. It is the easiest mode of communication. Easy to use and has got good range of communication over other RF modules.
Connecting Two arduino's via Zigbee
Components required
1. A pair of configured Zigbee
2. Pair of Arduino boards
3. Connecting wires, LED
4. Zigbee breakout boards
Zigbee break out boards are necessary because zigbee pins are a way too small and cannot be connected using normal jumper wires.
Step 1. Pin connections
Rx of zigbee to tx of arduino
Tx of zigbee to Rx of arduino.
Vcc- 3.3v
You can use digital pins 0 and 1 which are by default used for serial communication. If they are used for ZigBee , serial monitor cannot be used for the other purpose and whilre dumping code, connections are to be removed. So to avoid these problems, I recommend using Serial software library(inbuilt) through which other digital pins can be used for serial communication.
Step 2. Dump the transmitter and receiver codes
//transmitter code
In this code, we will transmit two letters from the transmitter o and f. At the receiver, LED is used to indicate the letter received. It turns on for o and off for f. We can view the received letters in Serial monitor
Connecting Two arduino's via Zigbee
Components required
1. A pair of configured Zigbee
2. Pair of Arduino boards
3. Connecting wires, LED
4. Zigbee breakout boards
Zigbee break out boards are necessary because zigbee pins are a way too small and cannot be connected using normal jumper wires.
Step 1. Pin connections
Rx of zigbee to tx of arduino
Tx of zigbee to Rx of arduino.
Vcc- 3.3v
You can use digital pins 0 and 1 which are by default used for serial communication. If they are used for ZigBee , serial monitor cannot be used for the other purpose and whilre dumping code, connections are to be removed. So to avoid these problems, I recommend using Serial software library(inbuilt) through which other digital pins can be used for serial communication.
Step 2. Dump the transmitter and receiver codes
//transmitter code
In this code, we will transmit two letters from the transmitter o and f. At the receiver, LED is used to indicate the letter received. It turns on for o and off for f. We can view the received letters in Serial monitor
- char readChar;
- void setup() {
- // put your setup code here, to run once:
- pinMode(13,OUTPUT);
- Serial.begin(9600);
- }
- void loop() {
- Serial.print('o');
- delay(1000);
- Serial.print('f');
- delay(1000);// put your main code here, to run repeatedly:
- }
Receiver Code
- char readChar;
- void setup() {
- pinMode(13,OUTPUT);
- Serial.begin(9600);// put your setup code here, to run once:
- }
- void loop() {
- if(Serial.available()>0)
- {readChar=Serial.read();
- if(readChar=='O')
- digitalWrite(13,HIGH);
- if(readChar=='f')
- digitalWrite(13,LOW);
- delay(500);
- }
- }
No comments:
Post a Comment