Wednesday, January 22, 2014

Multi-Copter I/O Shield v2

Hello all,

  Today I will talking about my experience with my multi-copter i/o shield and where I'm going with it.  Over a year ago I built my first MIOS (Link).  This post is one of the most popular on my blog.

The original MIOS

  It worked great as an interface for the working with the data buses on the Arduino Due, but resistor based voltage divider for dealing with the RC input was really sub-optimal.  It also only used 3.3v pulses to control the ESC/servos, which again is not the greatest.
  Having used version 1 for over an year now, I have decided to make a second version.  This version MIOSv2, brings a whole new level of flexibility and usefulness to the Due platform.


  I have replaced the resistor voltage divider with "real" logic level voltage translator.  This unit is the TI TSX0108E signal translator.  I have used two of these units on the new board.  This gives me 16 channels of 5v I/O (14x or on the right angle header and 2x are next to the lower translator ship).  And since the chips are automatically bidirectional, this signal voltage translation is invisible.  Yes, this means that if you decide to, you could attach 16 servos by only using the normal Arduino configuration and it will work without any additional consideration.  If you want to alternate input and output every other pin, you can do that.  If all you want are inputs, again, it's as easy as writing your program to use the associated pins as inputs.

New MIOSv2 before adding the components.

  These 5v I/O are connected to Arduino pins 24 through 39.  This mean that none of the special function pins are obstructed by this functionality.  All of the PWM, DAC, ADC, CAN, I2C, SPI, and Serial pins are completely available to use even if you employ every single 5v I/O.

Complete MIOSv2 attached to an Arduino Due

  Like my previous version, I have grouped the major I/O buses with ground and 3.3v power.  This gives you three SPI, 2x of each of the two I2C (aka TWI, or Wire), and both Serial 2 and Serial 3.  I don't break out Serial 1 as it is used for communication to the Aduino software (but if I needed it it would be trivial to grab it from the perimeter and get the ground and 3.3v from any other group).  All of the I/O pins around the perimeter are brought to the inside with an 0.1" spacing to make it easy to solder wires/headers to use them.
  I have also added solder points for bringing power to the shield to power the Due independent of the power jack or USB port.  This power input is run through a PI filter to reduce the electrical noise from adjacent motors, ESC, servos, radios etc...

  I have made the decision to sell these as there has been an large degree interest in the original version.  I did not want to sell that version as I didn't feel it was really as good as it should be.  This new version fixes all of the reservations I had with the original and works perfectly.  The initial batch is in manufacturing and testing.     I have started to develop a store front for my long term sales, but in the short term I will probably sell the initial batch on eBay or directly to get these out in the field while my store is being developed.  If you are interested please send an email to PhilsTechCorner@gmail.com.  I will be selling this initial batch for $20 each (Future production runs will be $30 each).  These are 100% guaranteed to function perfectly, the only difference in this initial batch is that all of the SMD components are hand soldered and some of the printing on the boards is a little lighter than I would have preferred.  Orders are first-come-first serve and should ship out by last week of January.  Arduino Due sold separately.

 That is all for now.  Let me know if you have any questions.

  Thanks for reading and please sign up on the right if you want to be automatically notified when I post more updates.

~Phillip

<< Previous Quadrotor Post | Next Quadrotor Post >>

Monday, December 30, 2013

The Adventure Continues

Hello All,

  I apologize for my lack of posts in the last year.  My multicopter projects have taken a back seat to some other interests and to "real life" priorities.  I anticipate putting more time into posting about what I am doing over the winter.  As part of that, I have started uploading some of my Arduino libraries to my Github account.  These are libraries that I have personally written for my quad copter project.  I have a couple of disclaimers in relation to these libraries:

  1. I am an amateur coder.  These are written to accomplish things the way I think they should be done.  There are probably better ways to do everything I do.
  2. These are written for the Arduino platform and will work for both 8-bit Atmel processors and the 32-bit SAM.  Although the code is basic C++, I will not be adjusting them to work outside of the Arduino platform.
  3. I would love feedback from anyone who finds these libraries useful.  Having said that, I generally will not be adding additional functionality to them unless it benefits me.  I know that sounds selfish, but I only have a limited amount of time and coding for others when I could be working on my own projects just isn't in the cards at this time.
  4. I am working on the documentation for these libraries, but it's probably never going to be perfect.  If experimenting and reading the code in my libraries to figure out how things work doesn't sound like fun to you, then these may not be the right libraries for you.
  5. These are a work in progress.
Ok, now that that's out of the way, here's the fun stuff.  I have uploaded the first two libraries and they are used for sensor filtering.

Median Filter:
This is an one dimensional filter that receives data as INT data type and sorts it from highest to lowest value and returns the median result.  This type of filter can be very good at rejecting "spikey" noise while not introducing a large filter lag.  I use this on my accelerometer readings due to the level of noise I see from motor and propeller vibration.

Usage:

#include

MedianFilter filterObject(window size, filter seed);  // Object creation.
...
    filteredData = filterObject.in(rawData); // use the "in" method when adding data to the object, it returns the latest result.
    ...
    filteredData = filterObject.out(); // use the "out" method to retrieve the current result without submitting new data. 

Average processing time (micro seconds) when submitting new data (given certain window sizes):

3 7 15 31 63 127 255
Due 2.11 3.27 5.39 9.56 17.8 34.3 67.5
328-16 18.0 29.4 50.5 92.3 176 340 677

Notes:
Avoid using a lot of these with large windows sizes.  Although I have tried to keep the memory needs as small as possible, the amount of memory needed to store a lot of numbers adds up quickly.  


Low Pass Filter
This is an one dimensional, exponential decay, low pass filter.  It accepts data type INT.  I prefer this filter over a sliding window filter for a couple of reasons.  The first is that is is very fast, even on the 8-bit processors.  The second reason is that new data has the highest effect immediately after it is added to the filter, and has diminishing effect as new samples are added.  This contrasts to a sliding window where the data has constant effect as long as it exists in the window.  Both filter types have equivalent long term effects.

Usage:

#include

LowPassFilter filterObject(filtering power, filter seed); // Object creation.

...
    filteredData = filterObject.in(rawData); // use the "in" method when adding data to the object, it returns the latest result.
    ...
    filteredData = filterObject.out(); // use the "out" method to retrieve the current result without submitting new data. 

Processing time (micro seconds) when submitting new data (based on filtering power):
1 2 3 4
Due 0.48 0.48 0.48 0.48
328-16 2.9 3.2 3.5 3.8

Notes:
Each increase in filtering power doubles the effect of this filter.  Both the "lag" and the "smoothing" effect are doubled.  A filter power of zero has no effect on the data.

I have designed these two filters so that I can "stack" them as follows:
filteredData = LPF_object.in(MF_object.in(rawData));
When I get around to uploading my library for the Invesense MPU-6050, it will be more apparent why I have done this.  In addition, you will notice that both of these filters use data type int, this is intentional as it is much faster this way.  My final control/orientation computations are done as floats/doubles but avoiding converting to them until as late as possible helps keep my control loops from getting too slow.

Over the next month I intend to release the following libraries:
MPU6050 - my library for the Invesense MPU-6050 (nearly finished, re-verifying it's function)
Math3D - my Quaternion and 3D vector library (re-writing to include operator overloading)

My next post, I will be discussing my experience with my Multicopter I/O Shield (MIOS) and my future plan for it.

That is all for now.  Let me know if you have any questions.

  Thanks for reading and please sign up on the right if you want to be automatically notified when I post more updates.

~Phillip


Thursday, December 13, 2012

MIOS: Multi-Copter I/O Shield for the Arduino Due

  As I previewed in my last post,  I am making an shield to fit the Arduino Due that will simplify connecting the RC reciever, motor ESC, and I/O for sensor communication.  The PCB's for the shield came this week and below are pictures and some explanations.


  Above is the board layout in Eagle before sending it to the fab house.  I used a board fab service called OSH Park.  This service combines many small PCB orders into a large order to spread the cost out between all of the participants.



  Above is the board render I received back from OSH Park after they accepted my design.



  Here is a picture of the board by itself.  The Picture came out a bit blurry, but the actual board is very clean and sharp.  The silk masks are very clean and the gold plating on the solder pads/holes is pretty.  Dark Purple is the only color option from OSH Park, but that seemed like an good alternative to the traditional pea green pcb I could have received from another board service.  I spent a bunch of time with the continuity tester on my DMM making sure everything was routed correctly and there were no shorts or miss directed paths.  Everything checked out as good.



  Here I am test fitting the board to make sure all of the headers will fit in the correct holes when placed on top of an Due.  It's a little hard to see the header pins in the picture since they match the color of the gold plating.  I am happy to see everything fit perfectly.



  All of the header pins are soldered in now including the SPI header in the middle of the board.



  The servo and receiver headers are now soldered in place.




  The voltage divider resistors are in place and soldered.  Since the Due is only compatible with 3.3v signals, I have to reduce the 5v signal that comes from the receiver.  I tested them by applying 5v to each one end then measuring the voltage at the mid point.  All of them were very close to 3.3v.


  Here is a view of the underside of the board with all of the connectors soldered in place.  After taking this picture, I washed the board to remove the solder flux.  This significantly reduced the smudged and dirty appearance near where I soldered.



  Placed onto the Due.  Everything still fits nicely.



  Another angle.

  My next steps will be soldering on pig tails with connectors for attaching sensors.  The I/O holes are spaced correctly for 0.1" connectors, but I am using pig tails on this board so I can attach and detach sensors even when the unit is installed in a tight air frame.

  That is all for now.  Let me know if you have any questions.

  Thanks for reading and please sign up on the right if you want to be automatically notified when I post more updates.

~Phillip

<< Previous Quadrotor Post | Next Quadrotor Post >>