Monthly Archive for September, 2013

Hard Drive Scroll Wheel Revisited

While I’m still thinking about the best algorithm for making proximity-based scrolling, I decided to revisit my somewhat failed attempt at using a hard drive motor as a scroll wheel. Last time, I had the scrolling algorithm working, but failed to get V-USB to work reliably with the ATMega I was using. However, since I was already working with the Stellaris boards for proximity scrolling, I decided to add in hard drive scrolling functionality at the same time.

The schematic is roughly the same as before, except the microcontroller has been replaced with the Stellaris Launchpad board.

I have a separate branch for this work and the code is really rough right now. I had to make some changes to the HID mouse implementation because it doesn’t support horizontal (or vertical) scrolling.

It works!

Scrolling with a Proximity Sensor

A long, long time ago (i.e. 6 months), a representative from Newark contacted me asking if I would like to review one of their products. I was interested in a few projects at the time that would require a proximity sensor, so I ordered this GP2D12 distance sensor from Sharp. Of course, I never actually got around to using it until… now. But finally this weekend I had a chance to try it out.

I decided to just go with something simple, with minimal parts, to try things out. I’ve had a Stellaris Launchpad lying around for a while that I hadn’t had a chance to use for anything yet, so I decided to go through the process of installing the toolchain on Linux.

After that, I started coding. The first step was to just modify an existing USB CDC example to spit out ADC samples at a pretty fast clip so that I could do algorithmic development on my computer.

Right now, I’ve got a fairly good prototype for an algorithm that does the following:

  1. Average bunch of samples as a background-noise baseline (i.e. without any hand over the sensor).
  2. Move into a state machine that waits until the readings are significantly higher than the baseline.
  3. Average a bunch of these samples as the “resting” hand position.
  4. Thereafter, average a bunch of samples and compare the difference between them and the resting position. Generate scroll events based on the magnitude and sign of the difference (with some deadzone in the center).
  5. If at any point, the value falls down close to the background noise baseline, assume the user has taken their hand away and wait to go back to calculate a new resting hand position.

Once I get the idea finalized out, I’ll draw out a state diagram and implement it directly on the Launchpad so that the device just shows up as a generic USB mouse.

In the meantime, I’ll talk about the proximity sensor. It’s more than just a photoresistor with an IR LED; it does some signal processing onboard to help eliminate noise from a lot of the usual background effects like ambient light or temperature.

I took some samples through the ADC on the Launchpad and got some interesting results.

  • (A) Baseline noise from the sensor staring at the ceiling.
  • (B) I placed my hand 10cm or so from the sensor.
  • (C) I move closer to the sensor.
  • (D) Eventually I move so close that I hit the other side of the curve where the voltage decreases.
  • (E) I start moving my hand away from the sensor.
  • (F) The sensor is staring at the ceiling again.

There’s a few interesting things to note. First, the periodic noise is coming from the fact that I’m powering the sensor with the 5V VBUS, which has the same noise. Unfortunately the sensor must be powered with somewhere between 4.5V and 5.5V, so I can’t power it from the regulated 3.3V bus. When powered with a regulated 5V bus, it works beautifully. I’m really impressed at how good it is at filtering out noise from environmental effects. One thing that this graph does not show is that the device is designed to be extremely accurate with respect to position. That is, you can easily make a digital ruler with it. I think I might try that out too at some point. And at the cost of like two burritos, this part is a pretty good deal.

ACRISifying an IKEA FADO Light

So we bought this FADO accent light from IKEA and frankly, it’s kind of… well… boring. I thought that maybe I could breathe new life into it by converting it into an ACRIS lighting instrument. For bonus points, I tried to do it in the least destructive way possible. Here’s what I did:

The first step was to rip out the old guts. I used a screwdriver to carefully open the tabs connecting the lightbulb assembly to the base.

Then I pulled out the wires that run through the base and into the lightbulb assembly.

Next, I used a dremel to grind down the side supports on the tabs to make a little shelf. I’m still letting this count as non-destructive because you can still assemble the original parts easily. Okay the assembly is ready to go.

Now came the fun part. Since it’s impossible to differentiate multiple LEDs in the light (I tried — looks like crap), it’s easiest to just solder all of the LED terminals together, and bring 4 wires out through the base.

It started with this:

And ended up like this (ugly, I know):

Then, I modified the controller a bit by wiring 3 pairs of channels together to handle the current from 3 LEDs. I screwed the board into the light base and carefully put the globe on.

The result isn’t half bad:

For hipster points, I took an instavine.

Unfortunately, there’s a few problems. First, I don’t have useful tools so I had to tape the damn thing together. Not good. Second, there’s no heatsink on the LEDs, so I’m not running them at full power. Third, I need to extend the feet on the base out a bit more so that the board is protected. Fourth, if I wanted to take it apart, I’d have to unplug all the LEDs and unscrew the board before I can reach the weird little springloaded thing that keeps the light bulb on the base.

But overall, it actually works quite nicely. I think when I bought them here in the bay area, they were like $15. I might buy some more!