The Arduino is an open source hardware credit-card sized PC board with a microcontroller and supporting hardware to allow it to be used for prototyping.
When I say open-source hardware I mean the board’s schematics and design is freely available to anyone to use to fabricate their own boards.
The main purpose of the board is to breakout the various pins and functions as well as provide a UCB connector so that microcontroller programming can be compiled on a PC and ‘bootloaded’ onto the controller.
An Arduino Uno (above) and an Arduino Nano (below)
This allows the Arduino to be used for prototyping and the construction of a variety of items. There are a number of different types of ‘Arduino’ boards from small IC chip sized nano boards to large mega boards (a little larger than a deck of cards) which support a lot of functions.
In addition to the Arduino board, companies like Sparkfun produce plug-on boards called ‘shields’ which are designed to ‘snap on’ to the Arduino board to provide additional functionallity such as Ethernet, Wifi, Sensors, SD card slots, etc…
What people do with the Arduino is really amazing. Some are rather silly while others are real serious. One example is a board hidden in an elevator so when it senses the elevator going up or down it makes the ‘Doctor Who’ sound. Another is a wireless remote-controlled robotic hand using a couple of Arduino lilypads and a glove (done by a high-school student…).
The heart of the Arduino is the ATMeg microcontroller. You can’t run windows or linux on it. The ATMeg microcontroller combines a cpu, memory, flash memory and various circuits on a single chip. The Arduino board basically takes these, adds some usefull components (a led, a reset button, a USB connector) and exposes the pins the ATMeg controls. Programs manulipulate the state of these pins to interact with, sense, and control outside components (like motors, ultrasonic sensors, ethernet, etc…).
Arduino ‘programs’ are called ‘sketches’ (I think that has something to do with the history of the IDE used to code). A ‘sketch’ is basically a C++ program and the IDE facilitates development since it has to link into the Arduino libraries and get the GCC compiler to generate binary code which will execute on the ATmeg microcontroller on the Arduino. It also facilities downloading and ‘bootloading’ the code. There isn’t an Operating System on the Arduino – you are literally coding on bare metal (or Silicon as the case may be). The only thing on the microcontroller is a little bootloader to facilitate loading programs (otherwise you would need a separate microcontroller ‘programmer’ device).
I first got involved with these boards when I came across the Raspberry Pi – a simular board running the Linux operating system. In fact I’m using one as my Voip (Voice-Over-IP) system running freePBX. From there I moved to the Beagleboard, and the Arduino ‘uno’ (which is their basic model board).
This Robot-car project
This is a project for a Robot car. I ordered the ‘kit’ on ebay and here is what the parts look like:
Infrared remote control and recever
Arduino UNO board
Sensor Shield (which fits on the Arduino)
Ultrisonic distance sensor (used for colission advoidance)
Three sensor ‘line follower’
Motor control and 4 motors with wheels
Here is a pic of the Sensor Shield attached to the Arduino:
The lower board is the Arduino and the upper board is the sensor shield.
The motors which are attached to the wheels are powered by 4 stepper motors which are wired to the ‘motor’ control board. This takes signals from the Arduino and, using supplied power, move the motors forward and backwards. In this case the left and right wheels are setup to operate in pairs. If they both run forward the car goes forward and if backwards the car goes (you guessed it!) backwards. If they go in opposite directions the car turns left or right.
A set of batteries (6 1.5 volts) supply 9V of power to the motor board to power the wheels.
The motor board also has a voltage regulator to supply 5V of power to the Arduino and sensor board. This is how the Arduino is powered when it is not connected to the UCB connector.
Along the left is the bottom portion of the platform sitting on a glass (so it won’t take off when the wheels start to spin). Below that is the ‘top’ portion with the Arduino board and a battery compartment to provide power. A USB connector runs from the computer (on the left) to the Arduino to download compiled programs – the computer itself is running Linux and the Arduino IDE.
Quick note – a compiled program, once downloaded, remains on the chip even without power – when the microprocessor is powered up it will start executing the program. The above robot wouldn’t be much good if it had to haul around the laptop.
The ‘test program’ given in the instructions was badly written and I didn’t want to use it (not to mention type it in). I did use portions of it for basic testing (go forward, go backwards) but for the video below I rewrote to code to be more structured and modular.