Thanks to spannerspencer and the team at Element14 I was provided with a free CodeBug. It is a very simple but awfully cute little board that makes a great present for 8-year olds and up. I have already purchased
and given away several of these.
Looking at the board, there really isn't a lot to it. There is a microcontroller, a 5x5 array of red LEDs, a couple of push-buttons, the USB connector and six holes of which two can be used to power the
CodeBug if you don't want to use the USB supply.
On the underside there are a couple more bits of functionality but they are not of interest for the purpose of this blog post.
It is designed to be easy to get into. It comes with a printed sheet but basically this is all there is to it:
1. Go to www.codebug.co.uk/gettingstarted
2. Watch the video!
3. Click on "Create"
4. Drag and drop stuff to create your computer program
5. Click on the Play icon to see it run in your web browser!
6. Click on Download and it gets saved to your PC
7. Hold down the left button on the CodeBug, plug it in, and release the button
8. Drag and drop the downloaded file into the CodeBug USB storage device that will have appeared
9. Press the right button on CodeBug to run the program
10. You can disconnect and reconnect the CodeBug to the USB supply and it will run the program again
The 5x5 LED matrix is multiplexed, in order to make it appear as if multiple LEDs can be lit at the same time. This effect is used to show shapes and characters on
the matrix. It can be used to scroll characters.
I wrote my first program on the CodeBug. It basically just scrolls the characters '1234' on the 5x5 LED matrix:
I was curious how much current this thing consumed. The easiest way is to connect up a multimeter. But, multimeters do not show rapid fluctuations in current.
Another way would be to use an oscilloscope and connect up a 5V supply in series with a small resistor, and measure the voltage across the resistor with the oscilloscope. Since Current = Voltage/Resistance, the trace on the oscilloscope would represent current.
Any oscilloscope could be used for this.
Instead I busted out the ADALM1000 ADALM1000 . It is a cheap USB tool can be used as a mini power source and current measurement device. For this purpose it is like a power supply and oscilloscope all-in-one.
I set it to supply 5V, and connected the two wires to the CodeBug's round holes marked PWR and GND (I didn't plug the USB into the CodeBug).
There is a getting started guide to the ADALM1000 here.
Once it was all hooked up, I saw this output when the '1234' message scrolled by. Click on it to examine it closer:
The top half of it just shows that the voltage was set to a fixed 5V supply (the ADALM1000 can also do fancy stuff like sine-waves, but I just wanted a fixed 5V supply to the CodeBug).
The bottom half shows time on the x-axis, and the yellow dashed stuff is the current consumption over time. It is dashed because the 5x5 LED array is multiplexed and it flashes rapidly (multiple times a second).
(Zoomed in):
It can be seen that the current peaked close to 0.07A (which is 70mA) while scrolling the '1234' message. It can also be seen that the entire message took just over two seconds to scroll.
On the right side of the diagram, circled in blue, is the same information represented in a different way. Here the x-axis is current. It can be seen by the bright parts of the spread line the amount of current consumed for the most amount of time.
The fainter parts of the spread show the current consumed for the least amounts of time. It is like an aggregated view.
The ADALM1000 is great for observing current consumption! Although I only used it with the CodeBug, it has many other uses. You can use it to check out the behaviour of components when subjected to voltages. It is like a portable lab.
For more information and ideas, see the ADALM1000 getting started guide mentioned earlier.