barryjh

Member Since: March 2, 2012

Country: United States

Lessons in Algorithms

December 21, 2016

Learn techniques on how to use Finite Impulse Response (FIR) filters and other data-processing tools to turn data into information.
  • Yep, you're crazy, but in a good way. It will be interesting to see what it actually takes in time and money to pull this off.

    Hey why not autonomize that Golf Cart, less chance of losing a limb with that. Or is that your next project?

    Good luck.

  • I'm not sure either. I built a weather station about 2 1/2 years ago and have been uploading data to WU. About a year ago I made a smart irrigation controller that used my PWS data locally and requested XML forecast data for my zipcode from WG. I've been hearing something might be changing or going away but both are functioning properly.

    Perhaps older API's that predated our projects have been shut down. I am not a paying subscriber, my account is free because I upload data.

  • Cool experiment.

    After watching the video a few things come to mind about the speeding off and falling over. Assuming the speeding off is due to an error correction above some threshold. Could it be any of the following?

    1. The motor does not have a high enough top end speed to get the wheels back under itself.
    2. The motor does not have enough torque to create enough acceleration to overcome the falling acceleration and reverse it.
    3. The horizontal speed somehow effects the vertical acceleration reading making the algorithm think it has righted the ship and then it slows and falls over.
  • No, no, that is my caption, not a snide remark.

  • "OMG, we're going to have a caption contest and only give away a tactile switch!!!"

  • Before starting this wire wrap job, I bought one of those fancy wrappers that held the spool of wire and stripped as it wrapped so I could just move pin to pin for the bus connections. Imagine the fun I had finding a loose wire in there.

  • Well, I don't have a project from 15 years ago that I used a Sparkfun product on, but while we are looking back at the past I have a contrast between projects done 30 years in between. I contrasted an all wire wrap board with a PCB board I built using knowledge I gained on the Sparkfun website that enabled me to design my own board and do the surface mount soldering. When I saw how easy Nate made it look to do surface mount soldering I decided to take the plunge and haven't looked back. Here is a photo of 1985 versus 2015.

    I found this 30+ year old gem in my garage while doing some rearranging. I just couldn't throw it out every time I would think back about all the work that went into that wire wrapping. Here is a link to the full article.

  • How about "Bumble Bot". Since it doesn't have weapons its kind of like the Abominable Snowman that had all its teeth pulled in the Rudolph the Red Nose Reindeer movie. :)

  • Pete, I write a lot of code dealing with Endianess between processors and from your bit pattern graphic, it appears the SBUS data is little endian with channels packed in a structure with 11bit bit channel fields. If the micro you use is little endian which most seem to be you can use the following structure to decode the Futaba SBUS. Its not good practice to send bit field structures in communication messages, but since the controller already did it,why not use such a structure on the other side. This might make using SBUS data easier to understand. Just put this structure definition above your setup() function.

    struct FutabaSBUS
    {
      uint8_t  start;
      uint16_t channel1 : 11;
      uint16_t channel2 : 11;
      uint16_t channel3 : 11;
      uint16_t channel4 : 11;
      uint16_t channel5 : 11;
      uint16_t channel6 : 11;
      uint16_t channel7 : 11;
      uint16_t channel8 : 11;
      uint16_t channel9 : 11;
      uint16_t channel10 : 11;
      uint16_t channel11 : 11;
      uint16_t channel12 : 11;
      uint16_t channel13 : 11;
      uint16_t channel14 : 11;
      uint16_t channel15 : 11;
      uint16_t channel16 : 11;
      uint8_t  unused;
      uint8_t  stop;
    };
    

    You can simply overlay over the RX_array a reference variable of the structure type and then use it to decode the channels and flag fields. For example put this below your array definition:

    uint8_t RX_array[25];
    FutabaSBUS& sbus = *(FutabaSBUS*)RX_array;
    

    Then in your loop after reading data into the buffer you can simply do this:

    channel[1] = sbus.channel1;
    channel[2] = sbus.channel2;
    

    etc...

    Also you can just use the sbus fields directly in your code like this without copying into a channel array:

    //set up light mode on channel 7 
    if (sbus.channel6 < 0x00FF) mode = 0;
    else if ((sbus.channel6 > 0x00FF) && (sbus.channel6 < 0x0400)) mode = 1; 
    else if (sbus.channel6 > 0x0700) mode = 2; 
    

    If you port this code to big Endian just copy the bytes as they come in from the SBUS using index 24 down to 0 rather than 0 to 24, and reverse all the fields of the FutabaSBUS structure and it will decode big endian.

    I did run a test just poking a few data values into the array to verify output and all looks good and as you can see the structure is a size of 25 bytes. This verifies the Arduino compiler produces compatible code.

    RX_array[0] = 0xFF;
    RX_array[1] = 0x01; // Poke a 1 into channel 1 bits
    RX_array[2] = 0x10; // Poke a 2 into channel 2 bits
    RX_array[24] = 0x10;
    
    printf("Struct size = %d\n",sizeof(FutabaSBUS));
    printf("start = %d\n",sbus.start);
    printf("channel1 = %d\n",sbus.channel1);
    printf("channel2 = %d\n",sbus.channel2);
    printf("stop = %d\n",sbus.stop);
    

    The test code produced this output on little endian ESP8266 Thing Dev:

    Struct size = 25

    start = 255

    channel1 = 1

    channel2 = 2

    stop = 16

  • As you can tell I am clueless about Drone's not having played around with one yet. I was thinking the guts of what's in the RC controller that a uC or SBC could provide virtual steering, speed, etc data on the channels going up to the drone, however that would mean I would need a feed back with current positioning to fly to a location with virtual controls. I guess what your saying is that I would want custom flight controller on board as well so it would know where its at while flying to coordinates that it can receive via any wireless medium, like Xbee etc.

    I guess open source or hackable flight controllers may already exist for such a thing.

No public wish lists :(