Friday, January 6, 2012

DIY FrSky GPS Telemetry Sensor with Logging

Following last year's rediscovery of radio controlled flight, I've recently become enamored with the hacking/mod potential of the downright bargain priced 9-channel FlySky FS-TH9X transmitter (also sold as Turnigy/Eurgle etc). The original 2.4GHz RF module and firmware are quite useable, already making this a fairly capable piece of kit considering the price.

However, it becomes a truly remarkable tool when equipped with an open source replacement firmware and the FrSky telemetry capable RF module replacement. For a very moderate investment and with the willingness to do a few intermediate level hardware modifications, you end up with a package providing features that even many top-of-the line, brand name transmitters are lacking.

An RC tinkerer's dream!

While going through the huge thread over at RCGroups and some related content, I stumbled upon a post by (Jo)Hannes a.k.a. der-frickler detailing a custom GPS module he built for the FrSky Telemetry Sensor Hub - in order to receive real-time GPS data in his transmitter display and overcoming a temporary backorder situation with the original/OEM FrSky GPS sensor.

I figured it would be nice to build upon that quite inspired hack and not only to be able to view the corresponding GPS data (such as height and speed) in the transmitter display - averting your eyes from your model while you are flying can be rather tricky if not downright disastrous during high speed low altitude sweeps - but also to have a log of all collected GPS data for later analysis and visualization.

A bit of research led me to the solution of using the same inexpensive Mediatek MT3326 GPS receiver used by Hannes, paired with a SparkFun OpenLog data logger capable of capturing the 9600 baud NMEA output sequence of the GPS chip and writing it onto a micro-SD card. Following the reference sheet for the MediaTek chip resulted in a fairly straight forward circuit design and a corresponding SMD based reference layout:

I apologize for the messiness, PCB layout and hardware design is not one of my fortes. The main components are the already mentioned MediaTek chip and OpenLog breakout board, complemented by an LM3940 3.3V regulator for the GPS chip, a GPS fix LED indicator, and a battery backup for the GPS almanac based on a simple CR2032 Li battery. My initial intention was to use an AMS1117 regulator with it's less stringent capacitor requirements but the 3940 was all I had at hand...

The result can be seen below, the CR2032 battery is hot glued to the bottom of the circuit board (not visible). The OpenLog board does not need any additional configuration. The standard firmware settings of the board match the serial GPS output, and log to a separate TXT file each time the circuit is powered up:

The result is a (relatively) straight forward plug-and-play GPS module for the FrSky telemetry system, with corresponding real-time SD card logging of NMEA data:

Further possibilities include using the OpenLog board to directly log the data stream from the telemetry sensor hub - this could be done within the transmitter at the return channel, removing the necessity for a separate logger in each model and allowing to capture not only the GPS data but also the data from the other sensors. Thanks to the open protocol used by FrSky, this would seem a relatively benign challenge.

P.S. The above logger also works quite well stand-alone - all you need is to provide 5-10V battery power via GND/VCC (approx 40mAh total power consumption)

Friday, March 25, 2011

MultiWiiCopter Build Log

I'm not sure where and how I first came upon multirotor radio controlled aircraft. In any case, I just new that is something for me. Initial research was a bit sobering, seeing what many commercial RC multicopter kits sell for. Sorry, I am not looking for a second car.

Thankfully, there are a number of open alternatives, and after some further research I was taken with the simplicity and effectiveness of AlexinParis' MultiWiiCopter project. It is based on an Arduino programmable micro controller and a MEMS gyroscope from a Wii Motion Plus. Simplistic, effective, and extensible. Added bonus: the flight control software is open source so your imagination is the limit.

The most popular designs are based on a quad rotor setup, usually built using aluminum tubing which is light, cheap, and easy to construct. A basic design guide can be found here. If money is no issue, CNC machined carbon frames like this one are available. If you have imagination, and access to your own CNC machine, then this or this may be something you want to look into.

I've decided to go with something slightly different, a frame based on 10mm EPP foam, sandwiched between layers of 1.5mm FR4 glass fibre. So far, I've not come across a similar approach. I'm hoping for light weight, sufficient crash resistance, and vibration dampening - while having some design freedom compared to the DIY look of aluminum tubing. Btw, I do have 2 meters of aluminum tubing as a backup. Just in case!

The design is based upon a set of Turnigy 2204-14T motors, each placed at the corner of a 20cm (8 inch) square. With 6x3 props, they should turn out approx 320g of max thrust per motor on a 3s Lipo battery. With an anticipated take-off weight of 450g, this provides a very decent thrust-to-weight ratio of 2.8:1. If that is not enough, 7x3.5 props on a 3s should deliver over 400g of thrust if needed. The closeness of the motors and overall size is perhaps not ideal stability wise, but I've made a conscious effort to keep it small without becoming bleading edge.

The heart of this design is a shield board designed by warthox which AlouetteIII has extended and commercialized. You can order it at Shipping from Australia was very quick, I received the board in a matter of a few days after placing my order.

Today, I took delivery of the final parts to build the board, so I dusted off my rusty soldering skills and got going. It was really quite straight forward, in large part thanks to the following video which outlines how to connect the Wii Motion Plus (WMP) board. I went with an original WMP instead of a china knock off to keep my first build simple:

Here the almost finished board, getting ready for the first test:

After downloading the Arduino development platform and the latest MultiWiiCopter release, flashing the Arduino board was a breeze, and the GUI started showing the gyroscope outputs from the WMP board.

Next, I took delivery of a Bosch BMA020 accelerometer (or ACC) breakout board, which Norbert a.k.a. Kinderkram from the RCGroups forum was kind enough to send my way. While the original MultiWiiCopter design uses the accelerometer from a Nintendo Nunchuk controler, the BMA020 is a smaller, cheaper, better performing alternative.

By the way, If you are holding back on the BMA020 because it is advertised as an assembly kit - assembly is limited to soldering the external connectors to it. The board itself is pre-soldered, no micro SMD voodoo required.

At 6 Euros a piece it's really a no brainer, except for the exorbitant shipping fees that the distributer ELV charges - in particular for shipments outside of Germany. Norbert is kind enough to place a bulk order with ELV every few weeks and then sends out the boards at cost to whomever is interested. Be thankful if he continues to offer this service, and considerate if at some point he decides he's had enough.

The ACC provides support for auto-level mode, removing the need for constant corrections from the pilot to keep the aircraft level. This is especially helpful for aerial photography and FPV flying - which I am both interested in eventually. You have the option to turn the auto-level mode on or off from your transmitter.

Attaching the BMA020 was fairly straight forward. As there was little room left on the front of the board, I decided to mount it on the back using a single layer of foam tape. To connect the board, you need to wire it to the I2C bus of the Arduino board - in parallel to the WMP. A wiring diagram is provided here, and the general orientation of the board here.

Below you can see the bottom of my Arduino shield board with the ACC connected to the I2C bus. The BMA020 board is 5V friendly and has internal pull-up resistors, so no need for any extra parts:


To enable the ACC, you need to comment out the following line from the Arduino sketch:
/* I2C accelerometer */
//#define ADXL345
#define BMA020
//#define BMA180

Also, since I mounted the board to the bottom, I needed to invert the Y and Z axis as follows (note the placement of the negative signs):

accADC[PITCH] =  (((rawADC_BMA020[3])<<8) | ((rawADC_BMA020[2]>>1)<<1))/64;
accADC[YAW]   = -(((rawADC_BMA020[5])<<8) | ((rawADC_BMA020[4]>>1)<<1))/64;
accADC[PITCH] = -(((rawADC_BMA020[3])<<8) | ((rawADC_BMA020[2]>>1)<<1))/64;
accADC[YAW]   =  (((rawADC_BMA020[5])<<8) | ((rawADC_BMA020[4]>>1)<<1))/64;

After re-compiling the sketch, and flashing it to the Arduino, I was able to see the ACC values and the spatial orientation of the board show up in the configuration GUI. Note that you need to level the board and press the calibrate button before you see accurate values:


Finally, after waiting what seemed like ages (I'm not the most patient person) my hardware arrived via Singapore. After paying the required ransom, I was able to pick up my package at customs. Following a final verification of the mounting hole distance on the Turnigy 2204-14T motors (31mm), I cut the top and bottom part of the frame from a sheet of 1.5mm FR4/G10 fiber glass. A jig saw and a Dremel were quite helpful in the process.

The pieces were then used to sandwich a 10mm EPP foam board, with embedded 10mm M3 hex standoff spacers at the mounting points for the controller board. This allows to attach the MultiWii board on top and a battery and Rx compartment at the bottom. The ESC motor control boards are embedded in the frame. The final design can be seen below, without the top plate which was off to re-program the micro controller with the newest software version:






Main Components:

Motors: Turnigy 2204-14T
ESCs: Hobbyking SS Series 8-10A
Lipo: 1000mAh 3S 20C
Props: GWS Style 6x3
Rx: OrangeRx DSM2
Total weight ready to fly: 410grams (incl battery)
Thrust to weight ratio: approx 2.8:1
Sound: An angry bee hive on steroids

Below a short video to further illustrate the results. While the build went smooth, I think I will need to practice flying this thing :-)
Quadro Maiden

Flash player v9 or newer required.

Sunday, March 18, 2007

Canon A70 - IR Modification

I describe below how to modify a Canon Powershot A70 into an IR only camera by replacing the factory installed IR cut filter with an IR only passing filter.

By removing the IR cut filter, and replacing it with an appropriate filter that only lets IR radiation pass, we can create a highly sensitive, IR capable digital camera that opens up a whole new world of creative possibilities while retaining the convenience of digital photography.

Why did I choose the A70? There are no specific technical reasons, I merely had one at my disposal. This hack is not new and has been performed with numerous different camera models by many other people. However, as decent documentation is scarce, I believe this page might be worthwhile for someone.

Before I continue, a few words of caution. Please read them carefully!

  • The below documentation is for entertainment or educational purposes only. It is most likely incomplete, wrong, misleading, full of errors and omissions, and potentially hazardous to yourself and your environment. Peruse at your own risk.
  • Understand that it is a very likely possibility that your camera will not survive the described modification. Don't attempt this if you don't feel the camera is expendable.
  • The flash capacitor in the camera stores a possibly lethal current. While unlikely, if you have a known or unknown medical condition, or just bad luck, you could possibly kill your self. If you proceed, take the appropriate precautions. The only way to stay completely safe is not to attempt this modification at all.
  • You agree to hold me free of any damages or injuries that should result from you or someone you know attempting the below modification.


You will need as a minimum the following tools and equipment:

  • EquipmentA set of 3 or 4 fine tweezers of various shapes
  • A 1mm flat head screwdriver
  • A Phillips screwdriver #000
  • A TORX screwdriver #T4
  • Packaging tape
  • A permanent pen
  • A clean work area
  • A Cokin P007 IR pass filter or something equivalent to create a replacement for the IR cut filter.
  • A dremel tool or similar to cut the replacement for the IR cut filter to its proper size. A small hand saw can be used as well, with 150 grain sand paper to sand the piece down to final dimensions.

Before you begin, have a good system to keep track of the screws and their original location:
Screw tracking
A large piece of packing or duct tape, turned around to expose the sticky side and fixed to your desk at it's ends is perfect. Draw outlines of the pieces you are removing directly onto the sticky side of the tape, label the drawn parts accordingly, then set down the screws at their approximate locations onto the tape while you disassemble. This will greatly help in preserving all screws and making sure they go back where they belong once you reassemble.

The Modification

First you need to remove the 3 screws on the bottom of the camera.

Open the cover for the connection ports. Remove the tray containing the CR1220 battery. You will see two screws which you need to remove.

Open the battery compartment on the bottom of the camera. There are four screws that need to be removed. Two on top and two on the inside of the compartment.

Open the CF card door and turn the camera on its head. There is another screw that needs to be removed.

Now the top plate containing the zoom and shutter release comes loose. It attaches via a tiny green connector to the body of the camera. Disconnect and remove. The CF card door will now also come off.

On the front of the camera, press the button marked with a red circle. This will allow you to unscrew the silver plastic ring around the lens.

There is one last screw on the back of the camera that you need to remove.

You will now need to carefully pry the plastic shell apart and off of the camera. Remove the back portion covering the LCD screen first, starting at the bottom and working yourself up. You will need to use some force, but not excessively so. It's more a question of feeling.

The cover for the battery compartment can be removed by pushing at the metal axis forming the hinge to the compartment in the direction of the green arrow with something like a paper clip. Watch the spring circled in red, you don't want it to go flying across the room.

This is what you end up with once the lid has been removed.

Now remove the mode dial at the top via the two screws holding it.

Before you proceed, take note of the "huge" capacitor to the left. It temporarily stores the power for a flash discharge and is probably loaded to full capacity. To prevent it from discharging via an accidental touch, possibly seriously hurting or even killing you or frying any equipment you might be touching at the time, I suggest you cover the terminals on top with electrician's tape for insulation.

Next, you need to remove the flexible circuit board covering most of the top and back of the camera. Start by removing the one screw holding it at the bottom.

Next, push the black lever to the top left inwards, so that you can remove the switch registering if the CF card door is open or shut. Be careful you don't push the black lever in too far, or it will come off and you will be hunting for it and the spring that usually pushes it back out. NOTE: this needs to work perfectly again when you put the camera back together. If not, the camera will think the CF card door is open and will NOT turn on. Be careful and take your time.

Now carefully remove the flexible circuit board from the body by lifting it off of the green circled notches one by one.

Once you have pried it completely loose, you will see where it attaches via a connector to one of the main circuit boards. carefully lift the green circled tabs with a small screw driver to unlock the connector and you will be able to pull the flexible circuit board completely off.

Now that the circuit board is removed, you can continue by removing the CF card reader. Remove the single screw circled above. Then, slowly slide the CF reader off of the rest of the body, towards you. You might need to lift it over a tab at the bottom of the camera.

Once it is almost off, separate the connector between the reader and the underlying DIGIC processor board by simply pulling back on it.

This is what it will look like once it has been separated.

Next is the LCD screen. But before you can remove it, you need to remove the optical viewfinder first. There is one screw on the front that you need to remove.

Then there are two more on top. Once removed, you can lift the viewfinder off of the top carefully. Take note that it is snapped in place in front where you removed the first screw. You will need to wiggle a bit for it to pop loose.

Under the area where the viewfinder was you will find the first screw that holds the LCD panel. There is a white ribbon cable in front of it. You will need to remove the ribbon cable eventually, so you might as well do it now by pulling it out of the marked connector which does not have a locking mechanism. Then remove the screw.

On the bottom of the camera, there are two additional screws to remove that fasten the LCD to the body.

As a last step, before you can remove the LCD, there are 2 more ribbon cables to detach - marked in blue above. The one on the side has a locking mechanism that is unlocked by moving the two blue circled pieces of plastic in the direction in which the cable detaches.

The smaller one on the bottom can just be pulled out.

Once the LCD is removed the DIGIC processor board to the right ist last before we have access to the sensor. Start by detaching the additional 3 ribbon cables marked above. The green circled one just pulls out, the blue circled ones need to be unlocked first by flipping the black plastic flap on top of them open. Next, remove the screw circled red and you should be able to wiggle the DIGIC board out of the plastic holding it to the body.

Once it is loose, there is a tiny connector on top that needs to be detached.

Finally, on the back of the board there is another ribbon cable that needs to be disconnected before you can completely remove the board.

Now you have direct access to the CCD sensor of the camera. It is fastened by three TORX screws. The top left one will be covered by the piece of metal holding the flash capacitor. Just carefully bend it to the side and out of the way.

If you have not done so yet, make sure you have a well protected, dust free place to put the sensor while you remove the IR cut filter. Check the metal housing of the sensor to see if it might be secured by one or two small drops of glue. If so, carefully scratch the glue away with a screw driver or an exacto knife. Take extreme care not to cut or otherwise damage any of the ribbon cables. Then unfasten the screws and carefully lift the sensor off by its ribbon cable.

This is what the CCD sensor looks like after being detached.

Here you can see the slightly blue tinted IR cut filter that we will be replacing by an IR only filter. Before we proceed, take note of the 3 brass shims around the screw threads holding the sensor. Also, note the two small springs marked with red arrows above. You want to be extremely careful not to lose any of them.

Carefully pull off the rubber gasket around the IR cut filter with a pair of tweezers. Then, using a screw driver, pry off the IR cut filter which is held to the plastic beneath by 2 tiny drops of glue.

Once the IR cut filter has been removed, fabricate a replacement piece out of the Cokin P007 IR filter, or whatever material you will be using. If you do not replace the IR filter with something of similar thickness and refractive index, your camera will be extremely near sighted and unusable except maybe for macros.

Above you can see the original IR cut filter in blue. As I was unable to obtain a P007 IR pass filter on short notice, I used a P003 red filter for the replacement (seen to the right) and added a piece from a thin gelatin IR filter so it would still be IR only.

Install your filter replacement in the same spot that the IR cut filter occupied and secure it with 2 additional drops of an appropriate glue. Two tiny strips of tape will work as well. Now put back the rubber gasket around the filter and re-attach the CCD sensor carefully.

Congratulations, you are almost done! Now you only need to put the whole thing back together again by retracing your steps and assembling in reverse order. Pay specific attention when re-attaching all those ribbon cables and other connectors. You want them connecting the right way around, coming together again securely and locked in place where supported. All the while you do not want to exert excessive force on any of them. Check each connection thoroughly before you move on. I would guess that 90% of the problems you might have on reassebly will be bad connections.

Good luck!!!

I would like to thank the creators of the following 2 web sites, which proved invaluable resources the first time I attempted this modification:
I would further like to thank Thomas, who sacrificed his Powershot A80. Thanks also go to Iain, who's A70 was apparently not harmed during the making of this documentation.

Feedback and questions are highly welcome, feel free to leave a comment below.