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

WIDGET

and a variant

123

the resulting name will appear as

WIDGET123

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

WIDGET-

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

S

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, HobbyKing.com. 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

Direction
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. 

Friday, April 13, 2012

Graphics Cards Hacking (Repair) Roundup

I must have bad luck with graphics cards. My last graphics card was an XFX nVidia 8600GT. My current graphics card is an EVGA nVidia 9800GT. Both have failed in unexpected ways. Fortunately, I have been able to fix both of them! WARNING - these procedures will most like void the warranty, if you have one.

XFX 8600GT

Exploding Caps



One evening I was sitting watching TV in another room with my wife. We heard some 'pop' noises. Well, more like several loud 'cracks'. My wife asked me what the sound was. I thought it was the ice maker in our fridge. Suspiciously, though, the graphics on my computer started having problems. I began seeing artifacts here and there. Then, more pops and the display become incredibly garbled and unusable. I pulled out the graphics card and what you see above is what faced me. Numerous aluminum electrolytic capacitors had exploded. You can see the paper separator(the yellow fibrous stuff) spewing out.

The Fix


To fix the 8600, I purchased some aluminum electrolytic capacitors from Digikey with the same values as the exploded ones. Generally, caps that large have their values and ratings printed on them. I needed some 1500uF 6.3V, 1000uF 6.3V, and 470uF 16V capacitors. The footprints for the capacitors were generic and supported multiple sizes, so I just got the cheapest ones in approximately the same size. Radial capacitors have 3 dimensions to consider. Lead spacing, diameter, and height. In retrospect, the replacement 1500uF caps are a lot taller than the original, but they still fit in my case. I wouldn't worry about stressing too much about matching ESR or any other features other than capacitance and voltage rating. Odds are that the originals are on the cheaper side.

Thursday, February 9, 2012

Installing the Android SDK on Ubuntu 11.10

My harddrive failed, forcing me to reinstall my OS. I decided to upgrade to Ubuntu 11.10, so this is basically a rehash of my previous instructions for Ubuntu 11.04.

  1. Make sure that you have the 32bit compatibility libraries installed if you are using 64bit Ubuntu

  2. If you fail to install the 32bit compatibility libraries you will get an 'adb version' error at the end when you run Eclipse. If you are running 64bit Ubuntu, start out by installing the 32bit libraries

    ~$ sudo apt-get install ia32-libs

  3. Install the JDK
  4. This should be a straight forward step

    ~$ sudo apt-get install openjdk-6-jdk

  5. Download and install Eclipse
  6. Find and download an appropriate version of Eclipse. Since my last instructions for 11.04, the version of Eclipse in the Ubuntu repositories has jumped to 3.7. Hooray! Go ahead and install Eclipse

    ~$ sudo apt-get install eclipse

Friday, January 6, 2012

Best Commercial White Wire Hack I've Seen

As an electronics tinkerer, I often take apart old electronics to salvage a nice audio pot here, a button there, etc... In my tinkering, I often come across white wire hacks, such as a wire after the fact soldered from one point to another, or something of the likes. Today I was taking apart a nice standard def analog Yamaha receiver that someone donated to my cause. I came across the most ridiculous white wire fix that I've seen in a commercial product to date. Did I mention that this is a nice expensive Yamaha product?

The Hack - Dead Bugs in a Yamaha RX-V890 Natural Sound Receiver

Unfortunately the receiver was already in pieces by the time I noticed the hack. Here is the hack:
Do you see it? Gosh, I wish I had a camera that took better macro pictures. Let's try another picture to see if you can see the hack. Click on the pictures to get a clearer view.

Do you see it now? There are 2 relays dead-bugged with hot glue onto two ICs, 'Pass the Pigs' style. Bus wire is soldered to the relay pins down to the IC pins (most visible in the last picture). Hot glue keeps the wires and parts in place. I think those three sideways caps (most visible in the first picture) are part of the hack as well.

Wow

As far as hacks go, this one is really well done. I'd hope so, because some poor soul probably had to fix thousands of these. I'd also hope that it was done well because this is an expensive piece of equipment. Regardless, it isn't what I was expecting to find taking apart this receiver. Who knows what other commercial products have crazy hacks!

Monday, January 2, 2012

Compile Code for the mbed from the LPCXpresso IDE

Recently I found myself working on an robotics system with an mbed. I was offline, and didn't want to use mbed's IDE for development. Plus, I already had LPCXpresso running on my computer. Browsing around, it seemed fairly simple to compile code for the mbed from LPCXpresso. Basically, after setting up a project with the correct target processor (in my case the LPC1768), follow these simple steps.

The Steps to Build a Binary File for mbed from LPCXpresso

  1. Build your project
  2. Browse in the Project Explorer to 'Debug' folder of your project where the .axf file can be found
  3. Right click on the .axf, then select 'Binary Utilities->Create Binary'
Pretty simple, eh? You should now see a .bin file with the same name as your .axf file that you can now throw onto your mbed via the USB Mass Storage Device bootloader already on the mbed. Great, now what about automatically building the binary file when you build your project? Easy enough!

The Steps to Automatically Generate a Binary File for mbed from LPCXpresso

  1. Open your project properties (can be done by right clicking on your project in the Project Explorer, and selecting 'Properties' from the popup menu)
  2. In the treeview on the left, select 'C/C++ General'->'Settings'
  3. Select the 'Build Steps' tab
  4. Remove/delete the '#' character in the Post-build steps Command box (thus uncommenting the already included command for generating a binary file)
  5. Repeat for all configurations desired, apply changes, and you're done!
Now, when you build your project in LPCXpresso, you will be left with a .bin file in the Debug folder that you can throw and run on an mbed!