By Kevin Cannon

Brand New Page is a project exploring the possibilities of mixing & merging elements of traditional toys with multimedia techniques. As part of this investigation we will build a physical prototype of a toy which has been inspired by our research. Project Homepage

Introduction

The goal for the hardware was to build a sensor which could detect blowing. A number of systems were investigated including the iCube, hacking hardware, using a microcontroller. Below is a short log of some of the things looked at during the the production.

Mouse Hacking

The most promising course of action looks like it'll be hacking the rotation sensors out of a mouse. Mice generally work using opto-electrical sensors. There's a Infrared LED, and a sensor attached to that. In between there's a disk with many slits in. The sensor simply sees pulses of light as the disk rotates.

Take a look a the inside of a mouse. Important things are labeled.
mouse internals

I found a few good sites on the net with details about how mice work, and have slowly begun figuring out the fundamentals.

Propeller

This project is all about blowing ;o) so we need to hook up a propeller to the rotation sensor if we want anything to happen. I popped into Mark's Models and purchased some replacement propellers for some radio controlled planes.

Attaching mouse wheel to propeller

I set about figuring how to attach the propeller to the mouse wheel.

Cutting drilling, gluing, soldering, filing and we came about with a basic solution. Basically, I drilled a hole in the shaft of the optical disk, and stick a nail into it. The nail was attached to the propeller as shown above. So, what exits now is a blowing operated mouse, fully functional by the way, if you were so inclined. My kitchen table was a bit of a mess after it all though.

Result:

Encoder

Once the propeller is completed and working, the next stage is to get it interfacing with the BX-24 chip. Instead of using the IR LEDs which comes with most mice, I decided to start with something that cam with an old Microsoft Mouse. It's a fully enclosed device, and appears to be mechanical. As the shaft turns, it actually makes the electrical connection, so it's basically just a switch. It seems to have two contacts, in order to measure the direction of rotation. Since the propeller will only spin in one direction, then I don't even need that.

Waves

It seems on further investigation that the component above isn't quite so simple. It out puts a wave of some sort. see output data

According to the kind folks on the BasicX users list I'm told it outputs a square wave, in quadrature format. This is little daunting. I can get data from it no problem, and detect movement by the peaks of the data. Interpreting it, to make it a little more useful (detecting speed etc...) is going to be a little harder.

1. Processing

Hooking up the sensor to a PC was a priority, so I attempted to do it with Processing first as it's the easiest means available. I was quickly able to input it and graph the data, by modifying their analog input example.

2. Director

Serial input in Director, is provided via a commercial third party xtra from Physical Bits. Getting the input in was messy. We got it working using the Debug.Print command, as opposed to the actual serial out communication.

Interpreting the Signal

After a long time of trying to interpret the signal, with mixed results, we decide to ditch it. I wasn't getting anywhere fast and it looked like something that could take a day or a month, and I wasn't having any joy in tracking down any DSP experts. We decided to go down a different route, and build manual rotary switch ourselves.

Building a Rotation Switch

We were getting a lot of background interference because things weren't grounded properly. My electronics education is a very hands on experience. I looked into that, and figured out how it works, so now it's either on, or grounded (1 or 0) as opposed to (1 or background stuff)

Switch Version 1.

Simple shaft device, mounted on a cocktail stick.
Detects series of 1111100000s. Hard to blow, and I was just holding the wires in place, but it's a proof of concept device that works, which is the most important thing.

Version 2 - In Progress

Here's some photos of what I've been looking at.

At a basic level this worked. I could read input but I was holding everything into place. So, knowing that the concept was working, I started investigating how to hold the connections in place, so everything doesn't stop working when you move them.

Hacking a Motor

In trying to work out the mechanics of how this should work I decided to break open a cheap motor I have. Since they probably share many similarities, I hoped it would give me a good idea how to mount things, and maybe I can salvage some components too.

Motors also generate a signal when turned, so I tested that, and watched it give a signal. The motor I have has too much torque for this project though, and I doubt I could find out that would work like that. We want to detect a signal, not generate electricity.

Major Update:

When I opened up the motor I found that the shaft and connection system was actually usable as a base for this sensor. I gutted out tall the magnets stuff and was left which a basic shell which could freely rotate. As you can see below is has to feather light connections, which is just what I needed to create a basic rotary switch.

I expected the hacked motor would merely provide a shell for me to use. The shaft I thought would need to be built on top of that, but I wanted to see if I could use the one in the motor. I hooked up the existing shaft to the BX chip. When a charge is sent down one connection, I read the values on the other. The result were not promising, I always got an off position 0000000000.

I looked closer at what was happening. Around the shaft is three separate pieces of metal. (shown above). I wanted to create a switch so I need to detect an on/off position. I applied some solder to two of the metal pieces. Now when the shaft rotates, the circuit connects, and I can read series of 1111s and 0000s, and from there it's straight forward to detecting speed of rotation.

The finished rotation sensor - yay!

Coding it all up

Now I had the sensor working, I had to hook it up to the BX chip, to get some usable data from it. Below is the basic principle of detecting rotation. I simply looks for the series of 1111s and 0000s and detect when there's a change of state. Count them up over a short time interval, and you get rotation speed.

'  Detect Rotations
   InputValue = GetPin(InputPin)
   		if StoredValue = 0 then
   			if InputValue = 1 then
   				Debug.Print "Beat"
   				RotationCounter = RotationCounter + 1
  			 Debug.Print CStr(RotationCounter)
   		end if
   end if

Full code for detecting rotation speed

Here's a graph of the data being interpreted by processing. The spikes are when I'm blowing the sensor. It's tiring stuff!

 

Epilogue

For full details on how the whole thing fitted together visit:
www.redbrick.dcu.ie/~blowaway