Top Banner
ELCT706 MicroLab Session #5 UART Usage for XBEE connection PC - PIC ELCT 706 Session #5 Dr. Mohamed Abdel Ghany Eng. Salma Hesham Eng. Ahmed Atteya
17

ELCT706 MicroLab Session #5 UART Usage for XBEE …eee.guc.edu.eg/Courses/Electronics/ELCT706...Eng. Salma Hesham Eng. Ahmed Atteya XBEE- modules allow Highly reliable and simple communication

Jun 25, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: ELCT706 MicroLab Session #5 UART Usage for XBEE …eee.guc.edu.eg/Courses/Electronics/ELCT706...Eng. Salma Hesham Eng. Ahmed Atteya XBEE- modules allow Highly reliable and simple communication

ELCT706 MicroLabSession #5

UART Usage for XBEE connection PC - PIC

ELCT 706 Session #5Dr. Mohamed Abdel GhanyEng. Salma HeshamEng. Ahmed Atteya

Page 2: ELCT706 MicroLab Session #5 UART Usage for XBEE …eee.guc.edu.eg/Courses/Electronics/ELCT706...Eng. Salma Hesham Eng. Ahmed Atteya XBEE- modules allow Highly reliable and simple communication

XBEE - Radio

ELCT 706 Session #4Dr. Mohamed Abdel GhanyEng. Salma HeshamEng. Ahmed Atteya

XBEE- modules allow

Highly reliable and simple communication between microcontrollers, computers, systems and anything with serial port

Flexibility of multi – XBEE modules communication

Wireless range of operation from 30m to 120m

Low power consumption

Interoperability: can work with any microcontroller

Page 3: ELCT706 MicroLab Session #5 UART Usage for XBEE …eee.guc.edu.eg/Courses/Electronics/ELCT706...Eng. Salma Hesham Eng. Ahmed Atteya XBEE- modules allow Highly reliable and simple communication

XBEE – Configuration

ELCT 706 Session #4Dr. Mohamed Abdel GhanyEng. Salma HeshamEng. Ahmed Atteya

Xbee-modules must be configured before usage either asTransmitter (Router) or Receiver (Coordinator)

Configuration Steps:1. Plug your Xbee module onto

the USB adapter and connect to the PC

2. Open X-CTU software and check from device manager on which port is your USB connected

Page 4: ELCT706 MicroLab Session #5 UART Usage for XBEE …eee.guc.edu.eg/Courses/Electronics/ELCT706...Eng. Salma Hesham Eng. Ahmed Atteya XBEE- modules allow Highly reliable and simple communication

XBEE - Connection

ELCT 706 Session #4Dr. Mohamed Abdel GhanyEng. Salma HeshamEng. Ahmed Atteya

XBEE S2/S1 has 20 pins Pin1 VDD = 3.3V Pin10 Gnd Pin 2 TX to PIC TX Pin 3 RX to PIC RX

3.3V

Tx

Rx

Data converter5 3.3

Page 5: ELCT706 MicroLab Session #5 UART Usage for XBEE …eee.guc.edu.eg/Courses/Electronics/ELCT706...Eng. Salma Hesham Eng. Ahmed Atteya XBEE- modules allow Highly reliable and simple communication

Control Car Motor from PC through Xbee-modules using PIC UART

Step 1Write the MikroC code to use the PIC UART module to control 4 LEDs on Port B(B7 to B4) from PC through Xbee-modules such that each LED corresponds to one of the characters ‘a’, ‘g’, ’e’ and ‘x’. If a different character is pressed all LEDs are turned off.Burn the Code on the PIC.

ELCT 706 Session #4Dr. Mohamed Abdel GhanyEng. Salma HeshamEng. Ahmed Atteya

Page 6: ELCT706 MicroLab Session #5 UART Usage for XBEE …eee.guc.edu.eg/Courses/Electronics/ELCT706...Eng. Salma Hesham Eng. Ahmed Atteya XBEE- modules allow Highly reliable and simple communication

Control Car Motor from PC through Xbee-modules using PIC UART

Step 2- Configure the Xbee-modules using X-CTU software, one as a receiver (coordinator) the other as transmitter (Router). - Connect the Xbee Receiver - Tx pin to the PIC - Rx pin- Keep the Xbee Transmitter connected to the PC.- Send Characters from PC to PIC and the LEDs should

turn ON and OFF correspondingly.

ELCT 706 Session #4Dr. Mohamed Abdel GhanyEng. Salma HeshamEng. Ahmed Atteya

Page 7: ELCT706 MicroLab Session #5 UART Usage for XBEE …eee.guc.edu.eg/Courses/Electronics/ELCT706...Eng. Salma Hesham Eng. Ahmed Atteya XBEE- modules allow Highly reliable and simple communication

Control Car Motor from PC through Xbee-modules using PIC UART

Step 3- Try your car using the Remote control.- Open the body of the car to get out the PCB controlling

the 2 motors of the car.- The outputs from the PIC will be connected to the 2

motors through the H-Bridge

ELCT 706 Session #4Dr. Mohamed Abdel GhanyEng. Salma HeshamEng. Ahmed Atteya

Page 8: ELCT706 MicroLab Session #5 UART Usage for XBEE …eee.guc.edu.eg/Courses/Electronics/ELCT706...Eng. Salma Hesham Eng. Ahmed Atteya XBEE- modules allow Highly reliable and simple communication

Control Car Motor from PC through Xbee-modules using PIC UART

ELCT 706 Session #4Dr. Mohamed Abdel GhanyEng. Salma HeshamEng. Ahmed Atteya

Pins Connections

1, 8, 15 gnd

4 Supply of Car

6, 9,11 VDD = 5V

5,7 Input 1st motor

2,3 Output 1st motor

10,12 Input 2nd motor

13,14 Output 2nd motor

Page 9: ELCT706 MicroLab Session #5 UART Usage for XBEE …eee.guc.edu.eg/Courses/Electronics/ELCT706...Eng. Salma Hesham Eng. Ahmed Atteya XBEE- modules allow Highly reliable and simple communication

XBEE – Configuration Steps Using XCTU

ELCT 706 Session #4Dr. Mohamed Abdel GhanyEng. Salma HeshamEng. Ahmed Atteya

1. Choose the correct COM PORT then click on the Test/Query button to connect your PC to the Xbee module.

Page 10: ELCT706 MicroLab Session #5 UART Usage for XBEE …eee.guc.edu.eg/Courses/Electronics/ELCT706...Eng. Salma Hesham Eng. Ahmed Atteya XBEE- modules allow Highly reliable and simple communication

XBEE – Configuration Steps Using XCTU

ELCT 706 Session #4Dr. Mohamed Abdel GhanyEng. Salma HeshamEng. Ahmed Atteya

1. Choose the correct COM PORT then click on the Test/Query button to connect your PC to the Xbee module.

This number will be used later so write it somewhere to come

back to it

Page 11: ELCT706 MicroLab Session #5 UART Usage for XBEE …eee.guc.edu.eg/Courses/Electronics/ELCT706...Eng. Salma Hesham Eng. Ahmed Atteya XBEE- modules allow Highly reliable and simple communication

XBEE – Configuration Steps Using XCTU

ELCT 706 Session #4Dr. Mohamed Abdel GhanyEng. Salma HeshamEng. Ahmed Atteya

2. Choose Modem Configuration option and press on the “Read”button for XCTU to read you Xbee-module version

Page 12: ELCT706 MicroLab Session #5 UART Usage for XBEE …eee.guc.edu.eg/Courses/Electronics/ELCT706...Eng. Salma Hesham Eng. Ahmed Atteya XBEE- modules allow Highly reliable and simple communication

XBEE S2 – Configuration Steps Using XCTU

ELCT 706 Session #4Dr. Mohamed Abdel GhanyEng. Salma HeshamEng. Ahmed Atteya

3. For Xbee- series 2, Configure the Xbee module as “Zigbee Coordinator AT” from the Function Set which sets this Xbee as a receiver

4. Enter the Serial number of the other Xbee module (the transmitter) in the Destination High and Low (such that they can be connected to each other).

Page 13: ELCT706 MicroLab Session #5 UART Usage for XBEE …eee.guc.edu.eg/Courses/Electronics/ELCT706...Eng. Salma Hesham Eng. Ahmed Atteya XBEE- modules allow Highly reliable and simple communication

XBEE S1 – Configuration Steps Using XCTU

ELCT 706 Session #4Dr. Mohamed Abdel GhanyEng. Salma HeshamEng. Ahmed Atteya

3. For Xbee- series 1, in the Function Set keep the default option that X-CTU sets when it reads your Xbee module. Then configure your Xbee as a receiver by choosing the Coordinator option in Coordinator Enable.

4. Enter the Serial number of the other Xbee module (the transmitter) in the Destination High and Low (such that they can be connected to each other).

Page 14: ELCT706 MicroLab Session #5 UART Usage for XBEE …eee.guc.edu.eg/Courses/Electronics/ELCT706...Eng. Salma Hesham Eng. Ahmed Atteya XBEE- modules allow Highly reliable and simple communication

XBEE – Configuration Steps Using XCTU

ELCT 706 Session #4Dr. Mohamed Abdel GhanyEng. Salma HeshamEng. Ahmed Atteya

5. Enter the PAN ID which will be the unique number (like a PIN) for your transmitter and receiver network, but more than one Xbee can be on this network.

6. Enter the Node identifier which is in this case “Coordinator 1” and the Baud Rateas 9600.

Page 15: ELCT706 MicroLab Session #5 UART Usage for XBEE …eee.guc.edu.eg/Courses/Electronics/ELCT706...Eng. Salma Hesham Eng. Ahmed Atteya XBEE- modules allow Highly reliable and simple communication

XBEE – Configuration Steps Using XCTU

ELCT 706 Session #4Dr. Mohamed Abdel GhanyEng. Salma HeshamEng. Ahmed Atteya

7. Check on the “Write” Button to write the chosen configuration on the Xbee-module and get the message“Write Parameters Complete”

Page 16: ELCT706 MicroLab Session #5 UART Usage for XBEE …eee.guc.edu.eg/Courses/Electronics/ELCT706...Eng. Salma Hesham Eng. Ahmed Atteya XBEE- modules allow Highly reliable and simple communication

XBEE – Configuration Steps Using XCTU

ELCT 706 Session #4Dr. Mohamed Abdel GhanyEng. Salma HeshamEng. Ahmed Atteya

8. Open the Terminal to verify the configuration by writing the blue commands and received the red data from the Xbee module

Page 17: ELCT706 MicroLab Session #5 UART Usage for XBEE …eee.guc.edu.eg/Courses/Electronics/ELCT706...Eng. Salma Hesham Eng. Ahmed Atteya XBEE- modules allow Highly reliable and simple communication

XBEE – Configuration Steps Using XCTU

ELCT 706 Session #4Dr. Mohamed Abdel GhanyEng. Salma HeshamEng. Ahmed Atteya

9. Remove the USB Cable then remove the Xbee Coordinator, mark it and put it away. Repeat the same steps for the other Xbee module to configure it as Transmitter“Zigbee Router AT”, enter the serial number of the receiver in Destination high and Low then enter the same “PAN ID” as the Receiver with Baud Rate = 9600.