My previous article began to explain the type of microchip behind many electronics. This month I will share the start of a simple project with you, in the hope that you will grasp what these miniature computers can do.
Our cordless vacuum problem
One of my hobbies is to think up ways to improve everyday things around us at home. We have a battery-powered vacuum cleaner which is a favourite, but one thing bugs me: its charger is always on, constantly overcharging the batteries, damaging them and necessitating frequent replacement.
I've devised a small project to demonstrate a microcontroller in action and help with this overcharging problem: a device which plugs in line with the existing charger.
It senses when you take the vacuum off its stand, knows how long you used it for and charges it accordingly once it is back on its stand. Once charged it disconnects the charger until next use. This should significantly extend the life of the batteries.
Even for a simple project as this, I begin by writing up notes in my projects book. After this, I usually start to write the program—even before I have the components in front of me.
When I write the program and its 'flow' starts to make sense, I start to think of alternate ways of performing a function. From experience, the best way to write the program and design the circuit is to keep it all as simple as possible.
For this project, I write the program in the 'C' Language using the open source IDE (Integrated Development Environment) program from Arduino.
To understand what the program does, read each line from top to bottom—the same way the microcontroller will read the program.
The comments will guide you, indicated by a // before a comment.
This program, before it can be understood by the microcontroller, needs to be converted into machine code—a language which the CPU on the microcontroller can understand. The IDE checks, compiles the code into machine code and uploads it to the chip by a serial port.
So now we have our program, in the next article we will assemble our prototype!
Michael Dahlenburg is an Electronics Engineer currently working in the ATM industry. He is non-denominational and has previously been involved in Church plants and assisting those in ministry. His interests include; enjoying family, home DIY, gardening, and most things tech-related and driving his wife crazy with a constant stream of inventions!
He lives with his Wife Michelle and 3 children in Gods own land of Southern Adelaide, Australia.
Michael Dahlenburg's previous articles may be viewed at http://www.pressserviceinternational.org/michael-dahlenburg.html