Gstreamer and the Logitech Pro 9000

This is a gstreamer pipeline that takes frames from a UVC camera on /dev/video0 and displays them on the screen, while simultaneously saving one frame per second to a file. In other words, it’s a single-command-line surveillance camera.

gst-launch v4l2src device=/dev/video0 ! ffmpegcolorspace ! video/x-raw-rgb,width=640,height=480 ! identity name=artoolkit ! tee name="logger" ! queue ! ximagesink sync=false logger. ! queue ! videorate ! video/x-raw-rgb,framerate=1/1 ! ffmpegcolorspace! pngenc snapshot=false ! multifilesink location="frame%05d.png"

Obviously, the camera can be set up to display in different resolutions, and save to differently named files. The next one expands the length of the section of the filename that changes to 8 digits, enough for one picture every second for 3.16 years. I also reorganized the order of the parameters so that ARToolkit can work with the data stream and do augmented reality stuff to it.

export ARTOOLKIT_CONFIG="v4l2src device=/dev/video0 ! tee name=logger ! queue ! ffmpegcolorspace ! video/x-raw-rgb,width=640,height=480 ! identity name=artoolkit ! fakesink sync=false logger. ! queue ! videorate ! video/x-raw-rgb,framerate=1/1 ! ffmpegcolorspace ! pngenc snapshot=false ! multifilesink location=frame%08d.png"

Cat Ear Code

This is the Arduino code for running the cat person ears. The circuit was simply three switches, one for each paw and one for the petting sensor, and a pair of servos. The code just checks each sensor and moves the corresponding ear.

#include <Servo.h>

//Servo pins
#define rightpaw 6
#define leftpaw 7
#define pet_sense 8

//Ear positions
#define r_up 95
#define r_down 160
#define l_up 180-r_up
#define l_down 180-r_down

Servo leftear;  // create servo object to control a servo
Servo rightear;

int pos = 0;    // variable to store the servo position

void setup()
{
  leftear.attach(9);  // attach the ear servos
  rightear.attach(10);

  pinMode(7, INPUT);

  leftear.write(l_up);
  rightear.write(r_up);
}


void loop()
{
  if(digitalRead(rightpaw) == HIGH)
  {
    rightear.write(r_down);
  }
  else
  {
    rightear.write(r_up);
  }

  if(digitalRead(leftpaw) == HIGH)
  {
    leftear.write(l_down);
  }
  else
  {
    leftear.write(l_up);
  }

  if(digitalRead(pet_sense) == HIGH)
  {
    leftear.write(l_down);
    rightear.write(r_down);
    delay(1500);
  }
}

Flaws with the original cat ears

My first version of the cat ears for people had these problems:

  • The servos are not as powerful as I would like, so they don’t move the ears as far down as I wanted.
  • The petting sensor on the headband between the ears was an afterthought, so instead of one cable leading from the headband to the controls, there are two.
  • The paw cables snap to the gloves with normal clothing snaps. If you dance like a spaz, they will get unsnapped.
  • The palm material of the gloves is insufficiently stretchy. This puts a bunch of load on the seams and, given time or big beefy hands, might cause the seams to fail.
  • The cable between the controller board and the gloves and hands has a non-locking, non-polarized connector in the middle of it. It is possible for this to get unplugged and then put back together backwards.
  • The cables are all absurdly long. It would fit me better if I was nine feet tall.
  • I’m not terribly pleased with the construction of the ears, particularly where the ear lining meets the headband.

I’ll be posting a bunch of links to the techniques used in making the ears and the code soon. It won’t be a full write-up of the process, but it will be enough pointers for someone who wants their own set of ears to do it fairly quickly.

If you can’t sew, solder, and operate simple hand tools, you may want to get a friend to help, but then you can make two sets, and bat your ears at each other.

Why I don't sell things

I have this problem, which may be common, and may not be a problem, where I don’t consider the things that I like doing as ways to make money. I do stuff like building random electronic devices because I enjoy the process of doing it. On the rare occasions that I’ve done it for money, I’ve found that the work stopped being fun and started being work. As a result, when someone approaches me about my hobbies with an eye towards monetizing them, I tend to react like someone told me I could sell my (hypothetical) pet cat for sausage. I could, and I might even make money off it, but it wouldn’t be fun and it misses the point.

That’s part of the reason that I don’t see a problem with making something and then giving it away (to a good home, that is. I don’t build things to be thrown away). Giving things away is usually bad business. It ensures negative margins and financial loss. I may lose money on the transaction, but life isn’t transactions, it’s experiences. I had the experience of taking a bunch of stuff that did nothing, building a functioning thing, debugging it, and learning from it. Once it’s built, it’s just an object, but while it’s being built, it’s a process. If a business is efficient, there is as little process as possible to make as many objects as possible. If a hobby is fun, there’s tons of process and the object is secondary, if it exists at all. Consider sports. You can go play frisbee with nothing but sensible clothes and a frisbee. At the end of the game, you haven’t created anything that can be sold, but you went through a process that was rewarding in and of itself.

It may be that entrepreneurs view their businesses the same way, with the functioning of the business being the process and the end product being the object. From that point of view, a streamlined management structure may have the same beauty and utility as a well-designed and smoothly implemented software framework or a well-designed sensor circuit.

However, understanding someone’s point of view is not the same thing as assuming it. As a result, I won’t be going into the cat sausage business any time soon.

While I was at the Mini Maker Faire, a bunch of people asked if they could buy various things that I had. I hadn’t applied for a permit to sell things, so I didn’t sell anything. I had two reasons for not selling things at the faire in general, and one reason for not selling my animatronic cat ears in specific.

The first reason to not sell at the faire is simple. I didn’t have anything to sell. Everything I wanted to take to the faire is stuff that I was proud of making and planned to keep.

The second reason is complex. I don’t really think of the Maker Faire as a place to buy and sell things, so much as a place to meet people and learn about things. Commerce is certainly present, but in terms of how I approach the event, it’s a lot closer to Firefly than the MIT Flea. Selling things is not the interaction that I want to engage in with people. I’d rather learn about what they are working on and teach them about what I have worked on.

The reason I wouldn’t sell the cat ears is that they are a prototype. I found several bugs in the initial shakedown that I haven’t fixed. I could fix them if I was going to make a production model to sell, but i probably won’t do that, for the reasons detailed above.

However, now I have a list of things to watch out for in the design, and the existing design. That’s enough to publish here and let other people make their own versions. Teaching beats selling any day of the week.

Logitech Pro 9000 and Artoolkit

I’m doing a little augmented reality work for my day job, using ARToolKit. ARToolKit works, and is documented, which is a combination of features that appears to be unique in open-source augmented reality software.

I configured my build to use GStreamer, and set my ARTOOLKIT_CONFIG environment variable to v4l2src device=/dev/video0 use-fixed-fps=false ! ffmpegcolorspace ! capsfilter caps=video/x-raw-rgb,bpp=24,width=640,height=480 ! identity name=artoolkit ! fakesink

That gives a good tradeoff between resolution and speed, and works just fine with the simpleLite demo program that comes with ARToolKit.

Augmented Reality is like normal reality, but better

Me Showing off at Maker Faire RI

Hacking LG Phone Chargers

I have an LG Lotus phone. It charges over a USB cable, which plugs into a USB-like port on the charger. I recently wanted to be able to charge my phone in the woods of Vermont, where outlets to plug a charger into are few and far between. To fix this, I built a simple regulator that draws power from a 7.2V RC car battery and provides 5V DC to a USB jack.

My cell phone charger

Unfortunately, when I plugged my phone into it, the phone displayed a message that said “Please use only genuine LJ accessories”.

To figure out how the phone identified the charger, I opened the charger up. I had visions of LG using an I2C EEPROM to store a unique identifier or some sort of crypto chip performing a handshake with the phone based on a shared secret that was baked in at the factory.

The bottom of the charger PCB

In reality, it’s nothing that complicated. The data lines of the USB port are connected to each other. This means that anything the phone sends down one data line will show back up on the other one, so it can detect the connected pins by driving one line high and seeing if the other line also goes high. I connected the data pins on my homebrew charger, and the phone started charging from it.

Help Maker Faire RI!

The Rhode Island Maker Faire, which I will be presenting at, is looking for a few kind souls to pledge financial support. Help your local DIY crowd and encourage innovation and tinkering!

Plasma cutter rectifier heatsinks

This evening, I added heat sinks to a couple of rectifiers that I’m planning to use in the power supply of a DIY plasma cutter. The rectifiers will each be handling half of the power load of the device, so I have beefy 35A/600V rectifiers. Each rectifier has a square metal case with a hole in the middle, so I drilled and tapped a hole in a the centers of a pair of CPU heat sinks and bolted the rectifiers to the heat sinks. This picture may help to make the assembly clear.

Rectifiers and heatsinks with fans

I had high hopes for the original fans that were on those heat sinks, but the lubricant that was in them had turned to gum, and so they didn’t spin. The new fans are from laptops, and run on 5V.

I’m planning to get the 5V from the low voltage filament windings of the microwave oven transformers that I’m using for the isolation transformer of the power supply. There are two sets of two transformers, wired “back-to-back” to act as isolation transformers. I’m going to post a complete schematic as soon as the power supply section of the cutter is fully assembled.

Exhibiting at Maker Faire Rhode Island

I just applied to exhibit at the RI Maker Mini-Faire. This is kind of a last-minute thing, so I’ll just be showing Cnidaria Hallucingena and whatever I have done of the various projects kicking around the house. I should probably also get business cards together by then, but having them done in 10 days strikes me as unlikely.

The Faire is August 28, 2010, at the Bank of America Skating Center in Providence RI from 3pm-11pm.

UPDATE: I’m in!