Monday, January 21, 2013

Hacking a Cheap HobbyKing 6 Channel Receiver - Summed Signals

RC Hobby Receivers

Any standard modern hobby RC receiver works the same way. The position of joysticks is converted to a digital value, which is then encoded, modulated, and broadcast on some radio frequency. On the other end, a receiver demodulates and decodes the values, converts them to PWM (Pulse Width Modulation), and outputs each of the PWM signals on a separate output pin. Typically, you would plug in a servo or motor controller to each output.

The signal on each output looks like the following picture

And now let us zoom in on one of those pulses

The value of the PWM is the width of the pulse. Standard hobby electronics have a pulse width between 1000us and 2000us, or between 1ms and 2ms. A pulse of 1000us is equivalent to 0% and a pulse of 2000us equals 100%. In the picture above, you can see that the pulse is about 1.46ms wide, which translates to just under 50%, or the joystick is centered. There is no official standard for the time between pulses, but typically a pulse occurs around every 20ms for use with average analog servos.

The Problem

Often in robotics or, for example, fancy multirotor aircraft, there may be addition smarts on the vehicle that needs to do additional computation on the inputs. RC radio transmitters are great. They usually have 2 nice joysticks, a miriad of switches, excellent range,

Tuesday, December 11, 2012

Using GStreamer to Stream All Audio Captured from Soundcard from One PC to Another

Jump to the solution

The Problem

I often work on multiple computers at a time. Additionally, I use headphones the majority of the time. Sometimes I would like to be able to stream all the sound (including system notifications) from one computer to another, allowing me to hear the system notifications from both machines on my headphones. The old-school way to accomplish this means running an audio cable from the output of one PC to the line in on the other. Although this works, the line-in device is usually low quality and noisy. Plus, what if the computers are far away? How about sending the audio digitally over the network? No need for a cable, assuming the computers are already networked!

The Solution - GStreamer

GStreamer is actually an amazing framework that allows you to create all sorts of media pipelines. In my opinion, it is easier to use than ffmpeg once you become familiar with the concepts of how to use it.

What is GStreamer and how does it work?

GStreamer uses a simple concept. You create pipes. Pipes have a source and a sink. A source generates content, and a sink consumes it. You can do fun things with pipes. Imagine that you have a soda fountain that takes in soda water for one source, soda flavoring from another, and spits out into cup sized increments. This process is very similar to the process of taking a video source and an audio source, combining them into a media stream, and then breaking it up in to packets to send it out over the network. Keep the idea of a pipe, with sources and sinks that you can chain together, in mind.

The trickiest part of GStreamer is that each source and each sink has its own set of input types or output types that it can produce or consume. The trick is matching up sinks to sources. If an mp3 encoding element takes in raw audio and spits out an mp3, you must ensure that something that can source raw audio is plugged in one side and something that sinks mp3 audio is plugged in the other. Makes sense, right? It is a little trickier in practice, just because there are so many different formats media can take.

Sunday, September 2, 2012

Winning "Jet" Powered Pinewood Derby Car

I finally had an opportunity to participate in a 'no holds barred' pinewood derby for grownups. The annual competition does have some standing by-laws, however.

  1. No open flame or explosions
  2. Any car leaving the track will be disqualified
  3. No sabotaging the other vehicles during the race

Being new to the area, and new to the competition, I set out to at least compete for the fastest car. After spending many hours finishing unpacking my garage to clear out a space to build a car, I had about 4 hours before the competition. I grabbed my tools and set to work.

The Design

Originally, I wanted to use the bell of an outrunner electric motor as the drive wheel, but I knew I did not have enough time to design and build such a pinewood derby car. So, I decided to salvage the parts from an old RC airboat (that didn't work so well) I had collecting dust in my garage.

The Chassis

The Materials

  1. 1/8" Scrap Plywood from the Homely Despot (they usually have scrap wood in the back of the lumber section that you can pick up for pennies on the dollar
  2. 1/2" Square Hardwood Dowel - Your local hardware store probably has 2ft lengths for about a dollar
  3. 3/8" Square Hardwood Dowel - same as the 1/2" dowel
  4. Small Self Tapping Wood Screws
  5. Pinewood derby Wheels and 'Axles' - You can substitute other wheels if you please
  6. 9x4x4mm ball bearing
  7. M4 bolt
  8. M4 nuts

Saturday, September 1, 2012

Cheap Source for Arduino Uno and Arduino Mega

Of all places, Hobbyking has a bunch of super cheap Arduino hardware. Probably the cheapest source you can find for these boards. Awesome! They even have a couple shields, if you know where to look.

Tuesday, May 8, 2012

Xbee Enabled RC Joystick Overview

Originally, I did this project to highlight how simple it can be to add a joystick to your robotics project using only:

  • Two Xbees (Series 1)
  • One Arduino
  • And one old joystick with a gameport connector

That is it. In this I also cover two things, how to hack those old joysticks all you electronics hoarders have (like myself) and demonstrate how to set up an Xbee as a data harvester and use some of the underutilized powers of the Xbee

The Overview

Here is a simple overview of the project. It doesn't get simpler than this.

Additionally, for the reasonable cost of an Arduino, two Xbees, and an old joystick you can find at a local thrift shop, you can have a multi-axis controller for you robotic project.

The Start - That Old Joystick

First you want to learn about that old joystick of yours. Check out Part I. I explain the process of modding your old Gameport joystick to work with a regular ADC you would find on a microcontroller.

Xbee Enabled Joystick, part I

Setting Up the Xbees

The next step in the project is setting up the Xbees. This explains how to set up the Xbee to automatically read values from the ADCs and digital inputs and send that information to a predetermined Xbee. The receiving Xbee is configured to receive that data and spit it out over the serial line using API mode

Xbee Enabled Joystick, part II

Finishing Up, Code for the Arduino and Schematics for the Xbee

In the conclusion I dust off my RC airboat, slap an Arduino to it, and demonstrate the final project. I include code samples for parsing the Xbee API packets and pulling out the ADC values from the joystick connected Xbee

Xbee Enabled Joystick, part III

Friday, April 27, 2012

Advanced Eagle Layout Tutorial - Building Better Library Parts - Variants and Technologies

Advanced Variants

Everybody knows that to create a device set you must have at least one variant of the device that binds the symbol to the package. The default variant is called ''. That is right. Double single quotes. It represents an empty string.

Naming Variants

You may have also noticed that if you name a variant, the name is appended to the device name. For example, if you have a device named


and a variant


the resulting name will appear as


Pretty cool, huh? Often manufacturers will have a package code embedded in the device part number. For example, if


is the base part number, and the manufacturer has package codes


Wednesday, April 25, 2012

Dirt Cheap USBasp AVR Programmer Available

Did you know that you can get a super cheap USBasp AVR programmer? $4.95 plus shipping (around $3 for International Unregistered). Where can I get this you might ask? An unlikely source, Wow. I don't know of anywhere else that can sell it that cheap. Generally stuff takes at least one month to arrive to the US from China, that is if the item is in stock. Longer for backordered items. But that is super cheap! Next HobbyKing order I make I'll through one on and review the programmer.

Monday, April 23, 2012

Eagle's Library Part Creation Standard

Did you know that Eagle had a Library Part Creation Standard? I didn't either. Check it out. I've seen plenty of parts that violate some of these rules, and consequently make life a little more difficult.

Sunday, April 22, 2012

Advanced Eagle Layout Tutorial - Building Better Library Parts - Pin Swaplevel

Once you have pin direction down, we can move on to some of the other features of Eagle's pins.

How to Use Pinswap/Swaplevel

Swaplevel can come in handy on occasion. Its purpose is to allow you to be able to dynamically change which pin is assigned to a certain pad when using an instance of a part in your schematic/on your board. The end effect would be the same as physically swapping the pins' locations in the symbol while leaving the rest of the symbol intact. Let's look at an example using a simple resistor:

Now, because a resistor is the same forwards, backwards, and and any which way, it makes sense to be able to arbitrarily swap the pins. Look at the following board.

Oops, my nice row of resistors has one that is flipped! I could rotate the part 180 degrees, but then the text name would in the wrong place. I can simply select the 'Pinswap' tool, click on the first SMD pad and then the second. Voila! The pins have been swapped!

Saturday, April 21, 2012

Advanced Eagle Layout Tutorial - Building Better Library Parts - Pin Directions

CadSoft Eagle is a great tool. However, I've only ever come across basic tutorials to get you started. A lot of features of Eagle are buried in the help files. These tips should help you become a power Eagle user and take advantage of a lot of things that eagle can do.

I assume the reader has basic familiarity with Eagle, and has a basic understanding of PCB design. I will explain some of the more advanced features of Eagle

First up, Pin Direction

Let us start in a symbol for a device.

When you add pins to a symbol, there are several options for the pin. Most of the options are aesthetic, but some come in handy when you run ERC. If you look in Eagle's help file under the 'PIN' command you can find this little blurb.

The Help

The logical direction of signal flow. It is essential for the Electrical Rule Check (ERC) and for the automatic wiring of the power supply pins. The following possibilities may be used: 

NC - not connected
In - input
Out - output (totem-pole)
IO - in/output (bidirectional)
OC - open collector or open drain
Hiz - high impedance output (e.g. 3-state)
Pas - passive (for resistors, capacitors etc.)
Pwr - power input pin (Vcc, Gnd, Vss, Vdd, etc.)
Sup - general supply pin (e.g. for ground symbol)

Default: IO 
If Pwr pins are used on a symbol and a corresponding Sup pin exists on the schematic, nets are connected automatically. The Sup pin is not used for components. 

Youtube Channel