Skip to main content

Getting started with the XBee


XBee is a wireless module that supports Zigbee protocol, allowing the development of microcontroller networks.
The datasheet is in the following link


Materials


To get your first xbee tutorial working, you'll need the following materials
  • USB Explorer Dongle
  • XBee interface
  • Two XBee radios
You'll need a way to program the XBee chip. Either of the following options will work external link:

https://www.sparkfun.com/products/9819
https://www.sparkfun.com/products/8687

If you decide to get the second product, make sure you have a micro USB cord
Either of the following product should work

Just make sure that you also include headers! The can be found at the following url

https://www.sparkfun.com/products/9280

You'll need to get two XBee radios since they use a P2P protocol to communicate. You'll also want to consider if you'll use Series 1 or Series 2. You'll also want to consider if you want to get a XBee PRO. For more details on the differences between these two, look at the following link


It is highly recommended to start off with the Series 1 model since the Series 2 models is supposed to be much harder to configure.

Testing your XBee


Plug one of your XBees into the USB Explorer Dongle. Make sure that you get your orientation right, otherwise you could brick your XBee.  The correct orientation is outlined on the USB Explorer Dongle

You'll then need to program your XBee from your computer. I'd recommend using X-CTU for a start.


Before using the X-CTU program, make sure that one of your XBees is plugged into the USB Dongle Explorer in the proper orientation and the USB Dongle is connected to the computer.
Then highlight the modem configuration tab, it should look like as follows





Click Read to read all of the specs for the device. Make sure to set the ID, DL, and MY flags. ID is the PAN ID, which is the ID of the entire network that your XBees are operating in. The DL is the destination address, which is the address of the other XBee radio. The MY is the address of the XBee currently plugged into the radio. Because I'm using only a Series 1 XBee radio, there can only be 2 XBees in each network. In my case, I set ID=1111, DL=1000 and MY=1001.

When you are done configuring the values, make sure that you press Write to finalize your changes. Then unplug your XBee and plug in your other XBee. Follow the same procedure except switch around DL and MY. In my case, I let ID=1111, DL=1001 and MY=1000

Once you have your XBee Radios configured, leave one of your XBee radios in the USB Explorer Dongle into the computer and plug in the other XBee radio into the Arduino shield. Make sure that the 3.3V and GND pins are connected to their corresponding pins in the Arduino. Then have a wire connecting the DIN and DOUT pins on the Arduino shield. To test to see if everything is working, highlight the Terminal tab in X-CTU tab and type some gibberish on the keyboard. If you set everything up correctly, then you should get something like this.





RGB code


Getting this example to work uses pretty much the same setup as the previous tutorial. Instead of wiring the DIN and DOUT pins together, wire the DIN and DOUT pins to the RX and TX pins of the Arduino. Make sure you don't mix up these pins.
The source code can be found at the following link under "Cable Replacement"


Good luck!



Troubleshooting


If your input is not being properly echoed back on the screen

1) Check your wiring. Make sure that none of the pins are bent.
2) Double check your XBee orientation - it should align with the outline marked in the shield
3) Double check your addresses to make sure that none of the addresses are the same

Comments

Popular posts from this blog

ANCOM explained

In case you have not heard, ANCOM is another differential abundance test, designed specifically for tweezing out differentially abundance bacteria between groups.  Now, note that there are a ton of differential abundance techniques out there.  And one might ask why are there so many people focused on this seemingly simple problem. It turns out that this problem is actually impossible.   And this is rooted into the issue of relative abundances.  A change of 1 species between samples can be also explained by the change of all of the other species between samples.   Let's take a look at simple, concrete example. Here we have ten species, and 1 species doubles after the first time point.  If we know the original abundances of this species, it's pretty clear that species 1 doubled.  However, if we can only obtain the proportions of species within the environment, the message isn't so clear. Above are the proportions of the species in the exact same environment

Behind the scenes with BIOM tables

Today, I'll be covering the BIOM file format , a standardized file format for storing sequence counts in samples.  This file format is typically used in the biological sciences, most notably in amplicon sequencing technologies, such as 16S sequencing. For those of you that aren't as familiar with these technologies.  When we conduct survey studies, we like to get a broad overview of the microbes that are living within a raw sample.  But we don't need to sequence the entire bacteria's genome to identify what the bacteria is.  We can just a sequence a housekeeping gene that every bacteria as - the 16S ribosome. Its a similar strategy deployed in court.  When DNA evidence is presented in the court room, only a tiny, tiny portion of an individuals DNA is actually required to uniquely identify that person. But moving on. The BIOM file format was originally designed to store counts of 16S sequences across samples, but it has grown to become a more generalized file fo

Encoding design matrices in Patsy

Some of us have seen the connections between ANOVA and linear regression (see here  for more detailed explanation).  In order to draw the equivalence between ANOVA and linear regression, we need a design matrix. For instance if we have a series of observations A, B, C as follows \[ \{A, B, C, A, A, B, C\}\] If we wanted to reformulate this into ANOVA-style test, we can do a comparison between A vs B, and A vs C.  We can encode that design matrix as follows \begin{bmatrix} 0 & 1 & 0 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 & 1 & 0 & 1 \\ \end{bmatrix} In the first row of the matrix, only the entries with B are labeled (since we are doing a comparison between A and B. In the second row, only the entries with C are labeled.  Since we have set A to implicitly be the reference, there is no row corresponding to A. If we want to explicitly derive this design matrix in patsy, we can do it as follows import pa