Arduino Duemilanove & ATMEGA328 Capabilities

July 1st, 2010

I picked myself up an Arduino Duemilanove development board. Its a small PCB made in Italy that has a socket for an Atmel Microcontroller, voltage regulator, and sockets for all the inputs and outputs. It has a few other features such as an ICSP header so that you can program a microcontroller while its in its circuit. This is good if you already have the chip in a production PCB and you want to upgrade the chips firmware. Combine the Arduino Duemilanove it with a few other things and you can start making some cool stuff. If you’re going to be doing a lot of experimenting, I suggest getting a breadboard with it. The breadboard contains holes with metal clips within them that allow connecting components quickly and easily. Once a prototype is made, you can move it on to a PCB. Breadboard is useless without jumper wires. You can get a jumper wire set which is just basically a bunch of wires in a plastic box.

Arduino Duemilanove

The first project I did was a basic hello world type of thing for microcontrollers. Unlike computers though, there is no screen to output hello world unless you attach one to the microcontroller which complicates things, however you can output stuff to an LED. So the first program I did was blink an LED. How boring, but it gets better. Slap on an RGB LED and attach the R Leg to one digital output pin, and the G and B to other output pins and the common can go to the Vin on the power supply socket. Using C, you can run an analog value between 0 and 255 and convert it to a PWM (pulse width modulation) signal to make the LED change colors. Use variables for the Analog values that way you can increment them every time the controller goes through the loops. Set a delay of around 25 milliseconds for a smooth transition between colors.

Even better than attaching to an LED is attaching to multiple LEDs using transistors and a charlieplexing technique used to save yourself on the limited output pins from the microcontroller. You can make a 3D matrix of LEDs. Using RGB LEDs in a 3D Matrix and you can probably output real 3D images.

Whats cooler than LEDs are motors. You can use motors to control CNC machines, robots, hexacopters, and more. Hexacopters use brushless motors which are actually controlled using microcontrollers themselves. An electronic speed contoller uses a Hall-Effect Sensor to sense the rotor position so it knows which coils to turn on. It can turn on and off coils at whatever pace it wants based on a PWM input signal. So a PWM signal from one microcontoller is used in another microcontoller which controls MOSFETs to turn on Brushless motor coils.

It gets even cooler than that, you can use a GPS chip to sense geographical position of something and then use the microcontoller to do whatever you want with that data. It can log it to an SD card, output it to an LCD, or use it to control motors. GPS chips can be small as small as 3 milimeters by 3 milimeters, so I suggest buying a module which has the chip on it, surrounding filtering capacitors plus the breakout board which allows you to interface with the microcontoller easily. Sparkfun electronics has some cool GPS modules. Some GPS chips are better than others. Chips such as the Hammerhead II used in the Apple iPhone are able to tell position even when there are interfering signals based off of radiowaves bouncing off buildings.

When I setup the sketch software with the Arduino Duemilanove on Ubuntu linux, I was able to monitor the serial port. Using a program you can send and receive data to and from the computer from the microcontroller similar to HyperTerminal on windows.

Arduino Sketch Code

This program basically checks to see if data was sent through serial. And if it has been, then it sends data back through the serial to the computer which basically outputs back whatever was sent. Here’s an example generated with the above code:

Arduino Serial Monitor

Serial data sent back to the computer which was intially sent to the microcontroller.

Notice how it outputted several numbers. Basically whatever I typed in and sent it sent back what I typed in the form of ASCII codes. This is basic raw system level programming, no fancy stuff like markup languages. The serial monitor is useful because you can read information from sensors, GPS modules, etc. You can output variable values to the serial port which is great for debugging. This demonstration shows the complexity of making a peripheral for the computer. Imagine writing a program which takes a CAD drawing and sends it through serial to the microcontroller which then takes that information and controls stepper motors and laser cutters in a CNC application. Also you might be wondering what we mean by serial when this Arduino board has a USB connection. The chip next to the USB port made by FTDI aacts as a USB to Serial converter.

Similar Posts

Comments