WIRELESS COMMUNICATION By: Team Team

Download Report

Transcript WIRELESS COMMUNICATION By: Team Team

WIRELESS
COMMUNICATION
By: Team Team
TEAM LEADER:
RYAN DAVIS
SOFTWARE SPECIALIST:
JOHN KIRSCHNER
ASSISTANT:
CODY DAVIS
HARDWARE SPECIALIST:
RYAN DUDASH
ASSISTANT:
JOSH FRONCZEK
OVERVIEW
• Hardware
• Specifications
• Wiring
• Schematics
• Protocol
• Registers
• Software
• LabView
• Summary
• Q&A
HARDWARE
• XBEE S1 RF Module
• TXS0104E Level Translator
XBee Series 1 RF
Module
•
Used In Transparent Mode
• This mode acts as if the two XBee modules are
wired but transmit the serial data wirelessly
•
XBee Chip is in Metric so a breakout board is
necessary for the use on a standard SI breadboard
•
Data Specifications
•
•
•
•
Supply Voltage: 2.8V-3.4V
Transmit Current: 45mA @ 3.3V
Idle/Receive Current: 50mA @ 3.3V
Indoor Range: Up to 100ft (30m)
XBee Pin Layout
TXS0104E Voltage
Level Translator
•
The Voltage level translator takes the applied voltage signal on
VCCB and steps it down to the applied voltage reference on VCCA
•
VCCA must be less than VCCB to work
•
5V is wired to VCCB
•
3.3V is wired to VCCA
•
OE pin is a 3-state output-mode enable and is a reference from
VCCA. 3.3V will need to be applied to the pin to turn off 3-state
output-mode
•
Data Specifications
•
•
1.65V to 3.6V on VCCA, 2.3V to 5.5V on VCCB
Max Data Rates – 24Mbps (Push Pull), 2 Mbps (Open Drain)
HOW TO: WIRING
•
Voltage level translator is connected to port E0
• Port E is the MCU’s SCI, SCI is known as the universal asynchronous
receiver/transmitter (UART).
•
Port E bit 0 is used as the transmitter T(x)
•
Port E bit 1 is used as the receiver R(x)
•
The receiver is not used in this application but can be used as a bonus
feature for the final project
SCHEMATIC
PROTOCOL
-
Used for communication between the Smart Car and the LabVIEW
interface
-
The fields are placed into a string for transmission
1. $SC
2. MyID
3. Destination ID
4. Battery voltage
5. IR Data
6. Steering Pulse Width
7. Current Speed
8. Motor Duty Cycle
9. :
10. Checksum
11. Line Feed
Oscilloscope Reading
REGISTERS
-
3 registers that need initialized
SCI1BD= 104;
-
//SCIxBD = BUSCLK/(16*Baud)
The baud rate register, used to set the baud rate
SCI1C1= 0;
//nothing needs to be changed around
- The first status control register, does not need any
manipulation
SCI1C2=0x0C;
//enable tx and rx pins
- The second status control register, controls whether or not the
tx and rx pins are turned on
CHECKSUM
FUNCTION
-
Checksum is the 1’s compliment of the summation of all the
bytes in the string
byte checksum8(void *p, int len)
{
byte *q = p;
// this is so p can be of any type
byte sum = 0;
// running sum of array bytes
for (; len>0; --len)
// iterate over each byte in array
sum += *q++;
// add byte value to running sum
return (byte)~sum;
// return 1's complement of sum
}
SCI_PUTS
SCI_PUTC
-
SCI_PUTC is the function used to transmit one character
value at a time through the tx pin on the FireBird module
void SCI_PUTC(char c){
while(!(SCI1S1_TDRE)){}
SCI1D = c;
}
-
//wait for tx pin
//send the character value
SCI_PUTS uses the SCI_PUTC function to transmit an entire string
void SCI_PUTS(char* s){
while(*s)
SCI_PUTC(*s++);
}
SENDDATA
FUNCTION
-
Constructs a string based off of the described protocol
The spine of the transmission functions
calls checksum and SCI_PUTS
void sendData() {
char stemp[40];
byte cksum;
// 8-bit 1's complement checksum
// create broadcast packet string
sprintf(stemp, "$SC%d,%d,%d,%d,%d,%d,%d",
MyID, BID, Vbatt, line, steerPW, CurrentSpeed, motorDC);
cksum = checksum8(stemp, (int)strlen(stemp));
// calculate checksum
sprintf(stemp+strlen(stemp), ":%02x:", cksum);
// and append it to string
stemp[strlen(stemp)-1] = EOP;
// add end-of-packet marker
SCI_puts(stemp);
// send status packet
msDelay(200);
}
LABVIEW
● LabVIEW decodes the
ASCII serial string and
outputs it on an indicator
panel
● The checksum
implemented into
Codewarrior is then
checked inside LabVIEW,
if the checksum is not valid
the package is discarded
and the data is not put onto
the panel
SUMMARY
-
Construct a circuit for interfacing with the XBee module
Learn how to interface with a voltage translator
Construct code for doing a check sum with a string
Construct code for transmitting data to the XBee module
REFERENCES
• XBee ® /XBee-PRO ® RF Modules (n.d.): n. pag.
Http://www.aet.calu.edu/. Web.
• Texas Instruments Incorporated. 4-Bit Bidirectional
Voltage-Level Translator for OD and Push-Pull
Applications (Rev. D) (n.d.): n. pag.
Http://www.aet.calu.edu/. Web.
• "Jeff Sumey's Virtual Resource Center." Jeff Sumey's
Virtual Resource Center. N.p., n.d. Web. 06 Apr. 2015.
QUESTIONS?