xbee basics - faludi basics rob faludi. ... bandwidth fast routing. existing methods for device...

35
XBee Basics Rob Faludi

Upload: duongcong

Post on 05-May-2018

218 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop

XBee Basics

Rob Faludi

Page 2: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop

Moving Data by Radio

toys wearables performance

portablesemergent systems

anything spinning

network objects sensors audio/video

feedback remotescontext

awareness

Page 3: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop

What Do We Want?

wirelesseasy

communicationreliability

low power addressing broadcast

small standardized cheap

bandwidth fast routing

Page 4: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop

Existing Methods for Device Communication

• Bluetooth

• "RF"

• XPort TCP/IP

• MatchPort TCP/IP

• Cell Phone Data GPRS

Page 5: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop

ZigBee & 802.15.4

• ZigBee is built on top of the IEEE 802.15.4 protocol

• XBee radios are available with or without ZigBee

• XBee 802.15.4 vs. ZNet 2.5

• Both ways are useful

Page 6: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop

802.15.4

• low power

• addressing

• cheap

• wireless

• small

• standardized

Page 7: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop

802.15.4 Topologies

• single peer

• multi-peer

• broadcast

Page 8: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop

ZigBee

• routing

• self-healing mesh

• ad-hoc network creation

Page 9: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop

ZigBee Topologies

• peer

• star

• mesh

• routing

Page 10: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop

How Do I Make One?

Page 11: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop

Materials

• XBee OEM Module (30-100 m range) $19XBee Pro (100m - 1.6 km range) $32

• Digi: http://www.digi.com

• Breakout Board, 2mm to 10 mil pin spacing. From me or Spark Fun

• Female headers 2mm from me or Spark Fun

• Male headers 10 mil (in stock at ITP)

Page 12: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop

Soldering Breakout Boards: pin spacing

2mm 0.1”

Page 13: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop

Soldering Breakout Boards: headers

2mm 0.1”

Page 14: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop

Soldering Breakout Boards: finished

Page 15: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop

Wiring

+3.3 Vtransmitreceive

ground

Page 16: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop

Remember!

• Use only +3.3 Volts. The regulator often has a different pin arrangement: G-O-I

• Always use decoupling capacitors. The radios often don’t work without them.

• You can’t send infinitely fast. Try putting a 10 ms delay into your loop.

• XBee TX goes to Arduino RX and vice versa.

• Arduino can run on 3.3 Volts (use a mini or breadboard with NG bootloader)

Page 17: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop

Instructions

• XBee Practical Example: Paired communication between two microcontrollers. Includes building, wiring and code for PIC and Arduino

• Making Things Talk by Tom Igoe

• I/O Example on my blog, or in the XBee manual section 2.2

Page 18: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop

XBee Send/Receive

Page 19: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop

Serial Terminal Programs

• Processing: http://rob.faludi.com/teaching/cmn/code/XBee_Terminal.pde

• Z-Term: http://homepage.mac.com/dalverson/zterm/

• HyperTerm: Windows Start Menu, Accessories, Communication

• screen: Terminal program on the Mac (or Linux)

• X-CTU: http://www.digi.com/support/productdetl.jsp?pid=3352&osvid=57&tp=4&s=316

• plenty of others

Page 20: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop

Baud, Bits and Parity

• Setting different baud rates: 9600

• Stop bits: 1

• Parity: None

• Flow control: none for now...

Page 21: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop

Data Mode vs. Command Mode

• Idle Mode, transmit and receive data

• Command Mode, talk to the XBee itself

• +++ "Yo, XBee"

• AT "Attention!" (Hayes command set)

Page 22: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop

Some AT Commands

• AT -> OK

• ATMY -> my address

• ATDH, ATDL -> destination address hi/lo

• ATID -> personal area network ID

• ATCN -> end command mode

Page 23: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop

AT Command Format

Page 24: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop

Hexadecimals

• Just like decimals, but count from 0 to 15 in each position

• Since there’s no existing single numeral representing 10 - 15, use A - F instead

• A = 10, B=11, C=12 ... F=15

• A1 = 161, common notation: 0xA1

• What does BFF equal? What does it look like?

• Calculators on Mac & Windows

Page 25: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop

Example:Remote Rotation

Page 26: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop

I/O Why

• Why:

• Save space, save power, save weight and save money

• Reduce complications

• Why not:

• Limited inputs/outputs

• No access to logic

• Each radio must be manually configured

Page 27: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop

Input/Output Wiring

+3.3 Vtransmitreceive

Ground

I/O pins

PWM outVoltage

reference

Page 28: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop

I/O AT Commands

• ATD0...D8 -> configure pins for I/O

• ATIR -> sample rate

• ATIT -> samples before transmit

• ATP0...P1 -> PWM configuration

• ATIU -> I/O output enable (UART)

• ATIA -> I/O input address

Page 29: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop

Example Configuration

• ATID3456 (PAN ID)ATMY1 my address 1ATDL2 destination address 2ATD02 output 0 in analog modeATD13 output 1 in digital out modeATIR14 sample rate 20 milliseconds (hex 14)ATIT5 samples before transmit 5

• ATID3456 (PAN ID)ATMY2 my address 2ATDL1 destination address 1ATP02 PWM 0 in PWM modeATD15 output 1 in digital out high modeATIU1 I/O output enabledATIA1 I/O input from address 1

Page 30: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop
Page 31: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop

Radio Communications

• What is radio?

• electromagnetic waves

• no medium required

• Modulation

• Well-described mystery: “air waves” “wireless” “ethereal communication”

• posters

Page 32: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop

Why Wireless?

• why wireless (mesh ≠ wireless)

• inverse square law

• what technologies can be used for device communication?

Page 33: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop

API Mode

• Powerful, steeper learning curve

• Data wrapped together with commands, addressing and status information

Page 34: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop

API Mode Format

*ATNJ = node join

Page 35: XBee Basics - Faludi Basics Rob Faludi. ... bandwidth fast routing. Existing Methods for Device Communication ... • Call / response • Broadcast • Start / stop

Protocols

• Sending

• Flow control

• Call / response

• Broadcast

• Start / stop

• Checksums

• Collisions