https://elinux.org/api.php?action=feedcontributions&user=Shinnsm&feedformat=atomeLinux.org - User contributions [en]2024-03-29T07:38:25ZUser contributionsMediaWiki 1.31.0https://elinux.org/index.php?title=ECE497_Project:_XBee&diff=192488ECE497 Project: XBee2012-11-13T02:55:38Z<p>Shinnsm: /* Highlights */ added joystick demo</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Grading Template ==<br />
<br />
I'm using the following template to grade. Each slot is 10 points.<br />
0 = Missing, 5=OK, 10=Wow!<br />
<br />
<pre style="color:red"><br />
00 Executive Summary<br />
05 Installation Instructions <br />
01 User Instructions<br />
00 Highlights<br />
00 Theory of Operation<br />
00 Work Breakdown<br />
00 Future Work<br />
00 Conclusions<br />
00 Demo<br />
00 Late<br />
Comments: I'm looking forward to seeing this.<br />
<br />
Score: 06/100<br />
</pre><br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal was to create wiki sections which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
We have successfully connected to the XBee radios from the Bones and sent data using the <code>/dev/ttyO</code> file system. We have also successfully done wireless implementations of the force sensitive resistor, the magnetometer, and the joystick alone a set of functions for expanding this to any sensor.<br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. We have successfully communicated wirelessly with three sensors: the force sensitive resistor, magnetometer, and joystick. We hope that these instructions and code libraries are useful to hobbyists who wish to implement their own wireless solutions with the BeagleBone.<br />
<br />
== General Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
[[File:XBeeBoneConnection.jpg|450px|XBee module connected to a BeagleBone.]]<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE.git https://github.com/duganje/ECE497_XBEE.git]. To begin, run <br />
beagle$ git clone https://github.com/duganje/ECE497_XBEE.git<br />
to clone he repository. This contains three folders with examples of XBee implementation for specific sensors and <code>XBee.c</code>, which contains helper functions for using the XBee. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
<br />
== 0.5" Force Sensitive Resistor ==<br />
<br />
These instructions are for interfacing the [[SparkFun: 0.5" Force Sensitive Resistor|0.5" Force Sensitive Resistor]] with the XBee.<br />
<br />
=== Required Items ===<br />
<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/9375 0.5" Force Sensitive Resistor]<br />
*1 x 27kΩ resistor<br />
<br />
=== Hardware ===<br />
<br />
First we will connect the force-sensitive resistor to the Bone (P9 header). A 27kΩ resistor is used to connect the 3.3V source (pin 3) from the Bone to one pin of the force-sensitive resistor. Then, the other pin of the force-sensitive resistor is connected to ground (pin 1). An analog pin (AIN) on the Bone connects to the node containing both resistors, and values can be read off of that AIN. AIN5 (pin 36) is being used to read values on the Bone.<br />
<br />
Next we will connect the XBee module to the Bone. The table below describes the necessary wiring.<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
With everything wired-up, your connections should match the image below. Click on the image to view the full resolution.<br />
<br />
[[File:ForceResistorXBee.jpg|600px|Picture of connection|link=http://elinux.org/images/3/3b/ForceResistorXBee.jpg]]<br />
<br />
=== Software ===<br />
<br />
We're going to start with these two pieces of code as a reference and combine them:<br />
<br />
*[https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c Code to interface with the force sensitive resistor]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
Running the code for the force sensitive resistor produces a value from 0 to 4096 depending on how much pressure is applied to the resistor. The harder the resistor is squeezed, the lower this value is. On line 46 of the force sensitive resistor code, <code>analogValue</code> is constantly updated and stores this number.<br />
<br />
The instructions now fork depending on whether you're setting up the sending XBee code or the receiving XBee code. When you're done you will have two C programs, one running on each Bone.<br />
<br />
==== Sending ====<br />
<br />
Start with the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c resistor code] as a base and add the following include to the top of the file to add our XBee library (available [https://github.com/duganje/ECE497_XBEE here]):<br />
<br />
#include "XBee.h"<br />
<br />
Next, add a call to <code>initializeXbee()</code> in <code>main</code> of the resistor code before the while loop begins.<br />
<br />
In the <code>while</code> loop after the value of <code>analogValue</code> is updated, add this line:<br />
<br />
sendIntXbee(analogValue);<br />
<br />
This will send the integer analog value to the receiving XBee. Now the number is constantly being sent in the while loop.<br />
<br />
==== Receiving ====<br />
<br />
Start with the [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee code] as a base and create a <code>main</code> function. First in <code>main</code>, add a call to <code>initializeXbee()</code> to setup the Bone to use the module.<br />
<br />
Next, add a while loop to <code>main</code> which continuously receives the integer analog value from the other Bone using the <code>receiveIntXbee()</code> function. Once the integer value is received, you're free to use that information for whatever purpose you wish. The example code below should give you an idea of how this is done:<br />
<br />
<pre>void main(int argc, char **argv, char **envp) {<br />
// Initialize XBee<br />
initializeXbee();<br />
<br />
// Keep going<br />
while (1) {<br />
int analogValue = receiveIntXbee();<br />
<br />
// Do anything based on analog value<br />
if (analogValue < 1000)<br />
ButtonPressedFunction();<br />
}<br />
}</pre><br />
<br />
==== Sample ====<br />
<br />
===== Required Items =====<br />
<br />
* LED<br />
* 220Ω resistor<br />
<br />
===== Instructions =====<br />
<br />
Based on the instructions above, I've created a sample set of programs. Using two Bones, the send program runs on one and the receive program runs on another. The "send" Bone includes an XBee module and the force sensitive resistor, [[ECE497 Project: XBee#Hardware 2|hooked-up as described here]]. The second Bone includes the XBee module hooked-up in the same way with the addition of an LED connected to pin 12 (GPIO1_28) of the Bone. Connect the ground pin of the LED to the Bone's ground (pin 1) using a 220Ω resistor.<br />
<br />
Running both programs emulates the original function of the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c force resistor sample code], the only difference being that the data is now sent wirelessly from one Bone to another.<br />
<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/sendResistor.c Send Program]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/receiveResistor.c Receive Program]<br />
<br />
To easily run the programs, follow these steps (you can skip the first step if you have already clone the repository):<br />
beagle$ git clone https://github.com/duganje/ECE497_XBEE.git<br />
beagle$ cd ECE497_XBEE<br />
beagle$ cd ForceResistor<br />
beagle$ make<br />
<br />
This will create 2 executables: '''sendResistor''' and '''receiveResistor'''. Run the programs by running:<br />
<br />
beagle$ ./sendResistor<br />
<br />
on the Bone connected to the XBee and the force sensitive resistor and<br />
<br />
beagle$ ./receiveResistor<br />
<br />
on the Bone connected to the XBee and the LED.<br />
<br />
You will then be able to squeeze the force sensitive resistor and see the LED light up on the other BeagleBone. We've created a [[ECE497 Project: XBee#Force Sensitive Resistor YouTube Demo|YouTube demo]] of this program in action.<br />
<br />
== Wireless 2-Axis Thumb Joystick ==<br />
<br />
These instructions are for interfacing the [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]] with the XBee. This application could be useful in a wireless controller setting. <br />
<br />
=== Required Items ===<br />
<br />
*2 X [http://adafruit.com/products/513 BeagleBone]<br />
*2 X [http://www.adafruit.com/products/128 XBee Module]<br />
*2 X [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 X [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]]<br />
<br />
=== BeagleBone Wiring Instructions ===<br />
<br />
On your first BeagleBone, wire pins 36 and 38 to your two analog inputs. Wire the Beagle's 1.8V VCC output, pin 32, to the VCC input of the Joystick. Finally, wire the select GPIO signal to the GPIO_7 pin or pin 42.<br />
<br />
Wire the XBee as shown in the table below:<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The pinout and visual implementation are shown below.<br />
<br />
[[File:Bone_P9_pinout.jpg|x400px]] [[File:XBee_and_Adafruit_Joystick.jpg|x400px]]<br />
<br />
On the second BeagleBone, wire the XBee exactly as the first XBee (as described in the table above).<br />
<br />
Don't hook up any other hardware to the second XBee as it will be acting as an information hub.<br />
<br />
=== Usage Instructions ===<br />
<br />
On both BeagleBones, clone this repository: https://github.com/duganje/ECE497_XBEE.git<br />
<br />
== Magnetometer ==<br />
<br />
These instructions are for interfacing the [[Sparkfun: HMC5883L Magnetometer|HMC5883L Magnetometer]] with the XBee.<br />
<br />
=== Required Items ===<br />
<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/10530? Magnetometer Breakout Board]<br />
<br />
===Hardware===<br />
<br />
The XBee radios should be connected to both Beagles as shown in the table below. <br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The Magnetometer should be connected to one BeagleBone as described in the [[Sparkfun: HMC5883L Magnetometer|hardware]] section of the Magnetometer page. Ground and Vcc on the Magnetometer should be connected to pins 1 and 3 respectively on header P9 of the bone. SCL and SDA on the Magnetometer should be connected to pins 19 and 20 on P9 to use I2C bus 3. Two 4.7kΩ resistors should also be connected between SCL and Vcc and between SDA and Vcc. Below is a picture of the Beagle connected to the Magnetometer and the XBee.<br />
<br />
[[File:XBEE_MAG.jpg|600px|Picture of connections]]<br />
<br />
===Software===<br />
<br />
The goal is to have the two BeagleBones attached to XBee radios with the one connected to the Magnetometer taking data and transmitting this data to the other Bone which will print the measured data.<br />
<br />
I started with the code to collect data from the Magnetometer and the code to send data using the XBee radios. Here are the links to these two programs:<br />
*[https://github.com/duganje/ECE497_duganje/blob/master/MiniProject02/miniproject02.c Code to gather magnetometer data]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
The code for the magnetometer uses I2C to read the values for the X, Y and Z-Axes and print these values to the terminal. The XBee code contains helper functions to transmit data wirelessly. I have written two programs: one to collect and transmit the magnetometer data and the other to receive and display this data.<br />
<br />
====Sending====<br />
<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Magnetometer/sendMag.c Tranmitting Magnetometer Data Code]<br />
<br />
The code uses [https://github.com/MarkAYoder/BeagleBoard-exercises/tree/master/i2c I2C code] from [[EBC Exercise 12 I2C]] and helper functions from [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee.c].<br />
<br />
The program uses:<br />
<br />
i2cget(i2cbus, address, daddress);<br />
<br />
to get the data from the magnetometer and <br />
<br />
sendShortXbee(val);<br />
<br />
to send these values to the receiving XBee.<br />
<br />
====Receiving====<br />
<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Magnetometer/receiveMag.c Receiving Magnetometer Data Code]<br />
<br />
The receiving code uses:<br />
<br />
receiveShortXbee();<br />
<br />
to read the values for each axis.<br />
<br />
Because we do not have a way to synchronize the two XBees, the receiving program must be started first to ensure the data is receive in the correct order.<br />
<br />
In the Highlights section, there is a video demo of the complete program.<br />
<br />
===Running the Code===<br />
Use the following to run the magnetometer code (you can skip the first step if you have already clone the repository):<br />
<br />
beagle$ git clone https://github.com/duganje/ECE497_XBEE.git<br />
beagle$ cd ECE497_XBEE<br />
beagle$ cd Magnetometer<br />
beagle$ make<br />
<br />
This will create 2 executables: '''receiveMag''' and '''sendMag'''. Run the code by doing:<br />
<br />
beagle$ ./sendMag<br />
<br />
on the Bone connected to the XBee and the magnetometer and:<br />
<br />
beagle$ ./receiveMag<br />
<br />
on the Bone connected to just the XBee.<br />
<br />
== General Usage ==<br />
<br />
These instructions are a general how-to for using the XBee with any sensor.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code>. In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate with the XBee using UART 2. Then in your <code>main.c</code> file, call: <pre>sendIntXbee(yourInt);</pre> with <code>yourInt</code> being any integer data you would like to transmit. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the integer which was sent through <code>sendIntXbee(int yourInt)</code> on the 1st board.<br />
<br />
The send and receive functions can be easily modified to send any data type, as shown in <code>XBee.c</code> with the following functions:<br />
<br />
<pre>sendShortXbee(short yourShort);</pre><br />
<pre>receiveShortXbee();</pre><br />
<br />
== Highlights ==<br />
<br />
Our project is able to send and receive wireless data for a whole range of possible implementations. We've created YouTube demos for the three sensor implementations we've described so far:<br />
<br />
=== Force Sensitive Resistor YouTube Demo ===<br />
{{#ev:youtube|Ds_BWsrvy1I}}<br />
<br />
=== 2-Axis Thumb Joystick YouTube Demo ===<br />
{{#ev:youtube|9t1MQGYNOt4}}<br />
<br />
=== Magnetometer YouTube Demo ===<br />
{{#ev:youtube|99bFqE54UHM}}<br />
<br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. UART files on the Bone represent serial connections. With an XBee connected to the Bone's UART 2 as shown above, sent and received messages are written to <code>/dev/ttyO2</code> (the O is an uppercase O, not a zero). The BeagleBone's UARTs are accessed through <code>/dev/ttyO'''x'''</code>, where <code>'''x'''</code> is the UART number. Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation. (done)<br />
*Thursday, 11/8 - Package language implemented between Bones. (done)<br />
*Sunday, 11/11 - YouTube demo uploaded. (done)<br />
*Monday, 11/12 - All documentation complete. (done)<br />
*Tuesday, 11/13 - Everything complete & all code ''makes''. (done)<br />
<br />
=== Completed Work ===<br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
* Initialization method - Josh Dugan<br />
* Force Sensitive Resistor implementation and demo - Stephen Shinn<br />
* Magnetometer implementation and demo - Josh Dugan<br />
* 2-Axis Thumb Joystick implementation and demo - Matt Moravec<br />
<br />
== Future Work ==<br />
<br />
The following are some additional things that could be done with this project:<br />
<br />
* Create and document interfaces for more sensors<br />
* Back-and-forth 2-sensor communication<br />
* Create a practical application such as a wireless doorbell<br />
<br />
== Conclusions ==<br />
<br />
In conclusion, we created an XBee wireless communication library for BeagleBone and adapted three sensors to use it. We've also documented general usage instructions for adapting XBee to use any type of sensor. We have not found a comprehensive source for how to use XBee modules with the BeagleBone, so our code and instructions are online with the intention that others use them as a reference.<br />
<br />
We were unable to get a working program with 2-way communication with 2 XBees each sending and receiving data because of synchronization problems. Addressing this would require the development of a communication protocol to prevent deadlocks and to ensure the receiving program knows what the data is when it receives it. This would be a logical next step in terms of future work for this project.<br />
<br />
Using the wireless modules is interesting, and there is a number of things you can do with them. We've listed a few ideas above which could be done in the future. One interesting idea would be to create a practical XBee application that someone could actually use in their home or work life. With a few XBees around the house, one could have a small network for sending data and using a sensor to control Christmas lights or something.<br />
<br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=192098ECE497 Project: XBee2012-11-12T22:27:58Z<p>Shinnsm: </p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Grading Template ==<br />
<br />
I'm using the following template to grade. Each slot is 10 points.<br />
0 = Missing, 5=OK, 10=Wow!<br />
<br />
<pre style="color:red"><br />
00 Executive Summary<br />
05 Installation Instructions <br />
01 User Instructions<br />
00 Highlights<br />
00 Theory of Operation<br />
00 Work Breakdown<br />
00 Future Work<br />
00 Conclusions<br />
00 Demo<br />
00 Late<br />
Comments: I'm looking forward to seeing this.<br />
<br />
Score: 06/100<br />
</pre><br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal was to create wiki sections which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
We have successfully connected to the XBee radios from the Bones and sent data using the <code>/dev/ttyO</code> file system. We have also successfully done wireless implementations of the force sensitive resistor, the magnetometer, and the joystick alone a set of functions for expanding this to any sensor.<br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. We have successfully communicated wirelessly with three sensors: the force sensitive resistor, magnetometer, and joystick. We hope that these instructions and code libraries are useful to hobbyists who wish to implement their own wireless solutions with the BeagleBone.<br />
<br />
== General Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
[[File:XBeeBoneConnection.jpg|450px|XBee module connected to a BeagleBone.]]<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE.git https://github.com/duganje/ECE497_XBEE.git]. To begin, run <br />
beagle$ git clone https://github.com/duganje/ECE497_XBEE.git<br />
to clone he repository. This contains three folders with examples of XBee implementation for specific sensors and <code>XBee.c</code>, which contains helper functions for using the XBee. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
<br />
== 0.5" Force Sensitive Resistor ==<br />
<br />
These instructions are for interfacing the [[SparkFun: 0.5" Force Sensitive Resistor|0.5" Force Sensitive Resistor]] with the XBee.<br />
<br />
=== Required Items ===<br />
<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/9375 0.5" Force Sensitive Resistor]<br />
*1 x 27kΩ resistor<br />
<br />
=== Hardware ===<br />
<br />
First we will connect the force-sensitive resistor to the Bone (P9 header). A 27kΩ resistor is used to connect the 3.3V source (pin 3) from the Bone to one pin of the force-sensitive resistor. Then, the other pin of the force-sensitive resistor is connected to ground (pin 1). An analog pin (AIN) on the Bone connects to the node containing both resistors, and values can be read off of that AIN. AIN5 (pin 36) is being used to read values on the Bone.<br />
<br />
Next we will connect the XBee module to the Bone. The table below describes the necessary wiring.<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
With everything wired-up, your connections should match the image below. Click on the image to view the full resolution.<br />
<br />
[[File:ForceResistorXBee.jpg|600px|Picture of connection|link=http://elinux.org/images/3/3b/ForceResistorXBee.jpg]]<br />
<br />
=== Software ===<br />
<br />
We're going to start with these two pieces of code as a reference and combine them:<br />
<br />
*[https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c Code to interface with the force sensitive resistor]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
Running the code for the force sensitive resistor produces a value from 0 to 4096 depending on how much pressure is applied to the resistor. The harder the resistor is squeezed, the lower this value is. On line 46 of the force sensitive resistor code, <code>analogValue</code> is constantly updated and stores this number.<br />
<br />
The instructions now fork depending on whether you're setting up the sending XBee code or the receiving XBee code. When you're done you will have two C programs, one running on each Bone.<br />
<br />
==== Sending ====<br />
<br />
Start with the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c resistor code] as a base and add the following include to the top of the file to add our XBee library (available [https://github.com/duganje/ECE497_XBEE here]):<br />
<br />
#include "XBee.h"<br />
<br />
Next, add a call to <code>initializeXbee()</code> in <code>main</code> of the resistor code before the while loop begins.<br />
<br />
In the <code>while</code> loop after the value of <code>analogValue</code> is updated, add this line:<br />
<br />
sendIntXbee(analogValue);<br />
<br />
This will send the integer analog value to the receiving XBee. Now the number is constantly being sent in the while loop.<br />
<br />
==== Receiving ====<br />
<br />
Start with the [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee code] as a base and create a <code>main</code> function. First in <code>main</code>, add a call to <code>initializeXbee()</code> to setup the Bone to use the module.<br />
<br />
Next, add a while loop to <code>main</code> which continuously receives the integer analog value from the other Bone using the <code>receiveIntXbee()</code> function. Once the integer value is received, you're free to use that information for whatever purpose you wish. The example code below should give you an idea of how this is done:<br />
<br />
<pre>void main(int argc, char **argv, char **envp) {<br />
// Initialize XBee<br />
initializeXbee();<br />
<br />
// Keep going<br />
while (1) {<br />
int analogValue = receiveIntXbee();<br />
<br />
// Do anything based on analog value<br />
if (analogValue < 1000)<br />
ButtonPressedFunction();<br />
}<br />
}</pre><br />
<br />
==== Sample ====<br />
<br />
===== Required Items =====<br />
<br />
* LED<br />
* 220Ω resistor<br />
<br />
===== Instructions =====<br />
<br />
Based on the instructions above, I've created a sample set of programs. Using two Bones, the send program runs on one and the receive program runs on another. The "send" Bone includes an XBee module and the force sensitive resistor, [[ECE497 Project: XBee#Hardware 2|hooked-up as described here]]. The second Bone includes the XBee module hooked-up in the same way with the addition of an LED connected to pin 12 (GPIO1_28) of the Bone. Connect the ground pin of the LED to the Bone's ground (pin 1) using a 220Ω resistor.<br />
<br />
Running both programs emulates the original function of the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c force resistor sample code], the only difference being that the data is now sent wirelessly from one Bone to another.<br />
<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/sendResistor.c Send Program]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/receiveResistor.c Receive Program]<br />
<br />
To easily run the programs, follow these steps (you can skip the first step if you have already clone the repository):<br />
beagle$ git clone https://github.com/duganje/ECE497_XBEE.git<br />
beagle$ cd ECE497_XBEE<br />
beagle$ cd ForceResistor<br />
beagle$ make<br />
<br />
This will create 2 executables: '''sendResistor''' and '''receiveResistor'''. Run the programs by running:<br />
<br />
beagle$ ./sendResistor<br />
<br />
on the Bone connected to the XBee and the force sensitive resistor and<br />
<br />
beagle$ ./receiveResistor<br />
<br />
on the Bone connected to the XBee and the LED.<br />
<br />
You will then be able to squeeze the force sensitive resistor and see the LED light up on the other BeagleBone. We've created a [[ECE497 Project: XBee#Force Sensitive Resistor YouTube Demo|YouTube demo]] of this program in action.<br />
<br />
== Wireless 2-Axis Thumb Joystick ==<br />
<br />
These instructions are for interfacing the [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]] with the XBee. This application could be useful in a wireless controller setting. <br />
<br />
=== Required Items ===<br />
<br />
*2 X [http://adafruit.com/products/513 BeagleBone]<br />
*2 X [http://www.adafruit.com/products/128 XBee Module]<br />
*2 X [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 X [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]]<br />
<br />
=== BeagleBone Wiring Instructions ===<br />
<br />
On your first BeagleBone, wire pins 36 and 38 to your two analog inputs. Wire the Beagle's 1.8V VCC output, pin 32, to the VCC input of the Joystick. Finally, wire the select GPIO signal to the GPIO_7 pin or pin 42.<br />
<br />
Wire the XBee as shown in the table below:<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The pinout and visual implementation are shown below.<br />
<br />
[[File:Bone_P9_pinout.jpg|x400px]] [[File:XBee_and_Adafruit_Joystick.jpg|x400px]]<br />
<br />
On the second BeagleBone, wire the XBee exactly as the first XBee (as described in the table above).<br />
<br />
Don't hook up any other hardware to the second XBee as it will be acting as an information hub.<br />
<br />
=== Usage Instructions ===<br />
<br />
On both BeagleBones, clone this repository: https://github.com/duganje/ECE497_XBEE.git<br />
<br />
== Magnetometer ==<br />
<br />
These instructions are for interfacing the [[Sparkfun: HMC5883L Magnetometer|HMC5883L Magnetometer]] with the XBee.<br />
<br />
=== Required Items ===<br />
<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/10530? Magnetometer Breakout Board]<br />
<br />
===Hardware===<br />
<br />
The XBee radios should be connected to both Beagles as shown in the table below. <br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The Magnetometer should be connected to one BeagleBone as described in the [[Sparkfun: HMC5883L Magnetometer|hardware]] section of the Magnetometer page. Ground and Vcc on the Magnetometer should be connected to pins 1 and 3 respectively on header P9 of the bone. SCL and SDA on the Magnetometer should be connected to pins 19 and 20 on P9 to use I2C bus 3. Two 4.7kΩ resistors should also be connected between SCL and Vcc and between SDA and Vcc. Below is a picture of the Beagle connected to the Magnetometer and the XBee.<br />
<br />
[[File:XBEE_MAG.jpg|600px|Picture of connections]]<br />
<br />
===Software===<br />
<br />
The goal is to have the two BeagleBones attached to XBee radios with the one connected to the Magnetometer taking data and transmitting this data to the other Bone which will print the measured data.<br />
<br />
I started with the code to collect data from the Magnetometer and the code to send data using the XBee radios. Here are the links to these two programs:<br />
*[https://github.com/duganje/ECE497_duganje/blob/master/MiniProject02/miniproject02.c Code to gather magnetometer data]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
The code for the magnetometer uses I2C to read the values for the X, Y and Z-Axes and print these values to the terminal. The XBee code contains helper functions to transmit data wirelessly. I have written two programs: one to collect and transmit the magnetometer data and the other to receive and display this data.<br />
<br />
====Sending====<br />
<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Magnetometer/sendMag.c Tranmitting Magnetometer Data Code]<br />
<br />
The code uses [https://github.com/MarkAYoder/BeagleBoard-exercises/tree/master/i2c I2C code] from [[EBC Exercise 12 I2C]] and helper functions from [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee.c].<br />
<br />
The program uses:<br />
<br />
i2cget(i2cbus, address, daddress);<br />
<br />
to get the data from the magnetometer and <br />
<br />
sendShortXbee(val);<br />
<br />
to send these values to the receiving XBee.<br />
<br />
====Receiving====<br />
<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Magnetometer/receiveMag.c Receiving Magnetometer Data Code]<br />
<br />
The receiving code uses:<br />
<br />
receiveShortXbee();<br />
<br />
to read the values for each axis.<br />
<br />
Because we do not have a way to synchronize the two XBees, the receiving program must be started first to ensure the data is receive in the correct order.<br />
<br />
In the Highlights section, there is a video demo of the complete program.<br />
<br />
===Running the Code===<br />
Use the following to run the magnetometer code (you can skip the first step if you have already clone the repository):<br />
<br />
beagle$ git clone https://github.com/duganje/ECE497_XBEE.git<br />
beagle$ cd ECE497_XBEE<br />
beagle$ cd Magnetometer<br />
beagle$ make<br />
<br />
This will create 2 executables: '''receiveMag''' and '''sendMag'''. Run the code by doing:<br />
<br />
beagle$ ./sendMag<br />
<br />
on the Bone connected to the XBee and the magnetometer and:<br />
<br />
beagle$ ./receiveMag<br />
<br />
on the Bone connected to just the XBee.<br />
<br />
== General Usage ==<br />
<br />
These instructions are a general how-to for using the XBee with any sensor.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code>. In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate with the XBee using UART 2. Then in your <code>main.c</code> file, call: <pre>sendIntXbee(yourInt);</pre> with <code>yourInt</code> being any integer data you would like to transmit. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the integer which was sent through <code>sendIntXbee(int yourInt)</code> on the 1st board.<br />
<br />
The send and receive functions can be easily modified to send any data type, as shown in <code>XBee.c</code> with the following functions:<br />
<br />
<pre>sendShortXbee(short yourShort);</pre><br />
<pre>receiveShortXbee();</pre><br />
<br />
== Highlights ==<br />
<br />
Our project is able to send and receive wireless data for a whole range of possible implementations. We've created YouTube demos for the three sensor implementations we've described so far:<br />
<br />
=== Force Sensitive Resistor YouTube Demo ===<br />
{{#ev:youtube|Ds_BWsrvy1I}}<br />
<br />
=== Magnetometer YouTube Demo ===<br />
{{#ev:youtube|99bFqE54UHM}}<br />
<br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. UART files on the Bone represent serial connections. With an XBee connected to the Bone's UART 2 as shown above, sent and received messages are written to <code>/dev/ttyO2</code> (the O is an uppercase O, not a zero). The BeagleBone's UARTs are accessed through <code>/dev/ttyO'''x'''</code>, where <code>'''x'''</code> is the UART number. Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation. (done)<br />
*Thursday, 11/8 - Package language implemented between Bones. (done)<br />
*Sunday, 11/11 - YouTube demo uploaded. (done)<br />
*Monday, 11/12 - All documentation complete. (done)<br />
*Tuesday, 11/13 - Everything complete & all code ''makes''. (done)<br />
<br />
=== Completed Work ===<br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
* Initialization method - Josh Dugan<br />
* Force Sensitive Resistor implementation and demo - Stephen Shinn<br />
* Magnetometer implementation and demo - Josh Dugan<br />
* 2-Axis Thumb Joystick implementation and demo - Matt Moravec<br />
<br />
== Future Work ==<br />
<br />
The following are some additional things that could be done with this project:<br />
<br />
* Create and document interfaces for more sensors<br />
* Back-and-forth 2-sensor communication<br />
* Create a practical application such as a wireless doorbell<br />
<br />
== Conclusions ==<br />
<br />
In conclusion, we created an XBee wireless communication library for BeagleBone and adapted three sensors to use it. We've also documented general usage instructions for adapting XBee to use any type of sensor. We have not found a comprehensive source for how to use XBee modules with the BeagleBone, so our code and instructions are online with the intention that others use them as a reference.<br />
<br />
We were unable to get a working program with 2-way communication with 2 XBees each sending and receiving data because of synchronization problems. Addressing this would require the development of a communication protocol to prevent deadlocks and to ensure the receiving program knows what the data is when it receives it. This would be a logical next step in terms of future work for this project.<br />
<br />
Using the wireless modules is interesting, and there is a number of things you can do with them. We've listed a few ideas above which could be done in the future. One interesting idea would be to create a practical XBee application that someone could actually use in their home or work life. With a few XBees around the house, one could have a small network for sending data and using a sensor to control Christmas lights or something.<br />
<br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=192074ECE497 Project: XBee2012-11-12T22:22:18Z<p>Shinnsm: </p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Grading Template ==<br />
<br />
I'm using the following template to grade. Each slot is 10 points.<br />
0 = Missing, 5=OK, 10=Wow!<br />
<br />
<pre style="color:red"><br />
00 Executive Summary<br />
05 Installation Instructions <br />
01 User Instructions<br />
00 Highlights<br />
00 Theory of Operation<br />
00 Work Breakdown<br />
00 Future Work<br />
00 Conclusions<br />
00 Demo<br />
00 Late<br />
Comments: I'm looking forward to seeing this.<br />
<br />
Score: 06/100<br />
</pre><br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal was to create wiki sections which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
We have successfully connected to the XBee radios from the Bones and sent data using the <code>/dev/ttyO</code> file system. We have also successfully done wireless implementations of the force sensitive resistor, the magnetometer, and the joystick alone a set of functions for expanding this to any sensor.<br />
<br />
We were unable to get a working program with 2-way communication with 2 XBees each sending and receiving data because of synchronization problems. Addressing this would likely require the development of a simple communication to prevent deadlocks and to ensure the receiving program knows what the data is when it receives it. <br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. We have successfully communicated wirelessly with three sensors: the force sensitive resistor, magnetometer, and joystick. We hope that these instructions and code libraries are useful to hobbyists who wish to implement their own wireless solutions with the BeagleBone.<br />
<br />
== General Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
[[File:XBeeBoneConnection.jpg|450px|XBee module connected to a BeagleBone.]]<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE.git https://github.com/duganje/ECE497_XBEE.git]. To begin, run <br />
beagle$ git clone https://github.com/duganje/ECE497_XBEE.git<br />
to clone he repository. This contains three folders with examples of XBee implementation for specific sensors and <code>XBee.c</code>, which contains helper functions for using the XBee. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
<br />
== 0.5" Force Sensitive Resistor ==<br />
<br />
These instructions are for interfacing the [[SparkFun: 0.5" Force Sensitive Resistor|0.5" Force Sensitive Resistor]] with the XBee.<br />
<br />
=== Required Items ===<br />
<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/9375 0.5" Force Sensitive Resistor]<br />
*1 x 27kΩ resistor<br />
<br />
=== Hardware ===<br />
<br />
First we will connect the force-sensitive resistor to the Bone (P9 header). A 27kΩ resistor is used to connect the 3.3V source (pin 3) from the Bone to one pin of the force-sensitive resistor. Then, the other pin of the force-sensitive resistor is connected to ground (pin 1). An analog pin (AIN) on the Bone connects to the node containing both resistors, and values can be read off of that AIN. AIN5 (pin 36) is being used to read values on the Bone.<br />
<br />
Next we will connect the XBee module to the Bone. The table below describes the necessary wiring.<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
With everything wired-up, your connections should match the image below. Click on the image to view the full resolution.<br />
<br />
[[File:ForceResistorXBee.jpg|600px|Picture of connection|link=http://elinux.org/images/3/3b/ForceResistorXBee.jpg]]<br />
<br />
=== Software ===<br />
<br />
We're going to start with these two pieces of code as a reference and combine them:<br />
<br />
*[https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c Code to interface with the force sensitive resistor]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
Running the code for the force sensitive resistor produces a value from 0 to 4096 depending on how much pressure is applied to the resistor. The harder the resistor is squeezed, the lower this value is. On line 46 of the force sensitive resistor code, <code>analogValue</code> is constantly updated and stores this number.<br />
<br />
The instructions now fork depending on whether you're setting up the sending XBee code or the receiving XBee code. When you're done you will have two C programs, one running on each Bone.<br />
<br />
==== Sending ====<br />
<br />
Start with the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c resistor code] as a base and add the following include to the top of the file to add our XBee library (available [https://github.com/duganje/ECE497_XBEE here]):<br />
<br />
#include "XBee.h"<br />
<br />
Next, add a call to <code>initializeXbee()</code> in <code>main</code> of the resistor code before the while loop begins.<br />
<br />
In the <code>while</code> loop after the value of <code>analogValue</code> is updated, add this line:<br />
<br />
sendIntXbee(analogValue);<br />
<br />
This will send the integer analog value to the receiving XBee. Now the number is constantly being sent in the while loop.<br />
<br />
==== Receiving ====<br />
<br />
Start with the [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee code] as a base and create a <code>main</code> function. First in <code>main</code>, add a call to <code>initializeXbee()</code> to setup the Bone to use the module.<br />
<br />
Next, add a while loop to <code>main</code> which continuously receives the integer analog value from the other Bone using the <code>receiveIntXbee()</code> function. Once the integer value is received, you're free to use that information for whatever purpose you wish. The example code below should give you an idea of how this is done:<br />
<br />
<pre>void main(int argc, char **argv, char **envp) {<br />
// Initialize XBee<br />
initializeXbee();<br />
<br />
// Keep going<br />
while (1) {<br />
int analogValue = receiveIntXbee();<br />
<br />
// Do anything based on analog value<br />
if (analogValue < 1000)<br />
ButtonPressedFunction();<br />
}<br />
}</pre><br />
<br />
==== Sample ====<br />
<br />
===== Required Items =====<br />
<br />
* LED<br />
* 220Ω resistor<br />
<br />
===== Instructions =====<br />
<br />
Based on the instructions above, I've created a sample set of programs. Using two Bones, the send program runs on one and the receive program runs on another. The "send" Bone includes an XBee module and the force sensitive resistor, [[ECE497 Project: XBee#Hardware 2|hooked-up as described here]]. The second Bone includes the XBee module hooked-up in the same way with the addition of an LED connected to pin 12 (GPIO1_28) of the Bone. Connect the ground pin of the LED to the Bone's ground (pin 1) using a 220Ω resistor.<br />
<br />
Running both programs emulates the original function of the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c force resistor sample code], the only difference being that the data is now sent wirelessly from one Bone to another.<br />
<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/sendResistor.c Send Program]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/receiveResistor.c Receive Program]<br />
<br />
To easily run the programs, follow these steps (you can skip the first step if you have already clone the repository):<br />
beagle$ git clone https://github.com/duganje/ECE497_XBEE.git<br />
beagle$ cd ECE497_XBEE<br />
beagle$ cd ForceResistor<br />
beagle$ make<br />
<br />
This will create 2 executables: '''sendResistor''' and '''receiveResistor'''. Run the programs by running:<br />
<br />
beagle$ ./sendResistor<br />
<br />
on the Bone connected to the XBee and the force sensitive resistor and<br />
<br />
beagle$ ./receiveResistor<br />
<br />
on the Bone connected to the XBee and the LED.<br />
<br />
You will then be able to squeeze the force sensitive resistor and see the LED light up on the other BeagleBone. We've created a [[ECE497 Project: XBee#Force Sensitive Resistor YouTube Demo|YouTube demo]] of this program in action.<br />
<br />
== Wireless 2-Axis Thumb Joystick ==<br />
<br />
These instructions are for interfacing the [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]] with the XBee. This application could be useful in a wireless controller setting. <br />
<br />
=== Required Items ===<br />
<br />
*2 X [http://adafruit.com/products/513 BeagleBone]<br />
*2 X [http://www.adafruit.com/products/128 XBee Module]<br />
*2 X [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 X [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]]<br />
<br />
=== BeagleBone Wiring Instructions ===<br />
<br />
On your first BeagleBone, wire pins 36 and 38 to your two analog inputs. Wire the Beagle's 1.8V VCC output, pin 32, to the VCC input of the Joystick. Finally, wire the select GPIO signal to the GPIO_7 pin or pin 42.<br />
<br />
Wire the XBee as shown in the table below:<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The pinout and visual implementation are shown below.<br />
<br />
[[File:Bone_P9_pinout.jpg|x400px]] [[File:XBee_and_Adafruit_Joystick.jpg|x400px]]<br />
<br />
On the second BeagleBone, wire the XBee exactly as the first XBee (as described in the table above).<br />
<br />
Don't hook up any other hardware to the second XBee as it will be acting as an information hub.<br />
<br />
=== Usage Instructions ===<br />
<br />
On both BeagleBones, clone this repository: https://github.com/duganje/ECE497_XBEE.git<br />
<br />
== Magnetometer ==<br />
<br />
These instructions are for interfacing the [[Sparkfun: HMC5883L Magnetometer|HMC5883L Magnetometer]] with the XBee.<br />
<br />
=== Required Items ===<br />
<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/10530? Magnetometer Breakout Board]<br />
<br />
===Hardware===<br />
<br />
The XBee radios should be connected to both Beagles as shown in the table below. <br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The Magnetometer should be connected to one BeagleBone as described in the [[Sparkfun: HMC5883L Magnetometer|hardware]] section of the Magnetometer page. Ground and Vcc on the Magnetometer should be connected to pins 1 and 3 respectively on header P9 of the bone. SCL and SDA on the Magnetometer should be connected to pins 19 and 20 on P9 to use I2C bus 3. Two 4.7kΩ resistors should also be connected between SCL and Vcc and between SDA and Vcc. Below is a picture of the Beagle connected to the Magnetometer and the XBee.<br />
<br />
[[File:XBEE_MAG.jpg|600px|Picture of connections]]<br />
<br />
===Software===<br />
<br />
The goal is to have the two BeagleBones attached to XBee radios with the one connected to the Magnetometer taking data and transmitting this data to the other Bone which will print the measured data.<br />
<br />
I started with the code to collect data from the Magnetometer and the code to send data using the XBee radios. Here are the links to these two programs:<br />
*[https://github.com/duganje/ECE497_duganje/blob/master/MiniProject02/miniproject02.c Code to gather magnetometer data]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
The code for the magnetometer uses I2C to read the values for the X, Y and Z-Axes and print these values to the terminal. The XBee code contains helper functions to transmit data wirelessly. I have written two programs: one to collect and transmit the magnetometer data and the other to receive and display this data.<br />
<br />
====Sending====<br />
<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Magnetometer/sendMag.c Tranmitting Magnetometer Data Code]<br />
<br />
The code uses [https://github.com/MarkAYoder/BeagleBoard-exercises/tree/master/i2c I2C code] from [[EBC Exercise 12 I2C]] and helper functions from [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee.c].<br />
<br />
The program uses:<br />
<br />
i2cget(i2cbus, address, daddress);<br />
<br />
to get the data from the magnetometer and <br />
<br />
sendShortXbee(val);<br />
<br />
to send these values to the receiving XBee.<br />
<br />
====Receiving====<br />
<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Magnetometer/receiveMag.c Receiving Magnetometer Data Code]<br />
<br />
The receiving code uses:<br />
<br />
receiveShortXbee();<br />
<br />
to read the values for each axis.<br />
<br />
Because we do not have a way to synchronize the two XBees, the receiving program must be started first to ensure the data is receive in the correct order.<br />
<br />
In the Highlights section, there is a video demo of the complete program.<br />
<br />
===Running the Code===<br />
Use the following to run the magnetometer code (you can skip the first step if you have already clone the repository):<br />
<br />
beagle$ git clone https://github.com/duganje/ECE497_XBEE.git<br />
beagle$ cd ECE497_XBEE<br />
beagle$ cd Magnetometer<br />
beagle$ make<br />
<br />
This will create 2 executables: '''receiveMag''' and '''sendMag'''. Run the code by doing:<br />
<br />
beagle$ ./sendMag<br />
<br />
on the Bone connected to the XBee and the magnetometer and:<br />
<br />
beagle$ ./receiveMag<br />
<br />
on the Bone connected to just the XBee.<br />
<br />
== General Usage ==<br />
<br />
These instructions are a general how-to for using the XBee with any sensor.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code>. In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate with the XBee using UART 2. Then in your <code>main.c</code> file, call: <pre>sendIntXbee(yourInt);</pre> with <code>yourInt</code> being any integer data you would like to transmit. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the integer which was sent through <code>sendIntXbee(int yourInt)</code> on the 1st board.<br />
<br />
The send and receive functions can be easily modified to send any data type, as shown in <code>XBee.c</code> with the following functions:<br />
<br />
<pre>sendShortXbee(short yourShort);</pre><br />
<pre>receiveShortXbee();</pre><br />
<br />
== Highlights ==<br />
<br />
Our project is able to send and receive wireless data for a whole range of possible implementations. We've created YouTube demos for the three sensor implementations we've described so far:<br />
<br />
=== Force Sensitive Resistor YouTube Demo ===<br />
{{#ev:youtube|Ds_BWsrvy1I}}<br />
<br />
=== Magnetometer YouTube Demo ===<br />
{{#ev:youtube|99bFqE54UHM}}<br />
<br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. UART files on the Bone represent serial connections. With an XBee connected to the Bone's UART 2 as shown above, sent and received messages are written to <code>/dev/ttyO2</code> (the O is an uppercase O, not a zero). The BeagleBone's UARTs are accessed through <code>/dev/ttyO'''x'''</code>, where <code>'''x'''</code> is the UART number. Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation. (done)<br />
*Thursday, 11/8 - Package language implemented between Bones. (done)<br />
*Sunday, 11/11 - YouTube demo uploaded. (done)<br />
*Monday, 11/12 - All documentation complete. (done)<br />
*Tuesday, 11/13 - Everything complete & all code ''makes''. (done)<br />
<br />
=== Completed Work ===<br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
* Initialization method - Josh Dugan<br />
* Force Sensitive Resistor implementation and demo - Stephen Shinn<br />
* Magnetometer implementation and demo - Josh Dugan<br />
* 2-Axis Thumb Joystick implementation and demo - Matt Moravec<br />
<br />
== Future Work ==<br />
<br />
The following are some additional things that could be done with this project:<br />
<br />
* Create and document interfaces for more sensors<br />
* Back-and-forth 2-sensor communication<br />
* Create a practical application such as a wireless doorbell<br />
<br />
== Conclusions ==<br />
<br />
In conclusion, we created an XBee wireless communication library for BeagleBone and adapted three sensors to use it. We've also documented general usage instructions for adapting XBee to use any type of sensor. We have not found a comprehensive source for how to use XBee modules with the BeagleBone, so our code and instructions are online with the intention that others use them as a reference.<br />
<br />
Using the wireless modules is interesting, and the possibilities are endless. We've listed a few ideas above which could be done in the future. One interesting idea would be to create a practical XBee application that someone could actually use in their home or work life. With a few XBees around the house, one could have a small network for sending data and controlling Christmas lights or something with a sensor.<br />
<br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=192068ECE497 Project: XBee2012-11-12T22:21:08Z<p>Shinnsm: /* Executive Summary */</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Grading Template ==<br />
<br />
I'm using the following template to grade. Each slot is 10 points.<br />
0 = Missing, 5=OK, 10=Wow!<br />
<br />
<pre style="color:red"><br />
00 Executive Summary<br />
05 Installation Instructions <br />
01 User Instructions<br />
00 Highlights<br />
00 Theory of Operation<br />
00 Work Breakdown<br />
00 Future Work<br />
00 Conclusions<br />
00 Demo<br />
00 Late<br />
Comments: I'm looking forward to seeing this.<br />
<br />
Score: 06/100<br />
</pre><br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal was to create wiki sections which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
We have successfully connected to the XBee radios from the Bones and sent data using the <code>/dev/ttyO</code> file system. We have also successfully done wireless implementations of the force sensitive resistor, the magnetometer, and the joystick alone a set of functions for expanding this to any sensor.<br />
<br />
We were unable to get a working program with 2-way communication with 2 XBees each sending and receiving data because of synchronization problems. Addressing this would likely require the development of a simple communication to prevent deadlocks and to ensure the receiving program knows what the data is when it receives it. <br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. We have successfully communicated wirelessly with three sensors: the force sensitive resistor, magnetometer, and joystick. We hope that these instructions and code libraries are useful to hobbyists who wish to implement their own wireless solutions with the BeagleBone.<br />
<br />
== General Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
[[File:XBeeBoneConnection.jpg|450px|XBee module connected to a BeagleBone.]]<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE.git https://github.com/duganje/ECE497_XBEE.git]. To begin, run <br />
beagle$ git clone https://github.com/duganje/ECE497_XBEE.git<br />
to clone he repository. This contains three folders with examples of XBee implementation for specific sensors and <code>XBee.c</code>, which contains helper functions for using the XBee. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
<br />
== 0.5" Force Sensitive Resistor ==<br />
<br />
These instructions are for interfacing the [[SparkFun: 0.5" Force Sensitive Resistor|0.5" Force Sensitive Resistor]] with the XBee.<br />
<br />
=== Required Items ===<br />
<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/9375 0.5" Force Sensitive Resistor]<br />
*1 x 27kΩ resistor<br />
<br />
=== Hardware ===<br />
<br />
First we will connect the force-sensitive resistor to the Bone (P9 header). A 27kΩ resistor is used to connect the 3.3V source (pin 3) from the Bone to one pin of the force-sensitive resistor. Then, the other pin of the force-sensitive resistor is connected to ground (pin 1). An analog pin (AIN) on the Bone connects to the node containing both resistors, and values can be read off of that AIN. AIN5 (pin 36) is being used to read values on the Bone.<br />
<br />
Next we will connect the XBee module to the Bone. The table below describes the necessary wiring.<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
With everything wired-up, your connections should match the image below. Click on the image to view the full resolution.<br />
<br />
[[File:ForceResistorXBee.jpg|600px|Picture of connection|link=http://elinux.org/images/3/3b/ForceResistorXBee.jpg]]<br />
<br />
=== Software ===<br />
<br />
We're going to start with these two pieces of code as a reference and combine them:<br />
<br />
*[https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c Code to interface with the force sensitive resistor]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
Running the code for the force sensitive resistor produces a value from 0 to 4096 depending on how much pressure is applied to the resistor. The harder the resistor is squeezed, the lower this value is. On line 46 of the force sensitive resistor code, <code>analogValue</code> is constantly updated and stores this number.<br />
<br />
The instructions now fork depending on whether you're setting up the sending XBee code or the receiving XBee code. When you're done you will have two C programs, one running on each Bone.<br />
<br />
==== Sending ====<br />
<br />
Start with the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c resistor code] as a base and add the following include to the top of the file to add our XBee library (available [https://github.com/duganje/ECE497_XBEE here]):<br />
<br />
#include "XBee.h"<br />
<br />
Next, add a call to <code>initializeXbee()</code> in <code>main</code> of the resistor code before the while loop begins.<br />
<br />
In the <code>while</code> loop after the value of <code>analogValue</code> is updated, add this line:<br />
<br />
sendIntXbee(analogValue);<br />
<br />
This will send the integer analog value to the receiving XBee. Now the number is constantly being sent in the while loop.<br />
<br />
==== Receiving ====<br />
<br />
Start with the [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee code] as a base and create a <code>main</code> function. First in <code>main</code>, add a call to <code>initializeXbee()</code> to setup the Bone to use the module.<br />
<br />
Next, add a while loop to <code>main</code> which continuously receives the integer analog value from the other Bone using the <code>receiveIntXbee()</code> function. Once the integer value is received, you're free to use that information for whatever purpose you wish. The example code below should give you an idea of how this is done:<br />
<br />
<pre>void main(int argc, char **argv, char **envp) {<br />
// Initialize XBee<br />
initializeXbee();<br />
<br />
// Keep going<br />
while (1) {<br />
int analogValue = receiveIntXbee();<br />
<br />
// Do anything based on analog value<br />
if (analogValue < 1000)<br />
ButtonPressedFunction();<br />
}<br />
}</pre><br />
<br />
==== Sample ====<br />
<br />
===== Required Items =====<br />
<br />
* LED<br />
* 220Ω resistor<br />
<br />
===== Instructions =====<br />
<br />
Based on the instructions above, I've created a sample set of programs. Using two Bones, the send program runs on one and the receive program runs on another. The "send" Bone includes an XBee module and the force sensitive resistor, [[ECE497 Project: XBee#Hardware 2|hooked-up as described here]]. The second Bone includes the XBee module hooked-up in the same way with the addition of an LED connected to pin 12 (GPIO1_28) of the Bone. Connect the ground pin of the LED to the Bone's ground (pin 1) using a 220Ω resistor.<br />
<br />
Running both programs emulates the original function of the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c force resistor sample code], the only difference being that the data is now sent wirelessly from one Bone to another.<br />
<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/sendResistor.c Send Program]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/receiveResistor.c Receive Program]<br />
<br />
To easily run the programs, follow these steps (you can skip the first step if you have already clone the repository):<br />
beagle$ git clone https://github.com/duganje/ECE497_XBEE.git<br />
beagle$ cd ECE_497_XBEE<br />
beagle$ cd ForceResistor<br />
beagle$ make<br />
<br />
This will create 2 executables: '''sendResistor''' and '''receiveResistor'''. Run the programs by running:<br />
<br />
beagle$ ./sendResistor<br />
<br />
on the Bone connected to the XBee and the force sensitive resistor and<br />
<br />
beagle$ ./receiveResistor<br />
<br />
on the Bone connected to the XBee and the LED.<br />
<br />
You will then be able to squeeze the force sensitive resistor and see the LED light up on the other BeagleBone. We've created a [[ECE497 Project: XBee#Force Sensitive Resistor YouTube Demo|YouTube demo]] of this program in action.<br />
<br />
== Wireless 2-Axis Thumb Joystick ==<br />
<br />
These instructions are for interfacing the [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]] with the XBee. This application could be useful in a wireless controller setting. <br />
<br />
=== Required Items ===<br />
<br />
*2 X [http://adafruit.com/products/513 BeagleBone]<br />
*2 X [http://www.adafruit.com/products/128 XBee Module]<br />
*2 X [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 X [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]]<br />
<br />
=== BeagleBone Wiring Instructions ===<br />
<br />
On your first BeagleBone, wire pins 36 and 38 to your two analog inputs. Wire the Beagle's 1.8V VCC output, pin 32, to the VCC input of the Joystick. Finally, wire the select GPIO signal to the GPIO_7 pin or pin 42.<br />
<br />
Wire the XBee as shown in the table below:<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The pinout and visual implementation are shown below.<br />
<br />
[[File:Bone_P9_pinout.jpg|x400px]] [[File:XBee_and_Adafruit_Joystick.jpg|x400px]]<br />
<br />
On the second BeagleBone, wire the XBee exactly as the first XBee (as described in the table above).<br />
<br />
Don't hook up any other hardware to the second XBee as it will be acting as an information hub.<br />
<br />
=== Usage Instructions ===<br />
<br />
On both BeagleBones, clone this repository: https://github.com/duganje/ECE497_XBEE.git<br />
<br />
== Magnetometer ==<br />
<br />
These instructions are for interfacing the [[Sparkfun: HMC5883L Magnetometer|HMC5883L Magnetometer]] with the XBee.<br />
<br />
=== Required Items ===<br />
<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/10530? Magnetometer Breakout Board]<br />
<br />
===Hardware===<br />
<br />
The XBee radios should be connected to both Beagles as shown in the table below. <br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The Magnetometer should be connected to one BeagleBone as described in the [[Sparkfun: HMC5883L Magnetometer|hardware]] section of the Magnetometer page. Ground and Vcc on the Magnetometer should be connected to pins 1 and 3 respectively on header P9 of the bone. SCL and SDA on the Magnetometer should be connected to pins 19 and 20 on P9 to use I2C bus 3. Two 4.7kΩ resistors should also be connected between SCL and Vcc and between SDA and Vcc. Below is a picture of the Beagle connected to the Magnetometer and the XBee.<br />
<br />
[[File:XBEE_MAG.jpg|600px|Picture of connections]]<br />
<br />
===Software===<br />
<br />
The goal is to have the two BeagleBones attached to XBee radios with the one connected to the Magnetometer taking data and transmitting this data to the other Bone which will print the measured data.<br />
<br />
I started with the code to collect data from the Magnetometer and the code to send data using the XBee radios. Here are the links to these two programs:<br />
*[https://github.com/duganje/ECE497_duganje/blob/master/MiniProject02/miniproject02.c Code to gather magnetometer data]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
The code for the magnetometer uses I2C to read the values for the X, Y and Z-Axes and print these values to the terminal. The XBee code contains helper functions to transmit data wirelessly. I have written two programs: one to collect and transmit the magnetometer data and the other to receive and display this data.<br />
<br />
====Sending====<br />
<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Magnetometer/sendMag.c Tranmitting Magnetometer Data Code]<br />
<br />
The code uses [https://github.com/MarkAYoder/BeagleBoard-exercises/tree/master/i2c I2C code] from [[EBC Exercise 12 I2C]] and helper functions from [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee.c].<br />
<br />
The program uses:<br />
<br />
i2cget(i2cbus, address, daddress);<br />
<br />
to get the data from the magnetometer and <br />
<br />
sendShortXbee(val);<br />
<br />
to send these values to the receiving XBee.<br />
<br />
====Receiving====<br />
<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Magnetometer/receiveMag.c Receiving Magnetometer Data Code]<br />
<br />
The receiving code uses:<br />
<br />
receiveShortXbee();<br />
<br />
to read the values for each axis.<br />
<br />
Because we do not have a way to synchronize the two XBees, the receiving program must be started first to ensure the data is receive in the correct order.<br />
<br />
In the Highlights section, there is a video demo of the complete program.<br />
<br />
===Running the Code===<br />
Use the following to run the magnetometer code (you can skip the first step if you have already clone the repository)<br />
beagle$ git clone https://github.com/duganje/ECE497_XBEE.git<br />
beagle$ cd ECE_497_XBEE<br />
beagle$ cd Magnetometer<br />
beagle$ make<br />
<br />
This will create 2 executables: '''receiveMag''' and '''sendMag'''. Run the code by doing<br />
beagle$ ./sendMag<br />
on the Bone connected to the XBee and the magnetometer and<br />
beagle$ ./receiveMag<br />
on the Bone connected to just the XBee.<br />
<br />
== General Usage ==<br />
<br />
These instructions are a general how-to for using the XBee with any sensor.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code>. In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate with the XBee using UART 2. Then in your <code>main.c</code> file, call: <pre>sendIntXbee(yourInt);</pre> with <code>yourInt</code> being any integer data you would like to transmit. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the integer which was sent through <code>sendIntXbee(int yourInt)</code> on the 1st board.<br />
<br />
The send and receive functions can be easily modified to send any data type, as shown in <code>XBee.c</code> with the following functions:<br />
<br />
<pre>sendShortXbee(short yourShort);</pre><br />
<pre>receiveShortXbee();</pre><br />
<br />
== Highlights ==<br />
<br />
Our project is able to send and receive wireless data for a whole range of possible implementations. We've created YouTube demos for the three sensor implementations we've described so far:<br />
<br />
=== Force Sensitive Resistor YouTube Demo ===<br />
{{#ev:youtube|Ds_BWsrvy1I}}<br />
<br />
=== Magnetometer YouTube Demo ===<br />
{{#ev:youtube|99bFqE54UHM}}<br />
<br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. UART files on the Bone represent serial connections. With an XBee connected to the Bone's UART 2 as shown above, sent and received messages are written to <code>/dev/ttyO2</code> (the O is an uppercase O, not a zero). The BeagleBone's UARTs are accessed through <code>/dev/ttyO'''x'''</code>, where <code>'''x'''</code> is the UART number. Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation. (done)<br />
*Thursday, 11/8 - Package language implemented between Bones. (done)<br />
*Sunday, 11/11 - YouTube demo uploaded. (done)<br />
*Monday, 11/12 - All documentation complete. (done)<br />
*Tuesday, 11/13 - Everything complete & all code ''makes''. (done)<br />
<br />
=== Completed Work ===<br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
* Initialization method - Josh Dugan<br />
* Force Sensitive Resistor implementation and demo - Stephen Shinn<br />
* Magnetometer implementation and demo - Josh Dugan<br />
* 2-Axis Thumb Joystick implementation and demo - Matt Moravec<br />
<br />
== Future Work ==<br />
<br />
The following are some additional things that could be done with this project:<br />
<br />
* Create and document interfaces for more sensors<br />
* Back-and-forth 2-sensor communication<br />
* Create a practical application such as a wireless doorbell<br />
<br />
== Conclusions ==<br />
<br />
In conclusion, we created an XBee wireless communication library for BeagleBone and adapted three sensors to use it. We've also documented general usage instructions for adapting XBee to use any type of sensor. We have not found a comprehensive source for how to use XBee modules with the BeagleBone, so our code and instructions are online with the intention that others use them as a reference.<br />
<br />
Using the wireless modules is interesting, and the possibilities are endless. We've listed a few ideas above which could be done in the future. One interesting idea would be to create a practical XBee application that someone could actually use in their home or work life. With a few XBees around the house, one could have a small network for sending data and controlling Christmas lights or something with a sensor.<br />
<br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=192056ECE497 Project: XBee2012-11-12T22:18:42Z<p>Shinnsm: cleanup</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Grading Template ==<br />
<br />
I'm using the following template to grade. Each slot is 10 points.<br />
0 = Missing, 5=OK, 10=Wow!<br />
<br />
<pre style="color:red"><br />
00 Executive Summary<br />
05 Installation Instructions <br />
01 User Instructions<br />
00 Highlights<br />
00 Theory of Operation<br />
00 Work Breakdown<br />
00 Future Work<br />
00 Conclusions<br />
00 Demo<br />
00 Late<br />
Comments: I'm looking forward to seeing this.<br />
<br />
Score: 06/100<br />
</pre><br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
We have successfully connected to the XBee radios from the Bones and sent data using the /dev/ttyO file system. We have also successfully done wireless implementations of the force sensitive resistor, the magnetometer and the joystick alone a set of functions for expanding this to any sensor.<br />
<br />
We were unable to get a working program with 2-way communication with 2 XBees each sending and receiving data because of synchronization problems. Addressing this would likely require the development of a simple communication to prevent deadlocks and to ensure the receiving program knows what the data is when it receives it. <br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. We have successfully communicated wirelessly with three sensors: the force sensitive resistor, magnetometer and joystick.<br />
<br />
== General Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
[[File:XBeeBoneConnection.jpg|450px|XBee module connected to a BeagleBone.]]<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE.git https://github.com/duganje/ECE497_XBEE.git]. To begin, run <br />
beagle$ git clone https://github.com/duganje/ECE497_XBEE.git<br />
to clone he repository. This contains three folders with examples of XBee implementation for specific sensors and <code>XBee.c</code>, which contains helper functions for using the XBee. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
<br />
== 0.5" Force Sensitive Resistor ==<br />
<br />
These instructions are for interfacing the [[SparkFun: 0.5" Force Sensitive Resistor|0.5" Force Sensitive Resistor]] with the XBee.<br />
<br />
=== Required Items ===<br />
<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/9375 0.5" Force Sensitive Resistor]<br />
*1 x 27kΩ resistor<br />
<br />
=== Hardware ===<br />
<br />
First we will connect the force-sensitive resistor to the Bone (P9 header). A 27kΩ resistor is used to connect the 3.3V source (pin 3) from the Bone to one pin of the force-sensitive resistor. Then, the other pin of the force-sensitive resistor is connected to ground (pin 1). An analog pin (AIN) on the Bone connects to the node containing both resistors, and values can be read off of that AIN. AIN5 (pin 36) is being used to read values on the Bone.<br />
<br />
Next we will connect the XBee module to the Bone. The table below describes the necessary wiring.<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
With everything wired-up, your connections should match the image below. Click on the image to view the full resolution.<br />
<br />
[[File:ForceResistorXBee.jpg|600px|Picture of connection|link=http://elinux.org/images/3/3b/ForceResistorXBee.jpg]]<br />
<br />
=== Software ===<br />
<br />
We're going to start with these two pieces of code as a reference and combine them:<br />
<br />
*[https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c Code to interface with the force sensitive resistor]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
Running the code for the force sensitive resistor produces a value from 0 to 4096 depending on how much pressure is applied to the resistor. The harder the resistor is squeezed, the lower this value is. On line 46 of the force sensitive resistor code, <code>analogValue</code> is constantly updated and stores this number.<br />
<br />
The instructions now fork depending on whether you're setting up the sending XBee code or the receiving XBee code. When you're done you will have two C programs, one running on each Bone.<br />
<br />
==== Sending ====<br />
<br />
Start with the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c resistor code] as a base and add the following include to the top of the file to add our XBee library (available [https://github.com/duganje/ECE497_XBEE here]):<br />
<br />
#include "XBee.h"<br />
<br />
Next, add a call to <code>initializeXbee()</code> in <code>main</code> of the resistor code before the while loop begins.<br />
<br />
In the <code>while</code> loop after the value of <code>analogValue</code> is updated, add this line:<br />
<br />
sendIntXbee(analogValue);<br />
<br />
This will send the integer analog value to the receiving XBee. Now the number is constantly being sent in the while loop.<br />
<br />
==== Receiving ====<br />
<br />
Start with the [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee code] as a base and create a <code>main</code> function. First in <code>main</code>, add a call to <code>initializeXbee()</code> to setup the Bone to use the module.<br />
<br />
Next, add a while loop to <code>main</code> which continuously receives the integer analog value from the other Bone using the <code>receiveIntXbee()</code> function. Once the integer value is received, you're free to use that information for whatever purpose you wish. The example code below should give you an idea of how this is done:<br />
<br />
<pre>void main(int argc, char **argv, char **envp) {<br />
// Initialize XBee<br />
initializeXbee();<br />
<br />
// Keep going<br />
while (1) {<br />
int analogValue = receiveIntXbee();<br />
<br />
// Do anything based on analog value<br />
if (analogValue < 1000)<br />
ButtonPressedFunction();<br />
}<br />
}</pre><br />
<br />
==== Sample ====<br />
<br />
===== Required Items =====<br />
<br />
* LED<br />
* 220Ω resistor<br />
<br />
===== Instructions =====<br />
<br />
Based on the instructions above, I've created a sample set of programs. Using two Bones, the send program runs on one and the receive program runs on another. The "send" Bone includes an XBee module and the force sensitive resistor, [[ECE497 Project: XBee#Hardware 2|hooked-up as described here]]. The second Bone includes the XBee module hooked-up in the same way with the addition of an LED connected to pin 12 (GPIO1_28) of the Bone. Connect the ground pin of the LED to the Bone's ground (pin 1) using a 220Ω resistor.<br />
<br />
Running both programs emulates the original function of the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c force resistor sample code], the only difference being that the data is now sent wirelessly from one Bone to another.<br />
<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/sendResistor.c Send Program]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/receiveResistor.c Receive Program]<br />
<br />
To easily run the programs, follow these steps (you can skip the first step if you have already clone the repository):<br />
beagle$ git clone https://github.com/duganje/ECE497_XBEE.git<br />
beagle$ cd ECE_497_XBEE<br />
beagle$ cd ForceResistor<br />
beagle$ make<br />
<br />
This will create 2 executables: '''sendResistor''' and '''receiveResistor'''. Run the programs by running:<br />
<br />
beagle$ ./sendResistor<br />
<br />
on the Bone connected to the XBee and the force sensitive resistor and<br />
<br />
beagle$ ./receiveResistor<br />
<br />
on the Bone connected to the XBee and the LED.<br />
<br />
You will then be able to squeeze the force sensitive resistor and see the LED light up on the other BeagleBone. We've created a [[ECE497 Project: XBee#Force Sensitive Resistor YouTube Demo|YouTube demo]] of this program in action.<br />
<br />
== Wireless 2-Axis Thumb Joystick ==<br />
<br />
These instructions are for interfacing the [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]] with the XBee. This application could be useful in a wireless controller setting. <br />
<br />
=== Required Items ===<br />
<br />
*2 X [http://adafruit.com/products/513 BeagleBone]<br />
*2 X [http://www.adafruit.com/products/128 XBee Module]<br />
*2 X [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 X [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]]<br />
<br />
=== BeagleBone Wiring Instructions ===<br />
<br />
On your first BeagleBone, wire pins 36 and 38 to your two analog inputs. Wire the Beagle's 1.8V VCC output, pin 32, to the VCC input of the Joystick. Finally, wire the select GPIO signal to the GPIO_7 pin or pin 42.<br />
<br />
Wire the XBee as shown in the table below:<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The pinout and visual implementation are shown below.<br />
<br />
[[File:Bone_P9_pinout.jpg|x400px]] [[File:XBee_and_Adafruit_Joystick.jpg|x400px]]<br />
<br />
On the second BeagleBone, wire the XBee exactly as the first XBee (as described in the table above).<br />
<br />
Don't hook up any other hardware to the second XBee as it will be acting as an information hub.<br />
<br />
=== Usage Instructions ===<br />
<br />
On both BeagleBones, clone this repository: https://github.com/duganje/ECE497_XBEE.git<br />
<br />
== Magnetometer ==<br />
<br />
These instructions are for interfacing the [[Sparkfun: HMC5883L Magnetometer|HMC5883L Magnetometer]] with the XBee.<br />
<br />
=== Required Items ===<br />
<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/10530? Magnetometer Breakout Board]<br />
<br />
===Hardware===<br />
<br />
The XBee radios should be connected to both Beagles as shown in the table below. <br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The Magnetometer should be connected to one BeagleBone as described in the [[Sparkfun: HMC5883L Magnetometer|hardware]] section of the Magnetometer page. Ground and Vcc on the Magnetometer should be connected to pins 1 and 3 respectively on header P9 of the bone. SCL and SDA on the Magnetometer should be connected to pins 19 and 20 on P9 to use I2C bus 3. Two 4.7kΩ resistors should also be connected between SCL and Vcc and between SDA and Vcc. Below is a picture of the Beagle connected to the Magnetometer and the XBee.<br />
<br />
[[File:XBEE_MAG.jpg|600px|Picture of connections]]<br />
<br />
===Software===<br />
<br />
The goal is to have the two BeagleBones attached to XBee radios with the one connected to the Magnetometer taking data and transmitting this data to the other Bone which will print the measured data.<br />
<br />
I started with the code to collect data from the Magnetometer and the code to send data using the XBee radios. Here are the links to these two programs:<br />
*[https://github.com/duganje/ECE497_duganje/blob/master/MiniProject02/miniproject02.c Code to gather magnetometer data]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
The code for the magnetometer uses I2C to read the values for the X, Y and Z-Axes and print these values to the terminal. The XBee code contains helper functions to transmit data wirelessly. I have written two programs: one to collect and transmit the magnetometer data and the other to receive and display this data.<br />
<br />
====Sending====<br />
<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Magnetometer/sendMag.c Tranmitting Magnetometer Data Code]<br />
<br />
The code uses [https://github.com/MarkAYoder/BeagleBoard-exercises/tree/master/i2c I2C code] from [[EBC Exercise 12 I2C]] and helper functions from [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee.c].<br />
<br />
The program uses:<br />
<br />
i2cget(i2cbus, address, daddress);<br />
<br />
to get the data from the magnetometer and <br />
<br />
sendShortXbee(val);<br />
<br />
to send these values to the receiving XBee.<br />
<br />
====Receiving====<br />
<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Magnetometer/receiveMag.c Receiving Magnetometer Data Code]<br />
<br />
The receiving code uses:<br />
<br />
receiveShortXbee();<br />
<br />
to read the values for each axis.<br />
<br />
Because we do not have a way to synchronize the two XBees, the receiving program must be started first to ensure the data is receive in the correct order.<br />
<br />
In the Highlights section, there is a video demo of the complete program.<br />
<br />
===Running the Code===<br />
Use the following to run the magnetometer code (you can skip the first step if you have already clone the repository)<br />
beagle$ git clone https://github.com/duganje/ECE497_XBEE.git<br />
beagle$ cd ECE_497_XBEE<br />
beagle$ cd Magnetometer<br />
beagle$ make<br />
<br />
This will create 2 executables: '''receiveMag''' and '''sendMag'''. Run the code by doing<br />
beagle$ ./sendMag<br />
on the Bone connected to the XBee and the magnetometer and<br />
beagle$ ./receiveMag<br />
on the Bone connected to just the XBee.<br />
<br />
== General Usage ==<br />
<br />
These instructions are a general how-to for using the XBee with any sensor.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code>. In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate with the XBee using UART 2. Then in your <code>main.c</code> file, call: <pre>sendIntXbee(yourInt);</pre> with <code>yourInt</code> being any integer data you would like to transmit. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the integer which was sent through <code>sendIntXbee(int yourInt)</code> on the 1st board.<br />
<br />
The send and receive functions can be easily modified to send any data type, as shown in <code>XBee.c</code> with the following functions:<br />
<br />
<pre>sendShortXbee(short yourShort);</pre><br />
<pre>receiveShortXbee();</pre><br />
<br />
== Highlights ==<br />
<br />
Our project is able to send and receive wireless data for a whole range of possible implementations. We've created YouTube demos for the three sensor implementations we've described so far:<br />
<br />
=== Force Sensitive Resistor YouTube Demo ===<br />
{{#ev:youtube|Ds_BWsrvy1I}}<br />
<br />
=== Magnetometer YouTube Demo ===<br />
{{#ev:youtube|99bFqE54UHM}}<br />
<br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. UART files on the Bone represent serial connections. With an XBee connected to the Bone's UART 2 as shown above, sent and received messages are written to <code>/dev/ttyO2</code> (the O is an uppercase O, not a zero). The BeagleBone's UARTs are accessed through <code>/dev/ttyO'''x'''</code>, where <code>'''x'''</code> is the UART number. Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation. (done)<br />
*Thursday, 11/8 - Package language implemented between Bones. (done)<br />
*Sunday, 11/11 - YouTube demo uploaded. (done)<br />
*Monday, 11/12 - All documentation complete. (done)<br />
*Tuesday, 11/13 - Everything complete & all code ''makes''. (done)<br />
<br />
=== Completed Work ===<br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
* Initialization method - Josh Dugan<br />
* Force Sensitive Resistor implementation and demo - Stephen Shinn<br />
* Magnetometer implementation and demo - Josh Dugan<br />
* 2-Axis Thumb Joystick implementation and demo - Matt Moravec<br />
<br />
== Future Work ==<br />
<br />
The following are some additional things that could be done with this project:<br />
<br />
* Create and document interfaces for more sensors<br />
* Back-and-forth 2-sensor communication<br />
* Create a practical application such as a wireless doorbell<br />
<br />
== Conclusions ==<br />
<br />
In conclusion, we created an XBee wireless communication library for BeagleBone and adapted three sensors to use it. We've also documented general usage instructions for adapting XBee to use any type of sensor. We have not found a comprehensive source for how to use XBee modules with the BeagleBone, so our code and instructions are online with the intention that others use them as a reference.<br />
<br />
Using the wireless modules is interesting, and the possibilities are endless. We've listed a few ideas above which could be done in the future. One interesting idea would be to create a practical XBee application that someone could actually use in their home or work life. With a few XBees around the house, one could have a small network for sending data and controlling Christmas lights or something with a sensor.<br />
<br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=191996ECE497 Project: XBee2012-11-12T21:28:14Z<p>Shinnsm: /* Instructions */</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Grading Template ==<br />
I'm using the following template to grade. Each slot is 10 points.<br />
0 = Missing, 5=OK, 10=Wow!<br />
<br />
<pre style="color:red"><br />
00 Executive Summary<br />
05 Installation Instructions <br />
01 User Instructions<br />
00 Highlights<br />
00 Theory of Operation<br />
00 Work Breakdown<br />
00 Future Work<br />
00 Conclusions<br />
00 Demo<br />
00 Late<br />
Comments: I'm looking forward to seeing this.<br />
<br />
Score: 06/100<br />
</pre><br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
We have successfully connected to the XBee radios from the Bones and sent data using the /dev/ttyO file system. We have also successfully done wireless implementations of the force sensitive resistor, the magnetometer and the joystick alone a set of functions for expanding this to any sensor.<br />
<br />
We were unable to get a working program with 2-way communication with 2 XBees each sending and receiving data because of synchronization problems. Addressing this would likely require the development of a simple communication to prevent deadlocks and to ensure the receiving program knows what the data is when it receives it. <br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. We have successfully communicated wirelessly with three sensors: the force sensitive resistor, magnetometer and joystick.<br />
<br />
== General Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
[[File:XBeeBoneConnection.jpg|450px|XBee module connected to a BeagleBone.]]<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE.git https://github.com/duganje/ECE497_XBEE.git]. To begin, run <br />
beagle$ git clone https://github.com/duganje/ECE497_XBEE.git<br />
to clone he repository. This contains three folders with examples of XBee implementation for specific sensors and <code>XBee.c</code>, which contains helper functions for using the XBee. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
<br />
== 0.5" Force Sensitive Resistor ==<br />
These instructions are for interfacing the [[SparkFun: 0.5" Force Sensitive Resistor|0.5" Force Sensitive Resistor]] with the XBee.<br />
<br />
=== Required Items ===<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/9375 0.5" Force Sensitive Resistor]<br />
*1 x 27kΩ resistor<br />
<br />
=== Hardware ===<br />
First we will connect the force-sensitive resistor to the Bone (P9 header). A 27kΩ resistor is used to connect the 3.3V source (pin 3) from the Bone to one pin of the force-sensitive resistor. Then, the other pin of the force-sensitive resistor is connected to ground (pin 1). An analog pin (AIN) on the Bone connects to the node containing both resistors, and values can be read off of that AIN. AIN5 (pin 36) is being used to read values on the Bone.<br />
<br />
Next we will connect the XBee module to the Bone. The table below describes the necessary wiring.<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
With everything wired-up, your connections should match the image below. Click on the image to view the full resolution.<br />
<br />
[[File:ForceResistorXBee.jpg|600px|Picture of connection|link=http://elinux.org/images/3/3b/ForceResistorXBee.jpg]]<br />
<br />
=== Software ===<br />
We're going to start with these two pieces of code as a reference and combine them:<br />
<br />
*[https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c Code to interface with the force sensitive resistor]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
Running the code for the force sensitive resistor produces a value from 0 to 4096 depending on how much pressure is applied to the resistor. The harder the resistor is squeezed, the lower this value is. On line 46 of the force sensitive resistor code, <code>analogValue</code> is constantly updated and stores this number.<br />
<br />
The instructions now fork depending on whether you're setting up the sending XBee code or the receiving XBee code. When you're done you will have two C programs, one running on each Bone.<br />
<br />
==== Sending ====<br />
Start with the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c resistor code] as a base and add the following include to the top of the file to add our XBee library (available [https://github.com/duganje/ECE497_XBEE here]):<br />
<br />
#include "XBee.h"<br />
<br />
Next, add a call to <code>initializeXbee()</code> in <code>main</code> of the resistor code before the while loop begins.<br />
<br />
In the <code>while</code> loop after the value of <code>analogValue</code> is updated, add this line:<br />
<br />
sendIntXbee(analogValue);<br />
<br />
This will send the integer analog value to the receiving XBee. Now the number is constantly being sent in the while loop.<br />
<br />
==== Receiving ====<br />
Start with the [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee code] as a base and create a <code>main</code> function. First in <code>main</code>, add a call to <code>initializeXbee()</code> to setup the Bone to use the module.<br />
<br />
Next, add a while loop to <code>main</code> which continuously receives the integer analog value from the other Bone using the <code>receiveIntXbee()</code> function. Once the integer value is received, you're free to use that information for whatever purpose you wish. The example code below should give you an idea of how this is done:<br />
<br />
<pre>void main(int argc, char **argv, char **envp) {<br />
// Initialize XBee<br />
initializeXbee();<br />
<br />
// Keep going<br />
while (1) {<br />
int analogValue = receiveIntXbee();<br />
<br />
// Do anything based on analog value<br />
if (analogValue < 1000)<br />
ButtonPressedFunction();<br />
}<br />
}</pre><br />
<br />
==== Sample ====<br />
<br />
===== Required Items =====<br />
* LED<br />
* 220Ω resistor<br />
<br />
===== Instructions =====<br />
<br />
Based on the instructions above, I've created a sample set of programs. Using two Bones, the send program runs on one and the receive program runs on another. The "send" Bone includes an XBee module and the force sensitive resistor, [[ECE497 Project: XBee#Hardware 2|hooked-up as described here]]. The second Bone includes the XBee module hooked-up in the same way with the addition of an LED connected to pin 12 (GPIO1_28) of the Bone. Connect the ground pin of the LED to the Bone's ground (pin 1) using a 220Ω resistor.<br />
<br />
Running both programs emulates the original function of the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c force resistor sample code], the only difference being that the data is now sent wirelessly from one Bone to another.<br />
<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/sendResistor.c Send Program]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/receiveResistor.c Receive Program]<br />
<br />
To easily run the programs, follow these steps (you can skip the first step if you have already clone the repository):<br />
beagle$ git clone https://github.com/duganje/ECE497_XBEE.git<br />
beagle$ cd ECE_497_XBEE<br />
beagle$ cd ForceResistor<br />
beagle$ make<br />
<br />
This will create 2 executables: '''sendResistor''' and '''receiveResistor'''. Run the programs by running:<br />
<br />
beagle$ ./sendResistor<br />
<br />
on the Bone connected to the XBee and the force sensitive resistor and<br />
<br />
beagle$ ./receiveResistor<br />
<br />
on the Bone connected to the XBee and the LED.<br />
<br />
You will then be able to squeeze the force sensitive resistor and see the LED light up on the other BeagleBone. We've created a [[ECE497 Project: XBee#Force Sensitive Resistor YouTube Demo|YouTube demo]] of this program in action.<br />
<br />
== Wireless 2-Axis Thumb Joystick ==<br />
These instructions are for interfacing the [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]] with the XBee. This application could be useful in a wireless controller setting. <br />
<br />
=== Required Items ===<br />
*2 X [http://adafruit.com/products/513 BeagleBone]<br />
*2 X [http://www.adafruit.com/products/128 XBee Module]<br />
*2 X [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 X [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]]<br />
<br />
=== BeagleBone Wiring Instructions ===<br />
On your first BeagleBone, wire pins 36 and 38 to your two analog inputs. Wire the Beagle's 1.8V VCC output, pin 32, to the VCC input of the Joystick. Finally, wire the select GPIO signal to the GPIO_7 pin or pin 42.<br />
<br />
Wire the XBee as shown in the table below:<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The pinout and visual implementation are shown below.<br />
<br />
[[File:Bone_P9_pinout.jpg|x400px]] [[File:XBee_and_Adafruit_Joystick.jpg|x400px]]<br />
<br />
On the second BeagleBone, wire the XBee exactly as the first XBee (as described in the table above).<br />
<br />
Don't hook up any other hardware to the second XBee as it will be acting as an information hub.<br />
<br />
=== Usage Instructions ===<br />
On both BeagleBones, clone this repository:<br />
<br />
== Magnetometer ==<br />
These instructions are for interfacing the [[Sparkfun: HMC5883L Magnetometer|HMC5883L Magnetometer]] with the XBee.<br />
<br />
=== Required Items ===<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/10530? Magnetometer Breakout Board]<br />
<br />
===Hardware===<br />
The XBee radios should be connected to both Beagles as shown in the table below. <br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The Magnetometer should be connected to one BeagleBone as described in the [[Sparkfun: HMC5883L Magnetometer|hardware]] section of the Magnetometer page. Ground and Vcc on the Magnetometer should be connected to pins 1 and 3 respectively on header P9 of the bone. SCL and SDA on the Magnetometer should be connected to pins 19 and 20 on P9 to use I2C bus 3. Two 4.7kΩ resistors should also be connected between SCL and Vcc and between SDA and Vcc. Below is a picture of the Beagle connected to the Magnetometer and the XBee.<br />
<br />
[[File:XBEE_MAG.jpg|600px|Picture of connections]]<br />
<br />
===Software===<br />
The goal is to have the two BeagleBones attached to XBee radios with the one connected to the Magnetometer taking data and transmitting this data to the other Bone which will print the measured data.<br />
<br />
I started with the code to collect data from the Magnetometer and the code to send data using the XBee radios. Here are the links to these two programs:<br />
*[https://github.com/duganje/ECE497_duganje/blob/master/MiniProject02/miniproject02.c Code to gather magnetometer data]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
The code for the magnetometer uses I2C to read the values for the X, Y and Z-Axes and print these values to the terminal. The XBee code contains helper functions to transmit data wirelessly. I have written two programs: one to collect and transmit the magnetometer data and the other to receive and display this data.<br />
<br />
====Sending====<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Magnetometer/sendMag.c Tranmitting Magnetometer Data Code]<br />
<br />
The code uses [https://github.com/MarkAYoder/BeagleBoard-exercises/tree/master/i2c I2C code] from [[EBC Exercise 12 I2C]] and helper functions from [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee.c]. <br />
The program uses <br />
i2cget(i2cbus, address, daddress);<br />
to get the data from the magnetometer and <br />
sendShortXbee(val);<br />
to send these values to the receiving XBee.<br />
<br />
====Receiving====<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Magnetometer/receiveMag.c Receiving Magnetometer Data Code]<br />
<br />
The receiving code uses <br />
receiveShortXbee();<br />
to read the values for each axis.<br />
<br />
Because we do not have a way to synchronize the two XBees, the receiving program must be started first to ensure the data is receive in the correct order.<br />
<br />
In the Highlights section, there is a video demo of the complete program.<br />
<br />
===Running the Code===<br />
use the following to run the magnetometer code (you can skip the first step if you have already clone the repository)<br />
beagle$ git clone https://github.com/duganje/ECE497_XBEE.git<br />
beagle$ cd ECE_497_XBEE<br />
beagle$ cd Magnetometer<br />
beagle$ make<br />
<br />
This will create 2 executables: '''receiveMag''' and '''sendMag'''. Run the code by doing<br />
beagle$ ./sendMag<br />
on the Bone connected to the XBee and the magnetometer and<br />
beagle$ ./receiveMag<br />
on the Bone connected to just the XBee<br />
<br />
== General Usage ==<br />
These instructions are a general how-to for using the XBee with any sensor.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code> (not created yet). In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate with the XBee using uart 2. Then in your main.c call: <pre>sendIntXbee(int yourInt);</pre> with <code>yourInt</code> being any data you would like to transmit. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the integer which was sent through <code>sendIntXbee(int yourInt)</code> on the 1st board.<br />
<br />
The send and receive functions can be easily modified to send any data type as shown in:<br />
<br />
<pre>sendShortXbee(short yourShort);</pre> <pre>receiveShortXbee();</pre><br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
<br />
== Highlights ==<br />
<br />
=== Force Sensitive Resistor YouTube Demo ===<br />
{{#ev:youtube|Ds_BWsrvy1I}}<br />
<br />
=== Magnetometer YouTube Demo ===<br />
{{#ev:youtube|99bFqE54UHM}}<br />
<br />
<!--<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
--><br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. UART files on the Bone represent serial connections. With an XBee connected to the Bone's UART 2 as shown above, sent and received messages are written to <code>/dev/ttyO2</code> (the O is an uppercase O, not a zero). The BeagleBone's UARTs are accessed through <code>/dev/ttyO'''x'''</code>, where <code>'''x'''</code> is the UART number. Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
--><br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation. (done)<br />
*Thursday, 11/8 - Package language implemented between Bones. (done)<br />
*Sunday, 11/11 - YouTube demo uploaded. (done)<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Everything complete & all code ''makes''.<br />
<br />
=== Completed Work ===<br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
* Initialization method - Josh Dugan<br />
* Force Sensitive Resistor implementation - Stephen Shinn<br />
* Magnetometer implementation - Josh Dugan<br />
* 2-Axis Thumb Joystick implementation - Matt Moravec<br />
<br />
=== To Do ===<br />
<br />
* Update documentation - All<br />
* Joystick demo - Matt<br />
* Clone repo from scratch and test make<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
<br />
The following are some additional things that could be done with this project:<br />
<br />
* Create and document interfaces for more sensors<br />
* Back-and-forth 2-sensor communication<br />
* Create a practical application such as a wireless doorbell<br />
<br />
== Conclusions ==<br />
<br />
In conclusion, we created an XBee wireless communication library for BeagleBone and adapted three sensors to use it. We've also documented general usage instructions for adapting XBee to use any type of sensor. We have not found a comprehensive source for how to use XBee modules with the BeagleBone, so our code and instructions are online with the intention that others use them as a reference.<br />
<br />
Using the wireless modules is interesting, and the possibilities are endless. We've listed a few ideas above which could be done in the future. One interesting idea would be to create a practical XBee application that someone could actually use in their home or work life. With a few XBees around the house, one could have a small network for sending data and controlling Christmas lights or something with a sensor.<br />
<!--<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
--><br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=191990ECE497 Project: XBee2012-11-12T21:27:00Z<p>Shinnsm: /* 0.5" Force Sensitive Resistor */</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Grading Template ==<br />
I'm using the following template to grade. Each slot is 10 points.<br />
0 = Missing, 5=OK, 10=Wow!<br />
<br />
<pre style="color:red"><br />
00 Executive Summary<br />
05 Installation Instructions <br />
01 User Instructions<br />
00 Highlights<br />
00 Theory of Operation<br />
00 Work Breakdown<br />
00 Future Work<br />
00 Conclusions<br />
00 Demo<br />
00 Late<br />
Comments: I'm looking forward to seeing this.<br />
<br />
Score: 06/100<br />
</pre><br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
We have successfully connected to the XBee radios from the Bones and sent data using the /dev/ttyO file system. We have also successfully done wireless implementations of the force sensitive resistor, the magnetometer and the joystick alone a set of functions for expanding this to any sensor.<br />
<br />
We were unable to get a working program with 2-way communication with 2 XBees each sending and receiving data because of synchronization problems. Addressing this would likely require the development of a simple communication to prevent deadlocks and to ensure the receiving program knows what the data is when it receives it. <br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. We have successfully communicated wirelessly with three sensors: the force sensitive resistor, magnetometer and joystick.<br />
<br />
== General Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
[[File:XBeeBoneConnection.jpg|450px|XBee module connected to a BeagleBone.]]<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE.git https://github.com/duganje/ECE497_XBEE.git]. To begin, run <br />
beagle$ git clone https://github.com/duganje/ECE497_XBEE.git<br />
to clone he repository. This contains three folders with examples of XBee implementation for specific sensors and <code>XBee.c</code>, which contains helper functions for using the XBee. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
<br />
== 0.5" Force Sensitive Resistor ==<br />
These instructions are for interfacing the [[SparkFun: 0.5" Force Sensitive Resistor|0.5" Force Sensitive Resistor]] with the XBee.<br />
<br />
=== Required Items ===<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/9375 0.5" Force Sensitive Resistor]<br />
*1 x 27kΩ resistor<br />
<br />
=== Hardware ===<br />
First we will connect the force-sensitive resistor to the Bone (P9 header). A 27kΩ resistor is used to connect the 3.3V source (pin 3) from the Bone to one pin of the force-sensitive resistor. Then, the other pin of the force-sensitive resistor is connected to ground (pin 1). An analog pin (AIN) on the Bone connects to the node containing both resistors, and values can be read off of that AIN. AIN5 (pin 36) is being used to read values on the Bone.<br />
<br />
Next we will connect the XBee module to the Bone. The table below describes the necessary wiring.<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
With everything wired-up, your connections should match the image below. Click on the image to view the full resolution.<br />
<br />
[[File:ForceResistorXBee.jpg|600px|Picture of connection|link=http://elinux.org/images/3/3b/ForceResistorXBee.jpg]]<br />
<br />
=== Software ===<br />
We're going to start with these two pieces of code as a reference and combine them:<br />
<br />
*[https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c Code to interface with the force sensitive resistor]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
Running the code for the force sensitive resistor produces a value from 0 to 4096 depending on how much pressure is applied to the resistor. The harder the resistor is squeezed, the lower this value is. On line 46 of the force sensitive resistor code, <code>analogValue</code> is constantly updated and stores this number.<br />
<br />
The instructions now fork depending on whether you're setting up the sending XBee code or the receiving XBee code. When you're done you will have two C programs, one running on each Bone.<br />
<br />
==== Sending ====<br />
Start with the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c resistor code] as a base and add the following include to the top of the file to add our XBee library (available [https://github.com/duganje/ECE497_XBEE here]):<br />
<br />
#include "XBee.h"<br />
<br />
Next, add a call to <code>initializeXbee()</code> in <code>main</code> of the resistor code before the while loop begins.<br />
<br />
In the <code>while</code> loop after the value of <code>analogValue</code> is updated, add this line:<br />
<br />
sendIntXbee(analogValue);<br />
<br />
This will send the integer analog value to the receiving XBee. Now the number is constantly being sent in the while loop.<br />
<br />
==== Receiving ====<br />
Start with the [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee code] as a base and create a <code>main</code> function. First in <code>main</code>, add a call to <code>initializeXbee()</code> to setup the Bone to use the module.<br />
<br />
Next, add a while loop to <code>main</code> which continuously receives the integer analog value from the other Bone using the <code>receiveIntXbee()</code> function. Once the integer value is received, you're free to use that information for whatever purpose you wish. The example code below should give you an idea of how this is done:<br />
<br />
<pre>void main(int argc, char **argv, char **envp) {<br />
// Initialize XBee<br />
initializeXbee();<br />
<br />
// Keep going<br />
while (1) {<br />
int analogValue = receiveIntXbee();<br />
<br />
// Do anything based on analog value<br />
if (analogValue < 1000)<br />
ButtonPressedFunction();<br />
}<br />
}</pre><br />
<br />
==== Sample ====<br />
<br />
===== Required Items =====<br />
* LED<br />
* 220Ω resistor<br />
<br />
===== Instructions =====<br />
<br />
Based on the instructions above, I've created a sample set of programs. Using two Bones, the send program runs on one and the receive program runs on another. The "send" Bone includes an XBee module and the force sensitive resistor, [[ECE497 Project: XBee#Hardware 2|hooked-up as described here]]. The second Bone includes the XBee module hooked-up in the same way with the addition of an LED connected to pin 12 (GPIO1_28) of the Bone. Connect the ground pin of the LED to the Bone's ground (pin 1) using a 220Ω resistor.<br />
<br />
Running both programs emulates the original function of the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c force resistor sample code], the only difference being that the data is now sent wirelessly from one Bone to another.<br />
<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/sendResistor.c Send Program]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/receiveResistor.c Receive Program]<br />
<br />
To easily run the programs, follow these steps (you can skip the first step if you have already clone the repository):<br />
beagle$ git clone https://github.com/duganje/ECE497_XBEE.git<br />
beagle$ cd ECE_497_XBEE<br />
beagle$ cd Magnetometer<br />
beagle$ make<br />
<br />
This will create 2 executables: '''sendResistor''' and '''receiveResistor'''. Run the programs by running:<br />
<br />
beagle$ ./sendResistor<br />
<br />
on the Bone connected to the XBee and the force sensitive resistor and<br />
<br />
beagle$ ./receiveResistor<br />
<br />
on the Bone connected to the XBee and the LED.<br />
<br />
You will then be able to squeeze the force sensitive resistor and see the LED light up on the other BeagleBone. We've created a [[ECE497 Project: XBee#Force Sensitive Resistor YouTube Demo|YouTube demo]] of this program in action.<br />
<br />
== Wireless 2-Axis Thumb Joystick ==<br />
These instructions are for interfacing the [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]] with the XBee. This application could be useful in a wireless controller setting. <br />
<br />
=== Required Items ===<br />
*2 X [http://adafruit.com/products/513 BeagleBone]<br />
*2 X [http://www.adafruit.com/products/128 XBee Module]<br />
*2 X [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 X [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]]<br />
<br />
=== BeagleBone Wiring Instructions ===<br />
On your first BeagleBone, wire pins 36 and 38 to your two analog inputs. Wire the Beagle's 1.8V VCC output, pin 32, to the VCC input of the Joystick. Finally, wire the select GPIO signal to the GPIO_7 pin or pin 42.<br />
<br />
Wire the XBee as shown in the table below:<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The pinout and visual implementation are shown below.<br />
<br />
[[File:Bone_P9_pinout.jpg|x400px]] [[File:XBee_and_Adafruit_Joystick.jpg|x400px]]<br />
<br />
On the second BeagleBone, wire the XBee exactly as the first XBee (as described in the table above).<br />
<br />
Don't hook up any other hardware to the second XBee as it will be acting as an information hub.<br />
<br />
=== Usage Instructions ===<br />
On both BeagleBones, clone this repository:<br />
<br />
== Magnetometer ==<br />
These instructions are for interfacing the [[Sparkfun: HMC5883L Magnetometer|HMC5883L Magnetometer]] with the XBee.<br />
<br />
=== Required Items ===<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/10530? Magnetometer Breakout Board]<br />
<br />
===Hardware===<br />
The XBee radios should be connected to both Beagles as shown in the table below. <br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The Magnetometer should be connected to one BeagleBone as described in the [[Sparkfun: HMC5883L Magnetometer|hardware]] section of the Magnetometer page. Ground and Vcc on the Magnetometer should be connected to pins 1 and 3 respectively on header P9 of the bone. SCL and SDA on the Magnetometer should be connected to pins 19 and 20 on P9 to use I2C bus 3. Two 4.7kΩ resistors should also be connected between SCL and Vcc and between SDA and Vcc. Below is a picture of the Beagle connected to the Magnetometer and the XBee.<br />
<br />
[[File:XBEE_MAG.jpg|600px|Picture of connections]]<br />
<br />
===Software===<br />
The goal is to have the two BeagleBones attached to XBee radios with the one connected to the Magnetometer taking data and transmitting this data to the other Bone which will print the measured data.<br />
<br />
I started with the code to collect data from the Magnetometer and the code to send data using the XBee radios. Here are the links to these two programs:<br />
*[https://github.com/duganje/ECE497_duganje/blob/master/MiniProject02/miniproject02.c Code to gather magnetometer data]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
The code for the magnetometer uses I2C to read the values for the X, Y and Z-Axes and print these values to the terminal. The XBee code contains helper functions to transmit data wirelessly. I have written two programs: one to collect and transmit the magnetometer data and the other to receive and display this data.<br />
<br />
====Sending====<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Magnetometer/sendMag.c Tranmitting Magnetometer Data Code]<br />
<br />
The code uses [https://github.com/MarkAYoder/BeagleBoard-exercises/tree/master/i2c I2C code] from [[EBC Exercise 12 I2C]] and helper functions from [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee.c]. <br />
The program uses <br />
i2cget(i2cbus, address, daddress);<br />
to get the data from the magnetometer and <br />
sendShortXbee(val);<br />
to send these values to the receiving XBee.<br />
<br />
====Receiving====<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Magnetometer/receiveMag.c Receiving Magnetometer Data Code]<br />
<br />
The receiving code uses <br />
receiveShortXbee();<br />
to read the values for each axis.<br />
<br />
Because we do not have a way to synchronize the two XBees, the receiving program must be started first to ensure the data is receive in the correct order.<br />
<br />
In the Highlights section, there is a video demo of the complete program.<br />
<br />
===Running the Code===<br />
use the following to run the magnetometer code (you can skip the first step if you have already clone the repository)<br />
beagle$ git clone https://github.com/duganje/ECE497_XBEE.git<br />
beagle$ cd ECE_497_XBEE<br />
beagle$ cd Magnetometer<br />
beagle$ make<br />
<br />
This will create 2 executables: '''receiveMag''' and '''sendMag'''. Run the code by doing<br />
beagle$ ./sendMag<br />
on the Bone connected to the XBee and the magnetometer and<br />
beagle$ ./receiveMag<br />
on the Bone connected to just the XBee<br />
<br />
== General Usage ==<br />
These instructions are a general how-to for using the XBee with any sensor.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code> (not created yet). In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate with the XBee using uart 2. Then in your main.c call: <pre>sendIntXbee(int yourInt);</pre> with <code>yourInt</code> being any data you would like to transmit. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the integer which was sent through <code>sendIntXbee(int yourInt)</code> on the 1st board.<br />
<br />
The send and receive functions can be easily modified to send any data type as shown in:<br />
<br />
<pre>sendShortXbee(short yourShort);</pre> <pre>receiveShortXbee();</pre><br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
<br />
== Highlights ==<br />
<br />
=== Force Sensitive Resistor YouTube Demo ===<br />
{{#ev:youtube|Ds_BWsrvy1I}}<br />
<br />
=== Magnetometer YouTube Demo ===<br />
{{#ev:youtube|99bFqE54UHM}}<br />
<br />
<!--<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
--><br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. UART files on the Bone represent serial connections. With an XBee connected to the Bone's UART 2 as shown above, sent and received messages are written to <code>/dev/ttyO2</code> (the O is an uppercase O, not a zero). The BeagleBone's UARTs are accessed through <code>/dev/ttyO'''x'''</code>, where <code>'''x'''</code> is the UART number. Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
--><br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation. (done)<br />
*Thursday, 11/8 - Package language implemented between Bones. (done)<br />
*Sunday, 11/11 - YouTube demo uploaded. (done)<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Everything complete & all code ''makes''.<br />
<br />
=== Completed Work ===<br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
* Initialization method - Josh Dugan<br />
* Force Sensitive Resistor implementation - Stephen Shinn<br />
* Magnetometer implementation - Josh Dugan<br />
* 2-Axis Thumb Joystick implementation - Matt Moravec<br />
<br />
=== To Do ===<br />
<br />
* Update documentation - All<br />
* Joystick demo - Matt<br />
* Clone repo from scratch and test make<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
<br />
The following are some additional things that could be done with this project:<br />
<br />
* Create and document interfaces for more sensors<br />
* Back-and-forth 2-sensor communication<br />
* Create a practical application such as a wireless doorbell<br />
<br />
== Conclusions ==<br />
<br />
In conclusion, we created an XBee wireless communication library for BeagleBone and adapted three sensors to use it. We've also documented general usage instructions for adapting XBee to use any type of sensor. We have not found a comprehensive source for how to use XBee modules with the BeagleBone, so our code and instructions are online with the intention that others use them as a reference.<br />
<br />
Using the wireless modules is interesting, and the possibilities are endless. We've listed a few ideas above which could be done in the future. One interesting idea would be to create a practical XBee application that someone could actually use in their home or work life. With a few XBees around the house, one could have a small network for sending data and controlling Christmas lights or something with a sensor.<br />
<!--<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
--><br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=191966ECE497 Project: XBee2012-11-12T21:17:44Z<p>Shinnsm: /* Sample */</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Grading Template ==<br />
I'm using the following template to grade. Each slot is 10 points.<br />
0 = Missing, 5=OK, 10=Wow!<br />
<br />
<pre style="color:red"><br />
00 Executive Summary<br />
05 Installation Instructions <br />
01 User Instructions<br />
00 Highlights<br />
00 Theory of Operation<br />
00 Work Breakdown<br />
00 Future Work<br />
00 Conclusions<br />
00 Demo<br />
00 Late<br />
Comments: I'm looking forward to seeing this.<br />
<br />
Score: 06/100<br />
</pre><br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
We have successfully connected to the XBee radios from the Bones and sent data using the /dev/ttyO file system. We have also successfully done wireless implementations of the force sensitive resistor, the magnetometer and the joystick alone a set of functions for expanding this to any sensor.<br />
<br />
We were unable to get a working program with 2-way communication with 2 XBees each sending and receiving data because of synchronization problems. Addressing this would likely require the development of a simple communication to prevent deadlocks and to ensure the receiving program knows what the data is when it receives it. <br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. We have successfully communicated wirelessly with three sensors: the force sensitive resistor, magnetometer and joystick.<br />
<br />
== General Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
[[File:XBeeBoneConnection.jpg|450px|XBee module connected to a BeagleBone.]]<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE.git https://github.com/duganje/ECE497_XBEE.git]. To begin, run <br />
beagle$ git clone https://github.com/duganje/ECE497_XBEE.git<br />
to clone he repository. This contains three folders with examples of XBee implementation for specific sensors and <code>XBee.c</code>, which contains helper functions for using the XBee. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
<br />
== 0.5" Force Sensitive Resistor ==<br />
These instructions are for interfacing the [[SparkFun: 0.5" Force Sensitive Resistor|0.5" Force Sensitive Resistor]] with the XBee.<br />
<br />
=== Required Items ===<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/9375 0.5" Force Sensitive Resistor]<br />
<br />
=== Hardware ===<br />
First we will connect the force-sensitive resistor to the Bone (P9 header). A 27kΩ resistor is used to connect the 3.3V source (pin 3) from the Bone to one pin of the force-sensitive resistor. Then, the other pin of the force-sensitive resistor is connected to ground (pin 1). An analog pin (AIN) on the Bone connects to the node containing both resistors, and values can be read off of that AIN. AIN5 (pin 36) is being used to read values on the Bone.<br />
<br />
Next we will connect the XBee module to the Bone. The table below describes the necessary wiring.<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
With everything wired-up, your connections should match the image below. Click on the image to view the full resolution.<br />
<br />
[[File:ForceResistorXBee.jpg|600px|Picture of connection|link=http://elinux.org/images/3/3b/ForceResistorXBee.jpg]]<br />
<br />
=== Software ===<br />
We're going to start with these two pieces of code as a reference and combine them:<br />
*[https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c Code to interface with the force sensitive resistor]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
Running the code for the force sensitive resistor produces a value from 0 to 4096 depending on how much pressure is applied to the resistor. The harder the resistor is squeezed, the lower this value is. On line 46 of the force sensitive resistor code, <code>analogValue</code> is constantly updated and stores this number.<br />
<br />
The instructions now fork depending on whether you're setting up the sending XBee code or the receiving XBee code. When you're done you will have two C programs, one running on each Bone.<br />
<br />
==== Sending ====<br />
Start with the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c resistor code] as a base and add the following include to the top of the file:<br />
<br />
#include "XBee.h"<br />
<br />
Next, add a call to <code>initializeXbee()</code> in <code>main</code> of the resistor code before the while loop begins.<br />
<br />
In the <code>while</code> loop after the value of <code>analogValue</code> is updated, add this line:<br />
<br />
sendIntXbee(analogValue);<br />
<br />
This will send the integer analog value to the receiving XBee. Now the number is constantly being sent in the while loop.<br />
<br />
==== Receiving ====<br />
Start with the [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee code] as a base and create a <code>main</code> function. First in <code>main</code>, add a call to <code>initializeXbee()</code> to setup the Bone to use the module.<br />
<br />
Next, add a while loop to <code>main</code> which continuously receives the integer analog value from the other Bone using the <code>receiveIntXbee()</code> function. Once the integer value is received, you're free to use that information for whatever purpose you wish. The example code below should give you an idea of how this is done:<br />
<br />
<pre>void main(int argc, char **argv, char **envp) {<br />
// Initialize XBee<br />
initializeXbee();<br />
<br />
// Keep going<br />
while (1) {<br />
int analogValue = receiveIntXbee();<br />
<br />
// Do anything based on analog value<br />
if (analogValue < 1000)<br />
ButtonPressedFunction();<br />
}<br />
}</pre><br />
<br />
==== Sample ====<br />
Based on the instructions above, I've created a sample set of programs. Using two Bones, the send program runs on one and the receive program runs on another. The "send" Bone includes an XBee module and the force sensitive resistor, [[ECE497_Project:_XBee#Hardware_2|hooked-up as described here]]. The second Bone includes the XBee module hooked-up in the same way with the addition of an LED connected to pin 12 (GPIO1_28) of the Bone. Connect the ground pin of the LED to the Bone's ground (pin 1) using a 220Ω resistor.<br />
<br />
Running both programs emulated the original function of the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c force resistor sample code], the only difference being that the data is now sent wirelessly from one Bone to another.<br />
<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/sendResistor.c Send Program]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/receiveResistor.c Receive Program]<br />
<br />
To easily use the program, clone [https://github.com/duganje/ECE497_XBEE.git our Git repository], cd into the ForceResistor directory, and then run the <code>make</code> command:<br />
<br />
make<br />
<br />
This will build both the <code>sendResistor</code> and <code>receiveResistor</code> programs to run on each BeagleBone. Copy each program to a Bone and run them at the same time with the XBee modules and LED connected as previously described. You will then be able to squeeze the force sensitive resistor and see the LED light up on the other BeagleBone. We've created a [[ECE497 Project: XBee#Force Sensitive Resistor YouTube Demo|YouTube demo]] of this program in action.<br />
<br />
== Wireless 2-Axis Thumb Joystick ==<br />
These instructions are for interfacing the [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]] with the XBee. This application could be useful in a wireless controller setting. <br />
<br />
=== Required Items ===<br />
*2 X [http://adafruit.com/products/513 BeagleBone]<br />
*2 X [http://www.adafruit.com/products/128 XBee Module]<br />
*2 X [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 X [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]]<br />
<br />
=== BeagleBone Wiring Instructions ===<br />
On your first BeagleBone, wire pins 36 and 38 to your two analog inputs. Wire the Beagle's 1.8V VCC output, pin 32, to the VCC input of the Joystick. Finally, wire the select GPIO signal to the GPIO_7 pin or pin 42.<br />
<br />
Wire the XBee as shown in the table below:<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The pinout and visual implementation are shown below.<br />
<br />
[[File:Bone_P9_pinout.jpg|x400px]] [[File:XBee_and_Adafruit_Joystick.jpg|x400px]]<br />
<br />
On the second BeagleBone, wire the XBee exactly as the first XBee (as described in the table above).<br />
<br />
Don't hook up any other hardware to the second XBee as it will be acting as an information hub.<br />
<br />
=== Usage Instructions ===<br />
On both BeagleBones, clone this repository:<br />
<br />
== Magnetometer ==<br />
These instructions are for interfacing the [[Sparkfun: HMC5883L Magnetometer|HMC5883L Magnetometer]] with the XBee.<br />
<br />
=== Required Items ===<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/10530? Magnetometer Breakout Board]<br />
<br />
===Hardware===<br />
The XBee radios should be connected to both Beagles as shown in the table below. <br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The Magnetometer should be connected to one BeagleBone as described in the [[Sparkfun: HMC5883L Magnetometer|hardware]] section of the Magnetometer page. Ground and Vcc on the Magnetometer should be connected to pins 1 and 3 respectively on header P9 of the bone. SCL and SDA on the Magnetometer should be connected to pins 19 and 20 on P9 to use I2C bus 3. Two 4.7kΩ resistors should also be connected between SCL and Vcc and between SDA and Vcc. Below is a picture of the Beagle connected to the Magnetometer and the XBee.<br />
<br />
[[File:XBEE_MAG.jpg|600px|Picture of connections]]<br />
<br />
===Software===<br />
The goal is to have the two BeagleBones attached to XBee radios with the one connected to the Magnetometer taking data and transmitting this data to the other Bone which will print the measured data.<br />
<br />
I started with the code to collect data from the Magnetometer and the code to send data using the XBee radios. Here are the links to these two programs:<br />
*[https://github.com/duganje/ECE497_duganje/blob/master/MiniProject02/miniproject02.c Code to gather magnetometer data]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
The code for the magnetometer uses I2C to read the values for the X, Y and Z-Axes and print these values to the terminal. The XBee code contains helper functions to transmit data wirelessly. I have written two programs: one to collect and transmit the magnetometer data and the other to receive and display this data.<br />
<br />
====Sending====<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Magnetometer/sendMag.c Tranmitting Magnetometer Data Code]<br />
<br />
The code uses [https://github.com/MarkAYoder/BeagleBoard-exercises/tree/master/i2c I2C code] from [[EBC Exercise 12 I2C]] and helper functions from [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee.c]. <br />
The program uses <br />
i2cget(i2cbus, address, daddress);<br />
to get the data from the magnetometer and <br />
sendShortXbee(val);<br />
to send these values to the receiving XBee.<br />
<br />
====Receiving====<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Magnetometer/receiveMag.c Receiving Magnetometer Data Code]<br />
<br />
The receiving code uses <br />
receiveShortXbee();<br />
to read the values for each axis.<br />
<br />
Because we do not have a way to synchronize the two XBees, the receiving program must be started first to ensure the data is receive in the correct order.<br />
<br />
In the Highlights section, there is a video demo of the complete program.<br />
<br />
===Running the Code===<br />
use the following to run the magnetometer code (you can skip the first step if you have already clone the repository)<br />
beagle$ git clone https://github.com/duganje/ECE497_XBEE.git<br />
beagle$ cd ECE_497_XBEE<br />
beagle$ cd Magnetometer<br />
beagle$ make<br />
<br />
This will create 2 executables: '''receiveMag''' and '''sendMag'''. Run the code by doing<br />
beagle$ ./sendMag<br />
on the Bone connected to the XBee and the magnetometer and<br />
beagle$ ./receiveMag<br />
on the Bone connected to just the XBee<br />
<br />
== General Usage ==<br />
These instructions are a general how-to for using the XBee with any sensor.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code> (not created yet). In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate with the XBee using uart 2. Then in your main.c call: <pre>sendIntXbee(int yourInt);</pre> with <code>yourInt</code> being any data you would like to transmit. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the integer which was sent through <code>sendIntXbee(int yourInt)</code> on the 1st board.<br />
<br />
The send and receive functions can be easily modified to send any data type as shown in:<br />
<br />
<pre>sendShortXbee(short yourShort);</pre> <pre>receiveShortXbee();</pre><br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
<br />
== Highlights ==<br />
<br />
=== Force Sensitive Resistor YouTube Demo ===<br />
{{#ev:youtube|Ds_BWsrvy1I}}<br />
<br />
=== Magnetometer YouTube Demo ===<br />
{{#ev:youtube|99bFqE54UHM}}<br />
<br />
<!--<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
--><br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. UART files on the Bone represent serial connections. With an XBee connected to the Bone's UART 2 as shown above, sent and received messages are written to <code>/dev/ttyO2</code> (the O is an uppercase O, not a zero). The BeagleBone's UARTs are accessed through <code>/dev/ttyO'''x'''</code>, where <code>'''x'''</code> is the UART number. Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
--><br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation. (done)<br />
*Thursday, 11/8 - Package language implemented between Bones. (done)<br />
*Sunday, 11/11 - YouTube demo uploaded. (done)<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Everything complete & all code ''makes''.<br />
<br />
=== Completed Work ===<br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
* Force Sensitive Resistor implementation - Stephen Shinn<br />
* Magnetometer implementation - Josh Dugan<br />
* 2-Axis Thumb Joystick implementation - Matt Moravec<br />
<br />
=== To Do ===<br />
<br />
* Update documentation - All<br />
* Joystick demo - Matt<br />
* Clone repo from scratch and test make<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
<br />
The following are some additional things that could be done with this project:<br />
<br />
* Create and document interfaces for more sensors<br />
* Back-and-forth 2-sensor communication<br />
* Create a practical application such as a wireless doorbell<br />
<br />
== Conclusions ==<br />
<br />
In conclusion, we created an XBee wireless communication library for BeagleBone and adapted three sensors to use it. We've also documented general usage instructions for adapting XBee to use any type of sensor. We have not found a comprehensive source for how to use XBee modules with the BeagleBone, so our code and instructions are online with the intention that others use them as a reference.<br />
<br />
Using the wireless modules is interesting, and the possibilities are endless. We've listed a few ideas above which could be done in the future. One interesting idea would be to create a practical XBee application that someone could actually use in their home or work life. With a few XBees around the house, one could have a small network for sending data and controlling Christmas lights or something with a sensor.<br />
<!--<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
--><br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=191954ECE497 Project: XBee2012-11-12T21:17:24Z<p>Shinnsm: /* Sample */</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Grading Template ==<br />
I'm using the following template to grade. Each slot is 10 points.<br />
0 = Missing, 5=OK, 10=Wow!<br />
<br />
<pre style="color:red"><br />
00 Executive Summary<br />
05 Installation Instructions <br />
01 User Instructions<br />
00 Highlights<br />
00 Theory of Operation<br />
00 Work Breakdown<br />
00 Future Work<br />
00 Conclusions<br />
00 Demo<br />
00 Late<br />
Comments: I'm looking forward to seeing this.<br />
<br />
Score: 06/100<br />
</pre><br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
We have successfully connected to the XBee radios from the Bones and sent data using the /dev/ttyO file system. We have also successfully done wireless implementations of the force sensitive resistor, the magnetometer and the joystick alone a set of functions for expanding this to any sensor.<br />
<br />
We were unable to get a working program with 2-way communication with 2 XBees each sending and receiving data because of synchronization problems. Addressing this would likely require the development of a simple communication to prevent deadlocks and to ensure the receiving program knows what the data is when it receives it. <br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. We have successfully communicated wirelessly with three sensors: the force sensitive resistor, magnetometer and joystick.<br />
<br />
== General Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
[[File:XBeeBoneConnection.jpg|450px|XBee module connected to a BeagleBone.]]<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE.git https://github.com/duganje/ECE497_XBEE.git]. To begin, run <br />
beagle$ git clone https://github.com/duganje/ECE497_XBEE.git<br />
to clone he repository. This contains three folders with examples of XBee implementation for specific sensors and <code>XBee.c</code>, which contains helper functions for using the XBee. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
<br />
== 0.5" Force Sensitive Resistor ==<br />
These instructions are for interfacing the [[SparkFun: 0.5" Force Sensitive Resistor|0.5" Force Sensitive Resistor]] with the XBee.<br />
<br />
=== Required Items ===<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/9375 0.5" Force Sensitive Resistor]<br />
<br />
=== Hardware ===<br />
First we will connect the force-sensitive resistor to the Bone (P9 header). A 27kΩ resistor is used to connect the 3.3V source (pin 3) from the Bone to one pin of the force-sensitive resistor. Then, the other pin of the force-sensitive resistor is connected to ground (pin 1). An analog pin (AIN) on the Bone connects to the node containing both resistors, and values can be read off of that AIN. AIN5 (pin 36) is being used to read values on the Bone.<br />
<br />
Next we will connect the XBee module to the Bone. The table below describes the necessary wiring.<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
With everything wired-up, your connections should match the image below. Click on the image to view the full resolution.<br />
<br />
[[File:ForceResistorXBee.jpg|600px|Picture of connection|link=http://elinux.org/images/3/3b/ForceResistorXBee.jpg]]<br />
<br />
=== Software ===<br />
We're going to start with these two pieces of code as a reference and combine them:<br />
*[https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c Code to interface with the force sensitive resistor]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
Running the code for the force sensitive resistor produces a value from 0 to 4096 depending on how much pressure is applied to the resistor. The harder the resistor is squeezed, the lower this value is. On line 46 of the force sensitive resistor code, <code>analogValue</code> is constantly updated and stores this number.<br />
<br />
The instructions now fork depending on whether you're setting up the sending XBee code or the receiving XBee code. When you're done you will have two C programs, one running on each Bone.<br />
<br />
==== Sending ====<br />
Start with the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c resistor code] as a base and add the following include to the top of the file:<br />
<br />
#include "XBee.h"<br />
<br />
Next, add a call to <code>initializeXbee()</code> in <code>main</code> of the resistor code before the while loop begins.<br />
<br />
In the <code>while</code> loop after the value of <code>analogValue</code> is updated, add this line:<br />
<br />
sendIntXbee(analogValue);<br />
<br />
This will send the integer analog value to the receiving XBee. Now the number is constantly being sent in the while loop.<br />
<br />
==== Receiving ====<br />
Start with the [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee code] as a base and create a <code>main</code> function. First in <code>main</code>, add a call to <code>initializeXbee()</code> to setup the Bone to use the module.<br />
<br />
Next, add a while loop to <code>main</code> which continuously receives the integer analog value from the other Bone using the <code>receiveIntXbee()</code> function. Once the integer value is received, you're free to use that information for whatever purpose you wish. The example code below should give you an idea of how this is done:<br />
<br />
<pre>void main(int argc, char **argv, char **envp) {<br />
// Initialize XBee<br />
initializeXbee();<br />
<br />
// Keep going<br />
while (1) {<br />
int analogValue = receiveIntXbee();<br />
<br />
// Do anything based on analog value<br />
if (analogValue < 1000)<br />
ButtonPressedFunction();<br />
}<br />
}</pre><br />
<br />
==== Sample ====<br />
Based on the instructions above, I've created a sample set of programs. Using two Bones, the send program runs on one and the receive program runs on another. The "send" Bone includes an XBee module and the force sensitive resistor, [[ECE497_Project:_XBee#Hardware_2|hooked-up as described here]]. The second Bone includes the XBee module hooked-up in the same way with the addition of an LED connected to pin 12 (GPIO1_28) of the Bone. Connect the ground pin of the LED to the Bone's ground (pin 1) using a 220Ω resistor.<br />
<br />
Running both programs emulated the original function of the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c force resistor sample code], the only difference being that the data is now sent wirelessly from one Bone to another.<br />
<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/sendResistor.c Send Program]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/receiveResistor.c Receive Program]<br />
<br />
To easily use the program, clone [https://github.com/duganje/ECE497_XBEE.git our Git repository], cd into the ForceResistor directory, and then run the <code>make</code> command:<br />
<br />
make<br />
<br />
This will build both the <code>sendResistor<code> and <code>receiveResistor<code> programs to run on each BeagleBone. Copy each program to a Bone and run them at the same time with the XBee modules and LED connected as previously described. You will then be able to squeeze the force sensitive resistor and see the LED light up on the other BeagleBone. We've created a [[ECE497 Project: XBee#Force Sensitive Resistor YouTube Demo|YouTube demo]] of this program in action.<br />
<br />
== Wireless 2-Axis Thumb Joystick ==<br />
These instructions are for interfacing the [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]] with the XBee. This application could be useful in a wireless controller setting. <br />
<br />
=== Required Items ===<br />
*2 X [http://adafruit.com/products/513 BeagleBone]<br />
*2 X [http://www.adafruit.com/products/128 XBee Module]<br />
*2 X [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 X [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]]<br />
<br />
=== BeagleBone Wiring Instructions ===<br />
On your first BeagleBone, wire pins 36 and 38 to your two analog inputs. Wire the Beagle's 1.8V VCC output, pin 32, to the VCC input of the Joystick. Finally, wire the select GPIO signal to the GPIO_7 pin or pin 42.<br />
<br />
Wire the XBee as shown in the table below:<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The pinout and visual implementation are shown below.<br />
<br />
[[File:Bone_P9_pinout.jpg|x400px]] [[File:XBee_and_Adafruit_Joystick.jpg|x400px]]<br />
<br />
On the second BeagleBone, wire the XBee exactly as the first XBee (as described in the table above).<br />
<br />
Don't hook up any other hardware to the second XBee as it will be acting as an information hub.<br />
<br />
=== Usage Instructions ===<br />
On both BeagleBones, clone this repository:<br />
<br />
== Magnetometer ==<br />
These instructions are for interfacing the [[Sparkfun: HMC5883L Magnetometer|HMC5883L Magnetometer]] with the XBee.<br />
<br />
=== Required Items ===<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/10530? Magnetometer Breakout Board]<br />
<br />
===Hardware===<br />
The XBee radios should be connected to both Beagles as shown in the table below. <br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The Magnetometer should be connected to one BeagleBone as described in the [[Sparkfun: HMC5883L Magnetometer|hardware]] section of the Magnetometer page. Ground and Vcc on the Magnetometer should be connected to pins 1 and 3 respectively on header P9 of the bone. SCL and SDA on the Magnetometer should be connected to pins 19 and 20 on P9 to use I2C bus 3. Two 4.7kΩ resistors should also be connected between SCL and Vcc and between SDA and Vcc. Below is a picture of the Beagle connected to the Magnetometer and the XBee.<br />
<br />
[[File:XBEE_MAG.jpg|600px|Picture of connections]]<br />
<br />
===Software===<br />
The goal is to have the two BeagleBones attached to XBee radios with the one connected to the Magnetometer taking data and transmitting this data to the other Bone which will print the measured data.<br />
<br />
I started with the code to collect data from the Magnetometer and the code to send data using the XBee radios. Here are the links to these two programs:<br />
*[https://github.com/duganje/ECE497_duganje/blob/master/MiniProject02/miniproject02.c Code to gather magnetometer data]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
The code for the magnetometer uses I2C to read the values for the X, Y and Z-Axes and print these values to the terminal. The XBee code contains helper functions to transmit data wirelessly. I have written two programs: one to collect and transmit the magnetometer data and the other to receive and display this data.<br />
<br />
====Sending====<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Magnetometer/sendMag.c Tranmitting Magnetometer Data Code]<br />
<br />
The code uses [https://github.com/MarkAYoder/BeagleBoard-exercises/tree/master/i2c I2C code] from [[EBC Exercise 12 I2C]] and helper functions from [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee.c]. <br />
The program uses <br />
i2cget(i2cbus, address, daddress);<br />
to get the data from the magnetometer and <br />
sendShortXbee(val);<br />
to send these values to the receiving XBee.<br />
<br />
====Receiving====<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Magnetometer/receiveMag.c Receiving Magnetometer Data Code]<br />
<br />
The receiving code uses <br />
receiveShortXbee();<br />
to read the values for each axis.<br />
<br />
Because we do not have a way to synchronize the two XBees, the receiving program must be started first to ensure the data is receive in the correct order.<br />
<br />
In the Highlights section, there is a video demo of the complete program.<br />
<br />
===Running the Code===<br />
use the following to run the magnetometer code (you can skip the first step if you have already clone the repository)<br />
beagle$ git clone https://github.com/duganje/ECE497_XBEE.git<br />
beagle$ cd ECE_497_XBEE<br />
beagle$ cd Magnetometer<br />
beagle$ make<br />
<br />
This will create 2 executables: '''receiveMag''' and '''sendMag'''. Run the code by doing<br />
beagle$ ./sendMag<br />
on the Bone connected to the XBee and the magnetometer and<br />
beagle$ ./receiveMag<br />
on the Bone connected to just the XBee<br />
<br />
== General Usage ==<br />
These instructions are a general how-to for using the XBee with any sensor.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code> (not created yet). In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate with the XBee using uart 2. Then in your main.c call: <pre>sendIntXbee(int yourInt);</pre> with <code>yourInt</code> being any data you would like to transmit. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the integer which was sent through <code>sendIntXbee(int yourInt)</code> on the 1st board.<br />
<br />
The send and receive functions can be easily modified to send any data type as shown in:<br />
<br />
<pre>sendShortXbee(short yourShort);</pre> <pre>receiveShortXbee();</pre><br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
<br />
== Highlights ==<br />
<br />
=== Force Sensitive Resistor YouTube Demo ===<br />
{{#ev:youtube|Ds_BWsrvy1I}}<br />
<br />
=== Magnetometer YouTube Demo ===<br />
{{#ev:youtube|99bFqE54UHM}}<br />
<br />
<!--<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
--><br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. UART files on the Bone represent serial connections. With an XBee connected to the Bone's UART 2 as shown above, sent and received messages are written to <code>/dev/ttyO2</code> (the O is an uppercase O, not a zero). The BeagleBone's UARTs are accessed through <code>/dev/ttyO'''x'''</code>, where <code>'''x'''</code> is the UART number. Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
--><br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation. (done)<br />
*Thursday, 11/8 - Package language implemented between Bones. (done)<br />
*Sunday, 11/11 - YouTube demo uploaded. (done)<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Everything complete & all code ''makes''.<br />
<br />
=== Completed Work ===<br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
* Force Sensitive Resistor implementation - Stephen Shinn<br />
* Magnetometer implementation - Josh Dugan<br />
* 2-Axis Thumb Joystick implementation - Matt Moravec<br />
<br />
=== To Do ===<br />
<br />
* Update documentation - All<br />
* Joystick demo - Matt<br />
* Clone repo from scratch and test make<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
<br />
The following are some additional things that could be done with this project:<br />
<br />
* Create and document interfaces for more sensors<br />
* Back-and-forth 2-sensor communication<br />
* Create a practical application such as a wireless doorbell<br />
<br />
== Conclusions ==<br />
<br />
In conclusion, we created an XBee wireless communication library for BeagleBone and adapted three sensors to use it. We've also documented general usage instructions for adapting XBee to use any type of sensor. We have not found a comprehensive source for how to use XBee modules with the BeagleBone, so our code and instructions are online with the intention that others use them as a reference.<br />
<br />
Using the wireless modules is interesting, and the possibilities are endless. We've listed a few ideas above which could be done in the future. One interesting idea would be to create a practical XBee application that someone could actually use in their home or work life. With a few XBees around the house, one could have a small network for sending data and controlling Christmas lights or something with a sensor.<br />
<!--<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
--><br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=191930ECE497 Project: XBee2012-11-12T21:11:13Z<p>Shinnsm: git</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Grading Template ==<br />
I'm using the following template to grade. Each slot is 10 points.<br />
0 = Missing, 5=OK, 10=Wow!<br />
<br />
<pre style="color:red"><br />
00 Executive Summary<br />
05 Installation Instructions <br />
01 User Instructions<br />
00 Highlights<br />
00 Theory of Operation<br />
00 Work Breakdown<br />
00 Future Work<br />
00 Conclusions<br />
00 Demo<br />
00 Late<br />
Comments: I'm looking forward to seeing this.<br />
<br />
Score: 06/100<br />
</pre><br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
We have successfully connected to the XBee radios from the Bones and sent data using the /dev/ttyO file system. We have also successfully done wireless implementations of the force sensitive resistor, the magnetometer and the joystick alone a set of functions for expanding this to any sensor.<br />
<br />
We were unable to get a working program with 2-way communication with 2 XBees each sending and receiving data because of synchronization problems. Addressing this would likely require the development of a simple communication to prevent deadlocks and to ensure the receiving program knows what the data is when it receives it. <br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. We have successfully communicated wirelessly with three sensors: the force sensitive resistor, magnetometer and joystick.<br />
<br />
== General Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
[[File:XBeeBoneConnection.jpg|450px|XBee module connected to a BeagleBone.]]<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE.git https://github.com/duganje/ECE497_XBEE.git]. To begin, download the <code>XBee.c</code> file which houses our communication methods. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
<br />
== 0.5" Force Sensitive Resistor ==<br />
These instructions are for interfacing the [[SparkFun: 0.5" Force Sensitive Resistor|0.5" Force Sensitive Resistor]] with the XBee.<br />
<br />
=== Required Items ===<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/9375 0.5" Force Sensitive Resistor]<br />
<br />
=== Hardware ===<br />
First we will connect the force-sensitive resistor to the Bone (P9 header). A 27kΩ resistor is used to connect the 3.3V source (pin 3) from the Bone to one pin of the force-sensitive resistor. Then, the other pin of the force-sensitive resistor is connected to ground (pin 1). An analog pin (AIN) on the Bone connects to the node containing both resistors, and values can be read off of that AIN. AIN5 (pin 36) is being used to read values on the Bone.<br />
<br />
Next we will connect the XBee module to the Bone. The table below describes the necessary wiring.<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
With everything wired-up, your connections should match the image below. Click on the image to view the full resolution.<br />
<br />
[[File:ForceResistorXBee.jpg|600px|Picture of connection|link=http://elinux.org/images/3/3b/ForceResistorXBee.jpg]]<br />
<br />
=== Software ===<br />
We're going to start with these two pieces of code as a reference and combine them:<br />
*[https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c Code to interface with the force sensitive resistor]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
Running the code for the force sensitive resistor produces a value from 0 to 4096 depending on how much pressure is applied to the resistor. The harder the resistor is squeezed, the lower this value is. On line 46 of the force sensitive resistor code, <code>analogValue</code> is constantly updated and stores this number.<br />
<br />
The instructions now fork depending on whether you're setting up the sending XBee code or the receiving XBee code. When you're done you will have two C programs, one running on each Bone.<br />
<br />
==== Sending ====<br />
Start with the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c resistor code] as a base and add the following include to the top of the file:<br />
<br />
#include "XBee.h"<br />
<br />
Next, add a call to <code>initializeXbee()</code> in <code>main</code> of the resistor code before the while loop begins.<br />
<br />
In the <code>while</code> loop after the value of <code>analogValue</code> is updated, add this line:<br />
<br />
sendIntXbee(analogValue);<br />
<br />
This will send the integer analog value to the receiving XBee. Now the number is constantly being sent in the while loop.<br />
<br />
==== Receiving ====<br />
Start with the [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee code] as a base and create a <code>main</code> function. First in <code>main</code>, add a call to <code>initializeXbee()</code> to setup the Bone to use the module.<br />
<br />
Next, add a while loop to <code>main</code> which continuously receives the integer analog value from the other Bone using the <code>receiveIntXbee()</code> function. Once the integer value is received, you're free to use that information for whatever purpose you wish. The example code below should give you an idea of how this is done:<br />
<br />
<pre>void main(int argc, char **argv, char **envp) {<br />
// Initialize XBee<br />
initializeXbee();<br />
<br />
// Keep going<br />
while (1) {<br />
int analogValue = receiveIntXbee();<br />
<br />
// Do anything based on analog value<br />
if (analogValue < 1000)<br />
ButtonPressedFunction();<br />
}<br />
}</pre><br />
<br />
==== Sample ====<br />
Based on the instructions above, I've created a sample set of programs. Using two Bones, the send program runs on one and the receive program runs on another. The "send" Bone includes an XBee module and the force sensitive resistor, [[ECE497_Project:_XBee#Hardware_2|hooked-up as described here]]. The second Bone includes the XBee module hooked-up in the same way with the addition of an LED connected to pin 12 (GPIO1_28) of the Bone. Connect the ground pin of the LED to the Bone's ground (pin 1) using a 220Ω resistor.<br />
<br />
Running both programs emulated the original function of the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c force resistor sample code], the only difference being that the data is now sent wirelessly from one Bone to another.<br />
<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/sendResistor.c Send Program]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/receiveResistor.c Receive Program]<br />
<br />
To easily use the program, clone [git://github.com/duganje/ECE497_XBEE.git our Git repository], cd into the ForceResistor directory, and then run the <code>make</code> command. This will build both the sendResistor and receiveResistor programs to run on one BeagleBone each.<br />
<br />
== Wireless 2-Axis Thumb Joystick ==<br />
These instructions are for interfacing the [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]] with the XBee. This application could be useful in a wireless controller setting. <br />
<br />
=== Required Items ===<br />
*2 X [http://adafruit.com/products/513 BeagleBone]<br />
*2 X [http://www.adafruit.com/products/128 XBee Module]<br />
*2 X [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 X [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]]<br />
<br />
=== BeagleBone Wiring Instructions ===<br />
On your first BeagleBone, wire pins 36 and 38 to your two analog inputs. Wire the Beagle's 1.8V VCC output, pin 32, to the VCC input of the Joystick. Finally, wire the select GPIO signal to the GPIO_7 pin or pin 42.<br />
<br />
Wire the XBee as shown in the table below:<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The pinout and visual implementation are shown below.<br />
<br />
[[File:Bone_P9_pinout.jpg|x400px]] [[File:XBee_and_Adafruit_Joystick.jpg|x400px]]<br />
<br />
On the second BeagleBone, wire the XBee exactly as the first XBee (as described in the table above).<br />
<br />
Don't hook up any other hardware to the second XBee as it will be acting as an information hub.<br />
<br />
=== Usage Instructions ===<br />
On both BeagleBones, clone this repository:<br />
<br />
== Magnetometer ==<br />
These instructions are for interfacing the [[Sparkfun: HMC5883L Magnetometer|HMC5883L Magnetometer]] with the XBee.<br />
<br />
=== Required Items ===<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/10530? Magnetometer Breakout Board]<br />
<br />
===Hardware===<br />
The XBee radios should be connected to both Beagles as shown in the table below. <br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The Magnetometer should be connected to one BeagleBone as described in the [[Sparkfun: HMC5883L Magnetometer|hardware]] section of the Magnetometer page. Ground and Vcc on the Magnetometer should be connected to pins 1 and 3 respectively on header P9 of the bone. SCL and SDA on the Magnetometer should be connected to pins 19 and 20 on P9 to use I2C bus 3. Two 4.7kΩ resistors should also be connected between SCL and Vcc and between SDA and Vcc. Below is a picture of the Beagle connected to the Magnetometer and the XBee.<br />
<br />
[[File:XBEE_MAG.jpg|600px|Picture of connections]]<br />
<br />
===Software===<br />
The goal is to have the two BeagleBones attached to XBee radios with the one connected to the Magnetometer taking data and transmitting this data to the other Bone which will print the measured data.<br />
<br />
I started with the code to collect data from the Magnetometer and the code to send data using the XBee radios. Here are the links to these two programs:<br />
*[https://github.com/duganje/ECE497_duganje/blob/master/MiniProject02/miniproject02.c Code to gather magnetometer data]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
The code for the magnetometer uses I2C to read the values for the X, Y and Z-Axes and print these values to the terminal. The XBee code contains helper functions to transmit data wirelessly. I have written two programs: one to collect and transmit the magnetometer data and the other to receive and display this data.<br />
<br />
====Sending====<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Magnetometer/sendMag.c Tranmitting Magnetometer Data Code]<br />
<br />
The code uses [https://github.com/MarkAYoder/BeagleBoard-exercises/tree/master/i2c I2C code] from [[EBC Exercise 12 I2C]] and helper functions from [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee.c]. <br />
The program uses <br />
i2cget(i2cbus, address, daddress);<br />
to get the data from the magnetometer and <br />
sendShortXbee(val);<br />
to send these values to the receiving XBee.<br />
<br />
====Receiving====<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Magnetometer/receiveMag.c Receiving Magnetometer Data Code]<br />
<br />
The receiving code uses <br />
receiveShortXbee();<br />
to read the values for each axis.<br />
<br />
Because we do not have a way to synchronize the two XBees, the receiving program must be started first to ensure the data is receive in the correct order.<br />
<br />
In the Highlights section, there is a video demo of the complete program.<br />
<br />
===Running the Code===<br />
use the following to run the magnetometer code (you can skip the first step if you have already clone the repository)<br />
git clone https://github.com/duganje/ECE497_XBEE.git<br />
cd ECE_497_XBEE<br />
cd Magnetometer<br />
make<br />
<br />
This will create 2 executables: '''receiveMag''' and '''sendMag'''. Run the code by doing<br />
./sendMag<br />
on the Bone connected to the XBee and the magnetometer and<br />
./receiveMag<br />
on the Bone connected to just the XBee<br />
<br />
== General Usage ==<br />
These instructions are a general how-to for using the XBee with any sensor.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code> (not created yet). In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate with the XBee using uart 2. Then in your main.c call: <pre>sendIntXbee(int yourInt);</pre> with <code>yourInt</code> being any data you would like to transmit. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the integer which was sent through <code>sendIntXbee(int yourInt)</code> on the 1st board.<br />
<br />
The send and receive functions can be easily modified to send any data type as shown in:<br />
<br />
<pre>sendShortXbee(short yourShort);</pre> <pre>receiveShortXbee();</pre><br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
<br />
== Highlights ==<br />
<br />
=== Force Sensitive Resistor YouTube Demo ===<br />
{{#ev:youtube|Ds_BWsrvy1I}}<br />
<br />
=== Magnetometer YouTube Demo ===<br />
{{#ev:youtube|99bFqE54UHM}}<br />
<br />
<!--<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
--><br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. UART files on the Bone represent serial connections. With an XBee connected to the Bone's UART 2 as shown above, sent and received messages are written to <code>/dev/ttyO2</code> (the O is an uppercase O, not a zero). The BeagleBone's UARTs are accessed through <code>/dev/ttyO'''x'''</code>, where <code>'''x'''</code> is the UART number. Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
--><br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation. (done)<br />
*Thursday, 11/8 - Package language implemented between Bones. (done)<br />
*Sunday, 11/11 - YouTube demo uploaded. (done)<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Everything complete & all code ''makes''.<br />
<br />
=== Completed Work ===<br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
* Force Sensitive Resistor implementation - Stephen Shinn<br />
* Magnetometer implementation - Josh Dugan<br />
* 2-Axis Thumb Joystick implementation - Matt Moravec<br />
<br />
=== To Do ===<br />
<br />
* Update documentation - All<br />
* Joystick demo - Matt<br />
* Clone repo from scratch and test make<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
<br />
The following are some additional things that could be done with this project:<br />
<br />
* Create and document interfaces for more sensors<br />
* Back-and-forth 2-sensor communication<br />
* Create a practical application such as a wireless doorbell<br />
<br />
== Conclusions ==<br />
<br />
In conclusion, we created an XBee wireless communication library for BeagleBone and adapted three sensors to use it. We've also documented general usage instructions for adapting XBee to use any type of sensor. We have not found a comprehensive source for how to use XBee modules with the BeagleBone, so our code and instructions are online with the intention that others use them as a reference.<br />
<br />
Using the wireless modules is interesting, and the possibilities are endless. We've listed a few ideas above which could be done in the future. One interesting idea would be to create a practical XBee application that someone could actually use in their home or work life. With a few XBees around the house, one could have a small network for sending data and controlling Christmas lights or something with a sensor.<br />
<!--<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
--><br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=191792ECE497 Project: XBee2012-11-12T19:32:05Z<p>Shinnsm: file names</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Grading Template ==<br />
I'm using the following template to grade. Each slot is 10 points.<br />
0 = Missing, 5=OK, 10=Wow!<br />
<br />
<pre style="color:red"><br />
00 Executive Summary<br />
05 Installation Instructions <br />
01 User Instructions<br />
00 Highlights<br />
00 Theory of Operation<br />
00 Work Breakdown<br />
00 Future Work<br />
00 Conclusions<br />
00 Demo<br />
00 Late<br />
Comments: I'm looking forward to seeing this.<br />
<br />
Score: 06/100<br />
</pre><br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
We have successfully connected to the XBee radios from the Bones and sent data using the /dev/ttyO file system. We have also successfully done wireless implementations of the force sensitive resistor, the magnetometer and the joystick alone a set of functions for expanding this to any sensor.<br />
<br />
We were unable to get a working program with 2-way communication with 2 XBees each sending and receiving data because of synchronization problems. Addressing this would likely require the development of a simple communication to prevent deadlocks and to ensure the receiving program knows what the data is when it receives it. <br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. We have successfully communicated wirelessly with three sensors: the force sensitive resistor, magnetometer and joystick.<br />
<br />
== General Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
[[File:XBeeBoneConnection.jpg|450px|XBee module connected to a BeagleBone.]]<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE.git https://github.com/duganje/ECE497_XBEE.git]. To begin, download the <code>XBee.c</code> file which houses our communication methods. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
<br />
== 0.5" Force Sensitive Resistor ==<br />
These instructions are for interfacing the [[SparkFun: 0.5" Force Sensitive Resistor|0.5" Force Sensitive Resistor]] with the XBee.<br />
<br />
=== Required Items ===<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/9375 0.5" Force Sensitive Resistor]<br />
<br />
=== Hardware ===<br />
First we will connect the force-sensitive resistor to the Bone (P9 header). A 27kΩ resistor is used to connect the 3.3V source (pin 3) from the Bone to one pin of the force-sensitive resistor. Then, the other pin of the force-sensitive resistor is connected to ground (pin 1). An analog pin (AIN) on the Bone connects to the node containing both resistors, and values can be read off of that AIN. AIN5 (pin 36) is being used to read values on the Bone.<br />
<br />
Next we will connect the XBee module to the Bone. The table below describes the necessary wiring.<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
With everything wired-up, your connections should match the image below. Click on the image to view the full resolution.<br />
<br />
[[File:ForceResistorXBee.jpg|600px|Picture of connection|link=http://elinux.org/images/3/3b/ForceResistorXBee.jpg]]<br />
<br />
=== Software ===<br />
We're going to start with these two pieces of code as a reference and combine them:<br />
*[https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c Code to interface with the force sensitive resistor]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
Running the code for the force sensitive resistor produces a value from 0 to 4096 depending on how much pressure is applied to the resistor. The harder the resistor is squeezed, the lower this value is. On line 46 of the force sensitive resistor code, <code>analogValue</code> is constantly updated and stores this number.<br />
<br />
The instructions now fork depending on whether you're setting up the sending XBee code or the receiving XBee code. When you're done you will have two C programs, one running on each Bone.<br />
<br />
==== Sending ====<br />
Start with the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c resistor code] as a base and add the following include to the top of the file:<br />
<br />
#include "XBee.h"<br />
<br />
Next, add a call to <code>initializeXbee()</code> in <code>main</code> of the resistor code before the while loop begins.<br />
<br />
In the <code>while</code> loop after the value of <code>analogValue</code> is updated, add this line:<br />
<br />
sendIntXbee(analogValue);<br />
<br />
This will send the integer analog value to the receiving XBee. Now the number is constantly being sent in the while loop.<br />
<br />
==== Receiving ====<br />
Start with the [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee code] as a base and create a <code>main</code> function. First in <code>main</code>, add a call to <code>initializeXbee()</code> to setup the Bone to use the module.<br />
<br />
Next, add a while loop to <code>main</code> which continuously receives the integer analog value from the other Bone using the <code>receiveIntXbee()</code> function. Once the integer value is received, you're free to use that information for whatever purpose you wish. The example code below should give you an idea of how this is done:<br />
<br />
<pre>void main(int argc, char **argv, char **envp) {<br />
// Initialize XBee<br />
initializeXbee();<br />
<br />
// Keep going<br />
while (1) {<br />
int analogValue = receiveIntXbee();<br />
<br />
// Do anything based on analog value<br />
if (analogValue < 1000)<br />
ButtonPressedFunction();<br />
}<br />
}</pre><br />
<br />
==== Sample ====<br />
Based on the instructions above, I've created a sample set of programs. Using two Bones, the send program runs on one and the receive program runs on another. The "send" Bone includes an XBee module and the force sensitive resistor, [[ECE497_Project:_XBee#Hardware_2|hooked-up as described here]]. The second Bone includes the XBee module hooked-up in the same way with the addition of an LED connected to pin 12 (GPIO1_28) of the Bone. Connect the ground pin of the LED to the Bone's ground (pin 1) using a 220Ω resistor.<br />
<br />
Running both programs emulated the original function of the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c force resistor sample code], the only difference being that the data is now sent wirelessly from one Bone to another.<br />
<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/resistorSend.c Send Program]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/resistorReceive.c Receive Program]<br />
<br />
== Wireless 2-Axis Thumb Joystick ==<br />
These instructions are for interfacing the [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]] with the XBee. This application could be useful in a wireless controller setting. <br />
<br />
=== Required Items ===<br />
*2 X [http://adafruit.com/products/513 BeagleBone]<br />
*2 X [http://www.adafruit.com/products/128 XBee Module]<br />
*2 X [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 X [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]]<br />
<br />
=== BeagleBone Wiring Instructions ===<br />
On your first BeagleBone, wire pins 36 and 38 to your two analog inputs. Wire the Beagle's 1.8V VCC output, pin 32, to the VCC input of the Joystick. Finally, wire the select GPIO signal to the GPIO_7 pin or pin 42.<br />
<br />
Wire the XBee as shown in the table below:<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The pinout and visual implementation are shown below.<br />
<br />
[[File:Bone_P9_pinout.jpg|x400px]] [[File:XBee_and_Adafruit_Joystick.jpg|x400px]]<br />
<br />
On the second BeagleBone, wire the XBee exactly as the first XBee (as described in the table above).<br />
<br />
Don't hook up any other hardware to the second XBee as it will be acting as an information hub.<br />
<br />
=== Usage Instructions ===<br />
On both BeagleBones, clone this repository:<br />
<br />
== Magnetometer ==<br />
These instructions are for interfacing the [[Sparkfun: HMC5883L Magnetometer|HMC5883L Magnetometer]] with the XBee.<br />
<br />
=== Required Items ===<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/10530? Magnetometer Breakout Board]<br />
<br />
===Hardware===<br />
The XBee radios should be connected to both Beagles as shown in the table below. <br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The Magnetometer should be connected to one BeagleBone as described in the [[Sparkfun: HMC5883L Magnetometer|hardware]] section of the Magnetometer page. Ground and Vcc on the Magnetometer should be connected to pins 1 and 3 respectively on header P9 of the bone. SCL and SDA on the Magnetometer should be connected to pins 19 and 20 on P9 to use I2C bus 3. Two 4.7kΩ resistors should also be connected between SCL and Vcc and between SDA and Vcc. Below is a picture of the Beagle connected to the Magnetometer and the XBee.<br />
<br />
[[File:XBEE_MAG.jpg|600px|Picture of connections]]<br />
<br />
===Software===<br />
The goal is to have the two BeagleBones attached to XBee radios with the one connected to the Magnetometer taking data and transmitting this data to the other Bone which will print the measured data.<br />
<br />
I started with the code to collect data from the Magnetometer and the code to send data using the XBee radios. Here are the links to these two programs:<br />
*[https://github.com/duganje/ECE497_duganje/blob/master/MiniProject02/miniproject02.c Code to gather magnetometer data]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
The code for the magnetometer uses I2C to read the values for the X, Y and Z-Axes and print these values to the terminal. The XBee code contains helper functions to transmit data wirelessly. I have written two programs: one to collect and transmit the magnetometer data and the other to receive and display this data.<br />
<br />
====Sending====<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Magnetometer/sendMag.c Tranmitting Magnetometer Data Code]<br />
<br />
The code uses [https://github.com/MarkAYoder/BeagleBoard-exercises/tree/master/i2c I2C code] from [[EBC Exercise 12 I2C]] and helper functions from [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee.c]. <br />
The program uses <br />
i2cget(i2cbus, address, daddress);<br />
to get the data from the magnetometer and <br />
sendShortXbee(val);<br />
to send these values to the receiving XBee.<br />
<br />
====Receiving====<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Magnetometer/receiveMag.c Receiving Magnetometer Data Code]<br />
<br />
The receiving code uses <br />
receiveShortXbee();<br />
to read the values for each axis.<br />
<br />
Because we do not have a way to synchronize the two XBees, the receiving program must be started first to ensure the data is receive in the correct order.<br />
<br />
In the Highlights section, there is a video demo of the complete program.<br />
<br />
== General Usage ==<br />
These instructions are a general how-to for using the XBee with any sensor.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code> (not created yet). In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate with the XBee using uart 2. Then in your main.c call: <pre>sendIntXbee(int yourInt);</pre> with <code>yourInt</code> being any data you would like to transmit. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the integer which was sent through <code>sendIntXbee(int yourInt)</code> on the 1st board.<br />
<br />
The send and receive functions can be easily modified to send any data type as shown in:<br />
<br />
<pre>sendShortXbee(short yourShort);</pre> <pre>receiveShortXbee();</pre><br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
<br />
== Highlights ==<br />
<br />
=== Force Sensitive Resistor YouTube Demo ===<br />
{{#ev:youtube|Ds_BWsrvy1I}}<br />
<br />
=== Magnetometer YouTube Demo ===<br />
{{#ev:youtube|99bFqE54UHM}}<br />
<br />
<!--<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
--><br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. UART files on the Bone represent serial connections. With an XBee connected to the Bone's UART 2 as shown above, sent and received messages are written to <code>/dev/ttyO2</code> (the O is an uppercase O, not a zero). The BeagleBone's UARTs are accessed through <code>/dev/ttyO'''x'''</code>, where <code>'''x'''</code> is the UART number. Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
--><br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation. (done)<br />
*Thursday, 11/8 - Package language implemented between Bones. (done)<br />
*Sunday, 11/11 - YouTube demo uploaded. (done)<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Everything complete & all code ''makes''.<br />
<br />
=== Completed Work ===<br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
* Force Sensitive Resistor implementation - Stephen Shinn<br />
* Magnetometer implementation - Josh Dugan<br />
* 2-Axis Thumb Joystick implementation - Matt Moravec<br />
<br />
=== To Do ===<br />
<br />
* Update documentation - All<br />
* Joystick demo - Matt<br />
* Clone repo from scratch and test make<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
<br />
The following are some additional things that could be done with this project:<br />
<br />
* Create and document interfaces for more sensors<br />
* Back-and-forth 2-sensor communication<br />
* Create a practical application such as a wireless doorbell<br />
<br />
== Conclusions ==<br />
<br />
In conclusion, we created an XBee wireless communication library for BeagleBone and adapted three sensors to use it. We've also documented general usage instructions for adapting XBee to use any type of sensor. We have not found a comprehensive source for how to use XBee modules with the BeagleBone, so our code and instructions are online with the intention that others use them as a reference.<br />
<br />
Using the wireless modules is interesting, and the possibilities are endless. We've listed a few ideas above which could be done in the future. One interesting idea would be to create a practical XBee application that someone could actually use in their home or work life. With a few XBees around the house, one could have a small network for sending data and controlling Christmas lights or something with a sensor.<br />
<!--<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
--><br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=191768ECE497 Project: XBee2012-11-12T19:22:56Z<p>Shinnsm: /* Milestones */</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Grading Template ==<br />
I'm using the following template to grade. Each slot is 10 points.<br />
0 = Missing, 5=OK, 10=Wow!<br />
<br />
<pre style="color:red"><br />
00 Executive Summary<br />
05 Installation Instructions <br />
01 User Instructions<br />
00 Highlights<br />
00 Theory of Operation<br />
00 Work Breakdown<br />
00 Future Work<br />
00 Conclusions<br />
00 Demo<br />
00 Late<br />
Comments: I'm looking forward to seeing this.<br />
<br />
Score: 06/100<br />
</pre><br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
Right now the various sensors have been documented and are working. We've received the XBee modules and soldered them as required. So far we've been able to send and receive messages from an XBee connected to a Windows PC to one connected to a Bone, and vice versa. We've started development on C code which is used to send and receive commands on the Bone. When finished, we'll have a library of methods for communication.<br />
<br />
Our next step is to move to Bone-to-Bone communication and to be able to control our sensors wirelessly from one Bone to the other.<br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. A protocol is in development and will be used for controlling sensors wirelessly.<br />
<br />
== General Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
[[File:XBeeBoneConnection.jpg|450px|XBee module connected to a BeagleBone.]]<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE.git https://github.com/duganje/ECE497_XBEE.git]. To begin, download the <code>XBee.c</code> file which houses our communication methods. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
<br />
== 0.5" Force Sensitive Resistor ==<br />
These instructions are for interfacing the [[SparkFun: 0.5" Force Sensitive Resistor|0.5" Force Sensitive Resistor]] with the XBee.<br />
<br />
=== Required Items ===<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/9375 0.5" Force Sensitive Resistor]<br />
<br />
=== Hardware ===<br />
First we will connect the force-sensitive resistor to the Bone (P9 header). A 27kΩ resistor is used to connect the 3.3V source (pin 3) from the Bone to one pin of the force-sensitive resistor. Then, the other pin of the force-sensitive resistor is connected to ground (pin 1). An analog pin (AIN) on the Bone connects to the node containing both resistors, and values can be read off of that AIN. AIN5 (pin 36) is being used to read values on the Bone.<br />
<br />
Next we will connect the XBee module to the Bone. The table below describes the necessary wiring.<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
With everything wired-up, your connections should match the image below. Click on the image to view the full resolution.<br />
<br />
[[File:ForceResistorXBee.jpg|600px|Picture of connection|link=http://elinux.org/images/3/3b/ForceResistorXBee.jpg]]<br />
<br />
=== Software ===<br />
We're going to start with these two pieces of code as a reference and combine them:<br />
*[https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c Code to interface with the force sensitive resistor]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
Running the code for the force sensitive resistor produces a value from 0 to 4096 depending on how much pressure is applied to the resistor. The harder the resistor is squeezed, the lower this value is. On line 46 of the force sensitive resistor code, <code>analogValue</code> is constantly updated and stores this number.<br />
<br />
The instructions now fork depending on whether you're setting up the sending XBee code or the receiving XBee code. When you're done you will have two C programs, one running on each Bone.<br />
<br />
==== Sending ====<br />
Start with the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c resistor code] as a base and add the following include to the top of the file:<br />
<br />
#include "XBee.h"<br />
<br />
Next, add a call to <code>initializeXbee()</code> in <code>main</code> of the resistor code before the while loop begins.<br />
<br />
In the <code>while</code> loop after the value of <code>analogValue</code> is updated, add this line:<br />
<br />
sendIntXbee(analogValue);<br />
<br />
This will send the integer analog value to the receiving XBee. Now the number is constantly being sent in the while loop.<br />
<br />
==== Receiving ====<br />
Start with the [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee code] as a base and create a <code>main</code> function. First in <code>main</code>, add a call to <code>initializeXbee()</code> to setup the Bone to use the module.<br />
<br />
Next, add a while loop to <code>main</code> which continuously receives the integer analog value from the other Bone using the <code>receiveIntXbee()</code> function. Once the integer value is received, you're free to use that information for whatever purpose you wish. The example code below should give you an idea of how this is done:<br />
<br />
<pre>void main(int argc, char **argv, char **envp) {<br />
// Initialize XBee<br />
initializeXbee();<br />
<br />
// Keep going<br />
while (1) {<br />
int analogValue = receiveIntXbee();<br />
<br />
// Do anything based on analog value<br />
if (analogValue < 1000)<br />
ButtonPressedFunction();<br />
}<br />
}</pre><br />
<br />
==== Sample ====<br />
Based on the instructions above, I've created a sample set of programs. Using two Bones, the send program runs on one and the receive program runs on another. The "send" Bone includes an XBee module and the force sensitive resistor, [[ECE497_Project:_XBee#Hardware_2|hooked-up as described here]]. The second Bone includes the XBee module hooked-up in the same way with the addition of an LED connected to pin 12 (GPIO1_28) of the Bone. Connect the ground pin of the LED to the Bone's ground (pin 1) using a 220Ω resistor.<br />
<br />
Running both programs emulated the original function of the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c force resistor sample code], the only difference being that the data is now sent wirelessly from one Bone to another.<br />
<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/sendProgram.c Send Program]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/receiveProgram.c Receive Program]<br />
<br />
== Wireless 2-Axis Thumb Joystick ==<br />
These instructions are for interfacing the [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]] with the XBee. This application could be useful in a wireless controller setting. <br />
<br />
=== Required Items ===<br />
*2 X [http://adafruit.com/products/513 BeagleBone]<br />
*2 X [http://www.adafruit.com/products/128 XBee Module]<br />
*2 X [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 X [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]]<br />
<br />
=== BeagleBone Wiring Instructions ===<br />
On your first BeagleBone, wire pins 36 and 38 to your two analog inputs. Wire the Beagle's 1.8V VCC output, pin 32, to the VCC input of the Joystick. Finally, wire the select GPIO signal to the GPIO_7 pin or pin 42.<br />
<br />
Wire the XBee as shown in the table below:<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The pinout and visual implementation are shown below.<br />
<br />
[[File:Bone_P9_pinout.jpg|x400px]] [[File:XBee_and_Adafruit_Joystick.jpg|x400px]]<br />
<br />
On the second BeagleBone, wire the XBee exactly as the first XBee (as described in the table above).<br />
<br />
Don't hook up any other hardware to the second XBee as it will be acting as an information hub.<br />
<br />
=== Usage Instructions ===<br />
On both BeagleBones, clone this repository:<br />
<br />
== Magnetometer ==<br />
These instructions are for interfacing the [[Sparkfun: HMC5883L Magnetometer|HMC5883L Magnetometer]] with the XBee.<br />
<br />
=== Required Items ===<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/10530? Magnetometer Breakout Board]<br />
<br />
===Hardware===<br />
The XBee radios should be connected to both Beagles as shown in the table below. <br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The Magnetometer should be connected to one BeagleBone as described in the [[Sparkfun: HMC5883L Magnetometer|hardware]] section of the Magnetometer page. Ground and Vcc on the Magnetometer should be connected to pins 1 and 3 respectively on header P9 of the bone. SCL and SDA on the Magnetometer should be connected to pins 19 and 20 on P9 to use I2C bus 3. Two 4.7kΩ resistors should also be connected between SCL and Vcc and between SDA and Vcc. Below is a picture of the Beagle connected to the Magnetometer and the XBee.<br />
<br />
[[File:XBEE_MAG.jpg|600px|Picture of connections]]<br />
<br />
===Software===<br />
The goal is to have the two BeagleBones attached to XBee radios with the one connected to the Magnetometer taking data and transmitting this data to the other Bone which will print the measured data.<br />
<br />
I started with the code to collect data from the Magnetometer and the code to send data using the XBee radios. Here are the links to these two programs:<br />
*[https://github.com/duganje/ECE497_duganje/blob/master/MiniProject02/miniproject02.c Code to gather magnetometer data]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
The code for the magnetometer uses I2C to read the values for the X, Y and Z-Axes and print these values to the terminal. The XBee code contains helper functions to transmit data wirelessly. I have written two programs: one to collect and transmit the magnetometer data and the other to receive and display this data.<br />
<br />
====Sending====<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Magnetometer/sendMag.c Tranmitting Magnetometer Data Code]<br />
<br />
The code uses [https://github.com/MarkAYoder/BeagleBoard-exercises/tree/master/i2c I2C code] from [[EBC Exercise 12 I2C]] and helper functions from [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee.c]. <br />
The program uses <br />
i2cget(i2cbus, address, daddress);<br />
to get the data from the magnetometer and <br />
sendShortXbee(val);<br />
to send these values to the receiving XBee.<br />
<br />
====Receiving====<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Magnetometer/receiveMag.c Receiving Magnetometer Data Code]<br />
<br />
The receiving code uses <br />
receiveShortXbee();<br />
to read the values for each axis.<br />
<br />
Because we do not have a way to synchronize the two XBees, the receiving program must be started first to ensure the data is receive in the correct order.<br />
<br />
In the Highlights section, there is a video demo of the complete program.<br />
<br />
== General Usage ==<br />
These instructions are a general how-to for using the XBee with any sensor.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code> (not created yet). In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate with the XBee using uart 2. Then in your main.c call: <pre>sendIntXbee(int yourInt);</pre> with <code>yourInt</code> being any data you would like to transmit. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the integer which was sent through <code>sendIntXbee(int yourInt)</code> on the 1st board.<br />
<br />
The send and receive functions can be easily modified to send any data type as shown in:<br />
<br />
<pre>sendShortXbee(short yourShort);</pre> <pre>receiveShortXbee();</pre><br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
<br />
== Highlights ==<br />
<br />
=== Force Sensitive Resistor YouTube Demo ===<br />
{{#ev:youtube|Ds_BWsrvy1I}}<br />
<br />
=== Magnetometer YouTube Demo ===<br />
{{#ev:youtube|99bFqE54UHM}}<br />
<br />
<!--<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
--><br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. UART files on the Bone represent serial connections. With an XBee connected to the Bone's UART 2 as shown above, sent and received messages are written to <code>/dev/ttyO2</code> (the O is an uppercase O, not a zero). The BeagleBone's UARTs are accessed through <code>/dev/ttyO'''x'''</code>, where <code>'''x'''</code> is the UART number. Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
--><br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation. (done)<br />
*Thursday, 11/8 - Package language implemented between Bones. (done)<br />
*Sunday, 11/11 - YouTube demo uploaded. (done)<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Everything complete & all code ''makes''.<br />
<br />
=== Completed Work ===<br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
* Force Sensitive Resistor implementation - Stephen Shinn<br />
* Magnetometer implementation - Josh Dugan<br />
* 2-Axis Thumb Joystick implementation - Matt Moravec<br />
<br />
=== To Do ===<br />
<br />
* Update documentation - All<br />
* Joystick demo - Matt<br />
* Clone repo from scratch and test make<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
<br />
The following are some additional things that could be done with this project:<br />
<br />
* Create and document interfaces for more sensors<br />
* Back-and-forth 2-sensor communication<br />
* Create a practical application such as a wireless doorbell<br />
<br />
== Conclusions ==<br />
<br />
In conclusion, we created an XBee wireless communication library for BeagleBone and adapted three sensors to use it. We've also documented general usage instructions for adapting XBee to use any type of sensor. We have not found a comprehensive source for how to use XBee modules with the BeagleBone, so our code and instructions are online with the intention that others use them as a reference.<br />
<br />
Using the wireless modules is interesting, and the possibilities are endless. We've listed a few ideas above which could be done in the future. One interesting idea would be to create a practical XBee application that someone could actually use in their home or work life. With a few XBees around the house, one could have a small network for sending data and controlling Christmas lights or something with a sensor.<br />
<!--<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
--><br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=191750ECE497 Project: XBee2012-11-12T19:11:35Z<p>Shinnsm: /* General Usage */</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Grading Template ==<br />
I'm using the following template to grade. Each slot is 10 points.<br />
0 = Missing, 5=OK, 10=Wow!<br />
<br />
<pre style="color:red"><br />
00 Executive Summary<br />
05 Installation Instructions <br />
01 User Instructions<br />
00 Highlights<br />
00 Theory of Operation<br />
00 Work Breakdown<br />
00 Future Work<br />
00 Conclusions<br />
00 Demo<br />
00 Late<br />
Comments: I'm looking forward to seeing this.<br />
<br />
Score: 06/100<br />
</pre><br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
Right now the various sensors have been documented and are working. We've received the XBee modules and soldered them as required. So far we've been able to send and receive messages from an XBee connected to a Windows PC to one connected to a Bone, and vice versa. We've started development on C code which is used to send and receive commands on the Bone. When finished, we'll have a library of methods for communication.<br />
<br />
Our next step is to move to Bone-to-Bone communication and to be able to control our sensors wirelessly from one Bone to the other.<br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. A protocol is in development and will be used for controlling sensors wirelessly.<br />
<br />
== General Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
[[File:XBeeBoneConnection.jpg|450px|XBee module connected to a BeagleBone.]]<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE.git https://github.com/duganje/ECE497_XBEE.git]. To begin, download the <code>XBee.c</code> file which houses our communication methods. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
<br />
== 0.5" Force Sensitive Resistor ==<br />
These instructions are for interfacing the [[SparkFun: 0.5" Force Sensitive Resistor|0.5" Force Sensitive Resistor]] with the XBee.<br />
<br />
=== Required Items ===<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/9375 0.5" Force Sensitive Resistor]<br />
<br />
=== Hardware ===<br />
First we will connect the force-sensitive resistor to the Bone (P9 header). A 27kΩ resistor is used to connect the 3.3V source (pin 3) from the Bone to one pin of the force-sensitive resistor. Then, the other pin of the force-sensitive resistor is connected to ground (pin 1). An analog pin (AIN) on the Bone connects to the node containing both resistors, and values can be read off of that AIN. AIN5 (pin 36) is being used to read values on the Bone.<br />
<br />
Next we will connect the XBee module to the Bone. The table below describes the necessary wiring.<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
With everything wired-up, your connections should match the image below. Click on the image to view the full resolution.<br />
<br />
[[File:ForceResistorXBee.jpg|600px|Picture of connection|link=http://elinux.org/images/3/3b/ForceResistorXBee.jpg]]<br />
<br />
=== Software ===<br />
We're going to start with these two pieces of code as a reference and combine them:<br />
*[https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c Code to interface with the force sensitive resistor]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
Running the code for the force sensitive resistor produces a value from 0 to 4096 depending on how much pressure is applied to the resistor. The harder the resistor is squeezed, the lower this value is. On line 46 of the force sensitive resistor code, <code>analogValue</code> is constantly updated and stores this number.<br />
<br />
The instructions now fork depending on whether you're setting up the sending XBee code or the receiving XBee code. When you're done you will have two C programs, one running on each Bone.<br />
<br />
==== Sending ====<br />
Start with the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c resistor code] as a base and add the following include to the top of the file:<br />
<br />
#include "XBee.h"<br />
<br />
Next, add a call to <code>initializeXbee()</code> in <code>main</code> of the resistor code before the while loop begins.<br />
<br />
In the <code>while</code> loop after the value of <code>analogValue</code> is updated, add this line:<br />
<br />
sendIntXbee(analogValue);<br />
<br />
This will send the integer analog value to the receiving XBee. Now the number is constantly being sent in the while loop.<br />
<br />
==== Receiving ====<br />
Start with the [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee code] as a base and create a <code>main</code> function. First in <code>main</code>, add a call to <code>initializeXbee()</code> to setup the Bone to use the module.<br />
<br />
Next, add a while loop to <code>main</code> which continuously receives the integer analog value from the other Bone using the <code>receiveIntXbee()</code> function. Once the integer value is received, you're free to use that information for whatever purpose you wish. The example code below should give you an idea of how this is done:<br />
<br />
<pre>void main(int argc, char **argv, char **envp) {<br />
// Initialize XBee<br />
initializeXbee();<br />
<br />
// Keep going<br />
while (1) {<br />
int analogValue = receiveIntXbee();<br />
<br />
// Do anything based on analog value<br />
if (analogValue < 1000)<br />
ButtonPressedFunction();<br />
}<br />
}</pre><br />
<br />
==== Sample ====<br />
Based on the instructions above, I've created a sample set of programs. Using two Bones, the send program runs on one and the receive program runs on another. The "send" Bone includes an XBee module and the force sensitive resistor, [[ECE497_Project:_XBee#Hardware_2|hooked-up as described here]]. The second Bone includes the XBee module hooked-up in the same way with the addition of an LED connected to pin 12 (GPIO1_28) of the Bone. Connect the ground pin of the LED to the Bone's ground (pin 1) using a 220Ω resistor.<br />
<br />
Running both programs emulated the original function of the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c force resistor sample code], the only difference being that the data is now sent wirelessly from one Bone to another.<br />
<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/sendProgram.c Send Program]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/receiveProgram.c Receive Program]<br />
<br />
== Wireless 2-Axis Thumb Joystick ==<br />
These instructions are for interfacing the [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]] with the XBee. This application could be useful in a wireless controller setting. <br />
<br />
=== Required Items ===<br />
*2 X [http://adafruit.com/products/513 BeagleBone]<br />
*2 X [http://www.adafruit.com/products/128 XBee Module]<br />
*2 X [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 X [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]]<br />
<br />
=== BeagleBone Wiring Instructions ===<br />
On your first BeagleBone, wire pins 36 and 38 to your two analog inputs. Wire the Beagle's 1.8V VCC output, pin 32, to the VCC input of the Joystick. Finally, wire the select GPIO signal to the GPIO_7 pin or pin 42.<br />
<br />
Wire the XBee as shown in the table below:<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The pinout and visual implementation are shown below.<br />
<br />
[[File:Bone_P9_pinout.jpg|x400px]] [[File:XBee_and_Adafruit_Joystick.jpg|x400px]]<br />
<br />
On the second BeagleBone, wire the XBee exactly as the first XBee (as described in the table above).<br />
<br />
Don't hook up any other hardware to the second XBee as it will be acting as an information hub.<br />
<br />
=== Usage Instructions ===<br />
On both BeagleBones, clone this repository:<br />
<br />
== Magnetometer ==<br />
These instructions are for interfacing the [[Sparkfun: HMC5883L Magnetometer|HMC5883L Magnetometer]] with the XBee.<br />
<br />
=== Required Items ===<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/10530? Magnetometer Breakout Board]<br />
<br />
===Hardware===<br />
The XBee radios should be connected to both Beagles as shown in the table below. <br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The Magnetometer should be connected to one BeagleBone as described in the [[Sparkfun: HMC5883L Magnetometer|hardware]] section of the Magnetometer page. Ground and Vcc on the Magnetometer should be connected to pins 1 and 3 respectively on header P9 of the bone. SCL and SDA on the Magnetometer should be connected to pins 19 and 20 on P9 to use I2C bus 3. Two 4.7kΩ resistors should also be connected between SCL and Vcc and between SDA and Vcc. Below is a picture of the Beagle connected to the Magnetometer and the XBee.<br />
<br />
[[File:XBEE_MAG.jpg|600px|Picture of connections]]<br />
<br />
===Software===<br />
The goal is to have the two BeagleBones attached to XBee radios with the one connected to the Magnetometer taking data and transmitting this data to the other Bone which will print the measured data.<br />
<br />
I started with the code to collect data from the Magnetometer and the code to send data using the XBee radios. Here are the links to these two programs:<br />
*[https://github.com/duganje/ECE497_duganje/blob/master/MiniProject02/miniproject02.c Code to gather magnetometer data]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
The code for the magnetometer uses I2C to read the values for the X, Y and Z-Axes and print these values to the terminal. The XBee code contains helper functions to transmit data wirelessly. I have written two programs: one to collect and transmit the magnetometer data and the other to receive and display this data.<br />
<br />
====Sending====<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Magnetometer/sendMag.c Tranmitting Magnetometer Data Code]<br />
<br />
The code uses [https://github.com/MarkAYoder/BeagleBoard-exercises/tree/master/i2c I2C code] from [[EBC Exercise 12 I2C]] and helper functions from [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee.c]. <br />
The program uses <br />
i2cget(i2cbus, address, daddress);<br />
to get the data from the magnetometer and <br />
sendShortXbee(val);<br />
to send these values to the receiving XBee.<br />
<br />
====Receiving====<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Magnetometer/receiveMag.c Receiving Magnetometer Data Code]<br />
<br />
The receiving code uses <br />
receiveShortXbee();<br />
to read the values for each axis.<br />
<br />
Because we do not have a way to synchronize the two XBees, the receiving program must be started first to ensure the data is receive in the correct order.<br />
<br />
In the Highlights section, there is a video demo of the complete program.<br />
<br />
== General Usage ==<br />
These instructions are a general how-to for using the XBee with any sensor.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code> (not created yet). In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate with the XBee using uart 2. Then in your main.c call: <pre>sendIntXbee(int yourInt);</pre> with <code>yourInt</code> being any data you would like to transmit. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the integer which was sent through <code>sendIntXbee(int yourInt)</code> on the 1st board.<br />
<br />
The send and receive functions can be easily modified to send any data type as shown in:<br />
<br />
<pre>sendShortXbee(short yourShort);</pre> <pre>receiveShortXbee();</pre><br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
<br />
== Highlights ==<br />
<br />
=== Force Sensitive Resistor YouTube Demo ===<br />
{{#ev:youtube|Ds_BWsrvy1I}}<br />
<br />
=== Magnetometer YouTube Demo ===<br />
{{#ev:youtube|99bFqE54UHM}}<br />
<br />
<!--<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
--><br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. UART files on the Bone represent serial connections. With an XBee connected to the Bone's UART 2 as shown above, sent and received messages are written to <code>/dev/ttyO2</code> (the O is an uppercase O, not a zero). The BeagleBone's UARTs are accessed through <code>/dev/ttyO'''x'''</code>, where <code>'''x'''</code> is the UART number. Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
--><br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation. (done)<br />
*Thursday, 11/8 - Package language implemented between Bones. (done)<br />
*Sunday, 11/11 - YouTube demo uploaded. (done)<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Presentation day; PowerPoint complete.<br />
<br />
=== Completed Work ===<br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
* Force Sensitive Resistor implementation - Stephen Shinn<br />
* Magnetometer implementation - Josh Dugan<br />
* 2-Axis Thumb Joystick implementation - Matt Moravec<br />
<br />
=== To Do ===<br />
<br />
* Update documentation - All<br />
* Joystick demo - Matt<br />
* Clone repo from scratch and test make<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
<br />
The following are some additional things that could be done with this project:<br />
<br />
* Create and document interfaces for more sensors<br />
* Back-and-forth 2-sensor communication<br />
* Create a practical application such as a wireless doorbell<br />
<br />
== Conclusions ==<br />
<br />
In conclusion, we created an XBee wireless communication library for BeagleBone and adapted three sensors to use it. We've also documented general usage instructions for adapting XBee to use any type of sensor. We have not found a comprehensive source for how to use XBee modules with the BeagleBone, so our code and instructions are online with the intention that others use them as a reference.<br />
<br />
Using the wireless modules is interesting, and the possibilities are endless. We've listed a few ideas above which could be done in the future. One interesting idea would be to create a practical XBee application that someone could actually use in their home or work life. With a few XBees around the house, one could have a small network for sending data and controlling Christmas lights or something with a sensor.<br />
<!--<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
--><br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=191744ECE497 Project: XBee2012-11-12T19:06:35Z<p>Shinnsm: /* Software */</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Grading Template ==<br />
I'm using the following template to grade. Each slot is 10 points.<br />
0 = Missing, 5=OK, 10=Wow!<br />
<br />
<pre style="color:red"><br />
00 Executive Summary<br />
05 Installation Instructions <br />
01 User Instructions<br />
00 Highlights<br />
00 Theory of Operation<br />
00 Work Breakdown<br />
00 Future Work<br />
00 Conclusions<br />
00 Demo<br />
00 Late<br />
Comments: I'm looking forward to seeing this.<br />
<br />
Score: 06/100<br />
</pre><br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
Right now the various sensors have been documented and are working. We've received the XBee modules and soldered them as required. So far we've been able to send and receive messages from an XBee connected to a Windows PC to one connected to a Bone, and vice versa. We've started development on C code which is used to send and receive commands on the Bone. When finished, we'll have a library of methods for communication.<br />
<br />
Our next step is to move to Bone-to-Bone communication and to be able to control our sensors wirelessly from one Bone to the other.<br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. A protocol is in development and will be used for controlling sensors wirelessly.<br />
<br />
== General Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
[[File:XBeeBoneConnection.jpg|450px|XBee module connected to a BeagleBone.]]<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE.git https://github.com/duganje/ECE497_XBEE.git]. To begin, download the <code>XBee.c</code> file which houses our communication methods. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
<br />
== 0.5" Force Sensitive Resistor ==<br />
These instructions are for interfacing the [[SparkFun: 0.5" Force Sensitive Resistor|0.5" Force Sensitive Resistor]] with the XBee.<br />
<br />
=== Required Items ===<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/9375 0.5" Force Sensitive Resistor]<br />
<br />
=== Hardware ===<br />
First we will connect the force-sensitive resistor to the Bone (P9 header). A 27kΩ resistor is used to connect the 3.3V source (pin 3) from the Bone to one pin of the force-sensitive resistor. Then, the other pin of the force-sensitive resistor is connected to ground (pin 1). An analog pin (AIN) on the Bone connects to the node containing both resistors, and values can be read off of that AIN. AIN5 (pin 36) is being used to read values on the Bone.<br />
<br />
Next we will connect the XBee module to the Bone. The table below describes the necessary wiring.<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
With everything wired-up, your connections should match the image below. Click on the image to view the full resolution.<br />
<br />
[[File:ForceResistorXBee.jpg|600px|Picture of connection|link=http://elinux.org/images/3/3b/ForceResistorXBee.jpg]]<br />
<br />
=== Software ===<br />
We're going to start with these two pieces of code as a reference and combine them:<br />
*[https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c Code to interface with the force sensitive resistor]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
Running the code for the force sensitive resistor produces a value from 0 to 4096 depending on how much pressure is applied to the resistor. The harder the resistor is squeezed, the lower this value is. On line 46 of the force sensitive resistor code, <code>analogValue</code> is constantly updated and stores this number.<br />
<br />
The instructions now fork depending on whether you're setting up the sending XBee code or the receiving XBee code. When you're done you will have two C programs, one running on each Bone.<br />
<br />
==== Sending ====<br />
Start with the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c resistor code] as a base and add the following include to the top of the file:<br />
<br />
#include "XBee.h"<br />
<br />
Next, add a call to <code>initializeXbee()</code> in <code>main</code> of the resistor code before the while loop begins.<br />
<br />
In the <code>while</code> loop after the value of <code>analogValue</code> is updated, add this line:<br />
<br />
sendIntXbee(analogValue);<br />
<br />
This will send the integer analog value to the receiving XBee. Now the number is constantly being sent in the while loop.<br />
<br />
==== Receiving ====<br />
Start with the [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee code] as a base and create a <code>main</code> function. First in <code>main</code>, add a call to <code>initializeXbee()</code> to setup the Bone to use the module.<br />
<br />
Next, add a while loop to <code>main</code> which continuously receives the integer analog value from the other Bone using the <code>receiveIntXbee()</code> function. Once the integer value is received, you're free to use that information for whatever purpose you wish. The example code below should give you an idea of how this is done:<br />
<br />
<pre>void main(int argc, char **argv, char **envp) {<br />
// Initialize XBee<br />
initializeXbee();<br />
<br />
// Keep going<br />
while (1) {<br />
int analogValue = receiveIntXbee();<br />
<br />
// Do anything based on analog value<br />
if (analogValue < 1000)<br />
ButtonPressedFunction();<br />
}<br />
}</pre><br />
<br />
==== Sample ====<br />
Based on the instructions above, I've created a sample set of programs. Using two Bones, the send program runs on one and the receive program runs on another. The "send" Bone includes an XBee module and the force sensitive resistor, [[ECE497_Project:_XBee#Hardware_2|hooked-up as described here]]. The second Bone includes the XBee module hooked-up in the same way with the addition of an LED connected to pin 12 (GPIO1_28) of the Bone. Connect the ground pin of the LED to the Bone's ground (pin 1) using a 220Ω resistor.<br />
<br />
Running both programs emulated the original function of the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c force resistor sample code], the only difference being that the data is now sent wirelessly from one Bone to another.<br />
<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/sendProgram.c Send Program]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/receiveProgram.c Receive Program]<br />
<br />
== Wireless 2-Axis Thumb Joystick ==<br />
These instructions are for interfacing the [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]] with the XBee. This application could be useful in a wireless controller setting. <br />
<br />
=== Required Items ===<br />
*2 X [http://adafruit.com/products/513 BeagleBone]<br />
*2 X [http://www.adafruit.com/products/128 XBee Module]<br />
*2 X [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 X [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]]<br />
<br />
=== BeagleBone Wiring Instructions ===<br />
On your first BeagleBone, wire pins 36 and 38 to your two analog inputs. Wire the Beagle's 1.8V VCC output, pin 32, to the VCC input of the Joystick. Finally, wire the select GPIO signal to the GPIO_7 pin or pin 42.<br />
<br />
Wire the XBee as shown in the table below:<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The pinout and visual implementation are shown below.<br />
<br />
[[File:Bone_P9_pinout.jpg|x400px]] [[File:XBee_and_Adafruit_Joystick.jpg|x400px]]<br />
<br />
On the second BeagleBone, wire the XBee exactly as the first XBee (as described in the table above).<br />
<br />
Don't hook up any other hardware to the second XBee as it will be acting as an information hub.<br />
<br />
=== Usage Instructions ===<br />
On both BeagleBones, clone this repository:<br />
<br />
== Magnetometer ==<br />
These instructions are for interfacing the [[Sparkfun: HMC5883L Magnetometer|HMC5883L Magnetometer]] with the XBee.<br />
<br />
=== Required Items ===<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/10530? Magnetometer Breakout Board]<br />
<br />
===Hardware===<br />
The XBee radios should be connected to both Beagles as shown in the table below. <br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The Magnetometer should be connected to one BeagleBone as described in the [[Sparkfun: HMC5883L Magnetometer|hardware]] section of the Magnetometer page. Ground and Vcc on the Magnetometer should be connected to pins 1 and 3 respectively on header P9 of the bone. SCL and SDA on the Magnetometer should be connected to pins 19 and 20 on P9 to use I2C bus 3. Two 4.7kΩ resistors should also be connected between SCL and Vcc and between SDA and Vcc. Below is a picture of the Beagle connected to the Magnetometer and the XBee.<br />
<br />
[[File:XBEE_MAG.jpg|600px|Picture of connections]]<br />
<br />
===Software===<br />
The goal is to have the two BeagleBones attached to XBee radios with the one connected to the Magnetometer taking data and transmitting this data to the other Bone which will print the measured data.<br />
<br />
I started with the code to collect data from the Magnetometer and the code to send data using the XBee radios. Here are the links to these two programs:<br />
*[https://github.com/duganje/ECE497_duganje/blob/master/MiniProject02/miniproject02.c Code to gather magnetometer data]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
The code for the magnetometer uses I2C to read the values for the X, Y and Z-Axes and print these values to the terminal. The XBee code contains helper functions to transmit data wirelessly. I have written two programs: one to collect and transmit the magnetometer data and the other to receive and display this data.<br />
<br />
====Sending====<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Magnetometer/sendMag.c Tranmitting Magnetometer Data Code]<br />
<br />
The code uses [https://github.com/MarkAYoder/BeagleBoard-exercises/tree/master/i2c I2C code] from [[EBC Exercise 12 I2C]] and helper functions from [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee.c]. <br />
The program uses <br />
i2cget(i2cbus, address, daddress);<br />
to get the data from the magnetometer and <br />
sendShortXbee(val);<br />
to send these values to the receiving XBee.<br />
<br />
====Receiving====<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Magnetometer/receiveMag.c Receiving Magnetometer Data Code]<br />
<br />
The receiving code uses <br />
receiveShortXbee();<br />
to read the values for each axis.<br />
<br />
Because we do not have a way to synchronize the two XBees, the receiving program must be started first to ensure the data is receive in the correct order.<br />
<br />
In the Highlights section, there is a video demo of the complete program.<br />
<br />
== General Usage ==<br />
These instructions are a general how-to for using the XBee with any sensor.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code> (not created yet). In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate with the XBee using uart 2. Then in your main.c call: <pre>sendIntXbee(int yourInt);</pre> with <code>yourInt</code> being any data you would like to transmit. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the integer which was sent through <code>sendIntXbee(int yourInt)</code> on the 1st board. <br />
<br />
<br />
The send and receive functions can be easily modified to send any data type as shown in <pre>sendShortXbee(short yourShort);</pre> <pre>receiveShortXbee();</pre><br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
<br />
== Highlights ==<br />
<br />
=== Force Sensitive Resistor YouTube Demo ===<br />
{{#ev:youtube|Ds_BWsrvy1I}}<br />
<br />
=== Magnetometer YouTube Demo ===<br />
{{#ev:youtube|99bFqE54UHM}}<br />
<br />
<!--<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
--><br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. UART files on the Bone represent serial connections. With an XBee connected to the Bone's UART 2 as shown above, sent and received messages are written to <code>/dev/ttyO2</code> (the O is an uppercase O, not a zero). The BeagleBone's UARTs are accessed through <code>/dev/ttyO'''x'''</code>, where <code>'''x'''</code> is the UART number. Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
--><br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation. (done)<br />
*Thursday, 11/8 - Package language implemented between Bones. (done)<br />
*Sunday, 11/11 - YouTube demo uploaded. (done)<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Presentation day; PowerPoint complete.<br />
<br />
=== Completed Work ===<br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
* Force Sensitive Resistor implementation - Stephen Shinn<br />
* Magnetometer implementation - Josh Dugan<br />
* 2-Axis Thumb Joystick implementation - Matt Moravec<br />
<br />
=== To Do ===<br />
<br />
* Update documentation - All<br />
* Joystick demo - Matt<br />
* Clone repo from scratch and test make<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
<br />
The following are some additional things that could be done with this project:<br />
<br />
* Create and document interfaces for more sensors<br />
* Back-and-forth 2-sensor communication<br />
* Create a practical application such as a wireless doorbell<br />
<br />
== Conclusions ==<br />
<br />
In conclusion, we created an XBee wireless communication library for BeagleBone and adapted three sensors to use it. We've also documented general usage instructions for adapting XBee to use any type of sensor. We have not found a comprehensive source for how to use XBee modules with the BeagleBone, so our code and instructions are online with the intention that others use them as a reference.<br />
<br />
Using the wireless modules is interesting, and the possibilities are endless. We've listed a few ideas above which could be done in the future. One interesting idea would be to create a practical XBee application that someone could actually use in their home or work life. With a few XBees around the house, one could have a small network for sending data and controlling Christmas lights or something with a sensor.<br />
<!--<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
--><br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=191738ECE497 Project: XBee2012-11-12T19:05:47Z<p>Shinnsm: /* Theory of Operation */</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Grading Template ==<br />
I'm using the following template to grade. Each slot is 10 points.<br />
0 = Missing, 5=OK, 10=Wow!<br />
<br />
<pre style="color:red"><br />
00 Executive Summary<br />
05 Installation Instructions <br />
01 User Instructions<br />
00 Highlights<br />
00 Theory of Operation<br />
00 Work Breakdown<br />
00 Future Work<br />
00 Conclusions<br />
00 Demo<br />
00 Late<br />
Comments: I'm looking forward to seeing this.<br />
<br />
Score: 06/100<br />
</pre><br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
Right now the various sensors have been documented and are working. We've received the XBee modules and soldered them as required. So far we've been able to send and receive messages from an XBee connected to a Windows PC to one connected to a Bone, and vice versa. We've started development on C code which is used to send and receive commands on the Bone. When finished, we'll have a library of methods for communication.<br />
<br />
Our next step is to move to Bone-to-Bone communication and to be able to control our sensors wirelessly from one Bone to the other.<br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. A protocol is in development and will be used for controlling sensors wirelessly.<br />
<br />
== General Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
[[File:XBeeBoneConnection.jpg|450px|XBee module connected to a BeagleBone.]]<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE.git https://github.com/duganje/ECE497_XBEE.git]. To begin, download the <code>XBee.c</code> <span style="color:red">(XBee.c? Give some more comments in your code. It looks like you are setting the pin MUX.)</span> file which houses our communication methods. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
<br />
== 0.5" Force Sensitive Resistor ==<br />
These instructions are for interfacing the [[SparkFun: 0.5" Force Sensitive Resistor|0.5" Force Sensitive Resistor]] with the XBee.<br />
<br />
=== Required Items ===<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/9375 0.5" Force Sensitive Resistor]<br />
<br />
=== Hardware ===<br />
First we will connect the force-sensitive resistor to the Bone (P9 header). A 27kΩ resistor is used to connect the 3.3V source (pin 3) from the Bone to one pin of the force-sensitive resistor. Then, the other pin of the force-sensitive resistor is connected to ground (pin 1). An analog pin (AIN) on the Bone connects to the node containing both resistors, and values can be read off of that AIN. AIN5 (pin 36) is being used to read values on the Bone.<br />
<br />
Next we will connect the XBee module to the Bone. The table below describes the necessary wiring.<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
With everything wired-up, your connections should match the image below. Click on the image to view the full resolution.<br />
<br />
[[File:ForceResistorXBee.jpg|600px|Picture of connection|link=http://elinux.org/images/3/3b/ForceResistorXBee.jpg]]<br />
<br />
=== Software ===<br />
We're going to start with these two pieces of code as a reference and combine them:<br />
*[https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c Code to interface with the force sensitive resistor]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
Running the code for the force sensitive resistor produces a value from 0 to 4096 depending on how much pressure is applied to the resistor. The harder the resistor is squeezed, the lower this value is. On line 46 of the force sensitive resistor code, <code>analogValue</code> is constantly updated and stores this number.<br />
<br />
The instructions now fork depending on whether you're setting up the sending XBee code or the receiving XBee code. When you're done you will have two C programs, one running on each Bone.<br />
<br />
==== Sending ====<br />
Start with the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c resistor code] as a base and add the following include to the top of the file:<br />
<br />
#include "XBee.h"<br />
<br />
Next, add a call to <code>initializeXbee()</code> in <code>main</code> of the resistor code before the while loop begins.<br />
<br />
In the <code>while</code> loop after the value of <code>analogValue</code> is updated, add this line:<br />
<br />
sendIntXbee(analogValue);<br />
<br />
This will send the integer analog value to the receiving XBee. Now the number is constantly being sent in the while loop.<br />
<br />
==== Receiving ====<br />
Start with the [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee code] as a base and create a <code>main</code> function. First in <code>main</code>, add a call to <code>initializeXbee()</code> to setup the Bone to use the module.<br />
<br />
Next, add a while loop to <code>main</code> which continuously receives the integer analog value from the other Bone using the <code>receiveIntXbee()</code> function. Once the integer value is received, you're free to use that information for whatever purpose you wish. The example code below should give you an idea of how this is done:<br />
<br />
<pre>void main(int argc, char **argv, char **envp) {<br />
// Initialize XBee<br />
initializeXbee();<br />
<br />
// Keep going<br />
while (1) {<br />
int analogValue = receiveIntXbee();<br />
<br />
// Do anything based on analog value<br />
if (analogValue < 1000)<br />
ButtonPressedFunction();<br />
}<br />
}</pre><br />
<br />
==== Sample ====<br />
Based on the instructions above, I've created a sample set of programs. Using two Bones, the send program runs on one and the receive program runs on another. The "send" Bone includes an XBee module and the force sensitive resistor, [[ECE497_Project:_XBee#Hardware_2|hooked-up as described here]]. The second Bone includes the XBee module hooked-up in the same way with the addition of an LED connected to pin 12 (GPIO1_28) of the Bone. Connect the ground pin of the LED to the Bone's ground (pin 1) using a 220Ω resistor.<br />
<br />
Running both programs emulated the original function of the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c force resistor sample code], the only difference being that the data is now sent wirelessly from one Bone to another.<br />
<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/sendProgram.c Send Program]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/receiveProgram.c Receive Program]<br />
<br />
== Wireless 2-Axis Thumb Joystick ==<br />
These instructions are for interfacing the [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]] with the XBee. This application could be useful in a wireless controller setting. <br />
<br />
=== Required Items ===<br />
*2 X [http://adafruit.com/products/513 BeagleBone]<br />
*2 X [http://www.adafruit.com/products/128 XBee Module]<br />
*2 X [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 X [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]]<br />
<br />
=== BeagleBone Wiring Instructions ===<br />
On your first BeagleBone, wire pins 36 and 38 to your two analog inputs. Wire the Beagle's 1.8V VCC output, pin 32, to the VCC input of the Joystick. Finally, wire the select GPIO signal to the GPIO_7 pin or pin 42.<br />
<br />
Wire the XBee as shown in the table below:<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The pinout and visual implementation are shown below.<br />
<br />
[[File:Bone_P9_pinout.jpg|x400px]] [[File:XBee_and_Adafruit_Joystick.jpg|x400px]]<br />
<br />
On the second BeagleBone, wire the XBee exactly as the first XBee (as described in the table above).<br />
<br />
Don't hook up any other hardware to the second XBee as it will be acting as an information hub.<br />
<br />
=== Usage Instructions ===<br />
On both BeagleBones, clone this repository:<br />
<br />
== Magnetometer ==<br />
These instructions are for interfacing the [[Sparkfun: HMC5883L Magnetometer|HMC5883L Magnetometer]] with the XBee.<br />
<br />
=== Required Items ===<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/10530? Magnetometer Breakout Board]<br />
<br />
===Hardware===<br />
The XBee radios should be connected to both Beagles as shown in the table below. <br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The Magnetometer should be connected to one BeagleBone as described in the [[Sparkfun: HMC5883L Magnetometer|hardware]] section of the Magnetometer page. Ground and Vcc on the Magnetometer should be connected to pins 1 and 3 respectively on header P9 of the bone. SCL and SDA on the Magnetometer should be connected to pins 19 and 20 on P9 to use I2C bus 3. Two 4.7kΩ resistors should also be connected between SCL and Vcc and between SDA and Vcc. Below is a picture of the Beagle connected to the Magnetometer and the XBee.<br />
<br />
[[File:XBEE_MAG.jpg|600px|Picture of connections]]<br />
<br />
===Software===<br />
The goal is to have the two BeagleBones attached to XBee radios with the one connected to the Magnetometer taking data and transmitting this data to the other Bone which will print the measured data.<br />
<br />
I started with the code to collect data from the Magnetometer and the code to send data using the XBee radios. Here are the links to these two programs:<br />
*[https://github.com/duganje/ECE497_duganje/blob/master/MiniProject02/miniproject02.c Code to gather magnetometer data]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
The code for the magnetometer uses I2C to read the values for the X, Y and Z-Axes and print these values to the terminal. The XBee code contains helper functions to transmit data wirelessly. I have written two programs: one to collect and transmit the magnetometer data and the other to receive and display this data.<br />
<br />
====Sending====<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Magnetometer/sendMag.c Tranmitting Magnetometer Data Code]<br />
<br />
The code uses [https://github.com/MarkAYoder/BeagleBoard-exercises/tree/master/i2c I2C code] from [[EBC Exercise 12 I2C]] and helper functions from [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee.c]. <br />
The program uses <br />
i2cget(i2cbus, address, daddress);<br />
to get the data from the magnetometer and <br />
sendShortXbee(val);<br />
to send these values to the receiving XBee.<br />
<br />
====Receiving====<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Magnetometer/receiveMag.c Receiving Magnetometer Data Code]<br />
<br />
The receiving code uses <br />
receiveShortXbee();<br />
to read the values for each axis.<br />
<br />
Because we do not have a way to synchronize the two XBees, the receiving program must be started first to ensure the data is receive in the correct order.<br />
<br />
In the Highlights section, there is a video demo of the complete program.<br />
<br />
== General Usage ==<br />
These instructions are a general how-to for using the XBee with any sensor.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code> (not created yet). In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate with the XBee using uart 2. Then in your main.c call: <pre>sendIntXbee(int yourInt);</pre> with <code>yourInt</code> being any data you would like to transmit. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the integer which was sent through <code>sendIntXbee(int yourInt)</code> on the 1st board. <br />
<br />
<br />
The send and receive functions can be easily modified to send any data type as shown in <pre>sendShortXbee(short yourShort);</pre> <pre>receiveShortXbee();</pre><br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
<br />
== Highlights ==<br />
<br />
=== Force Sensitive Resistor YouTube Demo ===<br />
{{#ev:youtube|Ds_BWsrvy1I}}<br />
<br />
=== Magnetometer YouTube Demo ===<br />
{{#ev:youtube|99bFqE54UHM}}<br />
<br />
<!--<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
--><br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. UART files on the Bone represent serial connections. With an XBee connected to the Bone's UART 2 as shown above, sent and received messages are written to <code>/dev/ttyO2</code> (the O is an uppercase O, not a zero). The BeagleBone's UARTs are accessed through <code>/dev/ttyO'''x'''</code>, where <code>'''x'''</code> is the UART number. Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
--><br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation. (done)<br />
*Thursday, 11/8 - Package language implemented between Bones. (done)<br />
*Sunday, 11/11 - YouTube demo uploaded. (done)<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Presentation day; PowerPoint complete.<br />
<br />
=== Completed Work ===<br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
* Force Sensitive Resistor implementation - Stephen Shinn<br />
* Magnetometer implementation - Josh Dugan<br />
* 2-Axis Thumb Joystick implementation - Matt Moravec<br />
<br />
=== To Do ===<br />
<br />
* Update documentation - All<br />
* Joystick demo - Matt<br />
* Clone repo from scratch and test make<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
<br />
The following are some additional things that could be done with this project:<br />
<br />
* Create and document interfaces for more sensors<br />
* Back-and-forth 2-sensor communication<br />
* Create a practical application such as a wireless doorbell<br />
<br />
== Conclusions ==<br />
<br />
In conclusion, we created an XBee wireless communication library for BeagleBone and adapted three sensors to use it. We've also documented general usage instructions for adapting XBee to use any type of sensor. We have not found a comprehensive source for how to use XBee modules with the BeagleBone, so our code and instructions are online with the intention that others use them as a reference.<br />
<br />
Using the wireless modules is interesting, and the possibilities are endless. We've listed a few ideas above which could be done in the future. One interesting idea would be to create a practical XBee application that someone could actually use in their home or work life. With a few XBees around the house, one could have a small network for sending data and controlling Christmas lights or something with a sensor.<br />
<!--<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
--><br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=191288ECE497 Project: XBee2012-11-11T23:12:54Z<p>Shinnsm: /* Future Work */</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Grading Template ==<br />
I'm using the following template to grade. Each slot is 10 points.<br />
0 = Missing, 5=OK, 10=Wow!<br />
<br />
<pre style="color:red"><br />
00 Executive Summary<br />
05 Installation Instructions <br />
01 User Instructions<br />
00 Highlights<br />
00 Theory of Operation<br />
00 Work Breakdown<br />
00 Future Work<br />
00 Conclusions<br />
00 Demo<br />
00 Late<br />
Comments: I'm looking forward to seeing this.<br />
<br />
Score: 06/100<br />
</pre><br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
Right now the various sensors have been documented and are working. We've received the XBee modules and soldered them as required. So far we've been able to send and receive messages from an XBee connected to a Windows PC to one connected to a Bone, and vice versa. We've started development on C code which is used to send and receive commands on the Bone. When finished, we'll have a library of methods for communication.<br />
<br />
Our next step is to move to Bone-to-Bone communication and to be able to control our sensors wirelessly from one Bone to the other.<br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. A protocol is in development and will be used for controlling sensors wirelessly.<br />
<br />
== General Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
[[File:XBeeBoneConnection.jpg|450px|XBee module connected to a BeagleBone.]]<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE.git https://github.com/duganje/ECE497_XBEE.git]. To begin, download the <code>XBee.c</code> <span style="color:red">(XBee.c? Give some more comments in your code. It looks like you are setting the pin MUX.)</span> file which houses our communication methods. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
<br />
== 0.5" Force Sensitive Resistor ==<br />
These instructions are for interfacing the [[SparkFun: 0.5" Force Sensitive Resistor|0.5" Force Sensitive Resistor]] with the XBee.<br />
<br />
=== Required Items ===<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/9375 0.5" Force Sensitive Resistor]<br />
<br />
=== Hardware ===<br />
First we will connect the force-sensitive resistor to the Bone (P9 header). A 27kΩ resistor is used to connect the 3.3V source (pin 3) from the Bone to one pin of the force-sensitive resistor. Then, the other pin of the force-sensitive resistor is connected to ground (pin 1). An analog pin (AIN) on the Bone connects to the node containing both resistors, and values can be read off of that AIN. AIN5 (pin 36) is being used to read values on the Bone.<br />
<br />
Next we will connect the XBee module to the Bone. The table below describes the necessary wiring.<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
With everything wired-up, your connections should match the image below. Click on the image to view the full resolution.<br />
<br />
[[File:ForceResistorXBee.jpg|600px|Picture of connection|link=http://elinux.org/images/3/3b/ForceResistorXBee.jpg]]<br />
<br />
=== Software ===<br />
We're going to start with these two pieces of code as a reference and combine them:<br />
*[https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c Code to interface with the force sensitive resistor]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
Running the code for the force sensitive resistor produces a value from 0 to 4096 depending on how much pressure is applied to the resistor. The harder the resistor is squeezed, the lower this value is. On line 46 of the force sensitive resistor code, <code>analogValue</code> is constantly updated and stores this number.<br />
<br />
The instructions now fork depending on whether you're setting up the sending XBee code or the receiving XBee code. When you're done you will have two C programs, one running on each Bone.<br />
<br />
==== Sending ====<br />
Start with the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c resistor code] as a base and add the following include to the top of the file:<br />
<br />
#include "XBee.h"<br />
<br />
Next, add a call to <code>initializeXbee()</code> in <code>main</code> of the resistor code before the while loop begins.<br />
<br />
In the <code>while</code> loop after the value of <code>analogValue</code> is updated, add this line:<br />
<br />
sendIntXbee(analogValue);<br />
<br />
This will send the integer analog value to the receiving XBee. Now the number is constantly being sent in the while loop.<br />
<br />
==== Receiving ====<br />
Start with the [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee code] as a base and create a <code>main</code> function. First in <code>main</code>, add a call to <code>initializeXbee()</code> to setup the Bone to use the module.<br />
<br />
Next, add a while loop to <code>main</code> which continuously receives the integer analog value from the other Bone using the <code>receiveIntXbee()</code> function. Once the integer value is received, you're free to use that information for whatever purpose you wish. The example code below should give you an idea of how this is done:<br />
<br />
<pre>void main(int argc, char **argv, char **envp) {<br />
// Initialize XBee<br />
initializeXbee();<br />
<br />
// Keep going<br />
while (1) {<br />
int analogValue = receiveIntXbee();<br />
<br />
// Do anything based on analog value<br />
if (analogValue < 1000)<br />
ButtonPressedFunction();<br />
}<br />
}</pre><br />
<br />
==== Sample ====<br />
Based on the instructions above, I've created a sample set of programs. Using two Bones, the send program runs on one and the receive program runs on another. The "send" Bone includes an XBee module and the force sensitive resistor, [[ECE497_Project:_XBee#Hardware_2|hooked-up as described here]]. The second Bone includes the XBee module hooked-up in the same way with the addition of an LED connected to pin 12 (GPIO1_28) of the Bone. Connect the ground pin of the LED to the Bone's ground (pin 1) using a 220Ω resistor.<br />
<br />
Running both programs emulated the original function of the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c force resistor sample code], the only difference being that the data is now sent wirelessly from one Bone to another.<br />
<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/sendProgram.c Send Program]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/receiveProgram.c Receive Program]<br />
<br />
== Wireless 2-Axis Thumb Joystick ==<br />
These instructions are for interfacing the [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]] with the XBee. This application could be useful in a wireless controller setting. <br />
<br />
=== Required Items ===<br />
*2 X [http://adafruit.com/products/513 BeagleBone]<br />
*2 X [http://www.adafruit.com/products/128 XBee Module]<br />
*2 X [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 X [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]]<br />
<br />
=== BeagleBone Wiring Instructions ===<br />
On your first BeagleBone, wire pins 36 and 38 to your two analog inputs. Wire the Beagle's 1.8V VCC output, pin 32, to the VCC input of the Joystick. Finally, wire the select GPIO signal to the GPIO_7 pin or pin 42.<br />
<br />
Wire the XBee as shown in the table below:<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The pinout and visual implementation are shown below.<br />
<br />
[[File:Bone_P9_pinout.jpg|x400px]] [[File:XBee_and_Adafruit_Joystick.jpg|x400px]]<br />
<br />
On the second BeagleBone, wire the XBee exactly as the first XBee (as described in the table above).<br />
<br />
Don't hook up any other hardware to the second XBee as it will be acting as an information hub.<br />
<br />
=== Usage Instructions ===<br />
On both BeagleBones, clone this repository:<br />
<br />
== Magnetometer ==<br />
These instructions are for interfacing the [[Sparkfun: HMC5883L Magnetometer|HMC5883L Magnetometer]] with the XBee.<br />
<br />
The goal is to have the two BeagleBones attached to XBee radios with the one connected to the Magnetometer taking data and transmitting this data to the other Bone which will print the measured data.<br />
<br />
The XBee radios should be connected to both Beagles as shown in the hardware section above. The Magnetometer should be connected as shown in the [[Sparkfun: HMC5883L Magnetometer|hardware]] section of the Magnetometer page. Below is a picture of the Beagle connected to the Magnetometer and the XBee.<br />
<br />
== General Usage ==<br />
These instructions are a general how-to for using the XBee with any sensor.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code> (not created yet). In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate to the XBee. Then in your main.c call: <pre>sendIntXbee(int yourInt);</pre> with chars as a string characters you choose. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the integers which were sent through <code>sendIntXbee(int yourInt)</code> on the 1st board. <br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
<br />
== Highlights ==<br />
<br />
=== Force Sensitive Resistor YouTube Demo ===<br />
{{#ev:youtube|Ds_BWsrvy1I}}<br />
<br />
=== Magnetometer YouTube Demo ===<br />
{{#ev:youtube|99bFqE54UHM}}<br />
<br />
<!--<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
--><br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. With an XBee connected to the Bone's UART 2 as shown above, sent and received messages are written to /dev/ttyO2 (the O is an uppercase O, not a zero).<span style="color:red">(Should be /dev/ttyO2. How do you change serial ports?)</span> Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
--><br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation. (done)<br />
*Thursday, 11/8 - Package language implemented between Bones. (done)<br />
*Sunday, 11/11 - YouTube demo uploaded. (done)<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Presentation day; PowerPoint complete.<br />
<br />
=== Completed Work ===<br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
* Force Sensitive Resistor implementation - Stephen Shinn<br />
* Magnetometer implementation - Josh Dugan<br />
* 2-Axis Thumb Joystick implementation - Matt Moravec<br />
<br />
=== To Do ===<br />
<br />
* Update documentation - All<br />
* Joystick demo - Matt<br />
* Clone repo from scratch and test make<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
<br />
The following are some additional things that could be done with this project:<br />
<br />
* Create and document interfaces for more sensors<br />
* Back-and-forth 2-sensor communication<br />
* Create a practical application such as a wireless doorbell<br />
<br />
== Conclusions ==<br />
<br />
In conclusion, we created an XBee wireless communication library for BeagleBone and adapted three sensors to use it. We've also documented general usage instructions for adapting XBee to use any type of sensor. We have not found a comprehensive source for how to use XBee modules with the BeagleBone, so our code and instructions are online with the intention that others use them as a reference.<br />
<br />
Using the wireless modules is interesting, and the possibilities are endless. We've listed a few ideas above which could be done in the future. One interesting idea would be to create a practical XBee application that someone could actually use in their home or work life. With a few XBees around the house, one could have a small network for sending data and controlling Christmas lights or something with a sensor.<br />
<!--<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
--><br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=191276ECE497 Project: XBee2012-11-11T23:10:58Z<p>Shinnsm: Add some future work and conclusions</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Grading Template ==<br />
I'm using the following template to grade. Each slot is 10 points.<br />
0 = Missing, 5=OK, 10=Wow!<br />
<br />
<pre style="color:red"><br />
00 Executive Summary<br />
05 Installation Instructions <br />
01 User Instructions<br />
00 Highlights<br />
00 Theory of Operation<br />
00 Work Breakdown<br />
00 Future Work<br />
00 Conclusions<br />
00 Demo<br />
00 Late<br />
Comments: I'm looking forward to seeing this.<br />
<br />
Score: 06/100<br />
</pre><br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
Right now the various sensors have been documented and are working. We've received the XBee modules and soldered them as required. So far we've been able to send and receive messages from an XBee connected to a Windows PC to one connected to a Bone, and vice versa. We've started development on C code which is used to send and receive commands on the Bone. When finished, we'll have a library of methods for communication.<br />
<br />
Our next step is to move to Bone-to-Bone communication and to be able to control our sensors wirelessly from one Bone to the other.<br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. A protocol is in development and will be used for controlling sensors wirelessly.<br />
<br />
== General Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
[[File:XBeeBoneConnection.jpg|450px|XBee module connected to a BeagleBone.]]<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE.git https://github.com/duganje/ECE497_XBEE.git]. To begin, download the <code>XBee.c</code> <span style="color:red">(XBee.c? Give some more comments in your code. It looks like you are setting the pin MUX.)</span> file which houses our communication methods. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
<br />
== 0.5" Force Sensitive Resistor ==<br />
These instructions are for interfacing the [[SparkFun: 0.5" Force Sensitive Resistor|0.5" Force Sensitive Resistor]] with the XBee.<br />
<br />
=== Required Items ===<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/9375 0.5" Force Sensitive Resistor]<br />
<br />
=== Hardware ===<br />
First we will connect the force-sensitive resistor to the Bone (P9 header). A 27kΩ resistor is used to connect the 3.3V source (pin 3) from the Bone to one pin of the force-sensitive resistor. Then, the other pin of the force-sensitive resistor is connected to ground (pin 1). An analog pin (AIN) on the Bone connects to the node containing both resistors, and values can be read off of that AIN. AIN5 (pin 36) is being used to read values on the Bone.<br />
<br />
Next we will connect the XBee module to the Bone. The table below describes the necessary wiring.<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
With everything wired-up, your connections should match the image below. Click on the image to view the full resolution.<br />
<br />
[[File:ForceResistorXBee.jpg|600px|Picture of connection|link=http://elinux.org/images/3/3b/ForceResistorXBee.jpg]]<br />
<br />
=== Software ===<br />
We're going to start with these two pieces of code as a reference and combine them:<br />
*[https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c Code to interface with the force sensitive resistor]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
Running the code for the force sensitive resistor produces a value from 0 to 4096 depending on how much pressure is applied to the resistor. The harder the resistor is squeezed, the lower this value is. On line 46 of the force sensitive resistor code, <code>analogValue</code> is constantly updated and stores this number.<br />
<br />
The instructions now fork depending on whether you're setting up the sending XBee code or the receiving XBee code. When you're done you will have two C programs, one running on each Bone.<br />
<br />
==== Sending ====<br />
Start with the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c resistor code] as a base and add the following include to the top of the file:<br />
<br />
#include "XBee.h"<br />
<br />
Next, add a call to <code>initializeXbee()</code> in <code>main</code> of the resistor code before the while loop begins.<br />
<br />
In the <code>while</code> loop after the value of <code>analogValue</code> is updated, add this line:<br />
<br />
sendIntXbee(analogValue);<br />
<br />
This will send the integer analog value to the receiving XBee. Now the number is constantly being sent in the while loop.<br />
<br />
==== Receiving ====<br />
Start with the [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee code] as a base and create a <code>main</code> function. First in <code>main</code>, add a call to <code>initializeXbee()</code> to setup the Bone to use the module.<br />
<br />
Next, add a while loop to <code>main</code> which continuously receives the integer analog value from the other Bone using the <code>receiveIntXbee()</code> function. Once the integer value is received, you're free to use that information for whatever purpose you wish. The example code below should give you an idea of how this is done:<br />
<br />
<pre>void main(int argc, char **argv, char **envp) {<br />
// Initialize XBee<br />
initializeXbee();<br />
<br />
// Keep going<br />
while (1) {<br />
int analogValue = receiveIntXbee();<br />
<br />
// Do anything based on analog value<br />
if (analogValue < 1000)<br />
ButtonPressedFunction();<br />
}<br />
}</pre><br />
<br />
==== Sample ====<br />
Based on the instructions above, I've created a sample set of programs. Using two Bones, the send program runs on one and the receive program runs on another. The "send" Bone includes an XBee module and the force sensitive resistor, [[ECE497_Project:_XBee#Hardware_2|hooked-up as described here]]. The second Bone includes the XBee module hooked-up in the same way with the addition of an LED connected to pin 12 (GPIO1_28) of the Bone. Connect the ground pin of the LED to the Bone's ground (pin 1) using a 220Ω resistor.<br />
<br />
Running both programs emulated the original function of the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c force resistor sample code], the only difference being that the data is now sent wirelessly from one Bone to another.<br />
<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/sendProgram.c Send Program]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/receiveProgram.c Receive Program]<br />
<br />
== Wireless 2-Axis Thumb Joystick ==<br />
These instructions are for interfacing the [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]] with the XBee. This application could be useful in a wireless controller setting. <br />
<br />
=== Required Items ===<br />
*2 X [http://adafruit.com/products/513 BeagleBone]<br />
*2 X [http://www.adafruit.com/products/128 XBee Module]<br />
*2 X [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 X [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]]<br />
<br />
=== BeagleBone Wiring Instructions ===<br />
On your first BeagleBone, wire pins 36 and 38 to your two analog inputs. Wire the Beagle's 1.8V VCC output, pin 32, to the VCC input of the Joystick. Finally, wire the select GPIO signal to the GPIO_7 pin or pin 42.<br />
<br />
Wire the XBee as shown in the table below:<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The pinout and visual implementation are shown below.<br />
<br />
[[File:Bone_P9_pinout.jpg|x400px]] [[File:XBee_and_Adafruit_Joystick.jpg|x400px]]<br />
<br />
On the second BeagleBone, wire the XBee exactly as the first XBee (as described in the table above).<br />
<br />
Don't hook up any other hardware to the second XBee as it will be acting as an information hub.<br />
<br />
=== Usage Instructions ===<br />
On both BeagleBones, clone this repository:<br />
<br />
== Magnetometer ==<br />
These instructions are for interfacing the [[Sparkfun: HMC5883L Magnetometer|HMC5883L Magnetometer]] with the XBee.<br />
<br />
The goal is to have the two BeagleBones attached to XBee radios with the one connected to the Magnetometer taking data and transmitting this data to the other Bone which will print the measured data.<br />
<br />
The XBee radios should be connected to both Beagles as shown in the hardware section above. The Magnetometer should be connected as shown in the [[Sparkfun: HMC5883L Magnetometer|hardware]] section of the Magnetometer page. Below is a picture of the Beagle connected to the Magnetometer and the XBee.<br />
<br />
== General Usage ==<br />
These instructions are a general how-to for using the XBee with any sensor.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code> (not created yet). In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate to the XBee. Then in your main.c call: <pre>sendIntXbee(int yourInt);</pre> with chars as a string characters you choose. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the integers which were sent through <code>sendIntXbee(int yourInt)</code> on the 1st board. <br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
<br />
== Highlights ==<br />
<br />
=== Force Sensitive Resistor YouTube Demo ===<br />
{{#ev:youtube|Ds_BWsrvy1I}}<br />
<br />
=== Magnetometer YouTube Demo ===<br />
{{#ev:youtube|99bFqE54UHM}}<br />
<br />
<!--<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
--><br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. With an XBee connected to the Bone's UART 2 as shown above, sent and received messages are written to /dev/ttyO2 (the O is an uppercase O, not a zero).<span style="color:red">(Should be /dev/ttyO2. How do you change serial ports?)</span> Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
--><br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation. (done)<br />
*Thursday, 11/8 - Package language implemented between Bones. (done)<br />
*Sunday, 11/11 - YouTube demo uploaded. (done)<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Presentation day; PowerPoint complete.<br />
<br />
=== Completed Work ===<br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
* Force Sensitive Resistor implementation - Stephen Shinn<br />
* Magnetometer implementation - Josh Dugan<br />
* 2-Axis Thumb Joystick implementation - Matt Moravec<br />
<br />
=== To Do ===<br />
<br />
* Update documentation - All<br />
* Joystick demo - Matt<br />
* Clone repo from scratch and test make<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
<br />
* Create and document interfaces for more sensors<br />
* Back-and-forth 2-sensor communication<br />
* Create a practical application such as a wireless doorbell<br />
<!--<br />
Suggest addition things that could be done with this project.<br />
--><br />
== Conclusions ==<br />
<br />
In conclusion, we created an XBee wireless communication library for BeagleBone and adapted three sensors to use it. We've also documented general usage instructions for adapting XBee to use any type of sensor. We have not found a comprehensive source for how to use XBee modules with the BeagleBone, so our code and instructions are online with the intention that others use them as a reference.<br />
<br />
Using the wireless modules is interesting, and the possibilities are endless. We've listed a few ideas above which could be done in the future. One interesting idea would be to create a practical XBee application that someone could actually use in their home or work life. With a few XBees around the house, one could have a small network for sending data and controlling Christmas lights or something with a sensor.<br />
<!--<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
--><br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=190994ECE497 Project: XBee2012-11-10T23:17:29Z<p>Shinnsm: /* Software */ Removing comments we addressed.</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Grading Template ==<br />
I'm using the following template to grade. Each slot is 10 points.<br />
0 = Missing, 5=OK, 10=Wow!<br />
<br />
<pre style="color:red"><br />
00 Executive Summary<br />
05 Installation Instructions <br />
01 User Instructions<br />
00 Highlights<br />
00 Theory of Operation<br />
00 Work Breakdown<br />
00 Future Work<br />
00 Conclusions<br />
00 Demo<br />
00 Late<br />
Comments: I'm looking forward to seeing this.<br />
<br />
Score: 06/100<br />
</pre><br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
Right now the various sensors have been documented and are working. We've received the XBee modules and soldered them as required. So far we've been able to send and receive messages from an XBee connected to a Windows PC to one connected to a Bone, and vice versa. We've started development on C code which is used to send and receive commands on the Bone. When finished, we'll have a library of methods for communication.<br />
<br />
Our next step is to move to Bone-to-Bone communication and to be able to control our sensors wirelessly from one Bone to the other.<br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. A protocol is in development and will be used for controlling sensors wirelessly.<br />
<br />
== General Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
[[File:XBeeBoneConnection.jpg|450px|XBee module connected to a BeagleBone.]]<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE.git https://github.com/duganje/ECE497_XBEE.git]. To begin, download the <code>XBee.c</code> <span style="color:red">(XBee.c? Give some more comments in your code. It looks like you are setting the pin MUX.)</span> file which houses our communication methods. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
<br />
== 0.5" Force Sensitive Resistor ==<br />
These instructions are for interfacing the [[SparkFun: 0.5" Force Sensitive Resistor|0.5" Force Sensitive Resistor]] with the XBee.<br />
<br />
=== Required Items ===<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/9375 0.5" Force Sensitive Resistor]<br />
<br />
=== Hardware ===<br />
First we will connect the force-sensitive resistor to the Bone (P9 header). A 27kΩ resistor is used to connect the 3.3V source (pin 3) from the Bone to one pin of the force-sensitive resistor. Then, the other pin of the force-sensitive resistor is connected to ground (pin 1). An analog pin (AIN) on the Bone connects to the node containing both resistors, and values can be read off of that AIN. AIN5 (pin 36) is being used to read values on the Bone.<br />
<br />
Next we will connect the XBee module to the Bone. The table below describes the necessary wiring.<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
With everything wired-up, your connections should match the image below. Click on the image to view the full resolution.<br />
<br />
[[File:ForceResistorXBee.jpg|600px|Picture of connection|link=http://elinux.org/images/3/3b/ForceResistorXBee.jpg]]<br />
<br />
=== Software ===<br />
We're going to start with these two pieces of code as a reference and combine them:<br />
*[https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c Code to interface with the force sensitive resistor]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
Running the code for the force sensitive resistor produces a value from 0 to 4096 depending on how much pressure is applied to the resistor. The harder the resistor is squeezed, the lower this value is. On line 46 of the force sensitive resistor code, <code>analogValue</code> is constantly updated and stores this number.<br />
<br />
The instructions now fork depending on whether you're setting up the sending XBee code or the receiving XBee code. When you're done you will have two C programs, one running on each Bone.<br />
<br />
==== Sending ====<br />
Start with the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c resistor code] as a base and add the following include to the top of the file:<br />
<br />
#include "XBee.h"<br />
<br />
Next, add a call to <code>initializeXbee()</code> in <code>main</code> of the resistor code before the while loop begins.<br />
<br />
In the <code>while</code> loop after the value of <code>analogValue</code> is updated, add this line:<br />
<br />
sendIntXbee(analogValue);<br />
<br />
This will send the integer analog value to the receiving XBee. Now the number is constantly being sent in the while loop.<br />
<br />
==== Receiving ====<br />
Start with the [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee code] as a base and create a <code>main</code> function. First in <code>main</code>, add a call to <code>initializeXbee()</code> to setup the Bone to use the module.<br />
<br />
Next, add a while loop to <code>main</code> which continuously receives the integer analog value from the other Bone using the <code>receiveIntXbee()</code> function. Once the integer value is received, you're free to use that information for whatever purpose you wish. The example code below should give you an idea of how this is done:<br />
<br />
<pre>void main(int argc, char **argv, char **envp) {<br />
// Initialize XBee<br />
initializeXbee();<br />
<br />
// Keep going<br />
while (1) {<br />
int analogValue = receiveIntXbee();<br />
<br />
// Do anything based on analog value<br />
if (analogValue < 1000)<br />
ButtonPressedFunction();<br />
}<br />
}</pre><br />
<br />
==== Sample ====<br />
Based on the instructions above, I've created a sample set of programs. Using two Bones, the send program runs on one and the receive program runs on another. The "send" Bone includes an XBee module and the force sensitive resistor, [[ECE497_Project:_XBee#Hardware_2|hooked-up as described here]]. The second Bone includes the XBee module hooked-up in the same way with the addition of an LED connected to pin 12 (GPIO1_28) of the Bone. Connect the ground pin of the LED to the Bone's ground (pin 1) using a 220Ω resistor.<br />
<br />
Running both programs emulated the original function of the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c force resistor sample code], the only difference being that the data is now sent wirelessly from one Bone to another.<br />
<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/sendProgram.c Send Program]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/receiveProgram.c Receive Program]<br />
<br />
== Wireless 2-Axis Thumb Joystick ==<br />
These instructions are for interfacing the [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]] with the XBee. This application could be useful in a wireless controller setting. <br />
<br />
=== Required Items ===<br />
*2 X [http://adafruit.com/products/513 BeagleBone]<br />
*2 X [http://www.adafruit.com/products/128 XBee Module]<br />
*2 X [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 X [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]]<br />
<br />
=== BeagleBone Wiring Instructions ===<br />
On your first BeagleBone, wire pins 36 and 38 to your two analog inputs. Wire the Beagle's 1.8V VCC output, pin 32, to the VCC input of the Joystick. Finally, wire the select GPIO signal to the GPIO_7 pin or pin 42.<br />
<br />
Wire the XBee as shown in the table below:<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The pinout and visual implementation are shown below.<br />
<br />
[[File:Bone_P9_pinout.jpg|x400px]] [[File:XBee_and_Adafruit_Joystick.jpg|x400px]]<br />
<br />
On the second BeagleBone, wire the XBee exactly as the first XBee (as described in the table above).<br />
<br />
Don't hook up any other hardware to the second XBee as it will be acting as an information hub.<br />
<br />
=== Usage Instructions ===<br />
On both BeagleBones, clone this repository:<br />
<br />
== Magnetometer ==<br />
These instructions are for interfacing the [[Sparkfun: HMC5883L Magnetometer|HMC5883L Magnetometer]] with the XBee.<br />
<br />
The goal is to have the two BeagleBones attached to XBee radios with the one connected to the Magnetometer taking data and transmitting this data to the other Bone which will print the measured data.<br />
<br />
The XBee radios should be connected to both Beagles as shown in the hardware section above. The Magnetometer should be connected as shown in the [[Sparkfun: HMC5883L Magnetometer|hardware]] section of the Magnetometer page. Below is a picture of the Beagle connected to the Magnetometer and the XBee.<br />
<br />
== General Usage ==<br />
These instructions are a general how-to for using the XBee with any sensor.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code> (not created yet). In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate to the XBee. Then in your main.c call: <pre>sendIntXbee(int yourInt);</pre> with chars as a string characters you choose. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the integers which were sent through <code>sendIntXbee(int yourInt)</code> on the 1st board. <br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
<br />
== Highlights ==<br />
<br />
=== Force Sensitive Resistor YouTube Demo ===<br />
{{#ev:youtube|Ds_BWsrvy1I}}<br />
<br />
=== Magnetometer YouTube Demo ===<br />
{{#ev:youtube|99bFqE54UHM}}<br />
<br />
<!--<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
--><br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. With an XBee connected to the Bone's UART 2 as shown above, sent and received messages are written to /dev/ttyO2 (the O is an uppercase O, not a zero).<span style="color:red">(Should be /dev/ttyO2. How do you change serial ports?)</span> Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
--><br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation. (done)<br />
*Thursday, 11/8 - Package language implemented between Bones. (done)<br />
*Sunday, 11/11 - YouTube demo uploaded. (done)<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Presentation day; PowerPoint complete.<br />
<br />
=== Completed Work ===<br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
* Force Sensitive Resistor implementation - Stephen Shinn<br />
* Magnetometer implementation - Josh Dugan<br />
* 2-Axis Thumb Joystick implementation - Matt Moravec<br />
<br />
=== To Do ===<br />
<br />
* Update documentation - All<br />
* Joystick demo - Matt<br />
* Clone repo from scratch and test make<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
TBD<br />
<!--<br />
Suggest addition things that could be done with this project.<br />
--><br />
== Conclusions ==<br />
TBD<br />
<!--<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
--><br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=190988ECE497 Project: XBee2012-11-10T23:16:09Z<p>Shinnsm: </p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Grading Template ==<br />
I'm using the following template to grade. Each slot is 10 points.<br />
0 = Missing, 5=OK, 10=Wow!<br />
<br />
<pre style="color:red"><br />
00 Executive Summary<br />
05 Installation Instructions <br />
01 User Instructions<br />
00 Highlights<br />
00 Theory of Operation<br />
00 Work Breakdown<br />
00 Future Work<br />
00 Conclusions<br />
00 Demo<br />
00 Late<br />
Comments: I'm looking forward to seeing this.<br />
<br />
Score: 06/100<br />
</pre><br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
Right now the various sensors have been documented and are working. We've received the XBee modules and soldered them as required. So far we've been able to send and receive messages from an XBee connected to a Windows PC to one connected to a Bone, and vice versa. We've started development on C code which is used to send and receive commands on the Bone. When finished, we'll have a library of methods for communication.<br />
<br />
Our next step is to move to Bone-to-Bone communication and to be able to control our sensors wirelessly from one Bone to the other.<br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. A protocol is in development and will be used for controlling sensors wirelessly.<br />
<br />
== General Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
[[File:XBeeBoneConnection.jpg|450px|XBee module connected to a BeagleBone.]]<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE.git https://github.com/duganje/ECE497_XBEE.git] <span style="color:red">(Use 'Git Read-Only' address)</span>. To begin, download the <code>XBee.c</code> <span style="color:red">(XBee.c? Give some more comments in your code. It looks like you are setting the pin MUX.)</span> file which houses our communication methods. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
<br />
== 0.5" Force Sensitive Resistor ==<br />
These instructions are for interfacing the [[SparkFun: 0.5" Force Sensitive Resistor|0.5" Force Sensitive Resistor]] with the XBee.<br />
<br />
=== Required Items ===<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/9375 0.5" Force Sensitive Resistor]<br />
<br />
=== Hardware ===<br />
First we will connect the force-sensitive resistor to the Bone (P9 header). A 27kΩ resistor is used to connect the 3.3V source (pin 3) from the Bone to one pin of the force-sensitive resistor. Then, the other pin of the force-sensitive resistor is connected to ground (pin 1). An analog pin (AIN) on the Bone connects to the node containing both resistors, and values can be read off of that AIN. AIN5 (pin 36) is being used to read values on the Bone.<br />
<br />
Next we will connect the XBee module to the Bone. The table below describes the necessary wiring.<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
With everything wired-up, your connections should match the image below. Click on the image to view the full resolution.<br />
<br />
[[File:ForceResistorXBee.jpg|600px|Picture of connection|link=http://elinux.org/images/3/3b/ForceResistorXBee.jpg]]<br />
<br />
=== Software ===<br />
We're going to start with these two pieces of code as a reference and combine them:<br />
*[https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c Code to interface with the force sensitive resistor]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
Running the code for the force sensitive resistor produces a value from 0 to 4096 depending on how much pressure is applied to the resistor. The harder the resistor is squeezed, the lower this value is. On line 46 of the force sensitive resistor code, <code>analogValue</code> is constantly updated and stores this number.<br />
<br />
The instructions now fork depending on whether you're setting up the sending XBee code or the receiving XBee code. When you're done you will have two C programs, one running on each Bone.<br />
<br />
==== Sending ====<br />
Start with the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c resistor code] as a base and add the following include to the top of the file:<br />
<br />
#include "XBee.h"<br />
<br />
Next, add a call to <code>initializeXbee()</code> in <code>main</code> of the resistor code before the while loop begins.<br />
<br />
In the <code>while</code> loop after the value of <code>analogValue</code> is updated, add this line:<br />
<br />
sendIntXbee(analogValue);<br />
<br />
This will send the integer analog value to the receiving XBee. Now the number is constantly being sent in the while loop.<br />
<br />
==== Receiving ====<br />
Start with the [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee code] as a base and create a <code>main</code> function. First in <code>main</code>, add a call to <code>initializeXbee()</code> to setup the Bone to use the module.<br />
<br />
Next, add a while loop to <code>main</code> which continuously receives the integer analog value from the other Bone using the <code>receiveIntXbee()</code> function. Once the integer value is received, you're free to use that information for whatever purpose you wish. The example code below should give you an idea of how this is done:<br />
<br />
<pre>void main(int argc, char **argv, char **envp) {<br />
// Initialize XBee<br />
initializeXbee();<br />
<br />
// Keep going<br />
while (1) {<br />
int analogValue = receiveIntXbee();<br />
<br />
// Do anything based on analog value<br />
if (analogValue < 1000)<br />
ButtonPressedFunction();<br />
}<br />
}</pre><br />
<br />
==== Sample ====<br />
Based on the instructions above, I've created a sample set of programs. Using two Bones, the send program runs on one and the receive program runs on another. The "send" Bone includes an XBee module and the force sensitive resistor, [[ECE497_Project:_XBee#Hardware_2|hooked-up as described here]]. The second Bone includes the XBee module hooked-up in the same way with the addition of an LED connected to pin 12 (GPIO1_28) of the Bone. Connect the ground pin of the LED to the Bone's ground (pin 1) using a 220Ω resistor.<br />
<br />
Running both programs emulated the original function of the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c force resistor sample code], the only difference being that the data is now sent wirelessly from one Bone to another.<br />
<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/sendProgram.c Send Program]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/receiveProgram.c Receive Program]<br />
<br />
== Wireless 2-Axis Thumb Joystick ==<br />
These instructions are for interfacing the [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]] with the XBee. This application could be useful in a wireless controller setting. <br />
<br />
=== Required Items ===<br />
*2 X [http://adafruit.com/products/513 BeagleBone]<br />
*2 X [http://www.adafruit.com/products/128 XBee Module]<br />
*2 X [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 X [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]]<br />
<br />
=== BeagleBone Wiring Instructions ===<br />
On your first BeagleBone, wire pins 36 and 38 to your two analog inputs. Wire the Beagle's 1.8V VCC output, pin 32, to the VCC input of the Joystick. Finally, wire the select GPIO signal to the GPIO_7 pin or pin 42.<br />
<br />
Wire the XBee as shown in the table below:<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The pinout and visual implementation are shown below.<br />
<br />
[[File:Bone_P9_pinout.jpg|x400px]] [[File:XBee_and_Adafruit_Joystick.jpg|x400px]]<br />
<br />
On the second BeagleBone, wire the XBee exactly as the first XBee (as described in the table above).<br />
<br />
Don't hook up any other hardware to the second XBee as it will be acting as an information hub.<br />
<br />
=== Usage Instructions ===<br />
On both BeagleBones, clone this repository:<br />
<br />
== Magnetometer ==<br />
These instructions are for interfacing the [[Sparkfun: HMC5883L Magnetometer|HMC5883L Magnetometer]] with the XBee.<br />
<br />
The goal is to have the two BeagleBones attached to XBee radios with the one connected to the Magnetometer taking data and transmitting this data to the other Bone which will print the measured data.<br />
<br />
The XBee radios should be connected to both Beagles as shown in the hardware section above. The Magnetometer should be connected as shown in the [[Sparkfun: HMC5883L Magnetometer|hardware]] section of the Magnetometer page. Below is a picture of the Beagle connected to the Magnetometer and the XBee.<br />
<br />
== General Usage ==<br />
These instructions are a general how-to for using the XBee with any sensor.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code> (not created yet). In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate to the XBee. Then in your main.c call: <pre>sendIntXbee(int yourInt);</pre> with chars as a string characters you choose. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the integers which were sent through <code>sendIntXbee(int yourInt)</code> on the 1st board. <br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
<br />
== Highlights ==<br />
<br />
=== Force Sensitive Resistor YouTube Demo ===<br />
{{#ev:youtube|Ds_BWsrvy1I}}<br />
<br />
=== Magnetometer YouTube Demo ===<br />
{{#ev:youtube|99bFqE54UHM}}<br />
<br />
<!--<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
--><br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. With an XBee connected to the Bone's UART 2 as shown above, sent and received messages are written to /dev/ttyO2 (the O is an uppercase O, not a zero).<span style="color:red">(Should be /dev/ttyO2. How do you change serial ports?)</span> Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
--><br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation. (done)<br />
*Thursday, 11/8 - Package language implemented between Bones. (done)<br />
*Sunday, 11/11 - YouTube demo uploaded. (done)<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Presentation day; PowerPoint complete.<br />
<br />
=== Completed Work ===<br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
* Force Sensitive Resistor implementation - Stephen Shinn<br />
* Magnetometer implementation - Josh Dugan<br />
* 2-Axis Thumb Joystick implementation - Matt Moravec<br />
<br />
=== To Do ===<br />
<br />
* Update documentation - All<br />
* Joystick demo - Matt<br />
* Clone repo from scratch and test make<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
TBD<br />
<!--<br />
Suggest addition things that could be done with this project.<br />
--><br />
== Conclusions ==<br />
TBD<br />
<!--<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
--><br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=190982ECE497 Project: XBee2012-11-10T23:11:28Z<p>Shinnsm: update links and milestones/work</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Grading Template ==<br />
I'm using the following template to grade. Each slot is 10 points.<br />
0 = Missing, 5=OK, 10=Wow!<br />
<br />
<pre style="color:red"><br />
00 Executive Summary<br />
05 Installation Instructions <br />
01 User Instructions<br />
00 Highlights<br />
00 Theory of Operation<br />
00 Work Breakdown<br />
00 Future Work<br />
00 Conclusions<br />
00 Demo<br />
00 Late<br />
Comments: I'm looking forward to seeing this.<br />
<br />
Score: 06/100<br />
</pre><br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
Right now the various sensors have been documented and are working. We've received the XBee modules and soldered them as required. So far we've been able to send and receive messages from an XBee connected to a Windows PC to one connected to a Bone, and vice versa. We've started development on C code which is used to send and receive commands on the Bone. When finished, we'll have a library of methods for communication.<br />
<br />
Our next step is to move to Bone-to-Bone communication and to be able to control our sensors wirelessly from one Bone to the other.<br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. A protocol is in development and will be used for controlling sensors wirelessly.<br />
<br />
== General Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
[[File:XBeeBoneConnection.jpg|450px|XBee module connected to a BeagleBone.]]<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE.git https://github.com/duganje/ECE497_XBEE.git] <span style="color:red">(Use 'Git Read-Only' address)</span>. To begin, download the <code>XBee.c</code> <span style="color:red">(XBee.c? Give some more comments in your code. It looks like you are setting the pin MUX.)</span> file which houses our communication methods. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
<br />
== 0.5" Force Sensitive Resistor ==<br />
These instructions are for interfacing the [[SparkFun: 0.5" Force Sensitive Resistor|0.5" Force Sensitive Resistor]] with the XBee.<br />
<br />
=== Required Items ===<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/9375 0.5" Force Sensitive Resistor]<br />
<br />
=== Hardware ===<br />
First we will connect the force-sensitive resistor to the Bone (P9 header). A 27kΩ resistor is used to connect the 3.3V source (pin 3) from the Bone to one pin of the force-sensitive resistor. Then, the other pin of the force-sensitive resistor is connected to ground (pin 1). An analog pin (AIN) on the Bone connects to the node containing both resistors, and values can be read off of that AIN. AIN5 (pin 36) is being used to read values on the Bone.<br />
<br />
Next we will connect the XBee module to the Bone. The table below describes the necessary wiring.<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
With everything wired-up, your connections should match the image below. Click on the image to view the full resolution.<br />
<br />
[[File:ForceResistorXBee.jpg|600px|Picture of connection|link=http://elinux.org/images/3/3b/ForceResistorXBee.jpg]]<br />
<br />
=== Software ===<br />
We're going to start with these two pieces of code as a reference and combine them:<br />
*[https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c Code to interface with the force sensitive resistor]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
Running the code for the force sensitive resistor produces a value from 0 to 4096 depending on how much pressure is applied to the resistor. The harder the resistor is squeezed, the lower this value is. On line 46 of the force sensitive resistor code, <code>analogValue</code> is constantly updated and stores this number.<br />
<br />
The instructions now fork depending on whether you're setting up the sending XBee code or the receiving XBee code. When you're done you will have two C programs, one running on each Bone.<br />
<br />
==== Sending ====<br />
Start with the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c resistor code] as a base and add the following include to the top of the file:<br />
<br />
#include "XBee.h"<br />
<br />
Next, add a call to <code>initializeXbee()</code> in <code>main</code> of the resistor code before the while loop begins.<br />
<br />
In the <code>while</code> loop after the value of <code>analogValue</code> is updated, add this line:<br />
<br />
sendIntXbee(analogValue);<br />
<br />
This will send the integer analog value to the receiving XBee. Now the number is constantly being sent in the while loop.<br />
<br />
==== Receiving ====<br />
Start with the [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee code] as a base and create a <code>main</code> function. First in <code>main</code>, add a call to <code>initializeXbee()</code> to setup the Bone to use the module.<br />
<br />
Next, add a while loop to <code>main</code> which continuously receives the integer analog value from the other Bone using the <code>receiveIntXbee()</code> function. Once the integer value is received, you're free to use that information for whatever purpose you wish. The example code below should give you an idea of how this is done:<br />
<br />
<pre>void main(int argc, char **argv, char **envp) {<br />
// Initialize XBee<br />
initializeXbee();<br />
<br />
// Keep going<br />
while (1) {<br />
int analogValue = receiveIntXbee();<br />
<br />
// Do anything based on analog value<br />
if (analogValue < 1000)<br />
ButtonPressedFunction();<br />
}<br />
}</pre><br />
<br />
==== Sample ====<br />
Based on the instructions above, I've created a sample set of programs. Using two Bones, the send program runs on one and the receive program runs on another. The "send" Bone includes an XBee module and the force sensitive resistor, [[ECE497_Project:_XBee#Hardware_2|hooked-up as described here]]. The second Bone includes the XBee module hooked-up in the same way with the addition of an LED connected to pin 12 (GPIO1_28) of the Bone. Connect the ground pin of the LED to the Bone's ground (pin 1) using a 220Ω resistor.<br />
<br />
Running both programs emulated the original function of the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c force resistor sample code], the only difference being that the data is now sent wirelessly from one Bone to another.<br />
<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/sendProgram.c Send Program]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/ForceResistor/receiveProgram.c Receive Program]<br />
<br />
== Wireless 2-Axis Thumb Joystick ==<br />
These instructions are for interfacing the [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]] with the XBee. This application could be useful in a wireless controller setting. <br />
<br />
=== Required Items ===<br />
*2 X [http://adafruit.com/products/513 BeagleBone]<br />
*2 X [http://www.adafruit.com/products/128 XBee Module]<br />
*2 X [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 X [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]]<br />
<br />
=== BeagleBone Wiring Instructions ===<br />
On your first BeagleBone, wire pins 36 and 38 to your two analog inputs. Wire the Beagle's 1.8V VCC output, pin 32, to the VCC input of the Joystick. Finally, wire the select GPIO signal to the GPIO_7 pin or pin 42.<br />
<br />
Wire the XBee as shown in the table below:<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The pinout and visual implementation are shown below.<br />
<br />
[[File:Bone_P9_pinout.jpg|x400px]] [[File:XBee_and_Adafruit_Joystick.jpg|x400px]]<br />
<br />
On the second BeagleBone, wire the XBee exactly as the first XBee (as described in the table above).<br />
<br />
Don't hook up any other hardware to the second XBee as it will be acting as an information hub.<br />
<br />
=== Usage Instructions ===<br />
On both BeagleBones, clone this repository:<br />
<br />
== Magnetometer ==<br />
These instructions are for interfacing the [[Sparkfun: HMC5883L Magnetometer|HMC5883L Magnetometer]] with the XBee.<br />
<br />
The goal is to have the two BeagleBones attached to XBee radios with the one connected to the Magnetometer taking data and transmitting this data to the other Bone which will print the measured data.<br />
<br />
The XBee radios should be connected to both Beagles as shown in the hardware section above. The Magnetometer should be connected as shown in the [[Sparkfun: HMC5883L Magnetometer|hardware]] section of the Magnetometer page. Below is a picture of the Beagle connected to the Magnetometer and the XBee.<br />
<br />
== General Usage ==<br />
These instructions are a general how-to for using the XBee with any sensor.<br />
<br />
<span style="color:red">(You need two sets of instructions, one for how to use your code for a given sensor. The other for adapting your code to another sensor.)</span><br />
<br />
TO DO: How to use the send and receive functions. Include screenshots.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code> (not created yet). In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate to the XBee. Then in your main.c call: <pre>sendIntXbee(int yourInt);</pre> with chars as a string characters you choose. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the integers which were sent through <code>sendIntXbee(int yourInt)</code> on the 1st board. <br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
<br />
== Highlights ==<br />
<br />
=== Force Sensitive Resistor YouTube Demo ===<br />
{{#ev:youtube|Ds_BWsrvy1I}}<br />
<br />
=== Magnetometer YouTube Demo ===<br />
{{#ev:youtube|99bFqE54UHM}}<br />
<br />
<!--<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
--><br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. With an XBee connected to the Bone's UART 2 as shown above, sent and received messages are written to /dev/ttyO2 (the O is an uppercase O, not a zero).<span style="color:red">(Should be /dev/ttyO2. How do you change serial ports?)</span> Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
--><br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation. (done)<br />
*Thursday, 11/8 - Package language implemented between Bones. (done)<br />
*Sunday, 11/11 - YouTube demo uploaded. (done)<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Presentation day; PowerPoint complete.<br />
<br />
=== Completed Work ===<br />
<br />
<span style="color:red">(It doesn't look like you've done much so far. I'm looking forward to seeing the final project.)</span><br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
* Force Sensitive Resistor implementation - Stephen Shinn<br />
* Magnetometer implementation - Josh Dugan<br />
* 2-Axis Thumb Joystick implementation - Matt Moravec<br />
<br />
=== To Do ===<br />
<br />
* Sensor implementation: starting with the sensors that we interfaced earlier in the class<br />
* Wiki pages<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
TBD<br />
<!--<br />
Suggest addition things that could be done with this project.<br />
--><br />
== Conclusions ==<br />
TBD<br />
<!--<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
--><br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=190976ECE497 Project: XBee2012-11-10T23:07:29Z<p>Shinnsm: added 2 youtube demos</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Grading Template ==<br />
I'm using the following template to grade. Each slot is 10 points.<br />
0 = Missing, 5=OK, 10=Wow!<br />
<br />
<pre style="color:red"><br />
00 Executive Summary<br />
05 Installation Instructions <br />
01 User Instructions<br />
00 Highlights<br />
00 Theory of Operation<br />
00 Work Breakdown<br />
00 Future Work<br />
00 Conclusions<br />
00 Demo<br />
00 Late<br />
Comments: I'm looking forward to seeing this.<br />
<br />
Score: 06/100<br />
</pre><br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
Right now the various sensors have been documented and are working. We've received the XBee modules and soldered them as required. So far we've been able to send and receive messages from an XBee connected to a Windows PC to one connected to a Bone, and vice versa. We've started development on C code which is used to send and receive commands on the Bone. When finished, we'll have a library of methods for communication.<br />
<br />
Our next step is to move to Bone-to-Bone communication and to be able to control our sensors wirelessly from one Bone to the other.<br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. A protocol is in development and will be used for controlling sensors wirelessly.<br />
<br />
== General Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
[[File:XBeeBoneConnection.jpg|450px|XBee module connected to a BeagleBone.]]<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE.git https://github.com/duganje/ECE497_XBEE.git] <span style="color:red">(Use 'Git Read-Only' address)</span>. To begin, download the <code>XBee.c</code> <span style="color:red">(XBee.c? Give some more comments in your code. It looks like you are setting the pin MUX.)</span> file which houses our communication methods. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
<br />
== 0.5" Force Sensitive Resistor ==<br />
These instructions are for interfacing the [[SparkFun: 0.5" Force Sensitive Resistor|0.5" Force Sensitive Resistor]] with the XBee.<br />
<br />
=== Required Items ===<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/9375 0.5" Force Sensitive Resistor]<br />
<br />
=== Hardware ===<br />
First we will connect the force-sensitive resistor to the Bone (P9 header). A 27kΩ resistor is used to connect the 3.3V source (pin 3) from the Bone to one pin of the force-sensitive resistor. Then, the other pin of the force-sensitive resistor is connected to ground (pin 1). An analog pin (AIN) on the Bone connects to the node containing both resistors, and values can be read off of that AIN. AIN5 (pin 36) is being used to read values on the Bone.<br />
<br />
Next we will connect the XBee module to the Bone. The table below describes the necessary wiring.<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
With everything wired-up, your connections should match the image below. Click on the image to view the full resolution.<br />
<br />
[[File:ForceResistorXBee.jpg|600px|Picture of connection|link=http://elinux.org/images/3/3b/ForceResistorXBee.jpg]]<br />
<br />
=== Software ===<br />
We're going to start with these two pieces of code as a reference and combine them:<br />
*[https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c Code to interface with the force sensitive resistor]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
Running the code for the force sensitive resistor produces a value from 0 to 4096 depending on how much pressure is applied to the resistor. The harder the resistor is squeezed, the lower this value is. On line 46 of the force sensitive resistor code, <code>analogValue</code> is constantly updated and stores this number.<br />
<br />
The instructions now fork depending on whether you're setting up the sending XBee code or the receiving XBee code. When you're done you will have two C programs, one running on each Bone.<br />
<br />
==== Sending ====<br />
Start with the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c resistor code] as a base and add the following include to the top of the file:<br />
<br />
#include "XBee.h"<br />
<br />
Next, add a call to <code>initializeXbee()</code> in <code>main</code> of the resistor code before the while loop begins.<br />
<br />
In the <code>while</code> loop after the value of <code>analogValue</code> is updated, add this line:<br />
<br />
sendIntXbee(analogValue);<br />
<br />
This will send the integer analog value to the receiving XBee. Now the number is constantly being sent in the while loop.<br />
<br />
==== Receiving ====<br />
Start with the [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee code] as a base and create a <code>main</code> function. First in <code>main</code>, add a call to <code>initializeXbee()</code> to setup the Bone to use the module.<br />
<br />
Next, add a while loop to <code>main</code> which continuously receives the integer analog value from the other Bone using the <code>receiveIntXbee()</code> function. Once the integer value is received, you're free to use that information for whatever purpose you wish. The example code below should give you an idea of how this is done:<br />
<br />
<pre>void main(int argc, char **argv, char **envp) {<br />
// Initialize XBee<br />
initializeXbee();<br />
<br />
// Keep going<br />
while (1) {<br />
int analogValue = receiveIntXbee();<br />
<br />
// Do anything based on analog value<br />
if (analogValue < 1000)<br />
ButtonPressedFunction();<br />
}<br />
}</pre><br />
<br />
==== Sample ====<br />
Based on the instructions above, I've created a sample set of programs. Using two Bones, the send program runs on one and the receive program runs on another. The "send" Bone includes an XBee module and the force sensitive resistor, [[ECE497_Project:_XBee#Hardware_2|hooked-up as described here]]. The second Bone includes the XBee module hooked-up in the same way with the addition of an LED connected to pin 12 (GPIO1_28) of the Bone. Connect the ground pin of the LED to the Bone's ground (pin 1) using a 220Ω resistor.<br />
<br />
Running both programs emulated the original function of the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c force resistor sample code], the only difference being that the data is now sent wirelessly from one Bone to another.<br />
<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Force%20Sensitive%20Resistor/sendProgram.c Send Program]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Force%20Sensitive%20Resistor/receiveProgram.c Receive Program]<br />
<br />
== Wireless 2-Axis Thumb Joystick ==<br />
These instructions are for interfacing the [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]] with the XBee. This application could be useful in a wireless controller setting. <br />
<br />
=== Required Items ===<br />
*2 X [http://adafruit.com/products/513 BeagleBone]<br />
*2 X [http://www.adafruit.com/products/128 XBee Module]<br />
*2 X [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 X [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]]<br />
<br />
=== BeagleBone Wiring Instructions ===<br />
On your first BeagleBone, wire pins 36 and 38 to your two analog inputs. Wire the Beagle's 1.8V VCC output, pin 32, to the VCC input of the Joystick. Finally, wire the select GPIO signal to the GPIO_7 pin or pin 42.<br />
<br />
Wire the XBee as shown in the table below:<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The pinout and visual implementation are shown below.<br />
<br />
[[File:Bone_P9_pinout.jpg|x400px]] [[File:XBee_and_Adafruit_Joystick.jpg|x400px]]<br />
<br />
On the second BeagleBone, wire the XBee exactly as the first XBee (as described in the table above).<br />
<br />
Don't hook up any other hardware to the second XBee as it will be acting as an information hub.<br />
<br />
=== Usage Instructions ===<br />
On both BeagleBones, clone this repository:<br />
<br />
== Magnetometer ==<br />
These instructions are for interfacing the [[Sparkfun: HMC5883L Magnetometer|HMC5883L Magnetometer]] with the XBee.<br />
<br />
The goal is to have the two BeagleBones attached to XBee radios with the one connected to the Magnetometer taking data and transmitting this data to the other Bone which will print the measured data.<br />
<br />
The XBee radios should be connected to both Beagles as shown in the hardware section above. The Magnetometer should be connected as shown in the [[Sparkfun: HMC5883L Magnetometer|hardware]] section of the Magnetometer page. Below is a picture of the Beagle connected to the Magnetometer and the XBee.<br />
<br />
== General Usage ==<br />
These instructions are a general how-to for using the XBee with any sensor.<br />
<br />
<span style="color:red">(You need two sets of instructions, one for how to use your code for a given sensor. The other for adapting your code to another sensor.)</span><br />
<br />
TO DO: How to use the send and receive functions. Include screenshots.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code> (not created yet). In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate to the XBee. Then in your main.c call: <pre>sendIntXbee(int yourInt);</pre> with chars as a string characters you choose. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the integers which were sent through <code>sendIntXbee(int yourInt)</code> on the 1st board. <br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
<br />
== Highlights ==<br />
<br />
=== Force Sensitive Resistor YouTube Demo ===<br />
{{#ev:youtube|Ds_BWsrvy1I}}<br />
<br />
=== Magnetometer YouTube Demo ===<br />
{{#ev:youtube|99bFqE54UHM}}<br />
<br />
<!--<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
--><br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. With an XBee connected to the Bone's UART 2 as shown above, sent and received messages are written to /dev/ttyO2 (the O is an uppercase O, not a zero).<span style="color:red">(Should be /dev/ttyO2. How do you change serial ports?)</span> Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
--><br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation.<br />
*Thursday, 11/8 - Package language implemented between Bones.<br />
*Sunday, 11/11 - YouTube demo uploaded.<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Presentation day; PowerPoint complete.<br />
<br />
=== Completed Work ===<br />
<br />
<span style="color:red">(It doesn't look like you've done much so far. I'm looking forward to seeing the final project.)</span><br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
<br />
=== To Do ===<br />
<br />
* Sensor implementation: starting with the sensors that we interfaced earlier in the class<br />
* Wiki pages<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
TBD<br />
<!--<br />
Suggest addition things that could be done with this project.<br />
--><br />
== Conclusions ==<br />
TBD<br />
<!--<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
--><br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=190898ECE497 Project: XBee2012-11-09T19:08:58Z<p>Shinnsm: /* Sample */</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Grading Template ==<br />
I'm using the following template to grade. Each slot is 10 points.<br />
0 = Missing, 5=OK, 10=Wow!<br />
<br />
<pre style="color:red"><br />
00 Executive Summary<br />
05 Installation Instructions <br />
01 User Instructions<br />
00 Highlights<br />
00 Theory of Operation<br />
00 Work Breakdown<br />
00 Future Work<br />
00 Conclusions<br />
00 Demo<br />
00 Late<br />
Comments: I'm looking forward to seeing this.<br />
<br />
Score: 06/100<br />
</pre><br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
Right now the various sensors have been documented and are working. We've received the XBee modules and soldered them as required. So far we've been able to send and receive messages from an XBee connected to a Windows PC to one connected to a Bone, and vice versa. We've started development on C code which is used to send and receive commands on the Bone. When finished, we'll have a library of methods for communication.<br />
<br />
Our next step is to move to Bone-to-Bone communication and to be able to control our sensors wirelessly from one Bone to the other.<br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. A protocol is in development and will be used for controlling sensors wirelessly.<br />
<br />
== General Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
[[File:XBeeBoneConnection.jpg|450px|XBee module connected to a BeagleBone.]]<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE.git https://github.com/duganje/ECE497_XBEE.git] <span style="color:red">(Use 'Git Read-Only' address)</span>. To begin, download the <code>XBee.c</code> <span style="color:red">(XBee.c? Give some more comments in your code. It looks like you are setting the pin MUX.)</span> file which houses our communication methods. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
<br />
== 0.5" Force Sensitive Resistor ==<br />
These instructions are for interfacing the [[SparkFun: 0.5" Force Sensitive Resistor|0.5" Force Sensitive Resistor]] with the XBee.<br />
<br />
=== Required Items ===<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/9375 0.5" Force Sensitive Resistor]<br />
<br />
=== Hardware ===<br />
First we will connect the force-sensitive resistor to the Bone (P9 header). A 27kΩ resistor is used to connect the 3.3V source (pin 3) from the Bone to one pin of the force-sensitive resistor. Then, the other pin of the force-sensitive resistor is connected to ground (pin 1). An analog pin (AIN) on the Bone connects to the node containing both resistors, and values can be read off of that AIN. AIN5 (pin 36) is being used to read values on the Bone.<br />
<br />
Next we will connect the XBee module to the Bone. The table below describes the necessary wiring.<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
With everything wired-up, your connections should match the image below. Click on the image to view the full resolution.<br />
<br />
[[File:ForceResistorXBee.jpg|600px|Picture of connection|link=http://elinux.org/images/3/3b/ForceResistorXBee.jpg]]<br />
<br />
=== Software ===<br />
We're going to start with these two pieces of code as a reference and combine them:<br />
*[https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c Code to interface with the force sensitive resistor]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
Running the code for the force sensitive resistor produces a value from 0 to 4096 depending on how much pressure is applied to the resistor. The harder the resistor is squeezed, the lower this value is. On line 46 of the force sensitive resistor code, <code>analogValue</code> is constantly updated and stores this number.<br />
<br />
The instructions now fork depending on whether you're setting up the sending XBee code or the receiving XBee code. When you're done you will have two C programs, one running on each Bone.<br />
<br />
==== Sending ====<br />
Start with the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c resistor code] as a base and add the following include to the top of the file:<br />
<br />
#include "XBee.h"<br />
<br />
Next, add a call to <code>initializeXbee()</code> in <code>main</code> of the resistor code before the while loop begins.<br />
<br />
In the <code>while</code> loop after the value of <code>analogValue</code> is updated, add this line:<br />
<br />
sendIntXbee(analogValue);<br />
<br />
This will send the integer analog value to the receiving XBee. Now the number is constantly being sent in the while loop.<br />
<br />
==== Receiving ====<br />
Start with the [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee code] as a base and create a <code>main</code> function. First in <code>main</code>, add a call to <code>initializeXbee()</code> to setup the Bone to use the module.<br />
<br />
Next, add a while loop to <code>main</code> which continuously receives the integer analog value from the other Bone using the <code>receiveIntXbee()</code> function. Once the integer value is received, you're free to use that information for whatever purpose you wish. The example code below should give you an idea of how this is done:<br />
<br />
<pre>void main(int argc, char **argv, char **envp) {<br />
// Initialize XBee<br />
initializeXbee();<br />
<br />
// Keep going<br />
while (1) {<br />
int analogValue = receiveIntXbee();<br />
<br />
// Do anything based on analog value<br />
if (analogValue < 1000)<br />
ButtonPressedFunction();<br />
}<br />
}</pre><br />
<br />
==== Sample ====<br />
Based on the instructions above, I've created a sample set of programs. Using two Bones, the send program runs on one and the receive program runs on another. The "send" Bone includes an XBee module and the force sensitive resistor, [[ECE497_Project:_XBee#Hardware_2|hooked-up as described here]]. The second Bone includes the XBee module hooked-up in the same way with the addition of an LED connected to pin 12 (GPIO1_28) of the Bone. Connect the ground pin of the LED to the Bone's ground (pin 1) using a 220Ω resistor.<br />
<br />
Running both programs emulated the original function of the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c force resistor sample code], the only difference being that the data is now sent wirelessly from one Bone to another.<br />
<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Force%20Sensitive%20Resistor/sendProgram.c Send Program]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Force%20Sensitive%20Resistor/receiveProgram.c Receive Program]<br />
<br />
== Wireless 2-Axis Thumb Joystick ==<br />
These instructions are for interfacing the [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]] with the XBee. This application could be useful in a wireless controller setting. <br />
<br />
=== Required Items ===<br />
*2 X [http://adafruit.com/products/513 BeagleBone]<br />
*2 X [http://www.adafruit.com/products/128 XBee Module]<br />
*2 X [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 X [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]]<br />
<br />
=== BeagleBone Wiring Instructions ===<br />
On your first BeagleBone, wire pins 36 and 38 to your two analog inputs. Wire the Beagle's 1.8V VCC output, pin 32, to the VCC input of the Joystick. Finally, wire the select GPIO signal to the GPIO_7 pin or pin 42.<br />
<br />
Wire the XBee as shown in the table below:<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The pinout and visual implementation are shown below.<br />
<br />
[[File:Bone_P9_pinout.jpg|x400px]] [[File:XBee_and_Adafruit_Joystick.jpg|x400px]]<br />
<br />
On the second BeagleBone, wire the XBee exactly as the first XBee (as described in the table above).<br />
<br />
Don't hook up any other hardware to the second XBee as it will be acting as an information hub.<br />
<br />
=== Usage Instructions ===<br />
On both BeagleBones, clone this repository:<br />
<br />
== Magnetometer ==<br />
These instructions are for interfacing the [[Sparkfun: HMC5883L Magnetometer|HMC5883L Magnetometer]] with the XBee.<br />
<br />
The goal is to have the two BeagleBones attached to XBee radios with the one connected to the Magnetometer taking data and transmitting this data to the other Bone which will print the measured data.<br />
<br />
The XBee radios should be connected to both Beagles as shown in the hardware section above. The Magnetometer should be connected as shown in the [[Sparkfun: HMC5883L Magnetometer|hardware]] section of the Magnetometer page. Below is a picture of the Beagle connected to the Magnetometer and the XBee.<br />
<br />
== General Usage ==<br />
These instructions are a general how-to for using the XBee with any sensor.<br />
<br />
<span style="color:red">(You need two sets of instructions, one for how to use your code for a given sensor. The other for adapting your code to another sensor.)</span><br />
<br />
TO DO: How to use the send and receive functions. Include screenshots.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code> (not created yet). In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate to the XBee. Then in your main.c call: <pre>sendIntXbee(int yourInt);</pre> with chars as a string characters you choose. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the integers which were sent through <code>sendIntXbee(int yourInt)</code> on the 1st board. <br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
<br />
== Highlights ==<br />
<br />
TBD: Showcase an example of a sensor controlling something wireless.<br />
<!--<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
--><br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. With an XBee connected to the Bone's UART 2 as shown above, sent and received messages are written to /dev/ttyO2 (the O is an uppercase O, not a zero).<span style="color:red">(Should be /dev/ttyO2. How do you change serial ports?)</span> Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
--><br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation.<br />
*Thursday, 11/8 - Package language implemented between Bones.<br />
*Sunday, 11/11 - YouTube demo uploaded.<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Presentation day; PowerPoint complete.<br />
<br />
=== Completed Work ===<br />
<br />
<span style="color:red">(It doesn't look like you've done much so far. I'm looking forward to seeing the final project.)</span><br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
<br />
=== To Do ===<br />
<br />
* Sensor implementation: starting with the sensors that we interfaced earlier in the class<br />
* Wiki pages<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
TBD<br />
<!--<br />
Suggest addition things that could be done with this project.<br />
--><br />
== Conclusions ==<br />
TBD<br />
<!--<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
--><br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=190574ECE497 Project: XBee2012-11-08T17:23:23Z<p>Shinnsm: /* Sample */</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Grading Template ==<br />
I'm using the following template to grade. Each slot is 10 points.<br />
0 = Missing, 5=OK, 10=Wow!<br />
<br />
<pre style="color:red"><br />
00 Executive Summary<br />
05 Installation Instructions <br />
01 User Instructions<br />
00 Highlights<br />
00 Theory of Operation<br />
00 Work Breakdown<br />
00 Future Work<br />
00 Conclusions<br />
00 Demo<br />
00 Late<br />
Comments: I'm looking forward to seeing this.<br />
<br />
Score: 06/100<br />
</pre><br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
Right now the various sensors have been documented and are working. We've received the XBee modules and soldered them as required. So far we've been able to send and receive messages from an XBee connected to a Windows PC to one connected to a Bone, and vice versa. We've started development on C code which is used to send and receive commands on the Bone. When finished, we'll have a library of methods for communication.<br />
<br />
Our next step is to move to Bone-to-Bone communication and to be able to control our sensors wirelessly from one Bone to the other.<br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. A protocol is in development and will be used for controlling sensors wirelessly.<br />
<br />
== General Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
[[File:XBeeBoneConnection.jpg|450px|XBee module connected to a BeagleBone.]]<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [git://github.com/duganje/ECE497_XBEE.git git://github.com/duganje/ECE497_XBEE.git] <span style="color:red">(Use 'Git Read-Only' address)</span>. To begin, download the <code>XBee.c</code> <span style="color:red">(XBee.c? Give some more comments in your code. It looks like you are setting the pin MUX.)</span> file which houses our communication methods. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
<br />
== 0.5" Force Sensitive Resistor ==<br />
These instructions are for interfacing the [[SparkFun: 0.5" Force Sensitive Resistor|0.5" Force Sensitive Resistor]] with the XBee.<br />
<br />
=== Required Items ===<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/9375 0.5" Force Sensitive Resistor]<br />
<br />
=== Hardware ===<br />
First we will connect the force-sensitive resistor to the Bone (P9 header). A 27kΩ resistor is used to connect the 3.3V source (pin 3) from the Bone to one pin of the force-sensitive resistor. Then, the other pin of the force-sensitive resistor is connected to ground (pin 1). An analog pin (AIN) on the Bone connects to the node containing both resistors, and values can be read off of that AIN. AIN5 (pin 36) is being used to read values on the Bone.<br />
<br />
Next we will connect the XBee module to the Bone. The table below describes the necessary wiring.<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
With everything wired-up, your connections should match the image below. Click on the image to view the full resolution.<br />
<br />
[[File:ForceResistorXBee.jpg|600px|Picture of connection|link=http://elinux.org/images/3/3b/ForceResistorXBee.jpg]]<br />
<br />
=== Software ===<br />
We're going to start with these two pieces of code as a reference and combine them:<br />
*[https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c Code to interface with the force sensitive resistor]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
Running the code for the force sensitive resistor produces a value from 0 to 4096 depending on how much pressure is applied to the resistor. The harder the resistor is squeezed, the lower this value is. On line 46 of the force sensitive resistor code, <code>analogValue</code> is constantly updated and stores this number.<br />
<br />
The instructions now fork depending on whether you're setting up the sending XBee code or the receiving XBee code. When you're done you will have two C programs, one running on each Bone.<br />
<br />
==== Sending ====<br />
Start with the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c resistor code] as a base and add the following include to the top of the file:<br />
<br />
#include "XBee.h"<br />
<br />
Next, add a call to <code>initializeXbee()</code> in <code>main</code> of the resistor code before the while loop begins.<br />
<br />
In the <code>while</code> loop after the value of <code>analogValue</code> is updated, add this line:<br />
<br />
sendIntXbee(analogValue);<br />
<br />
This will send the integer analog value to the receiving XBee. Now the number is constantly being sent in the while loop.<br />
<br />
==== Receiving ====<br />
Start with the [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee code] as a base and create a <code>main</code> function. First in <code>main</code>, add a call to <code>initializeXbee()</code> to setup the Bone to use the module.<br />
<br />
Next, add a while loop to <code>main</code> which continuously receives the integer analog value from the other Bone using the <code>receiveIntXbee()</code> function. Once the integer value is received, you're free to use that information for whatever purpose you wish. The example code below should give you an idea of how this is done:<br />
<br />
<pre>void main(int argc, char **argv, char **envp) {<br />
// Initialize XBee<br />
initializeXbee();<br />
<br />
// Keep going<br />
while (1) {<br />
int analogValue = receiveIntXbee();<br />
<br />
// Do anything based on analog value<br />
if (analogValue < 1000)<br />
ButtonPressedFunction();<br />
}<br />
}</pre><br />
<br />
==== Sample ====<br />
Based on the instructions above, I've created a sample set of programs. Using two Bones, the send program runs on one and the receive program runs on another. The "send" Bone includes an XBee module and the force sensitive resistor, [[ECE497_Project:_XBee#Hardware_2|hooked-up as described here]]. The second Bone includes the XBee module hooked-up in the same way and an LED connected to an LED on pin 12 (GPIO1_28).<br />
<br />
Running both programs emulated the original function of the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c force resistor sample code], the only difference being that the data is now sent wirelessly from one Bone to another.<br />
<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Force%20Sensitive%20Resistor/sendProgram.c Send Program]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/Force%20Sensitive%20Resistor/receiveProgram.c Receive Program]<br />
<br />
== Wireless 2-Axis Thumb Joystick ==<br />
These instructions are for interfacing the [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]] with the XBee. This application could be useful in a wireless controller setting. <br />
<br />
=== Required Items ===<br />
*2 X [http://adafruit.com/products/513 BeagleBone]<br />
*2 X [http://www.adafruit.com/products/128 XBee Module]<br />
*2 X [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 X [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]]<br />
<br />
=== BeagleBone Wiring Instructions ===<br />
On your first BeagleBone, wire pins 36 and 38 to your two analog inputs. Wire the Beagle's 1.8V VCC output, pin 32, to the VCC input of the Joystick. Finally, wire the select GPIO signal to the GPIO_7 pin or pin 42.<br />
<br />
Wire the XBee as shown in the table below:<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The pinout and visual implementation are shown below.<br />
<br />
[[File:Bone_P9_pinout.jpg|x400px]] [[File:XBee_and_Adafruit_Joystick.jpg|x400px]]<br />
<br />
On the second BeagleBone, wire the XBee exactly as the first XBee (as described in the table above).<br />
<br />
Don't hook up any other hardware to the second XBee as it will be acting as an information hub.<br />
<br />
=== Usage Instructions ===<br />
On both BeagleBones, clone this repository:<br />
<br />
== Magnetometer ==<br />
These instructions are for interfacing the [[Sparkfun: HMC5883L Magnetometer|HMC5883L Magnetometer]] with the XBee.<br />
<br />
The goal is to have the two BeagleBones attached to XBee radios with the one connected to the Magnetometer taking data and transmitting this data to the other Bone which will print the measured data.<br />
<br />
The XBee radios should be connected to both Beagles as shown in the hardware section above. The Magnetometer should be connected as shown in the [[Sparkfun: HMC5883L Magnetometer|hardware]] section of the Magnetometer page. Below is a picture of the Beagle connected to the Magnetometer and the XBee.<br />
<br />
== General Usage ==<br />
These instructions are a general how-to for using the XBee with any sensor.<br />
<br />
<span style="color:red">(You need two sets of instructions, one for how to use your code for a given sensor. The other for adapting your code to another sensor.)</span><br />
<br />
TO DO: How to use the send and receive functions. Include screenshots.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code> (not created yet). In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate to the XBee. Then in your main.c call: <pre>sendIntXbee(int yourInt);</pre> with chars as a string characters you choose. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the integers which were sent through <code>sendIntXbee(int yourInt)</code> on the 1st board. <br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
<br />
== Highlights ==<br />
<br />
TBD: Showcase an example of a sensor controlling something wireless.<br />
<!--<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
--><br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. With an XBee connected to the Bone's UART 2 as shown above, sent and received messages are written to /dev/ttyO2 (the O is an uppercase O, not a zero).<span style="color:red">(Should be /dev/ttyO2. How do you change serial ports?)</span> Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
--><br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation.<br />
*Thursday, 11/8 - Package language implemented between Bones.<br />
*Sunday, 11/11 - YouTube demo uploaded.<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Presentation day; PowerPoint complete.<br />
<br />
=== Completed Work ===<br />
<br />
<span style="color:red">(It doesn't look like you've done much so far. I'm looking forward to seeing the final project.)</span><br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
<br />
=== To Do ===<br />
<br />
* Sensor implementation: starting with the sensors that we interfaced earlier in the class<br />
* Wiki pages<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
TBD<br />
<!--<br />
Suggest addition things that could be done with this project.<br />
--><br />
== Conclusions ==<br />
TBD<br />
<!--<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
--><br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=190568ECE497 Project: XBee2012-11-08T17:16:22Z<p>Shinnsm: /* Software */</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Grading Template ==<br />
I'm using the following template to grade. Each slot is 10 points.<br />
0 = Missing, 5=OK, 10=Wow!<br />
<br />
<pre style="color:red"><br />
00 Executive Summary<br />
05 Installation Instructions <br />
01 User Instructions<br />
00 Highlights<br />
00 Theory of Operation<br />
00 Work Breakdown<br />
00 Future Work<br />
00 Conclusions<br />
00 Demo<br />
00 Late<br />
Comments: I'm looking forward to seeing this.<br />
<br />
Score: 06/100<br />
</pre><br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
Right now the various sensors have been documented and are working. We've received the XBee modules and soldered them as required. So far we've been able to send and receive messages from an XBee connected to a Windows PC to one connected to a Bone, and vice versa. We've started development on C code which is used to send and receive commands on the Bone. When finished, we'll have a library of methods for communication.<br />
<br />
Our next step is to move to Bone-to-Bone communication and to be able to control our sensors wirelessly from one Bone to the other.<br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. A protocol is in development and will be used for controlling sensors wirelessly.<br />
<br />
== General Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
[[File:XBeeBoneConnection.jpg|450px|XBee module connected to a BeagleBone.]]<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [git://github.com/duganje/ECE497_XBEE.git git://github.com/duganje/ECE497_XBEE.git] <span style="color:red">(Use 'Git Read-Only' address)</span>. To begin, download the <code>XBee.c</code> <span style="color:red">(XBee.c? Give some more comments in your code. It looks like you are setting the pin MUX.)</span> file which houses our communication methods. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
<br />
== 0.5" Force Sensitive Resistor ==<br />
These instructions are for interfacing the [[SparkFun: 0.5" Force Sensitive Resistor|0.5" Force Sensitive Resistor]] with the XBee.<br />
<br />
=== Required Items ===<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/9375 0.5" Force Sensitive Resistor]<br />
<br />
=== Hardware ===<br />
First we will connect the force-sensitive resistor to the Bone (P9 header). A 27kΩ resistor is used to connect the 3.3V source (pin 3) from the Bone to one pin of the force-sensitive resistor. Then, the other pin of the force-sensitive resistor is connected to ground (pin 1). An analog pin (AIN) on the Bone connects to the node containing both resistors, and values can be read off of that AIN. AIN5 (pin 36) is being used to read values on the Bone.<br />
<br />
Next we will connect the XBee module to the Bone. The table below describes the necessary wiring.<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
With everything wired-up, your connections should match the image below. Click on the image to view the full resolution.<br />
<br />
[[File:ForceResistorXBee.jpg|600px|Picture of connection|link=http://elinux.org/images/3/3b/ForceResistorXBee.jpg]]<br />
<br />
=== Software ===<br />
We're going to start with these two pieces of code as a reference and combine them:<br />
*[https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c Code to interface with the force sensitive resistor]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
Running the code for the force sensitive resistor produces a value from 0 to 4096 depending on how much pressure is applied to the resistor. The harder the resistor is squeezed, the lower this value is. On line 46 of the force sensitive resistor code, <code>analogValue</code> is constantly updated and stores this number.<br />
<br />
The instructions now fork depending on whether you're setting up the sending XBee code or the receiving XBee code. When you're done you will have two C programs, one running on each Bone.<br />
<br />
==== Sending ====<br />
Start with the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c resistor code] as a base and add the following include to the top of the file:<br />
<br />
#include "XBee.h"<br />
<br />
Next, add a call to <code>initializeXbee()</code> in <code>main</code> of the resistor code before the while loop begins.<br />
<br />
In the <code>while</code> loop after the value of <code>analogValue</code> is updated, add this line:<br />
<br />
sendIntXbee(analogValue);<br />
<br />
This will send the integer analog value to the receiving XBee. Now the number is constantly being sent in the while loop.<br />
<br />
==== Receiving ====<br />
Start with the [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee code] as a base and create a <code>main</code> function. First in <code>main</code>, add a call to <code>initializeXbee()</code> to setup the Bone to use the module.<br />
<br />
Next, add a while loop to <code>main</code> which continuously receives the integer analog value from the other Bone using the <code>receiveIntXbee()</code> function. Once the integer value is received, you're free to use that information for whatever purpose you wish. The example code below should give you an idea of how this is done:<br />
<br />
<pre>void main(int argc, char **argv, char **envp) {<br />
// Initialize XBee<br />
initializeXbee();<br />
<br />
// Keep going<br />
while (1) {<br />
int analogValue = receiveIntXbee();<br />
<br />
// Do anything based on analog value<br />
if (analogValue < 1000)<br />
ButtonPressedFunction();<br />
}<br />
}</pre><br />
<br />
=== Sample ===<br />
Based on the instructions above, I've created a sample set of programs. Using two Bones, the send program runs on one and the receive program runs on another. The "send" Bone includes an XBee module and the force sensitive resistor, [[ECE497_Project:_XBee#Hardware_2|hooked-up as described here]]. The second Bone includes the XBee module hooked-up in the same way and an LED connected to an LED on pin 12 (GPIO1_28).<br />
<br />
Running both programs emulated the original function of the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c force resistor sample code], the only difference being that the data is now sent wirelessly from one Bone to another.<br />
<br />
...<br />
<br />
== Wireless 2-Axis Thumb Joystick ==<br />
These instructions are for interfacing the [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]] with the XBee. This application could be useful in a wireless controller setting. <br />
<br />
=== Required Items ===<br />
*2 X [http://adafruit.com/products/513 BeagleBone]<br />
*2 X [http://www.adafruit.com/products/128 XBee Module]<br />
*2 X [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 X [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]]<br />
<br />
=== BeagleBone Wiring Instructions ===<br />
On your first BeagleBone, wire pins 36 and 38 to your two analog inputs. Wire the Beagle's 1.8V VCC output, pin 32, to the VCC input of the Joystick. Finally, wire the select GPIO signal to the GPIO_7 pin or pin 42.<br />
<br />
Wire the XBee as shown in the table below:<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The pinout and visual implementation are shown below.<br />
<br />
[[File:Bone_P9_pinout.jpg|x400px]] [[File:XBee_and_Adafruit_Joystick.jpg|x400px]]<br />
<br />
On the second BeagleBone, wire the XBee exactly as the first XBee (as described in the table above).<br />
<br />
Don't hook up any other hardware to the second XBee as it will be acting as an information hub.<br />
<br />
=== Usage Instructions ===<br />
On both BeagleBones, clone this repository:<br />
<br />
== Magnetometer ==<br />
These instructions are for interfacing the [[Sparkfun: HMC5883L Magnetometer|HMC5883L Magnetometer]] with the XBee.<br />
<br />
The goal is to have the two BeagleBones attached to XBee radios with the one connected to the Magnetometer taking data and transmitting this data to the other Bone which will print the measured data.<br />
<br />
The XBee radios should be connected to both Beagles as shown in the hardware section above. The Magnetometer should be connected as shown in the [[Sparkfun: HMC5883L Magnetometer|hardware]] section of the Magnetometer page. Below is a picture of the Beagle connected to the Magnetometer and the XBee.<br />
<br />
== General Usage ==<br />
These instructions are a general how-to for using the XBee with any sensor.<br />
<br />
<span style="color:red">(You need two sets of instructions, one for how to use your code for a given sensor. The other for adapting your code to another sensor.)</span><br />
<br />
TO DO: How to use the send and receive functions. Include screenshots.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code> (not created yet). In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate to the XBee. Then in your main.c call: <pre>sendIntXbee(int yourInt);</pre> with chars as a string characters you choose. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the integers which were sent through <code>sendIntXbee(int yourInt)</code> on the 1st board. <br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
<br />
== Highlights ==<br />
<br />
TBD: Showcase an example of a sensor controlling something wireless.<br />
<!--<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
--><br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. With an XBee connected to the Bone's UART 2 as shown above, sent and received messages are written to /dev/ttyO2 (the O is an uppercase O, not a zero).<span style="color:red">(Should be /dev/ttyO2. How do you change serial ports?)</span> Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
--><br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation.<br />
*Thursday, 11/8 - Package language implemented between Bones.<br />
*Sunday, 11/11 - YouTube demo uploaded.<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Presentation day; PowerPoint complete.<br />
<br />
=== Completed Work ===<br />
<br />
<span style="color:red">(It doesn't look like you've done much so far. I'm looking forward to seeing the final project.)</span><br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
<br />
=== To Do ===<br />
<br />
* Sensor implementation: starting with the sensors that we interfaced earlier in the class<br />
* Wiki pages<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
TBD<br />
<!--<br />
Suggest addition things that could be done with this project.<br />
--><br />
== Conclusions ==<br />
TBD<br />
<!--<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
--><br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=190562ECE497 Project: XBee2012-11-08T17:05:16Z<p>Shinnsm: /* 0.5" Force Sensitive Resistor */</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Grading Template ==<br />
I'm using the following template to grade. Each slot is 10 points.<br />
0 = Missing, 5=OK, 10=Wow!<br />
<br />
<pre style="color:red"><br />
00 Executive Summary<br />
05 Installation Instructions <br />
01 User Instructions<br />
00 Highlights<br />
00 Theory of Operation<br />
00 Work Breakdown<br />
00 Future Work<br />
00 Conclusions<br />
00 Demo<br />
00 Late<br />
Comments: I'm looking forward to seeing this.<br />
<br />
Score: 06/100<br />
</pre><br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
Right now the various sensors have been documented and are working. We've received the XBee modules and soldered them as required. So far we've been able to send and receive messages from an XBee connected to a Windows PC to one connected to a Bone, and vice versa. We've started development on C code which is used to send and receive commands on the Bone. When finished, we'll have a library of methods for communication.<br />
<br />
Our next step is to move to Bone-to-Bone communication and to be able to control our sensors wirelessly from one Bone to the other.<br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. A protocol is in development and will be used for controlling sensors wirelessly.<br />
<br />
== General Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
[[File:XBeeBoneConnection.jpg|450px|XBee module connected to a BeagleBone.]]<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [git://github.com/duganje/ECE497_XBEE.git git://github.com/duganje/ECE497_XBEE.git] <span style="color:red">(Use 'Git Read-Only' address)</span>. To begin, download the <code>XBee.c</code> <span style="color:red">(XBee.c? Give some more comments in your code. It looks like you are setting the pin MUX.)</span> file which houses our communication methods. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
<br />
== 0.5" Force Sensitive Resistor ==<br />
These instructions are for interfacing the [[SparkFun: 0.5" Force Sensitive Resistor|0.5" Force Sensitive Resistor]] with the XBee.<br />
<br />
=== Required Items ===<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/9375 0.5" Force Sensitive Resistor]<br />
<br />
=== Hardware ===<br />
First we will connect the force-sensitive resistor to the Bone (P9 header). A 27kΩ resistor is used to connect the 3.3V source (pin 3) from the Bone to one pin of the force-sensitive resistor. Then, the other pin of the force-sensitive resistor is connected to ground (pin 1). An analog pin (AIN) on the Bone connects to the node containing both resistors, and values can be read off of that AIN. AIN5 (pin 36) is being used to read values on the Bone.<br />
<br />
Next we will connect the XBee module to the Bone. The table below describes the necessary wiring.<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
With everything wired-up, your connections should match the image below. Click on the image to view the full resolution.<br />
<br />
[[File:ForceResistorXBee.jpg|600px|Picture of connection|link=http://elinux.org/images/3/3b/ForceResistorXBee.jpg]]<br />
<br />
=== Software ===<br />
We're going to start with these two pieces of code as a reference and combine them:<br />
*[https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c Code to interface with the force sensitive resistor]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
Running the code for the force sensitive resistor produces a value from 0 to 4096 depending on how much pressure is applied to the resistor. The harder the resistor is squeezed, the lower this value is. On line 46 of the force sensitive resistor code, <code>analogValue</code> is constantly updated and stores this number.<br />
<br />
The instructions now fork depending on whether you're setting up the sending XBee code or the receiving XBee code. When you're done you will have two C programs, one running on each Bone.<br />
<br />
==== Sending ====<br />
Start with the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c resistor code] as a base and add the following include to the top of the file:<br />
<br />
#include "XBee.h"<br />
<br />
Next, add a call to <code>initializeXbee()</code> in <code>main</code> of the resistor code before the while loop begins.<br />
<br />
In the <code>while</code> loop after the value of <code>analogValue</code> is updated, add this line:<br />
<br />
sendIntXbee(analogValue);<br />
<br />
This will send the integer analog value to the receiving XBee. Now the number is constantly being sent in the while loop.<br />
<br />
==== Receiving ====<br />
Start with the [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee code] as a base and create a <code>main</code> function. First in <code>main</code>, add a call to <code>initializeXbee()</code> to setup the Bone to use the module.<br />
<br />
Next, add a while loop to <code>main</code> which continuously receives the integer analog value from the other Bone using the <code>receiveIntXbee()</code> function. Once the integer value is received, you're free to use that information for whatever purpose you wish. The example code below should give you an idea of how this is done:<br />
<br />
<pre>void main(int argc, char **argv, char **envp) {<br />
// Initialize XBee<br />
initializeXbee();<br />
<br />
// Keep going<br />
while (1) {<br />
int analogValue = receiveIntXbee();<br />
<br />
// Do anything based on analog value<br />
if (analogValue < 1000)<br />
ButtonPressedFunction();<br />
}<br />
}</pre><br />
<br />
== Wireless 2-Axis Thumb Joystick ==<br />
These instructions are for interfacing the [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]] with the XBee. This application could be useful in a wireless controller setting. <br />
<br />
=== Required Items ===<br />
*2 X [http://adafruit.com/products/513 BeagleBone]<br />
*2 X [http://www.adafruit.com/products/128 XBee Module]<br />
*2 X [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 X [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]]<br />
<br />
=== BeagleBone Wiring Instructions ===<br />
On your first BeagleBone, wire pins 36 and 38 to your two analog inputs. Wire the Beagle's 1.8V VCC output, pin 32, to the VCC input of the Joystick. Finally, wire the select GPIO signal to the GPIO_7 pin or pin 42.<br />
<br />
Wire the XBee as shown in the table below:<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The pinout and visual implementation are shown below.<br />
<br />
[[File:Bone_P9_pinout.jpg|x400px]] [[File:XBee_and_Adafruit_Joystick.jpg|x400px]]<br />
<br />
On the second BeagleBone, wire the XBee exactly as the first XBee (as described in the table above).<br />
<br />
Don't hook up any other hardware to the second XBee as it will be acting as an information hub.<br />
<br />
=== Usage Instructions ===<br />
On both BeagleBones, clone this repository:<br />
<br />
== Magnetometer ==<br />
These instructions are for interfacing the [[Sparkfun: HMC5883L Magnetometer|HMC5883L Magnetometer]] with the XBee.<br />
<br />
The goal is to have the two BeagleBones attached to XBee radios with the one connected to the Magnetometer taking data and transmitting this data to the other Bone which will print the measured data.<br />
<br />
The XBee radios should be connected to both Beagles as shown in the hardware section above. The Magnetometer should be connected as shown in the [[Sparkfun: HMC5883L Magnetometer|hardware]] section of the Magnetometer page. Below is a picture of the Beagle connected to the Magnetometer and the XBee.<br />
<br />
== General Usage ==<br />
These instructions are a general how-to for using the XBee with any sensor.<br />
<br />
<span style="color:red">(You need two sets of instructions, one for how to use your code for a given sensor. The other for adapting your code to another sensor.)</span><br />
<br />
TO DO: How to use the send and receive functions. Include screenshots.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code> (not created yet). In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate to the XBee. Then in your main.c call: <pre>sendIntXbee(int yourInt);</pre> with chars as a string characters you choose. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the integers which were sent through <code>sendIntXbee(int yourInt)</code> on the 1st board. <br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
<br />
== Highlights ==<br />
<br />
TBD: Showcase an example of a sensor controlling something wireless.<br />
<!--<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
--><br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. With an XBee connected to the Bone's UART 2 as shown above, sent and received messages are written to /dev/ttyO2 (the O is an uppercase O, not a zero).<span style="color:red">(Should be /dev/ttyO2. How do you change serial ports?)</span> Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
--><br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation.<br />
*Thursday, 11/8 - Package language implemented between Bones.<br />
*Sunday, 11/11 - YouTube demo uploaded.<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Presentation day; PowerPoint complete.<br />
<br />
=== Completed Work ===<br />
<br />
<span style="color:red">(It doesn't look like you've done much so far. I'm looking forward to seeing the final project.)</span><br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
<br />
=== To Do ===<br />
<br />
* Sensor implementation: starting with the sensors that we interfaced earlier in the class<br />
* Wiki pages<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
TBD<br />
<!--<br />
Suggest addition things that could be done with this project.<br />
--><br />
== Conclusions ==<br />
TBD<br />
<!--<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
--><br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=190394ECE497 Project: XBee2012-11-08T07:04:14Z<p>Shinnsm: /* Software */</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Grading Template ==<br />
I'm using the following template to grade. Each slot is 10 points.<br />
0 = Missing, 5=OK, 10=Wow!<br />
<br />
<pre style="color:red"><br />
00 Executive Summary<br />
05 Installation Instructions <br />
01 User Instructions<br />
00 Highlights<br />
00 Theory of Operation<br />
00 Work Breakdown<br />
00 Future Work<br />
00 Conclusions<br />
00 Demo<br />
00 Late<br />
Comments: I'm looking forward to seeing this.<br />
<br />
Score: 06/100<br />
</pre><br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
Right now the various sensors have been documented and are working. We've received the XBee modules and soldered them as required. So far we've been able to send and receive messages from an XBee connected to a Windows PC to one connected to a Bone, and vice versa. We've started development on C code which is used to send and receive commands on the Bone. When finished, we'll have a library of methods for communication.<br />
<br />
Our next step is to move to Bone-to-Bone communication and to be able to control our sensors wirelessly from one Bone to the other.<br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. A protocol is in development and will be used for controlling sensors wirelessly.<br />
<br />
== General Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
[[File:XBeeBoneConnection.jpg|450px|XBee module connected to a BeagleBone.]]<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE https://github.com/duganje/ECE497_XBEE] <span style="color:red">(Use 'Git Read-Only' address)</span>. To begin, download the <code>XBee.c</code> <span style="color:red">(XBee.c? Give some more comments in your code. It looks like you are setting the pin MUX.)</span> file which houses our communication methods. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
<br />
== 0.5" Force Sensitive Resistor ==<br />
These instructions are for interfacing the [[SparkFun: 0.5" Force Sensitive Resistor|0.5" Force Sensitive Resistor]] with the XBee.<br />
<br />
=== Required Items ===<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/9375 0.5" Force Sensitive Resistor]<br />
<br />
=== Hardware ===<br />
First we will connect the force-sensitive resistor to the Bone (P9 header). A 27kΩ resistor is used to connect the 3.3V source (pin 3) from the Bone to one pin of the force-sensitive resistor. Then, the other pin of the force-sensitive resistor is connected to ground (pin 1). An analog pin (AIN) on the Bone connects to the node containing both resistors, and values can be read off of that AIN. AIN5 (pin 36) is being used to read values on the Bone.<br />
<br />
Next we will connect the XBee module to the Bone. The table below describes the necessary wiring.<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
With everything wired-up, your connections should match the image below. Click on the image to view the full resolution.<br />
<br />
[[File:ForceResistorXBee.jpg|600px|Picture of connection|link=http://elinux.org/images/3/3b/ForceResistorXBee.jpg]]<br />
<br />
=== Software ===<br />
We're going to start with these two pieces of code as a reference and combine them:<br />
*[https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c Code to interface with the force sensitive resistor]<br />
*[https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c Code to interface with the XBee module]<br />
<br />
Running the code for the force sensitive resistor produces a value from 0 to 4096 depending on how much pressure is applied to the resistor. The harder the resistor is squeezed, the lower this value is. On line 46 of the force sensitive resistor code, <code>analogValue</code> is constantly updated and stores this number.<br />
<br />
The instructions now fork depending on whether you're setting up the sending XBee code or the receiving XBee code. When you're done you will have two C programs, one running on each Bone.<br />
<br />
==== Sending ====<br />
Start with the [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c resistor code] as a base and copy in the following functions from the XBee code: <code>initializeXbee()</code>, <code>sendIntXbee(int value)</code>, and <code>receiveIntXbee()</code>. Add a call to <code>initializeXbee()</code> in <code>main</code> of the resistor code before the while loop begins.<br />
<br />
In the <code>while</code> loop after the value of <code>analogValue</code> is updated, add this line:<br />
<br />
sendIntXbee(int value);<br />
<br />
This will send the integer analog value to the receiving XBee. Now the number is constantly being sent in the while loop.<br />
<br />
==== Receiving ====<br />
Start with the [https://github.com/duganje/ECE497_XBEE/blob/master/XBee.c XBee code] as a base and create a <code>main</code> function. Next add a while loop to <code>main</code> which continuously receives the integer analog value from the other Bone using the <code>receiveIntXbee()</code> function. Once the integer value is received, you're free to use that information for whatever purpose you wish. The example code below should give you an idea of how this is done:<br />
<br />
<pre>void main(int argc, char **argv, char **envp) {<br />
// Keep going<br />
while (1) {<br />
int analogValue = receiveIntXbee();<br />
<br />
// Do anything based on analog value<br />
if (analogValue < 1000)<br />
ButtonPressedFunction();<br />
}<br />
}</pre><br />
<br />
== Wireless 2-Axis Thumb Joystick ==<br />
These instructions are for interfacing the [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]] with the XBee. This application could be useful in a wireless controller setting. <br />
<br />
=== Required Items ===<br />
*2 X [http://adafruit.com/products/513 BeagleBone]<br />
*2 X [http://www.adafruit.com/products/128 XBee Module]<br />
*2 X [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 X [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]]<br />
<br />
=== BeagleBone Wiring Instructions ===<br />
On your first BeagleBone, wire pins 36 and 38 to your two analog inputs. Wire the Beagle's 1.8V VCC output, pin 32, to the VCC input of the Joystick. Finally, wire the select GPIO signal to the GPIO_7 pin or pin 42.<br />
<br />
Wire the XBee as shown in the table below:<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The pinout and visual implementation are shown below.<br />
<br />
[[File:Bone_P9_pinout.jpg|x400px]] [[File:XBee_and_Adafruit_Joystick.jpg|x400px]]<br />
<br />
On the second BeagleBone, wire the XBee exactly as the first XBee (as described in the table above).<br />
<br />
Don't hook up any other hardware to the second XBee as it will be acting as an information hub.<br />
<br />
=== Usage Instructions ===<br />
On both BeagleBones, clone this repository:<br />
<br />
== Magnetometer ==<br />
These instructions are for interfacing the [[Sparkfun: HMC5883L Magnetometer|HMC5883L Magnetometer]] with the XBee.<br />
<br />
The goal is to have the two BeagleBones attached to XBee radios with the one connected to the Magnetometer taking data and transmitting this data to the other Bone which will print the measured data.<br />
<br />
The XBee radios should be connected to both Beagles as shown in the hardware section above. The Magnetometer should be connected as shown in the [[Sparkfun: HMC5883L Magnetometer|hardware]] section of the Magnetometer page. Below is a picture of the Beagle connected to the Magnetometer and the XBee.<br />
<br />
== General Usage ==<br />
These instructions are a general how-to for using the XBee with any sensor.<br />
<br />
<span style="color:red">(You need two sets of instructions, one for how to use your code for a given sensor. The other for adapting your code to another sensor.)</span><br />
<br />
TO DO: How to use the send and receive functions. Include screenshots.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code> (not created yet). In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate to the XBee. Then in your main.c call: <pre>sendIntXbee(int yourInt);</pre> with chars as a string characters you choose. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the integers which were sent through <code>sendIntXbee(int yourInt)</code> on the 1st board. <br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
<br />
== Highlights ==<br />
<br />
TBD: Showcase an example of a sensor controlling something wireless.<br />
<!--<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
--><br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. With an XBee connected to the Bone's UART 2 as shown above, sent and received messages are written to /dev/ttyO2 (the O is an uppercase O, not a zero).<span style="color:red">(Should be /dev/ttyO2. How do you change serial ports?)</span> Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
--><br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation.<br />
*Thursday, 11/8 - Package language implemented between Bones.<br />
*Sunday, 11/11 - YouTube demo uploaded.<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Presentation day; PowerPoint complete.<br />
<br />
=== Completed Work ===<br />
<br />
<span style="color:red">(It doesn't look like you've done much so far. I'm looking forward to seeing the final project.)</span><br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
<br />
=== To Do ===<br />
<br />
* Sensor implementation: starting with the sensors that we interfaced earlier in the class<br />
* Wiki pages<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
TBD<br />
<!--<br />
Suggest addition things that could be done with this project.<br />
--><br />
== Conclusions ==<br />
TBD<br />
<!--<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
--><br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=190376ECE497 Project: XBee2012-11-08T06:41:33Z<p>Shinnsm: /* 0.5" Force Sensitive Resistor */ Hardware</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Grading Template ==<br />
I'm using the following template to grade. Each slot is 10 points.<br />
0 = Missing, 5=OK, 10=Wow!<br />
<br />
<pre style="color:red"><br />
00 Executive Summary<br />
05 Installation Instructions <br />
01 User Instructions<br />
00 Highlights<br />
00 Theory of Operation<br />
00 Work Breakdown<br />
00 Future Work<br />
00 Conclusions<br />
00 Demo<br />
00 Late<br />
Comments: I'm looking forward to seeing this.<br />
<br />
Score: 06/100<br />
</pre><br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
Right now the various sensors have been documented and are working. We've received the XBee modules and soldered them as required. So far we've been able to send and receive messages from an XBee connected to a Windows PC to one connected to a Bone, and vice versa. We've started development on C code which is used to send and receive commands on the Bone. When finished, we'll have a library of methods for communication.<br />
<br />
Our next step is to move to Bone-to-Bone communication and to be able to control our sensors wirelessly from one Bone to the other.<br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. A protocol is in development and will be used for controlling sensors wirelessly.<br />
<br />
== General Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
[[File:XBeeBoneConnection.jpg|450px|XBee module connected to a BeagleBone.]]<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE https://github.com/duganje/ECE497_XBEE] <span style="color:red">(Use 'Git Read-Only' address)</span>. To begin, download the <code>XBee.c</code> <span style="color:red">(XBee.c? Give some more comments in your code. It looks like you are setting the pin MUX.)</span> file which houses our communication methods. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
<br />
== 0.5" Force Sensitive Resistor ==<br />
These instructions are for interfacing the [[SparkFun: 0.5" Force Sensitive Resistor|0.5" Force Sensitive Resistor]] with the XBee.<br />
<br />
=== Required Items ===<br />
*2 x [http://adafruit.com/products/513 BeagleBone]<br />
*2 x [http://www.adafruit.com/products/128 XBee Module]<br />
*2 x [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 x [https://www.sparkfun.com/products/9375 0.5" Force Sensitive Resistor]<br />
<br />
=== Hardware ===<br />
First we will connect the force-sensitive resistor to the Bone (P9 header). A 27kΩ resistor is used to connect the 3.3V source (pin 3) from the Bone to one pin of the force-sensitive resistor. Then, the other pin of the force-sensitive resistor is connected to ground (pin 1). An analog pin (AIN) on the Bone connects to the node containing both resistors, and values can be read off of that AIN. AIN5 (pin 36) is being used to read values on the Bone.<br />
<br />
Next we will connect the XBee module to the Bone. The table below describes the necessary wiring.<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
With everything wired-up, your connections should match the image below. Click on the image to view the full resolution.<br />
<br />
[[File:ForceResistorXBee.jpg|600px|Picture of connection|link=http://elinux.org/images/3/3b/ForceResistorXBee.jpg]]<br />
<br />
=== Software ===<br />
soon<br />
<br />
== Wireless 2-Axis Thumb Joystick ==<br />
These instructions are for interfacing the [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]] with the XBee. This application could be useful in a wireless controller setting. <br />
<br />
=== Required Items ===<br />
*2 X [http://adafruit.com/products/513 BeagleBone]<br />
*2 X [http://www.adafruit.com/products/128 XBee Module]<br />
*2 X [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 X [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]]<br />
<br />
=== BeagleBone Wiring Instructions ===<br />
On your first BeagleBone, wire pins 36 and 38 to your two analog inputs. Wire the Beagle's 1.8V VCC output, pin 32, to the VCC input of the Joystick. Finally, wire the select GPIO signal to the GPIO_7 pin or pin 42.<br />
<br />
Wire the XBee as shown in the table below:<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The pinout and visual implementation are shown below.<br />
<br />
[[File:Bone_P9_pinout.jpg|x400px]] [[File:XBee_and_Adafruit_Joystick.jpg|x400px]]<br />
<br />
On the second BeagleBone, wire the XBee exactly as the first XBee (as described in the table above).<br />
<br />
Don't hook up any other hardware to the second XBee as it will be acting as an information hub.<br />
<br />
=== Usage Instructions ===<br />
On both BeagleBones, clone this repository:<br />
<br />
== Magnetometer ==<br />
These instructions are for interfacing the [[Sparkfun: HMC5883L Magnetometer|HMC5883L Magnetometer]] with the XBee.<br />
<br />
The goal is to have the two BeagleBones attached to XBee radios with the one connected to the Magnetometer taking data and transmitting this data to the other Bone which will print the measured data.<br />
<br />
The XBee radios should be connected to both Beagles as shown in the hardware section above. The Magnetometer should be connected as shown in the [[Sparkfun: HMC5883L Magnetometer|hardware]] section of the Magnetometer page. Below is a picture of the Beagle connected to the Magnetometer and the XBee.<br />
<br />
== General Usage ==<br />
These instructions are a general how-to for using the XBee with any sensor.<br />
<br />
<span style="color:red">(You need two sets of instructions, one for how to use your code for a given sensor. The other for adapting your code to another sensor.)</span><br />
<br />
TO DO: How to use the send and receive functions. Include screenshots.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code> (not created yet). In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate to the XBee. Then in your main.c call: <pre>sendIntXbee(int yourInt);</pre> with chars as a string characters you choose. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the integers which were sent through <code>sendIntXbee(int yourInt)</code> on the 1st board. <br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
<br />
== Highlights ==<br />
<br />
TBD: Showcase an example of a sensor controlling something wireless.<br />
<!--<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
--><br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. With an XBee connected to the Bone's UART 2 as shown above, sent and received messages are written to /dev/ttyO2 (the O is an uppercase O, not a zero).<span style="color:red">(Should be /dev/ttyO2. How do you change serial ports?)</span> Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
--><br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation.<br />
*Thursday, 11/8 - Package language implemented between Bones.<br />
*Sunday, 11/11 - YouTube demo uploaded.<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Presentation day; PowerPoint complete.<br />
<br />
=== Completed Work ===<br />
<br />
<span style="color:red">(It doesn't look like you've done much so far. I'm looking forward to seeing the final project.)</span><br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
<br />
=== To Do ===<br />
<br />
* Sensor implementation: starting with the sensors that we interfaced earlier in the class<br />
* Wiki pages<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
TBD<br />
<!--<br />
Suggest addition things that could be done with this project.<br />
--><br />
== Conclusions ==<br />
TBD<br />
<!--<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
--><br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=190370ECE497 Project: XBee2012-11-08T06:34:41Z<p>Shinnsm: /* Wireless 2-Axis Thumb Joystick */</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Grading Template ==<br />
I'm using the following template to grade. Each slot is 10 points.<br />
0 = Missing, 5=OK, 10=Wow!<br />
<br />
<pre style="color:red"><br />
00 Executive Summary<br />
05 Installation Instructions <br />
01 User Instructions<br />
00 Highlights<br />
00 Theory of Operation<br />
00 Work Breakdown<br />
00 Future Work<br />
00 Conclusions<br />
00 Demo<br />
00 Late<br />
Comments: I'm looking forward to seeing this.<br />
<br />
Score: 06/100<br />
</pre><br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
Right now the various sensors have been documented and are working. We've received the XBee modules and soldered them as required. So far we've been able to send and receive messages from an XBee connected to a Windows PC to one connected to a Bone, and vice versa. We've started development on C code which is used to send and receive commands on the Bone. When finished, we'll have a library of methods for communication.<br />
<br />
Our next step is to move to Bone-to-Bone communication and to be able to control our sensors wirelessly from one Bone to the other.<br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. A protocol is in development and will be used for controlling sensors wirelessly.<br />
<br />
== General Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
[[File:XBeeBoneConnection.jpg|450px|XBee module connected to a BeagleBone.]]<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE https://github.com/duganje/ECE497_XBEE] <span style="color:red">(Use 'Git Read-Only' address)</span>. To begin, download the <code>XBee.c</code> <span style="color:red">(XBee.c? Give some more comments in your code. It looks like you are setting the pin MUX.)</span> file which houses our communication methods. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
<br />
== 0.5" Force Sensitive Resistor ==<br />
These instructions are for interfacing the [[SparkFun: 0.5" Force Sensitive Resistor|0.5" Force Sensitive Resistor]] with the XBee.<br />
<br />
[[File:ForceResistorXBee.jpg|600px]]<br />
<br />
== Wireless 2-Axis Thumb Joystick ==<br />
These instructions are for interfacing the [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]] with the XBee. This application could be useful in a wireless controller setting. <br />
<br />
=== Required Items ===<br />
*2 X [http://adafruit.com/products/513 BeagleBone]<br />
*2 X [http://www.adafruit.com/products/128 XBee Module]<br />
*2 X [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 X [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]]<br />
<br />
=== BeagleBone Wiring Instructions ===<br />
On your first BeagleBone, wire pins 36 and 38 to your two analog inputs. Wire the Beagle's 1.8V VCC output, pin 32, to the VCC input of the Joystick. Finally, wire the select GPIO signal to the GPIO_7 pin or pin 42.<br />
<br />
Wire the XBee as shown in the table below:<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The pinout and visual implementation are shown below.<br />
<br />
[[File:Bone_P9_pinout.jpg|x400px]] [[File:XBee_and_Adafruit_Joystick.jpg|x400px]]<br />
<br />
On the second BeagleBone, wire the XBee exactly as the first XBee (as described in the table above).<br />
<br />
Don't hook up any other hardware to the second XBee as it will be acting as an information hub.<br />
<br />
=== Usage Instructions ===<br />
On both BeagleBones, clone this repository:<br />
<br />
== Magnetometer ==<br />
These instructions are for interfacing the [[Sparkfun: HMC5883L Magnetometer|HMC5883L Magnetometer]] with the XBee.<br />
<br />
The goal is to have the two BeagleBones attached to XBee radios with the one connected to the Magnetometer taking data and transmitting this data to the other Bone which will print the measured data.<br />
<br />
The XBee radios should be connected to both Beagles as shown in the hardware section above. The Magnetometer should be connected as shown in the [[Sparkfun: HMC5883L Magnetometer|hardware]] section of the Magnetometer page. Below is a picture of the Beagle connected to the Magnetometer and the XBee.<br />
<br />
== General Usage ==<br />
These instructions are a general how-to for using the XBee with any sensor.<br />
<br />
<span style="color:red">(You need two sets of instructions, one for how to use your code for a given sensor. The other for adapting your code to another sensor.)</span><br />
<br />
TO DO: How to use the send and receive functions. Include screenshots.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code> (not created yet). In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate to the XBee. Then in your main.c call: <pre>sendIntXbee(int yourInt);</pre> with chars as a string characters you choose. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the integers which were sent through <code>sendIntXbee(int yourInt)</code> on the 1st board. <br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
<br />
== Highlights ==<br />
<br />
TBD: Showcase an example of a sensor controlling something wireless.<br />
<!--<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
--><br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. With an XBee connected to the Bone's UART 2 as shown above, sent and received messages are written to /dev/ttyO2 (the O is an uppercase O, not a zero).<span style="color:red">(Should be /dev/ttyO2. How do you change serial ports?)</span> Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
--><br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation.<br />
*Thursday, 11/8 - Package language implemented between Bones.<br />
*Sunday, 11/11 - YouTube demo uploaded.<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Presentation day; PowerPoint complete.<br />
<br />
=== Completed Work ===<br />
<br />
<span style="color:red">(It doesn't look like you've done much so far. I'm looking forward to seeing the final project.)</span><br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
<br />
=== To Do ===<br />
<br />
* Sensor implementation: starting with the sensors that we interfaced earlier in the class<br />
* Wiki pages<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
TBD<br />
<!--<br />
Suggest addition things that could be done with this project.<br />
--><br />
== Conclusions ==<br />
TBD<br />
<!--<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
--><br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=190160ECE497 Project: XBee2012-11-08T01:27:08Z<p>Shinnsm: /* 0.5" Force Sensitive Resistor */</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Grading Template ==<br />
I'm using the following template to grade. Each slot is 10 points.<br />
0 = Missing, 5=OK, 10=Wow!<br />
<br />
<pre style="color:red"><br />
00 Executive Summary<br />
05 Installation Instructions <br />
01 User Instructions<br />
00 Highlights<br />
00 Theory of Operation<br />
00 Work Breakdown<br />
00 Future Work<br />
00 Conclusions<br />
00 Demo<br />
00 Late<br />
Comments: I'm looking forward to seeing this.<br />
<br />
Score: 06/100<br />
</pre><br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
Right now the various sensors have been documented and are working. We've received the XBee modules and soldered them as required. So far we've been able to send and receive messages from an XBee connected to a Windows PC to one connected to a Bone, and vice versa. We've started development on C code which is used to send and receive commands on the Bone. When finished, we'll have a library of methods for communication.<br />
<br />
Our next step is to move to Bone-to-Bone communication and to be able to control our sensors wirelessly from one Bone to the other.<br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. A protocol is in development and will be used for controlling sensors wirelessly.<br />
<br />
== General Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
[[File:XBeeBoneConnection.jpg|450px|XBee module connected to a BeagleBone.]]<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE https://github.com/duganje/ECE497_XBEE] <span style="color:red">(Use 'Git Read-Only' address)</span>. To begin, download the <code>XBee.c</code> <span style="color:red">(XBee.c? Give some more comments in your code. It looks like you are setting the pin MUX.)</span> file which houses our communication methods. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
<br />
== 0.5" Force Sensitive Resistor ==<br />
These instructions are for interfacing the [[SparkFun: 0.5" Force Sensitive Resistor|0.5" Force Sensitive Resistor]] with the XBee.<br />
<br />
[[File:ForceResistorXBee.jpg|600px]]<br />
<br />
== Wireless 2-Axis Thumb Joystick ==<br />
These instructions are for interfacing the [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]] with the XBee. This application could be useful in a wireless controller setting. <br />
<br />
=== Required Items ===<br />
*2 X [http://adafruit.com/products/513 BeagleBone]<br />
*2 X [http://www.adafruit.com/products/128 XBee Module]<br />
*2 X [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 X [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]]<br />
<br />
=== BeagleBone Wiring Instructions ===<br />
On your first BeagleBone, wire pins 36 and 38 to your two analog inputs. Wire the Beagle's 1.8V VCC output, pin 32, to the VCC input of the Joystick. Finally, wire the select GPIO signal to the GPIO_7 pin or pin 42.<br />
<br />
Wire the XBee as shown in the table below:<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The pinout and visual implementation are shown below.<br />
<br />
[[File:Bone_P9_pinout.jpg|x400px]] [[File:XBee_and_Adafruit_Joystick.jpg|x400px]]<br />
<br />
On the second BeagleBone, wire the XBee exactly as the first XBee was wired or as shown in the table below:<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
Don't hook up any other hardware to the second XBee as it will be acting as an information hub.<br />
<br />
=== Usage Instructions ===<br />
On both Beaglebones, clone this repository:<br />
<br />
== Magnetometer ==<br />
These instructions are for interfacing the [[Sparkfun: HMC5883L Magnetometer|HMC5883L Magnetometer]] with the XBee.<br />
<br />
The goal is to have the two BeagleBones attached to XBee radios with the one connected to the Magnetometer taking data and transmitting this data to the other Bone which will print the measured data.<br />
<br />
The XBee radios should be connected to both Beagles as shown in the hardware section above. The Magnetometer should be connected as shown in the [[Sparkfun: HMC5883L Magnetometer|hardware]] section of the Magnetometer page. Below is a picture of the Beagle connected to the Magnetometer and the XBee.<br />
<br />
== General Usage ==<br />
These instructions are a general how-to for using the XBee with any sensor.<br />
<br />
<span style="color:red">(You need two sets of instructions, one for how to use your code for a given sensor. The other for adapting your code to another sensor.)</span><br />
<br />
TO DO: How to use the send and receive functions. Include screenshots.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code> (not created yet). In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate to the XBee. Then in your main.c call: <pre>sendIntXbee(int yourInt);</pre> with chars as a string characters you choose. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the integers which were sent through <code>sendIntXbee(int yourInt)</code> on the 1st board. <br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
<br />
== Highlights ==<br />
<br />
TBD: Showcase an example of a sensor controlling something wireless.<br />
<!--<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
--><br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. With an XBee connected to the Bone's UART 2 as shown above, sent and received messages are written to /dev/ttyO2 (the O is an uppercase O, not a zero).<span style="color:red">(Should be /dev/ttyO2. How do you change serial ports?)</span> Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
--><br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation.<br />
*Thursday, 11/8 - Package language implemented between Bones.<br />
*Sunday, 11/11 - YouTube demo uploaded.<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Presentation day; PowerPoint complete.<br />
<br />
=== Completed Work ===<br />
<br />
<span style="color:red">(It doesn't look like you've done much so far. I'm looking forward to seeing the final project.)</span><br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
<br />
=== To Do ===<br />
<br />
* Sensor implementation: starting with the sensors that we interfaced earlier in the class<br />
* Wiki pages<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
TBD<br />
<!--<br />
Suggest addition things that could be done with this project.<br />
--><br />
== Conclusions ==<br />
TBD<br />
<!--<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
--><br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=File:ForceResistorXBee.jpg&diff=190154File:ForceResistorXBee.jpg2012-11-08T01:25:58Z<p>Shinnsm: </p>
<hr />
<div></div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=190130ECE497 Project: XBee2012-11-08T01:17:02Z<p>Shinnsm: /* BeagleBone Wiring Instructions */</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Grading Template ==<br />
I'm using the following template to grade. Each slot is 10 points.<br />
0 = Missing, 5=OK, 10=Wow!<br />
<br />
<pre style="color:red"><br />
00 Executive Summary<br />
05 Installation Instructions <br />
01 User Instructions<br />
00 Highlights<br />
00 Theory of Operation<br />
00 Work Breakdown<br />
00 Future Work<br />
00 Conclusions<br />
00 Demo<br />
00 Late<br />
Comments: I'm looking forward to seeing this.<br />
<br />
Score: 06/100<br />
</pre><br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
Right now the various sensors have been documented and are working. We've received the XBee modules and soldered them as required. So far we've been able to send and receive messages from an XBee connected to a Windows PC to one connected to a Bone, and vice versa. We've started development on C code which is used to send and receive commands on the Bone. When finished, we'll have a library of methods for communication.<br />
<br />
Our next step is to move to Bone-to-Bone communication and to be able to control our sensors wirelessly from one Bone to the other.<br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. A protocol is in development and will be used for controlling sensors wirelessly.<br />
<br />
== General Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
[[File:XBeeBoneConnection.jpg|450px|XBee module connected to a BeagleBone.]]<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE https://github.com/duganje/ECE497_XBEE] <span style="color:red">(Use 'Git Read-Only' address)</span>. To begin, download the <code>XBee.c</code> <span style="color:red">(XBee.c? Give some more comments in your code. It looks like you are setting the pin MUX.)</span> file which houses our communication methods. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
<br />
== 0.5" Force Sensitive Resistor ==<br />
These instructions are for interfacing the [[SparkFun: 0.5" Force Sensitive Resistor|0.5" Force Sensitive Resistor]] with the XBee.<br />
<br />
== 2-Axis Thumb Joystick ==<br />
These instructions are for interfacing the [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]] with the XBee. This application could be useful in a wireless controller setting. <br />
<br />
=== Required Items ===<br />
*2 X [http://adafruit.com/products/513 BeagleBone]<br />
*2 X [http://www.adafruit.com/products/128 XBee Module]<br />
*2 X [http://www.adafruit.com/products/126 XBee Adaptor Kit]<br />
*1 X [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]]<br />
<br />
=== BeagleBone Wiring Instructions ===<br />
On your first BeagleBone, wire pins 36 and 38 to your two analog inputs. Wire the Beagle's 1.8V VCC output, pin 32, to the VCC input of the Joystick. Finally, wire the select GPIO signal to the GPIO_7 pin or pin 42.<br />
<br />
Wire the XBee as shown in the table below:<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The pinout and visual implementation are shown below.<br />
<br />
[[File:Bone_P9_pinout.jpg|x400px]] [[File:XBee_and_Adafruit_Joystick.jpg|x400px]]<br />
<br />
On the second BeagleBone, wire the XBee exactly as the first XBee was wired or as shown in the table below:<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
Don't hook up any other hardware to the second XBee as it will be acting as a hub.<br />
<br />
== Magnetometer ==<br />
These instructions are for interfacing the [[Sparkfun: HMC5883L Magnetometer|HMC5883L Magnetometer]] with the XBee.<br />
<br />
The goal is to have the two BeagleBones attached to XBee radios with the one connected to the Magnetometer taking data and transmitting this data to the other Bone which will print the measured data.<br />
<br />
The XBee radios should be connected to both Beagles as shown in the hardware section above. The Magnetometer should be connected as shown in the [[Sparkfun: HMC5883L Magnetometer|hardware]] section of the Magnetometer page. Below is a picture of the Beagle connected to the Magnetometer and the XBee.<br />
<br />
== General Usage ==<br />
These instructions are a general how-to for using the XBee with any sensor.<br />
<br />
<span style="color:red">(You need two sets of instructions, one for how to use your code for a given sensor. The other for adapting your code to another sensor.)</span><br />
<br />
TO DO: How to use the send and receive functions. Include screenshots.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code> (not created yet). In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate to the XBee. Then in your main.c call: <pre>sendIntXbee(int yourInt);</pre> with chars as a string characters you choose. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the integers which were sent through <code>sendIntXbee(int yourInt)</code> on the 1st board. <br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
<br />
== Highlights ==<br />
<br />
TBD: Showcase an example of a sensor controlling something wireless.<br />
<!--<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
--><br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. With an XBee connected to the Bone's UART 2 as shown above, sent and received messages are written to /dev/ttyO2 (the O is an uppercase O, not a zero).<span style="color:red">(Should be /dev/ttyO2. How do you change serial ports?)</span> Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
--><br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation.<br />
*Thursday, 11/8 - Package language implemented between Bones.<br />
*Sunday, 11/11 - YouTube demo uploaded.<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Presentation day; PowerPoint complete.<br />
<br />
=== Completed Work ===<br />
<br />
<span style="color:red">(It doesn't look like you've done much so far. I'm looking forward to seeing the final project.)</span><br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
<br />
=== To Do ===<br />
<br />
* Sensor implementation: starting with the sensors that we interfaced earlier in the class<br />
* Wiki pages<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
TBD<br />
<!--<br />
Suggest addition things that could be done with this project.<br />
--><br />
== Conclusions ==<br />
TBD<br />
<!--<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
--><br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=User:Shinnsm&diff=189026User:Shinnsm2012-11-06T14:41:32Z<p>Shinnsm: </p>
<hr />
<div>Stephen Shinn<br />
<br />
Computer Engineering major, class of 2013.<br />
<br />
== Projects ==<br />
* [[SparkFun: 0.5" Force Sensitive Resistor]]<br />
* [[ECE497 Project: XBee]]<br />
<br />
[[Category:ECE497|Us]]</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=188666ECE497 Project: XBee2012-11-05T17:30:01Z<p>Shinnsm: /* Installation Instructions */</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Grading Template ==<br />
I'm using the following template to grade. Each slot is 10 points.<br />
0 = Missing, 5=OK, 10=Wow!<br />
<br />
<pre style="color:red"><br />
00 Executive Summary<br />
05 Installation Instructions <br />
01 User Instructions<br />
00 Highlights<br />
00 Theory of Operation<br />
00 Work Breakdown<br />
00 Future Work<br />
00 Conclusions<br />
00 Demo<br />
00 Late<br />
Comments: I'm looking forward to seeing this.<br />
<br />
Score: 06/100<br />
</pre><br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
Right now the various sensors have been documented and are working. We've received the XBee modules and soldered them as required. So far we've been able to send and receive messages from an XBee connected to a Windows PC to one connected to a Bone, and vice versa. We've started development on C code which is used to send and receive commands on the Bone. When finished, we'll have a library of methods for communication.<br />
<br />
Our next step is to move to Bone-to-Bone communication and to be able to control our sensors wirelessly from one Bone to the other.<br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. A protocol is in development and will be used for controlling sensors wirelessly.<br />
<br />
== Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{| class="wikitable" style="text-align:center;" width=300px<br />
! align="center"| XBee<br />
! Bone, P9 header<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
[[File:XBeeBoneConnection.jpg|450px|XBee module connected to a BeagleBone.]]<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE github.com/duganje/ECE497_XBEE] <span style="color:red">(Use 'Git Read-Only' address)</span>. To begin, download the <code>serial.c</code> <span style="color:red">(XBee.c? Give some more comments in your code. It looks like you are setting the pin MUX.)</span> file which houses our communication methods. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
<br />
== Specific Sensor Instructions ==<br />
=== 0.5" Force Sensitive Resistor ===<br />
These instructions are for interfacing the [[SparkFun: 0.5" Force Sensitive Resistor|0.5" Force Sensitive Resistor]] with the XBee.<br />
<br />
=== 2-Axis Thumb Joystick ===<br />
These instructions are for interfacing the [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]] with the XBee.<br />
<br />
==== Sample Heading ====<br />
<br />
=== Magnetometer ===<br />
These instructions are for interfacing the [[Sparkfun: HMC5883L Magnetometer|HMC5883L Magnetometer]] with the XBee.<br />
<br />
== General Usage ==<br />
These instructions are a general how-to for using the XBee with any sensor.<br />
<br />
<span style="color:red">(You need two sets of instructions, one for how to use your code for a given sensor. The other for adapting your code to another sensor.)</span><br />
<br />
TO DO: How to use the send and receive functions. Include screenshots.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code> (not created yet). In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate to the XBee. Then in your main.c call: <pre>sendIntXbee(int yourInt);</pre> with chars as a string characters you choose. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the integers which were sent through <code>sendIntXbee(int yourInt)</code> on the 1st board. <br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
<br />
== Highlights ==<br />
<br />
TBD: Showcase an example of a sensor controlling something wireless.<br />
<!--<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
--><br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. With an XBee connected to the Bone's UART, sent and received messages are written to the ttyO2 file.<span style="color:red">(Should be /dev/ttyO2. How do you change serial ports?)</span> Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
--><br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation.<br />
*Thursday, 11/8 - Package language implemented between Bones.<br />
*Sunday, 11/11 - YouTube demo uploaded.<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Presentation day; PowerPoint complete.<br />
<br />
=== Completed Work ===<br />
<br />
<span style="color:red">(It doesn't look like you've done much so far. I'm looking forward to seeing the final project.)</span><br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
<br />
=== To Do ===<br />
<br />
* Sensor implementation: starting with the sensors that we interfaced earlier in the class<br />
* Wiki pages<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
TBD<br />
<!--<br />
Suggest addition things that could be done with this project.<br />
--><br />
== Conclusions ==<br />
TBD<br />
<!--<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
--><br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=188648ECE497 Project: XBee2012-11-05T17:24:09Z<p>Shinnsm: </p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Grading Template ==<br />
I'm using the following template to grade. Each slot is 10 points.<br />
0 = Missing, 5=OK, 10=Wow!<br />
<br />
<pre style="color:red"><br />
00 Executive Summary<br />
05 Installation Instructions <br />
01 User Instructions<br />
00 Highlights<br />
00 Theory of Operation<br />
00 Work Breakdown<br />
00 Future Work<br />
00 Conclusions<br />
00 Demo<br />
00 Late<br />
Comments: I'm looking forward to seeing this.<br />
<br />
Score: 06/100<br />
</pre><br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
Right now the various sensors have been documented and are working. We've received the XBee modules and soldered them as required. So far we've been able to send and receive messages from an XBee connected to a Windows PC to one connected to a Bone, and vice versa. We've started development on C code which is used to send and receive commands on the Bone. When finished, we'll have a library of methods for communication.<br />
<br />
Our next step is to move to Bone-to-Bone communication and to be able to control our sensors wirelessly from one Bone to the other.<br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. A protocol is in development and will be used for controlling sensors wirelessly.<br />
<br />
== Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{|<br />
! align="left"| XBee<br />
! Bone<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22 <span style="color:red">(Which header?)</span><br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
[[File:XBeeBoneConnection.jpg|450px|XBee module connected to a BeagleBone.]]<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE github.com/duganje/ECE497_XBEE] <span style="color:red">(Use 'Git Read-Only' address)</span>. To begin, download the <code>serial.c</code> <span style="color:red">(XBee.c? Give some more comments in your code. It looks like you are setting the pin MUX.)</span> file which houses our communication methods. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
<br />
== Specific Sensor Instructions ==<br />
=== 0.5" Force Sensitive Resistor ===<br />
These instructions are for interfacing the [[SparkFun: 0.5" Force Sensitive Resistor|0.5" Force Sensitive Resistor]] with the XBee.<br />
<br />
=== 2-Axis Thumb Joystick ===<br />
These instructions are for interfacing the [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]] with the XBee.<br />
<br />
==== Sample Heading ====<br />
<br />
=== Magnetometer ===<br />
These instructions are for interfacing the [[Sparkfun: HMC5883L Magnetometer|HMC5883L Magnetometer]] with the XBee.<br />
<br />
== General Usage ==<br />
These instructions are a general how-to for using the XBee with any sensor.<br />
<br />
<span style="color:red">(You need two sets of instructions, one for how to use your code for a given sensor. The other for adapting your code to another sensor.)</span><br />
<br />
TO DO: How to use the send and receive functions. Include screenshots.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code> (not created yet). In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate to the XBee. Then in your main.c call: <pre>sendIntXbee(int yourInt);</pre> with chars as a string characters you choose. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the integers which were sent through <code>sendIntXbee(int yourInt)</code> on the 1st board. <br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
<br />
== Highlights ==<br />
<br />
TBD: Showcase an example of a sensor controlling something wireless.<br />
<!--<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
--><br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. With an XBee connected to the Bone's UART, sent and received messages are written to the ttyO2 file.<span style="color:red">(Should be /dev/ttyO2. How do you change serial ports?)</span> Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
--><br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation.<br />
*Thursday, 11/8 - Package language implemented between Bones.<br />
*Sunday, 11/11 - YouTube demo uploaded.<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Presentation day; PowerPoint complete.<br />
<br />
=== Completed Work ===<br />
<br />
<span style="color:red">(It doesn't look like you've done much so far. I'm looking forward to seeing the final project.)</span><br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
<br />
=== To Do ===<br />
<br />
* Sensor implementation: starting with the sensors that we interfaced earlier in the class<br />
* Wiki pages<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
TBD<br />
<!--<br />
Suggest addition things that could be done with this project.<br />
--><br />
== Conclusions ==<br />
TBD<br />
<!--<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
--><br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=188612ECE497 Project: XBee2012-11-05T17:12:11Z<p>Shinnsm: /* User Instructions */</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Grading Template ==<br />
I'm using the following template to grade. Each slot is 10 points.<br />
0 = Missing, 5=OK, 10=Wow!<br />
<br />
<pre style="color:red"><br />
00 Executive Summary<br />
05 Installation Instructions <br />
01 User Instructions<br />
00 Highlights<br />
00 Theory of Operation<br />
00 Work Breakdown<br />
00 Future Work<br />
00 Conclusions<br />
00 Demo<br />
00 Late<br />
Comments: I'm looking forward to seeing this.<br />
<br />
Score: 06/100<br />
</pre><br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
Right now the various sensors have been documented and are working. We've received the XBee modules and soldered them as required. So far we've been able to send and receive messages from an XBee connected to a Windows PC to one connected to a Bone, and vice versa. We've started development on C code which is used to send and receive commands on the Bone. When finished, we'll have a library of methods for communication.<br />
<br />
Our next step is to move to Bone-to-Bone communication and to be able to control our sensors wirelessly from one Bone to the other.<br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. A protocol is in development and will be used for controlling sensors wirelessly.<br />
<br />
== Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{|<br />
! align="left"| XBee<br />
! Bone<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22 <span style="color:red">(Which header?)</span><br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
[[File:XBeeBoneConnection.jpg|450px|XBee module connected to a BeagleBone.]]<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE github.com/duganje/ECE497_XBEE] <span style="color:red">(Use 'Git Read-Only' address)</span>. To begin, download the <code>serial.c</code> <span style="color:red">(XBee.c? Give some more comments in your code. It looks like you are setting the pin MUX.)</span> file which houses our communication methods. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
<br />
== User Instructions ==<br />
=== Specific Sensors ===<br />
==== 0.5" Force Sensitive Resistor ====<br />
These instructions are for interfacing the [[SparkFun: 0.5" Force Sensitive Resistor|0.5" Force Sensitive Resistor]] with the XBee.<br />
<br />
==== 2-Axis Thumb Joystick ====<br />
These instructions are for interfacing the [[Adafruit: 2-Axis Thumb Joystick|2-Axis Thumb Joystick]] with the XBee.<br />
<br />
==== Magnetometer ====<br />
These instructions are for interfacing the [[Sparkfun: HMC5883L Magnetometer|HMC5883L Magnetometer]] with the XBee.<br />
<br />
=== General Usage ===<br />
These instructions are a general how-to for using the XBee with any sensor.<br />
<br />
<span style="color:red">(You need two sets of instructions, one for how to use your code for a given sensor. The other for adapting your code to another sensor.)</span><br />
<br />
TO DO: How to use the send and receive functions. Include screenshots.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code> (not created yet). In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate to the XBee. Then in your main.c call: <pre>sendIntXbee(int yourInt);</pre> with chars as a string characters you choose. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the integers which were sent through <code>sendIntXbee(int yourInt)</code> on the 1st board. <br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
<br />
== Highlights ==<br />
<br />
TBD: Showcase an example of a sensor controlling something wireless.<br />
<!--<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
--><br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. With an XBee connected to the Bone's UART, sent and received messages are written to the ttyO2 file.<span style="color:red">(Should be /dev/ttyO2. How do you change serial ports?)</span> Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
--><br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation.<br />
*Thursday, 11/8 - Package language implemented between Bones.<br />
*Sunday, 11/11 - YouTube demo uploaded.<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Presentation day; PowerPoint complete.<br />
<br />
=== Completed Work ===<br />
<br />
<span style="color:red">(It doesn't look like you've done much so far. I'm looking forward to seeing the final project.)</span><br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
<br />
=== To Do ===<br />
<br />
* Sensor implementation: starting with the sensors that we interfaced earlier in the class<br />
* Wiki pages<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
TBD<br />
<!--<br />
Suggest addition things that could be done with this project.<br />
--><br />
== Conclusions ==<br />
TBD<br />
<!--<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
--><br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=187094ECE497 Project: XBee2012-11-02T17:56:56Z<p>Shinnsm: /* Hardware */ uploaded image</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
Right now the various sensors have been documented and are working. We've received the XBee modules and soldered them as required. So far we've been able to send a receive messages from an XBee connected to a Windows PC to one connected to a Bone, and vice versa. We've started development on C code which is used to send and receive commands on the Bone. When finished, we'll have a library of methods for communication.<br />
<br />
Our next step is to move to Bone-to-Bone communication and to be able to control our sensors wirelessly from one Bone to the other.<br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. A protocol is in development and will be used for controlling sensors wirelessly.<br />
<br />
== Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{|<br />
! align="left"| XBee<br />
! Bone<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
[[File:XBeeBoneConnection.jpg|450px|XBee module connected to a BeagleBone.]]<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE github.com/duganje/ECE497_XBEE]. To begin, download the <code>serial.c</code> file which houses our communication methods. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
== User Instructions ==<br />
<br />
TO DO: How to use the send and receive functions. Include screenshots.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code> (not created yet). In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate to the XBee. Then in your main.c call: <pre>sendIntXbee(chars);</pre> with chars as a string characters you choose. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the string of characters which were sent through <code>sendIntXbee()</code> on the 1st board. <br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
== Highlights ==<br />
<br />
TBD: Showcase an example of a sensor controlling something wireless.<br />
<!--<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
--><br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. With an XBee connected to the Bone's UART, sent and received messages are written to the ttyO2 file. Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
--><br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation.<br />
*Thursday, 11/8 - Package language implemented between Bones.<br />
*Sunday, 11/11 - YouTube demo uploaded.<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Presentation day; PowerPoint complete.<br />
<br />
=== Completed Work ===<br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
<br />
=== To Do ===<br />
<br />
* Sensor implementation: starting with the sensors that we interfaced earlier in the class<br />
* Wiki pages<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
TBD<br />
<!--<br />
Suggest addition things that could be done with this project.<br />
--><br />
== Conclusions ==<br />
TBD<br />
<!--<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
--><br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=File:XBeeBoneConnection.jpg&diff=187088File:XBeeBoneConnection.jpg2012-11-02T17:55:52Z<p>Shinnsm: XBee module connected to a BeagleBone.</p>
<hr />
<div>XBee module connected to a BeagleBone.</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=186836ECE497 Project: XBee2012-11-02T16:31:54Z<p>Shinnsm: update functions</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
Right now the various sensors have been documented and are working. We've received the XBee modules and soldered them as required. So far we've been able to send a receive messages from an XBee connected to a Windows PC to one connected to a Bone, and vice versa. We've started development on C code which is used to send and receive commands on the Bone. When finished, we'll have a library of methods for communication.<br />
<br />
Our next step is to move to Bone-to-Bone communication and to be able to control our sensors wirelessly from one Bone to the other.<br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. A protocol is in development and will be used for controlling sensors wirelessly.<br />
<br />
== Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{|<br />
! align="left"| XBee<br />
! Bone<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
http://i.imgur.com/zm4uu.jpg<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE github.com/duganje/ECE497_XBEE]. To begin, download the <code>serial.c</code> file which houses our communication methods. You are now able to send data wirelessly using the <code>SendIntXbee()</code> and <code>ReceiveIntXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
== User Instructions ==<br />
<br />
TO DO: How to use the send and receive functions. Include screenshots.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, <code>XBee.h</code> (not created yet). In your <code>main.c</code> file or your program, first run: <pre>initializeXbee();</pre> which sets the pins we will need to communicate to the XBee. Then in your main.c call: <pre>sendIntXbee(chars);</pre> with chars as a string characters you choose. On your 2nd BeagleBone, call: <pre>receiveIntXbee();</pre> which will return the string of characters which were sent through <code>sendIntXbee()</code> on the 1st board. <br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
== Highlights ==<br />
<br />
TBD: Showcase an example of a sensor controlling something wireless.<br />
<!--<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
--><br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. With an XBee connected to the Bone's UART, sent and received messages are written to the ttyO2 file. Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
--><br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation.<br />
*Thursday, 11/8 - Package language implemented between Bones.<br />
*Sunday, 11/11 - YouTube demo uploaded.<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Presentation day; PowerPoint complete.<br />
<br />
=== Completed Work ===<br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
<br />
=== To Do ===<br />
<br />
* Sensor implementation: starting with the sensors that we interfaced earlier in the class<br />
* Wiki pages<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
TBD<br />
<!--<br />
Suggest addition things that could be done with this project.<br />
--><br />
== Conclusions ==<br />
TBD<br />
<!--<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
--><br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=186830ECE497 Project: XBee2012-11-02T16:18:44Z<p>Shinnsm: formatting</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
Right now the various sensors have been documented and are working. We've received the XBee modules and soldered them as required. So far we've been able to send a receive messages from an XBee connected to a Windows PC to one connected to a Bone, and vice versa. We've started development on C code which is used to send and receive commands on the Bone. When finished, we'll have a library of methods for communication.<br />
<br />
Our next step is to move to Bone-to-Bone communication and to be able to control our sensors wirelessly from one Bone to the other.<br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. A protocol is in development and will be used for controlling sensors wirelessly.<br />
<br />
== Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{|<br />
! align="left"| XBee<br />
! Bone<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
http://i.imgur.com/zm4uu.jpg<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE github.com/duganje/ECE497_XBEE]. To begin, download the <code>serial.c</code> file which houses our communication methods. You are now able to send data wirelessly using the <code>SendXbee()</code> and <code>ReceiveXbee()</code> functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
== User Instructions ==<br />
<br />
TO DO: How to use the send and receive functions. Include screenshots.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, XBee.h. In your main.c file or your program, first run: <pre>initializeXBee();</pre> which sets the pins we will need to communicate to the XBee. Then in your main.c call: <pre>sendXBee(chars);</pre> with chars as a string characters you choose. On your 2nd BeagleBone, call: <pre>receiveXBee();</pre> which will return the string of characters which were sent through <code>sendXBee()</code> on the 1st board. <br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
== Highlights ==<br />
<br />
TBD: Showcase an example of a sensor controlling something wireless.<br />
<!--<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
--><br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. With an XBee connected to the Bone's UART, sent and received messages are written to the ttyO2 file. Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
--><br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation.<br />
*Thursday, 11/8 - Package language implemented between Bones.<br />
*Sunday, 11/11 - YouTube demo uploaded.<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Presentation day; PowerPoint complete.<br />
<br />
=== Completed Work ===<br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
<br />
=== To Do ===<br />
<br />
* Sensor implementation: starting with the sensors that we interfaced earlier in the class<br />
* Wiki pages<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
TBD<br />
<!--<br />
Suggest addition things that could be done with this project.<br />
--><br />
== Conclusions ==<br />
TBD<br />
<!--<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
--><br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=User_talk:Wmat&diff=186806User talk:Wmat2012-11-02T16:09:01Z<p>Shinnsm: /* Image uploads are broken */ new section</p>
<hr />
<div>Test talk page email.<br />
<br />
Hi there. Are you able to remove spam user accounts? I've been blanking out their user pages but it would be good to remove the accounts completely. [[User:Andrewmk|Andrewmk]] 15:35, 3 August 2012 (UTC)<br />
<br />
Yes, I typically monitor the Recent Changes and when I see spam, I delete it and ban the User. --[[User:Wmat|Wmat]] 15:57, 3 August 2012 (UTC)<br />
<br />
== Adminship ==<br />
<br />
Hi, I'm Jeff, and I'd love to help you out on eLinux. I am on MediaWiki.org (User:Jeffwang) and I also run my own web host service (http://www.mywikis.com). I have years of experience on wikis and with adminship, I can help you ban spam users. Thank you. --[[User:Jeff|Jeff]] 23:04, 20 September 2012 (UTC)<br />
:Replied to your email. Good luck with those bogus accounts!<br />
<br />
== Image uploads are broken ==<br />
<br />
FYI. --[[User:Shinnsm|Shinnsm]] ([[User talk:Shinnsm|talk]]) 16:09, 2 November 2012 (UTC)</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=186794ECE497 Project: XBee2012-11-02T16:07:19Z<p>Shinnsm: /* Installation Instructions */</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
Right now the various sensors have been documented and are working. We've received the XBee modules and soldered them as required. So far we've been able to send a receive messages from an XBee connected to a Windows PC to one connected to a Bone, and vice versa. We've started development on C code which is used to send and receive commands on the Bone. When finished, we'll have a library of methods for communication.<br />
<br />
Our next step is to move to Bone-to-Bone communication and to be able to control our sensors wirelessly from one Bone to the other.<br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. A protocol is in development and will be used for controlling sensors wirelessly.<br />
<br />
== Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{|<br />
! align="left"| XBee<br />
! Bone<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
http://i.imgur.com/zm4uu.jpg<br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE github.com/duganje/ECE497_XBEE]. To begin, download the C file which houses our communication methods. You are now able to send data wirelessly using the SendXbee() and ReceiveXbee() functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
<br />
== User Instructions ==<br />
<br />
TO DO: How to use the send and receive functions. Include screenshots.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, XBee.h. In your main.c file or your program, first run initializeXBee(); which sets the pins we will need to communicate to the XBee. Then in your main.c call sendXBee(chars); with chars as a string characters you choose. On your 2nd beagleboard, call receiveXBee(); which will return the string of characters which were sent through sendXBee() on the 1st board. <br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
== Highlights ==<br />
<br />
TBD: Showcase an example of a sensor controlling something wireless.<br />
<!--<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
--><br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. With an XBee connected to the Bone's UART, sent and received messages are written to the ttyO2 file. Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
--><br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation.<br />
*Thursday, 11/8 - Package language implemented between Bones.<br />
*Sunday, 11/11 - YouTube demo uploaded.<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Presentation day; PowerPoint complete.<br />
<br />
=== Completed Work ===<br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
<br />
=== To Do ===<br />
<br />
* Sensor implementation: starting with the sensors that we interfaced earlier in the class<br />
* Wiki pages<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
TBD<br />
<!--<br />
Suggest addition things that could be done with this project.<br />
--><br />
== Conclusions ==<br />
TBD<br />
<!--<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
--><br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=186698ECE497 Project: XBee2012-11-02T15:48:51Z<p>Shinnsm: formatting</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
Right now the various sensors have been documented and are working. We've received the XBee modules and soldered them as required. So far we've been able to send a receive messages from an XBee connected to a Windows PC to one connected to a Bone, and vice versa. We've started development on C code which is used to send and receive commands on the Bone. When finished, we'll have a library of methods for communication.<br />
<br />
Our next step is to move to Bone-to-Bone communication and to be able to control our sensors wirelessly from one Bone to the other.<br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. A protocol is in development and will be used for controlling sensors wirelessly.<br />
<br />
== Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{|<br />
! align="left"| XBee<br />
! Bone<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
<PIC><br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE github.com/duganje/ECE497_XBEE]. To begin, download the C file which houses our communication methods. You are now able to send data wirelessly using the SendXbee() and ReceiveXbee() functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
== User Instructions ==<br />
<br />
TO DO: How to use the send and receive functions. Include screenshots.<br />
<br />
After cloning our repository to your favorite location, include the necessary header file, XBee.h. In your main.c file or your program, first run initializeXBee(); which sets the pins we will need to communicate to the XBee. Then in your main.c call sendXBee(chars); with chars as a string characters you choose. On your 2nd beagleboard, call receiveXBee(); which will return the string of characters which were sent through sendXBee() on the 1st board. <br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
== Highlights ==<br />
<br />
TBD: Showcase an example of a sensor controlling something wireless.<br />
<!--<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
--><br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. With an XBee connected to the Bone's UART, sent and received messages are written to the ttyO2 file. Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
--><br />
<br />
== Work Breakdown ==<br />
<br />
=== Milestones ===<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation.<br />
*Thursday, 11/8 - Package language implemented between Bones.<br />
*Sunday, 11/11 - YouTube demo uploaded.<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Presentation day; PowerPoint complete.<br />
<br />
=== Completed Work ===<br />
<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
<br />
=== To Do ===<br />
<br />
* Sensor implementation: starting with the sensors that we interfaced earlier in the class<br />
* Wiki pages<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
TBD<br />
<!--<br />
Suggest addition things that could be done with this project.<br />
--><br />
== Conclusions ==<br />
TBD<br />
<!--<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
--><br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=186122ECE497 Project: XBee2012-11-01T21:53:21Z<p>Shinnsm: cleanup</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
Right now the various sensors have been documented and are working. We've received the XBee modules and soldered them as required. So far we've been able to send a receive messages from an XBee connected to a Windows PC to one connected to a Bone, and vice versa. We've started development on C code which is used to send and receive commands on the Bone. When finished, we'll have a library of methods for communication.<br />
<br />
Our next step is to move to Bone-to-Bone communication and to be able to control our sensors wirelessly from one Bone to the other.<br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. A protocol is in development and will be used for controlling sensors wirelessly.<br />
<br />
== Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{|<br />
! align="left"| XBee<br />
! Bone<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
<PIC><br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE github.com/duganje/ECE497_XBEE]. To begin, download the C file which houses our communication methods. You are now able to send data wirelessly using the SendXbee() and ReceiveXbee() functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
== User Instructions ==<br />
<br />
TO DO: How to use the send and receive functions. Include screenshots.<br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
== Highlights ==<br />
TBD: Showcase an example of a sensor controlling something wireless.<br />
<!--<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
--><br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. With an XBee connected to the Bone's UART, sent and received messages are written to the ttyO2 file. Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
--><br />
<br />
== Work Breakdown ==<br />
=== Milestones ===<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation.<br />
*Thursday, 11/8 - Package language implemented between Bones.<br />
*Sunday, 11/11 - YouTube demo uploaded.<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Presentation day; PowerPoint complete.<br />
<br />
=== Completed Work ===<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
<br />
=== To Do ===<br />
* Sensor implementation<br />
* Wiki pages<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
TBD<br />
<!--<br />
Suggest addition things that could be done with this project.<br />
--><br />
== Conclusions ==<br />
TBD<br />
<!--<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
--><br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=186110ECE497 Project: XBee2012-11-01T21:45:57Z<p>Shinnsm: More info on our progress</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Executive Summary ==<br />
<br />
The XBee project involves taking two series-one XBee modules and interfacing them with the various sensors that have been documented in our ECE497 group. Our goal is to create wiki pages which expand on the sensors to include sample wireless communication documentation and source code.<br />
<br />
Right now the various sensors have been documented and are working. We've received the XBee modules and soldered them as required. So far we've been able to send a receive messages from an XBee connected to a Windows PC to one connected to a Bone, and vice versa. We've started development on C code which is used to send and receive commands on the Bone. When finished, we'll have a library of methods for communication.<br />
<br />
Our next step is to move to Bone-to-Bone communication and to be able to control our sensors wirelessly from one Bone to the other.<br />
<br />
In conclusion, we're using XBee modules to communicate from one Bone to another. A protocol is in development and will be used for controlling sensors wirelessly.<br />
<br />
== Installation Instructions ==<br />
<br />
=== Hardware ===<br />
<br />
The very first step is to solder your XBee module, see [http://www.ladyada.net/make/xbee/solder.html the instructions here]. Once the module is assembled, you may wire-up the XBee module to the BeagleBone's serial ports. The table below describes how to hook up the module to UART2 on the Bone:<br />
<br />
{|<br />
! align="left"| XBee<br />
! Bone<br />
|-<br />
|GND<br />
|Ground, port 1<br />
|-<br />
|3V<br />
|3.3V, port 3<br />
|-<br />
|TX<br />
|RX, port 22<br />
|-<br />
|RX<br />
|TX, port 21<br />
|}<br />
<br />
The image below shows the configuration:<br />
<br />
<PIC><br />
<br />
=== Software ===<br />
<br />
Our git repo for this project is available here: [https://github.com/duganje/ECE497_XBEE github.com/duganje/ECE497_XBEE]. To begin, download the C file which houses our communication methods. You are now able to send data wirelessly using the SendXbee() and ReceiveXbee() functions. Repeat this procedure on a separate BeagleBone and use the same functions to receive and reply data.<br />
<!--<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
--><br />
== User Instructions ==<br />
<br />
TO DO: How to use the send and receive functions. Include screenshots.<br />
<!--<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
--><br />
== Highlights ==<br />
<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
<br />
== Theory of Operation ==<br />
<br />
The main theory of operation is based on Linux's use of files. With an XBee connected to the Bone's UART, sent and received messages are written to the ttyO2 file. Our code uses this and reads the file to receive a message and writes to the file to send a message. Any XBee's on the same network wil receive the message and we can do anything we want with it.<br />
<!--<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.--><br />
<br />
== Milestones ==<br />
<br />
*Monday, 10/29 - XBee hardware received. (done)<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent. (done)<br />
*Monday, 11/5 - Initial sensor implementation.<br />
*Thursday, 11/8 - Package language implemented between Bones.<br />
*Sunday, 11/11 - YouTube demo uploaded.<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Presentation day; PowerPoint complete.<br />
<br />
== Work Breakdown ==<br />
=== Completed Work ===<br />
* Soldering XBee's - Matt Moravec<br />
* Initial communication methods - Stephen Shinn<br />
* Expanded communication methods - Josh Dugan<br />
<br />
=== To Do ===<br />
* Sensor implementation<br />
* Wiki pages<br />
<!--<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
--><br />
== Future Work ==<br />
<br />
Suggest addition things that could be done with this project.<br />
<br />
== Conclusions ==<br />
<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
<br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=User:Shinnsm&diff=183398User:Shinnsm2012-10-22T16:30:36Z<p>Shinnsm: project name update</p>
<hr />
<div>Stephen Shinn<br />
<br />
Computer Engineering major, class of 2013.<br />
<br />
== Projects ==<br />
* [[SparkFun: 0.5" Force Sensitive Resistor]]<br />
* [[ECE497 Project: XBee]]<br />
<br />
[[Category:ECE497]]</div>Shinnsmhttps://elinux.org/index.php?title=EBC_Contributions_and_Project_Status&diff=183392EBC Contributions and Project Status2012-10-22T16:30:17Z<p>Shinnsm: project name update</p>
<hr />
<div>[[Category:ECE497 |Contributions]]<br />
{{YoderHead}}<br />
<br />
== Fall 2012 ==<br />
<br />
=== Project Status ===<br />
<br />
Please edit this page and add your project to this list. Copy my [[ECE497 Project Template]] to your own eLinux page and include the title of your project in the name of the page. <br />
<br />
Please make the list alphabetical by family name.<br />
<br />
Take a look at what you and others have contributed.<br />
<br />
{|<br />
|- <br />
! Name<br />
! Contributions<br />
! Project<br />
! git repository<br />
|-<br />
| [[User:atniptw | Tom Atnip]]<br />
| <br />
| [[ECE497 Beagle VNS | Beagle VNS]]<br />
| [https://github.com/atniptw/ atniptw]<br />
|-<br />
| [[User:larmorgs | Greg Larmore]]<br />
| <br />
| [[ECE497 Project Template | My Beagle Project]]<br />
| [https://github.com/larmorgs/ larmorgs]<br />
|-<br />
| [[User:jessebrannon | Jesse Brannon]]<br />
| <br />
| [[ECE497 Project Template | My Beagle Project]]<br />
| [https://github.com/brannojs/ brannojs]<br />
|-<br />
| [[User:Xinyu1991 | Xinyu Cheng]]<br />
| <br />
| [[ECE497 Project Template | My Beagle Project]]<br />
| [https://github.com/xinyu1991]<br />
|-<br />
| [[User:correlbn | Bryan Correll]]<br />
| [[Special:Contributions/correlbn|contrib]]<br />
| [[BeagleBone PRU | BeagleBone PRU]]<br />
| [https://github.com/correlbn/My-Beagle-Project/ Correlbn]<br />
|-<br />
| [[User:draneaw | Alex Drane]]<br />
| <br />
| [[ECE497 draneaw Project | My Beagle Project]]<br />
| [https://github.com/draneaw/My-Beagle-Project draneaw]<br />
|-<br />
| [[User:duganje | Josh Dugan]]<br />
| <br />
| [[ECE497 Project: XBee|XBee]]<br />
| [https://github.com/duganje/ duganje]<br />
|-<br />
| [[User:Geislekj | Kevin Geisler]]<br />
| <br />
| [[ECE497 Beagle VNS | Beagle VNS]]<br />
| [https://github.com/geislekj/ geislekj]<br />
| <br />
|-<br />
| [[User:chris.good | Christopher A Good]]<br />
| [[Special:Contributions/Chris.good|contrib]]<br />
| [[ECE497 Project Template | My Beagle Project]]<br />
| [https://github.com/goodca/ goodca]<br />
| <br />
|-<br />
| [[User:hansenrl | Ross Hansen]]<br />
| [[Special:Contributions/hansenrl|contrib]]<br />
| [[ECE497 Project AutoPilot | AutoPilot]]<br />
| [https://github.com/hansenrl/ Hansenrl]<br />
| <br />
|-<br />
| [[User:jungeml | Michael Junge]]<br />
| [[Special:Contributions/jungeml|contrib]]<br />
| [[ECE497 Project AutoPilot | AutoPilot]]<br />
| [https://github.com/jungeml/ Jungeml]<br />
|-<br />
|<br />
|-<br />
| [[User:Lix | Xia Li]]<br />
| [[Special:Contributions/Lix|contrib]]<br />
| [[ECE497 Lix Project | My Beagle Project]]<br />
| [https://github.com/1984xiali/ xiali]<br />
|-<br />
| [[User:mmoravec | Matthew Moravec]]<br />
| <br />
| [[ECE497 Project: XBee|XBee]]<br />
|<br />
|-<br />
| [[User:ngop | Peter Ngo]]<br />
| <br />
| [[ECE497 ngop Project: Beaglebone PRU|Beaglebone PRU]]<br />
| [https://github.com/ngop/ ngop]<br />
|<br />
|-<br />
| [[User:shinnsm|Stephen Shinn]]<br />
| [[Special:Contributions/shinnsm|contrib]]<br />
| [[ECE497 Project: XBee|XBee]]<br />
| [https://github.com/shinnsm shinnsm]<br />
|-<br />
| [[User:Yoder | Mark A. Yoder]]<br />
| [[Special:Contributions/Yoder | contrib]]<br />
| [[ECE497 Project Template | My Beagle Project]]<br />
| [https://github.com/MarkAYoder MarkAYoder]<br />
|-<br />
| [[User:Popenhjc | James Popenhagen]]<br />
| <br />
| [[BeagleBone PRU | BeagleBone PRU]]<br />
| [https://github.com/popenhjc/ popenhjc]<br />
|-<br />
| [[User:Whiteer | Elias White]]<br />
| <br />
| [[ECE497 whiteer Project | My Beagle Project]]<br />
| [https://github.com/whiteer whiteer]<br />
|-<br />
| [[User:ruff | Ruffin White]]<br />
| <br />
| [[ECE497 Beagle VNS | Beagle VNS]]<br />
| [https://github.com/ruffsl/ ruffsl]<br />
|<br />
|-<br />
| [[User:Richarsm | Sean Richardson]]<br />
| <br />
| [[ECE497 richarsm Project | My Beagle Project]]<br />
| [https://github.com/seanrich Sean Richardson]<br />
|-<br />
| [[User:Millerap | Andrew Miller]]<br />
|<br />
| [[ECE 497 millerap Project | My Beagle Project]]<br />
| [https://github.com/millerap millerap]<br />
|-| <br />
| [[User:Astroricks | Yue Zhang]]<br />
| <br />
| [[ECE497 Yue Zhang Project | My Beagle Project]]<br />
| [https://github.com/Astroricks/Beagle-Project Yue Zhang]<br />
|-<br />
| [[User:Lobdeljt | John Lobdell]]<br />
| <br />
| [[ECE 497 lobdeljt Project | My Beagle Project]]<br />
| [https://github.com/jtlobdell jtlobdell]<br />
|-<br />
|<br />
|}<br />
<br />
== Winter 2011-2012 ==<br />
<br />
=== Contributions ===<br />
<br />
# [[Special:Contributions/Yuming | Yuming Cao]]<br />
# [[Special:Contributions/Yifei | Yifei Li]]<br />
# [[Special:Contributions/Harrisgw | Greg Harrison]]<br />
# [[Special:Contributions/mac | Jack Ma]]<br />
# [[Special:Contributions/Gemini91 | Guanqun Wang]]<br />
# [[Special:Contributions/Yanj | Mona Yan]]<br />
# [[Special:Contributions/Yoder | Mark A. Yoder]]<br />
# [[Special:Contributions/Yuhasmj | Michael Yuhas]]<br />
# [[Special:Contributions/Ziyi Zhang | Ziyi Zhang]]<br />
# [[Special:Contributions/Zitnikdj | David Zitnik]]<br />
# [[Special:Contributions/Zitnikdj | Alex Drane]]<br />
# [[Special:Contributions/jessebrannon | Jesse Brannon]]<br />
# [[Special:Contributions/larmorgs | Greg Larmore]]<br />
# [[Special:Contributions/jungeml | Michael Junge]]<br />
# [[Special:Contributions/millerap | Andrew Miller]]<br />
# [[Special:Contributions/correlbn | Bryan Correll]]<br />
<br />
=== Project Status ===<br />
<br />
# [[User:Yoder | Mark A. Yoder]], [[ECE497 Project Template | My Beagle Project]]<br />
# [[user:Yanj|Mona Yan]] and [[user:Harrisgw| Greg Harrison]], [[PS EYE QT PROJECT | Playstation Eye Audio with Qt]]<br />
# [[user:Caogecym | Yuming Cao]] and [[user:Ziyi Zhang | Ziyi Zhang]], [[Node.js Weather Station]]<br />
# [[user:Yifei| Yifei Li]] and [[user:Gemini91| Guanqun Wang]], [[ Kinect Project | Play games using Kinect on Beagleboard]]<br />
# [[user:Yuhasmj| Michael J. Yuhas]] and [[user:mac | Jack Ma]], [[ Multiple Partitions via U-boot | Multiple Partitions via U-boot ]]<br />
# [[user:Zitnikdj| David Zitnik]], [[ ECE497 Project: Twitter Java Application | Twitter Java Application ]]<br />
<br />
<br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=183380ECE497 Project: XBee2012-10-22T16:29:28Z<p>Shinnsm: moved ECE497 Project: Zigbee to ECE497 Project: XBee: Using XBee modules</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Executive Summary ==<br />
<br />
Give two sentence intro to the project.<br />
<br />
Give two sentences telling what works.<br />
<br />
Give two sentences telling what isn't working.<br />
<br />
End with a two sentence conclusion.<br />
<br />
The sentence count is approximate and only to give an idea of the expected length.<br />
<br />
== Installation Instructions ==<br />
<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
<br />
== User Instructions ==<br />
<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
<br />
== Highlights ==<br />
<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
<br />
== Theory of Operation ==<br />
<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
<br />
== Milestones ==<br />
<br />
*Monday, 10/29 - XBee hardware received.<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent.<br />
*Monday, 11/5 - Initial sensor implementation.<br />
*Thursday, 11/8 - Package language implemented between Bones.<br />
*Sunday, 11/11 - YouTube demo uploaded.<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Presentation day; PowerPoint complete.<br />
<br />
== Work Breakdown ==<br />
<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
<br />
== Future Work ==<br />
<br />
Suggest addition things that could be done with this project.<br />
<br />
== Conclusions ==<br />
<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
<br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_Zigbee&diff=183386ECE497 Project: Zigbee2012-10-22T16:29:28Z<p>Shinnsm: moved ECE497 Project: Zigbee to ECE497 Project: XBee: Using XBee modules</p>
<hr />
<div>#REDIRECT [[ECE497 Project: XBee]]</div>Shinnsmhttps://elinux.org/index.php?title=ECE497_Project:_XBee&diff=183374ECE497 Project: XBee2012-10-22T16:25:00Z<p>Shinnsm: Milestones added</p>
<hr />
<div>[[Category:ECE497 |Project]]<br />
{{YoderHead}}<br />
<br />
Team members: [[User:Shinnsm|Stephen Shinn]], [[User:Mmoravec|Matt Moravec]], [[User:Duganje|Josh Dugan]].<br />
<br />
== Executive Summary ==<br />
<br />
Give two sentence intro to the project.<br />
<br />
Give two sentences telling what works.<br />
<br />
Give two sentences telling what isn't working.<br />
<br />
End with a two sentence conclusion.<br />
<br />
The sentence count is approximate and only to give an idea of the expected length.<br />
<br />
== Installation Instructions ==<br />
<br />
Give step by step instructions on how to install your project on the SPEd2 image. <br />
<br />
* Include your [https://github.com/ github] path as a link like this: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn]. <br />
* Include any additional packages installed via '''opkg'''.<br />
* Include kernel mods.<br />
* If there is extra hardware needed, include links to where it can be obtained.<br />
<br />
== User Instructions ==<br />
<br />
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.<br />
<br />
== Highlights ==<br />
<br />
Here is where you brag about what your project can do.<br />
<br />
Include a [http://www.youtube.com/ YouTube] demo.<br />
<br />
== Theory of Operation ==<br />
<br />
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.<br />
<br />
== Milestones ==<br />
<br />
*Monday, 10/29 - XBee hardware received.<br />
*Thursday, 11/1 - XBee Bones are connected and commands can be sent.<br />
*Monday, 11/5 - Initial sensor implementation.<br />
*Thursday, 11/8 - Package language implemented between Bones.<br />
*Sunday, 11/11 - YouTube demo uploaded.<br />
*Monday, 11/12 - All documentation complete.<br />
*Tuesday, 11/13 - Presentation day; PowerPoint complete.<br />
<br />
== Work Breakdown ==<br />
<br />
List the major tasks in your project and who did what.<br />
<br />
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.<br />
<br />
== Future Work ==<br />
<br />
Suggest addition things that could be done with this project.<br />
<br />
== Conclusions ==<br />
<br />
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.<br />
<br />
{{YoderFoot}}</div>Shinnsmhttps://elinux.org/index.php?title=SparkFun:_0.5%22_Force_Sensitive_Resistor&diff=182996SparkFun: 0.5" Force Sensitive Resistor2012-10-22T03:09:35Z<p>Shinnsm: </p>
<hr />
<div>[[Category:ECE497]]<br />
[[Category:SparkFun]]<br />
<br />
<pre style="color:red"><br />
Overview: 2<br />
Wiring: 2<br />
Code: 2<br />
git/Compiles with make: 0, I get a Segmentation fault when I run it.<br />
Demo: 2<br />
Total: 8<br />
Comments: Looks good, but I get a Seg fault when running your code. <br />
Let's figure out why.<br />
</pre><br />
<br />
[[File:Sparkfun-force-sensitive resistor.jpg|thumb|The force-sensitive resistor.]] <br />
<br />
== Overview ==<br />
<br />
The [https://www.sparkfun.com/products/9375 SparkFun 0.5" Force Sensitive Resistor] varies its resistance based on the amount of force applied to it. The larger the force, the lower the resistance of the device. When no force is being applied, the resistance is larger than 1MΩ. Like a regular resistor, it only has two leads. The FSR Integration Guide can be accessed [http://www.sparkfun.com/datasheets/Sensors/Pressure/fsrguide.pdf here].<br />
<br />
== Bone Usage ==<br />
=== Physical ===<br />
<br />
The force-sensitive resistor works well when used with one of the BeagleBone's analog inputs. The images below outline how to hook it up. This schematic on the left is modified and originally from the [http://www.sparkfun.com/tutorials/269 SparkFun tutorial on the force-sensitive resistor]. The example on the right outlines one way to hook-up the resistor to read values from the Bone.<br />
<br />
[[File:Force-Sensitive Resistor Schematic.jpg|x350px|Schematic]] [[File:Force-Sensitive Resistor Bone hookup.jpg|x350px|Bone example]]<br />
<br />
A 27kΩ resistor is used to connect the 3.3V source (pin 3) from the Bone to one pin of the force-sensitive resistor. Then, the other pin of the force-sensitive resistor is connected to ground (pin 1). An analog pin (AIN) on the Bone connects to the node containing both resistors, and values can be read off of that AIN. I'm using AIN5 (pin 36) to read values on the Bone.<br />
<br />
=== Reading Values ===<br />
<br />
Reading values off of the analog input is the same as explained in [[EBC_Exercise_10_Flashing_an_LED#Analog_in_-_bone|Exercise 10]]. You can "cat" '''ain6''', and the value will range from around 0 to 4096. When no force is applied to the force-sensitive resistor, the value is close to 4096. When maximum force is applied, the value is close to 0.<br />
<br />
Programmatically, this means that you can read that '''ain6''' value, which is based on how much force is applied, and do anything you want with it. The following code reads the analog value and saves it as an int named '''analogValue''':<br />
<br />
FILE* file = fopen("/sys/devices/platform/omap/tsc/ain6", "r");<br />
int analogValue = 0;<br />
fscanf(file, "%d", &analogValue);<br />
fclose(file);<br />
<br />
The example program below uses this idea to light an LED based on how much force is applied to the force-sensitive resistor.<br />
<br />
== Example Program ==<br />
[[File:Force-Sensitive Resistor LED program.jpg|thumb|200px|Bone config for example program]]<br />
<br />
I've written a program which demonstrates usage of the force-sensitive resistor, [https://github.com/shinnsm/ECE497/blob/master/MiniProject02/miniProj2.c available here]. The input is the force-sensitive resistor on pin 36 (AIN5), and the output is an LED on pin 12 (GPIO1_28). The physical configuration is shown in the image on the right.<br />
<br />
The result of this program is that the harder one squeezes on the force-sensitive resistor, the brighter the LED illuminates. It is configured to require quite a bit of force for maximum brightness.<br />
<br />
== Graphical Display ==<br />
A graphical display is available for the force sensitive resistor in accordance with [[EBC Mini Project 04]]. To prepare the BeagleBone, start by running:<br />
<br />
beagle$ '''opkg update'''<br />
beagle$ '''opkg install nodejs'''<br />
<br />
With ''nodejs'' installed, pull the files from my [https://github.com/shinnsm/ECE497/tree/master/MiniProject04 MiniProject 4 repository] onto the BeagleBone in a convenient folder. Make sure the force sensitive resistor is connected to ain6 as described above, then run:<br />
<br />
beagle$ '''node buttonBox.js'''<br />
<br />
The graphical interface server is now running. To view it, point your browser to '''''bone'':8081/buttonBox.html''', where ''bone'' is the IP address or alias of your BeagleBone. An example of what you'll see is given below. As you squeeze the force sensitive resistor with alternating force, the line graph with move up and down in real-time.<br />
<br />
[[File:Force Resistior Graphical Display.png|500px|Graphical display]]</div>Shinnsm