Saturday, March 20, 2010

Controlling Simple Machine Inventions with Microcontroller Chips

Inventions are becoming ever more complex. Complex inventions often require some sort of control system. It may be that a simple machine invention you have come up with requires several actions to perform its intended function.

Micro controller chips are a fantastic way to control simple machines and even highly complex machines. They are very small, incredibly powerful, and cheap as dirt! Micro controllers have a variety of built in functions including a microprocessor, voltage comparators, analog to digital converters, timers and more.

I’ve recently been seeing ads on TV for the Glade Sense & Spray motion activated air freshener. This is a great example of a simple machine, and I think a very clever invention. I did a Google patent search and came up with a patent application that seems to apply to this device, but it doesn’t mention anything about motion control, just timed and manual operation.

Application number: 11/247,793
Publication number: US 2006/0076366 A1
Filing date: Oct 11, 2005

It shows a motor and gears along with a lever to actuate a spray canister of aerosol fragrance. It also shows a schematic diagram of a circuit for controlling the device. The schematic doesn’t include device numbers and I didn’t really spend the time looking for them.

Microcontroller chips are made by a number of manufacturers and there are thousands of variations available. The smallest I’ve seen has 6 pins. Two pins are always needed to supply power and ground, which leaves you with 4 pins to use for inputs and outputs. I’m not really sure what the maximum number of pins available now, but I’ve used controllers with 40 pins.

I use Microchip brand controllers since I learned how to program and use them, and I bought a basic compiler so I could program in basic, which I find much easier than using the machine or assembly language. You can purchase a programmer for the chips for less than a hundred bucks, and you can download everything you need free from microchip to get into programming those little suckers. There are lots of online forums where you can get plenty of free help with your micro-processor projects.

For almost every project I done an 8 pin controller is plenty. To automate the automatic aerosol dispenser using a 12F675 microchip controller we would only need one pin for the output. We could use a motor or solenoid as the aerosol actuator. That leaves us with 5 pins to use as inputs. We could stay simple and connect a button for manual operation to one of the pins, a motion sensor to another pin, and two pins for a switch to select the mode of operation.

Which pins you use for what, depends on what peripheral devices inside the chip you are going to make use of. For instance, if you are going to use one of the voltage comparators you would need to select a pin that can internally connect to it. Not all pins connect to everything.

With these inputs, we can use a switch to turn on or off the motion detection, turn on or off the timer function, accept an input signal from the motion sensor, and output a signal to the actuator with one pin left over.

The controller has a built in clock circuit that is plenty accurate enough for this application. If you need highly accurate timing you can use a crystal to establish the clock frequency.

The next step is to program the controller to perform the functions you want. It’s very easy to do with a basic compiler.

Since we have an extra left over pin, we could hook it to a temperature sensor and add a little more complexity and intelligence to our air freshener dispenser. We could program it to ignore the timer when the temperature is below 40 degrees figuring that there probably aren’t any people smelling stuff in a room that is below 40 degrees. Or maybe we could have it spray more frequently if the temperature is hot.

Or we could use the extra pin for a photo detector and if the room is dark, then the dispenser won’t spray. Obviously we are getting a little carried away with our air freshener, but it serves to allow us to explore what these controllers can do.

We could switch to a chip with 12 or 14 pins and add a wireless receiver to the package for remote control of the dispenser as well. With additional pins we could add another output and connect it to an audio alarm. The chip could easily keep track of how many times it operates and sound an audio alarm that you are running low on fragrance and need to replace the canister. Likewise you can use another pin to drive a LED so you will have a visual warning of running low.

We still have pins so let’s add a microphone and detect voices. We can then write into the program that’s stored in the chip to begin its timing sequence only after hearing someone’s voice if the room has been dark for over an hour.

The micro-controllers typically have memory for storing the program, which doesn’t disappear when you power down the chip, and ram memory that does disappear when you remove power. Many of these chips even have serial communications implemented internally to the chip like RS232 and the like.

Now that we have the worlds fanciest air freshener dispenser ever, why don’t you study up on micro-controllers, and use one to control the next simple machine invention you create, or maybe even a complex machine.

Another Micro-controller article: Microcontrollers -- What They Are and How They Work