Hello and welcome to our community! Is this your first visit?
Register
Page 1 of 15 12311 ... LastLast
Results 1 to 10 of 141
  1. #1
    Senior Pilot RobDrech's Avatar
    Join Date
    Sep 2012
    Posts
    243
    Downloads
    0
    Uploads
    0
    Reputation Points (Add)
    4

    Home Brew Telemetry

    One of the things that I really wanted to do with my quadcopter is have a transmitter based telemetry system using an arduino to relay to me some simple but useful information. Now that I have my quad built and flying, I figured I take a stab at it.

    Originally I was going to use a 2.4 mHz nordic nRF+ radios with the high power (non trace) antennas from Yourduino because I have had pretty good luck using them. But after putting some thought into what would need to happen on the quad (tx) side, I'm leaning towards the xbees now. With the xbees I can utilize the established serial communications built into the software. This way the quad will talk the rx as if it was talking to the configurator and I only have to worry about the rx side of the code.

    I figured that this information will help someone else too, so I will keep a log of the build to help my open source buddies.

    Without further ado, here we go!

    Parts list ( this will be a running tally that I will try my best to keep up-to-date), Updated 3/16/2013:

    NOTE: If you just want the final product list... I'll provide that after I succeed!

    v1.0

    One Arduino of your choice (I happen to have a few Unos laying around so they will do) in addition to your flight controller
    Two xbees (I bought a set of 2.4mHz series 1 Pro unit used for $40 off ebay, 900mhz may be desirable if you have a 2.4ghz radio and don't mind the extra $$)
    One xbee adapter (many companies make them, I happen to have an adafruit adapter laying around)
    One xbee arduino shield for arduino based FCs (I picked up a Seeed Studio shield at my local Radio (S)Hack for $15.)
    One sparkfun Xbee breakout board and headers for AQ32 based FCs
    With the adafruit xbee adapter, you will need a FTDI adapter (some other xbee adapters may have this on-board)
    One Nokia 5110 LCD and logic level shifter (both available as a package from adafruit for $10)
    One Pizio buzzer (sparkfun, adafruit, Radio Shack)
    At least one arduino wall mart power supply (sparkfun, adafruit)
    Enclosure (Radio Shack)
    5-way switch(Sparkfun, Adafruit)

    For Vibration alarms:
    One vibrator motor (the one I'm using was salvaged from a old cell phone), sparkfun, MPJA
    PN2222 Transistor
    1N4001 Diode
    270 ohm resistor
    Small thru-hole PCB
    Wire or Rainbow wire (Adafruit, and many others)
    Battery... This is up to you, I used this one.

    Soldering iron and basic soldering skills/equipment
    Breadboard and breadboard accessories (jumpers, maybe LEDs and resistors, etc)
    Some small 4-40 screws and nuts.
    Standoffs
    Wire
    Rubber grommets

    OMIT: One rotary encoder (I like this one because of the push button feature and it comes with a knob)

    v2.0

    One 8mhz/3v3 Arduino: The mini 8 mhz
    The micro 8 mhz (with this one, the button pin on a4 will have to be moved to a digital. No biggie.)
    The 328 pro 8 mhz
    Or any of the 8 mhz open source knock-offs, HK mini, Yourdunio, etc...

    Two xbees (I bought a set of 2.4mHz series 1 Pro unit used for $40 off ebay, 900mhz may be desirable if you have a 2.4ghz radio and don't mind the extra $$)
    One xbee adapter (many companies make them, I happen to have an adafruit adapter laying around)
    Two sparkfun Xbee breakout board and headers for AQ32 based FCs
    You will need a FTDI adapter (some other xbee adapters may have this on-board)
    One Nokia 5110 LCD (from adafruit for $10), NOTE logic level shifter not needed if the arduino is 3v3
    One Pizio buzzer (sparkfun, adafruit, Radio Shack)
    At least one arduino wall mart power supply (sparkfun, adafruit)
    5-way switch(Sparkfun, Adafruit)
    .100 or so Polycarbonate from Home Depot or Lowes
    Battery... This is up to you, I used this one.

    For Vibration alarms:
    One vibrator motor (the one I'm using was salvaged from a old cell phone), sparkfun, MPJA
    PN2222 Transistor
    1N4001 Diode
    270 ohm resistor
    Small thru-hole PCB

    Cautionary warning! - Pro type Xbees and the Nokia screen along with the motor and whatnot may be too much for the your arduinos on board voltage regulator. Confirm the capacity with the manufacturers documentation.

    Soldering iron and soldering skills/equipment are highly recommended (may be a good project to hone beginner skills)
    Breadboard and breadboard accessories (jumpers, maybe LEDs and resistors, etc)
    Some small 4-40 screws and nuts.
    Standoffs
    Wire


    Goals:


    Telemetry system good for line-of-site flying minimum (anything beyond that is a bonus)
    Display current heading, altitude and battery voltage.
    User adjustable "set heading", altitude alarm and battery alarm local to the rx.
    Beep alerts when craft heading = set heading, when the set altitude has been reached and critical battery alarm.
    Vibration pulse alerts if your eyes are busy.
    User re-callable max altitude and possibly other data.
    User settings stored in non-volatile memory.


    Some Prep:

    I'll assume that you already have an Arduino IDE installed and can upload code successfully.

    You'll need to install X-CTU for configuring the xbees and possibly a FTDI driver (You'll want the VCP driver).

    The guys here at Aeroquad did a nice job writing up the Xbee configuration, so I'll default to their page for that. I do want to add a few things that took me hours to figure out. After changing the Xbee's BD setting to 115200, remember to change the baud rate to 115200 on the PC settings page or your Xbee will not talk to your computer! On the Seeed Studio shield, both switches have to be to the right! On the Adafruit adapter listed above and when using the Xbee pros you will need to gently bend the power reg and capacitor out of the way because the Xbee will not seat all the way. The baud rate needs to change in the code to avoid communication errors. You will find the baud entry in the Aeroquad.h file (just use find "Baud" and change those two "define" baud rates to "111111". You can use the configurator to test the communication with the xbees.
    Last edited by RobDrech; 03-17-2013 at 04:03 AM.

  2. #2
    Senior Pilot RobDrech's Avatar
    Join Date
    Sep 2012
    Posts
    243
    Downloads
    0
    Uploads
    0
    Reputation Points (Add)
    4
    Test 1:


    In this test, I'll be setting up some code so that the rx can receive, sort and recall data sent from the quad. Because I will be relying on the established aeroquad serial communication commands to send the data, the rx will have to receive a comma separated string of values, store them and then recall the data that I would like to display. Unfortunately, there is no command to send barometric information by itself. So I will be using the "s" command which will send all craft data. When the "s" command is sent to the quad, the quad will in return send 24 pieces of data back. The rx will have to store all of the incoming data into an array to that it can be recalled at a later time to be displayed on the LCD. To save time and brain power, I'm using an example from the Arduino Cookbook that does just that. It utilizes a library called "TextFinder" to sort the data into fields. Please see the Arduino web page for more information on installing libraries if you are not sure on how to do so.

    I gently modified the example code so that it can handle floating point number rather than just integers.

    Code:
    #include <TextFinder.h>
    
    TextFinder finder(Serial);
    const int NUMBER_OF_FIELDS = 24; // how many comma-separated fields we expect
    int fieldIndex = 0; // the current field being received
    float values[NUMBER_OF_FIELDS]; // array holding values for all the fields
    
    void setup()
    {
    Serial.begin(57600); // Initialize serial port to send and receive at 57600 baud
    }
    
    void loop()
    {
    for(fieldIndex = 0; fieldIndex < 24; fieldIndex ++)
    {
    values[fieldIndex] = finder.getFloat(); // get a numeric value
    }
    Serial.print( fieldIndex);
    Serial.println(" fields received:");
    for(int i=0; i < fieldIndex; i++)
    {
    Serial.println(values[i]);
    }
    fieldIndex = 0; // ready to start over
    }

    Plug an Arduino into the USB, upload the code and open the serial monitor. Send the following information

    Code:
    0,0.02,-0.01,9.82,2.0,0,1500,1500,1500,1000,1000,2000,0,0,1000,1000,1000,1000,0,0,0,0,11.3,0\r\n
    And we get the following response shown below. As you can see, the information was sent all at once, the Arduino received each piece and then stored it in an array. Then the Arduino recalled the total number of pieces and then displayed each piece individually. Great, it works! This will be the work horse of the telemetry rx code. The picture below that highlights the fields that I am interested in, Heading, Altitude and Battery Voltage.

    With a little more modification

    Code:
    #include <TextFinder.h>
    
    TextFinder finder(Serial);
    const int NUMBER_OF_FIELDS = 24; // how many comma-separated fields we expect
    int fieldIndex = 0; // the current field being received
    float values[NUMBER_OF_FIELDS]; // array holding values for all the fields
    
    void setup()
    {
    Serial.begin(57600); // Initialize serial port to send and receive at 57600 baud
    }
    
    void loop()
    {
    for(fieldIndex = 0; fieldIndex < 24; fieldIndex ++)
    {
    values[fieldIndex] = finder.getFloat(); // get a numeric value
    }
    Serial.print( fieldIndex);
    Serial.println(" fields received:");
    {
    Serial.print(values[3]); Serial.println(" Heading");
    Serial.print(values[4]); Serial.println(" Altitude");
    Serial.print(values[22]); Serial.println(" Volts");
    }
    fieldIndex = 0; // ready to start over
    }
    We get a list of only the data we are interested in. Sweet! I say that this test is over.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	test1.jpg 
Views:	749 
Size:	164.3 KB 
ID:	8084   Click image for larger version. 

Name:	Test1b.jpg 
Views:	759 
Size:	168.3 KB 
ID:	8086  
    Attached Images Attached Images  
    Last edited by RobDrech; 01-20-2013 at 02:06 AM.

  3. #3
    Senior Pilot RobDrech's Avatar
    Join Date
    Sep 2012
    Posts
    243
    Downloads
    0
    Uploads
    0
    Reputation Points (Add)
    4
    Test 2:

    Test 2 is actually really simple. I just need to get the Nokia 5110 working. I am rather comfortable with the Nokia 5110 (really easy to use) so I really don't have much to add here. I had to add the code to include the library (refer to the Nokia 5110 page on adafruit), declare, initialize and set the contrast. That's really it... Here is how to print text.

    Code:
    nokia.setCursor(0, 0); // this sets the position to write the text
    nokia.print(values[3]); nokia.println(" Heading"); //Text to write, note the println! handy feature
    nokia.print(values[4]); nokia.println(" Altitude");
    nokia.print(values[22]); nokia.println(" Volts");
    nokia.display(); // This sends the text to the screen! do not forget or you will see nothing!
    Ok, so let's go ahead and take a look at what we got so far.

    Code:
    #include <TextFinder.h>
    #include "PCD8544.h"
    
    TextFinder finder(Serial);
    const int NUMBER_OF_FIELDS = 24; // how many comma-separated fields we expect
    int fieldIndex = 0; // the current field being received
    float values[NUMBER_OF_FIELDS]; // array holding values for all the fields
    
    // pin 7 - Serial clock out (SCLK)
    // pin 6 - Serial data out (DIN)
    // pin 5 - Data/Command select (D/C)
    // pin 4 - LCD chip select (CS)
    // pin 3 - LCD reset (RST)
    PCD8544 nokia = PCD8544(7, 6, 5, 4, 3);
    
    void setup()
    {
    Serial.begin(57600); // Initialize serial port to send and receive at 57600 baud
    
      nokia.init();
      nokia.setContrast(44);
    }
    
    void loop()
    {
    for(fieldIndex = 0; fieldIndex < 24; fieldIndex ++)
    {
    values[fieldIndex] = finder.getFloat(); // get a numeric value
    }
    Serial.print( fieldIndex);
    Serial.println(" fields received:");
    {
    Serial.print(values[3]); Serial.println(" Heading");
    Serial.print(values[4]); Serial.println(" Altitude");
    Serial.print(values[22]); Serial.println(" Volts");
    nokia.setCursor(0, 0);
    nokia.print(values[3]); nokia.println(" Heading");
    nokia.print(values[4]); nokia.println(" Altitude");
    nokia.print(values[22]); nokia.println(" Volts");
    nokia.display();
    }
    fieldIndex = 0; // ready to start over
    }
    One last thing. Because it is essential for this screen to communicate through a logic level converter, I made a daughter board for my display, which sits below the screen. The wiring and what not is the same as what is shown on the adafruit website, just more... permanent.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	IMGP0019.JPG 
Views:	775 
Size:	321.6 KB 
ID:	8090   Click image for larger version. 

Name:	IMGP0018.JPG 
Views:	777 
Size:	331.7 KB 
ID:	8091  
    Last edited by RobDrech; 01-21-2013 at 03:56 AM.

  4. #4
    Senior Pilot wooden's Avatar
    Join Date
    Dec 2011
    Location
    Pacific Northwest
    Posts
    4,652
    Blog Entries
    1
    Downloads
    1
    Uploads
    0
    Reputation Points (Add)
    27
    Looking good! However, there is a command to send only altitude based values - 'z'. This is in the development branch, don't know if you're using that or not but it'd probably be wise to as the next release is much closer to the dev branch than 3.1beta. 'z' will send both barometer and rangefinder values, or 0s for whichever is not enabled.
    push the envelope, watch it bend

  5. #5
    Senior Pilot RobDrech's Avatar
    Join Date
    Sep 2012
    Posts
    243
    Downloads
    0
    Uploads
    0
    Reputation Points (Add)
    4
    sneak peek of what the final screen may look like...
    Click image for larger version. 

Name:	IMGP0024.JPG 
Views:	758 
Size:	270.8 KB 
ID:	8098

  6. #6
    Senior Pilot RobDrech's Avatar
    Join Date
    Sep 2012
    Posts
    243
    Downloads
    0
    Uploads
    0
    Reputation Points (Add)
    4
    OK, so now we are ready to tie a few things together and get a move on with the project. I did some testing with the current RX code (shown below) with both mock craft data and an arduino v1.8 shield FC and both were promising. I had to fudge the data a little bit because my v1.8 shield does not have a magnetometer or an barometer but the RX was updating perfectly and showing the "right" data.

    Code:
    #include <TextFinder.h>
    #include "PCD8544.h"
    
    TextFinder finder(Serial);
    const int NUMBER_OF_FIELDS = 24; // how many comma-separated fields we expect
    int fieldIndex = 0; // the current field being received
    float values[NUMBER_OF_FIELDS]; // array holding values for all the fields
    
    // pin 7 - Serial clock out (SCLK)
    // pin 6 - Serial data out (DIN)
    // pin 5 - Data/Command select (D/C)
    // pin 4 - LCD chip select (CS)
    // pin 3 - LCD reset (RST)
    PCD8544 nokia = PCD8544(7, 6, 5, 4, 3);
    int batPix = 0; //Pixel for battery graphics
    int craftHeading = 0;
    int alarmHeading = 0;
    int craftAlt = 0;
    int alarmAlt = 0;
    float craftBattery = 0;
    float alarmBattery = 0;
    
    void setup()
    {
    Serial.begin(111111); // Initialize serial port
    
      nokia.init();
      nokia.setContrast(45);
      
    nokia.setCursor(0, 0);
    nokia.print("Connecting to Craft.......");
    nokia.display();
      
      delay(2500); //Waiting for everything settle
      
      Serial.print('s'); //sending the command to the craft to start streaming data
      
    }
    
    void loop()
    {
      nokia.clear();
    
    for(fieldIndex = 0; fieldIndex < 24; fieldIndex ++)
    {
    values[fieldIndex] = finder.getFloat(); // get a numeric value
    }
    
    craftHeading = values[3];
    craftAlt = values[4];
    craftBattery = values[22];
    
    nokia.setCursor(0, 0);
    nokia.println("CRAFT    STTNG");
    nokia.setCursor(6, 9);
    nokia.print(craftHeading);
    nokia.setCursor(33, 9);
    nokia.print("HDG");
    nokia.setCursor(61, 9);
    nokia.print(alarmHeading);
    
    nokia.setCursor(6, 18);
    nokia.print(craftAlt);
    nokia.setCursor(33, 18);
    nokia.print("ALT");
    nokia.setCursor(61, 18);
    nokia.print(alarmAlt);
    
    nokia.setCursor(0, 27);
    nokia.print(craftBattery);
    nokia.setCursor(33, 27);
    nokia.print("BAT");
    nokia.setCursor(58, 27);
    nokia.print(alarmBattery);
    
    nokia.setCursor(0, 38);
    nokia.print("E");
    nokia.setCursor(78, 38);
    nokia.print("F");
    
    nokia.drawline(8, 36, 69, 36, BLACK); // Drawing the "battery"
    nokia.drawline(8, 47, 69, 47, BLACK);
    nokia.drawline(69, 36, 69, 47, BLACK);
    nokia.drawline(8, 36, 8, 47, BLACK);
    nokia.drawline(70, 38, 72, 38, BLACK);
    nokia.drawline(70, 45, 72, 45, BLACK);
    nokia.drawline(73, 38, 73, 45, BLACK);
    
    nokia.fillrect(9, 37, batPix, 10, 1);
    nokia.display();
    
    fieldIndex = 0; // ready to start over
    }
    Note: Do not power the RX arduino (or the craft FC for that matter) by a USB connected to your computer. The serial connection to the Xbee(s) can be disrupted. Use a wallmart or a battery. You will need to enable "serial telemetry" in the code for the flight controller (refer to the appropiate Aeroquad Wiki page for help). Assuming that the FC is programmed and calibrated, the Xbees are configured and commicating and installed on the FC/RX arduino, you should be able to power on the craft FC and then the RX arduino. After a few seconds, the RX will send the "s" command and then begin getting streaming data from the FC. The craft heading, alt and battery voltage should be updating and shown on the Nokia screen.

    I also ordered a sparkfun Xbee breakout board and to make connecting the xbee to the AQ32 a little easier and safer (the headers will keep all those little pins in the right place). I used some rainbow wires to connect the power, gnd, Din and Dout per the Aeroquad instructions.Click image for larger version. 

Name:	DSC_0044.jpg 
Views:	697 
Size:	113.6 KB 
ID:	8158Click image for larger version. 

Name:	DSC_0045.jpg 
Views:	703 
Size:	109.5 KB 
ID:	8159Click image for larger version. 

Name:	DSC_0047.jpg 
Views:	687 
Size:	106.8 KB 
ID:	8160Click image for larger version. 

Name:	DSC_0048.jpg 
Views:	679 
Size:	109.5 KB 
ID:	8162Click image for larger version. 

Name:	DSC_004444.jpg 
Views:	678 
Size:	91.0 KB 
ID:	8165
    Last edited by RobDrech; 01-28-2013 at 03:30 AM.

  7. #7
    Senior Pilot jbsmith78's Avatar
    Join Date
    Mar 2012
    Posts
    493
    Downloads
    0
    Uploads
    0
    Reputation Points (Add)
    0

    Home Brew Telemetry

    This is a great post Rob... Very cool and clean build man!!! Might have to be my next project, thank you for posting all this info!!!
    Joshua @ MakerGeeks.com

  8. #8
    Senior Pilot RobDrech's Avatar
    Join Date
    Sep 2012
    Posts
    243
    Downloads
    0
    Uploads
    0
    Reputation Points (Add)
    4
    Thanks JB. Once I get the guts sorted out then the rest is cake! I'm still up in the air about a few things so I may just keep it simple for the time being and add to it later. I'll be sure to keep this up to date.

  9. #9
    Senior Pilot jbsmith78's Avatar
    Join Date
    Mar 2012
    Posts
    493
    Downloads
    0
    Uploads
    0
    Reputation Points (Add)
    0

    Home Brew Telemetry

    Quote Originally Posted by RobDrech View Post
    Thanks JB. Once I get the guts sorted out then the rest is cake! I'm still up in the air about a few things so I may just keep it simple for the time being and add to it later. I'll be sure to keep this up to date.
    I think it looks great but there are always things to tweak and play with, that's what makes it fun. Really great to see some out of the box thinking here, please keep us posted Rob!! Makes me want to start another project using this!!
    Joshua @ MakerGeeks.com

  10. #10
    New Member
    Join Date
    Jan 2013
    Posts
    1
    Downloads
    0
    Uploads
    0
    Reputation Points (Add)
    0
    Very neat and sweet for a newb like me. I will be watching, waiting and hoping.....


 
Page 1 of 15 12311 ... LastLast

Similar Threads

  1. Home made PCB -very cool
    By jbsmith78 in forum General Discussion
    Replies: 16
    Last Post: 02-12-2013, 06:31 AM
  2. Home 3rd home built Joystick for Aeroquad
    By IanJ in forum AeroQuad Flight Software
    Replies: 27
    Last Post: 02-04-2013, 12:08 AM
  3. Sunset flying at home
    By Trebhill in forum Flight Videos
    Replies: 5
    Last Post: 07-10-2012, 10:42 AM
  4. Replies: 4
    Last Post: 05-10-2011, 11:36 PM
  5. Home Cooking (aka Reflowing)
    By Honk in forum General Discussion
    Replies: 3
    Last Post: 03-16-2011, 05:46 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •