Eugene is a qualified control/instrumentation engineer Bsc (Eng) and has worked as a developer of electronics & software for SCADA systems.
What is a Microcontroller?
You probably have lots of these in your home although you don't know it! A microcontroller is a type of integrated circuit (IC) or "chip" which is often used in devices in your home which incorporate electronic circuitry. You have probably heard of microprocessors, e.g. Intel Pentium, and these are used as the CPU (Central Processing Unit), effectively the "brain", in a computer. Microprocessors are integrated circuits which process the instructions in a computer program, perform calculations and send data to and from memory and disk. A microcontroller is a specific type of microprocessor. It differs from a normal microprocessor in the following ways:
- It has built in "I/O" (input/output) capabilities. So it can read and write digital and analog values/states, and connect directly to the "real world". A microcontroller, unlike a microprocessor can connect directly to switches, buttons, LCD displays, LEDS, relays and serial ports
- Microcontrollers are generally used for low to medium complexity, specific tasks in equipment. This contrasts with the powerful, number crunching microprocessors used in PCs which handle a variety of software applications.
- Microcontrollers are often used in portable devices which run on batteries, e.g. digital cameras. So they are often low powered with a small current consumption (unlike the heat sinked, fan cooled microprocessor in a desktop computer)
- Compared to the microprocessor in a PC, the RAM within a microcontroller can typically range from 64k down to as little as 1k
- The program in a microcontroller is usually stored in EPROM or EEPROM. This is a type of non volatile (program doesn't disappear when the device is turned off) memory which can be continuously wiped and rewritten.
Lots of devices make use of microcontrollers. Some examples:
- Burglar alarms incorporate a microcontroller chip which is connected to the keypad, display and sensor/contact inputs. Microcontrollers are generally self contained chips with the ALU (Arithmetic Logic Unit), memory and I/O all contained within one integrated circuit
- Older automatic washing machines used a cam switch for sequencing the operations during a wash cycle. This was quite a complex switch and was mounted on the end of the shaft of the knob you used to select a wash program. Newer machines use a microcontroller to sequence operations. Other appliances such as microwave ovens and dishwashers may incorporate a microcontroller
- TVs use microcontrollers to handle the selection of channels and reading the state of buttons on the TV
- Microcontrollers are used for engine control and display of information on the dashboard (fascia) of vehicles
- Digital cameras use microcontrollers to handle input from buttons, control of image capture and display.
Some commonly used microcontrollers:
- Zilog Z8
- Intel 8051
- Texax Instruments TIMSP430
- Atmel AVR
What is an Arduino?
Arduino is an open source hardware/software programming platform based around Atmel microcontrollers. Open source means that circuit schematics and source code of software used in designs is freely available and can be modified by enthusiasts. Arduino development boards with their analog and digital, inputs and outputs, are ideal for artists, designers and electronic hobbyists who wish to put together a system without having to know a huge amount about digital design. Input and output signals are made available on the Arduino board using rows of female connectors into which individual leads or single in line (SIL) connectors can be plugged.
An Arduino development board will have at least:
- 9 digital pins which can be either input/output channels. Some of these can be setup as PWM (Pulse Width Modulation) outputs. A PWM signal is a square wave whose pulse width can be varied. PWM is used for speed and position control of motors and servos in robotics and remote control applications
- 4 analog input channels.
- At least one serial port which may also be used for download of code to the Arduino
Some boards also have a range of analog output channels.
There is a high degree of flexibility as regards the function of pins, some of which can be configured as either analog or digital. Digital pins can be configured as either input or output.
Arduino boards sense the environment around them as they receive input from sensors connected to these analog and digital inputs. They can also control actuators such as motors, alarm sounders and electric valves, or switch on LEDS, lamps or other visual indication devices. The output drive capability of outputs is limited, so usually transistors, FETS, or relays must be used between the Arduino output pin and driven device. An output is capable however, of driving LEDs directly.
The connectors on board are arranged in a standard manner so that shields can be connected. Shields are modules with a dedicated function (e,g, infra-red output, bluetooth, GSM, WIFI, Ethernet, motor on/off control using relas, stepper motor control). Depending on the shield type, it may be possible to stack several shields on top of each other and address them individually over an I2C, serial bus.
Since the Arduino code and hardware is open source, third party developers have produced clones of the official Arduino boards.
Arduino boards have from 32 to 512k of flash memory which can be used for program storage.
What Can an Arduino Board Be Used For?
An Arduino board can be used for doing lots of cool stuff. You can easily add LCD displays, a keypad or seven segment display modules and build a simple system quickly. Lots of information and libraries are available on the Arduino.cc website. You can design your own add on electronics or use shields to build a modular system. Arduinos because of their versatility can be used for simple, mundane tasks or complex applications. An example of a simple application would be the ability to turn on a device when the temperature in a room falls below a certain level. It wouldn't be too difficult to extend this application, and add a GSM module which could send out a text message when this occurs. Arduino boards can be used to implement a complex home automation system which could be controlled over a smart phone. They are also used by enthusiasts as the processing and control device in robots, and kits are available for building a simple wheeled robot.
Micontroller Projects — Programming an Arduino Board
Arduino boards are programmed in C and high level functions are provided as standard for reading and writing to analog and digital pins and serial ports. Source code is known as a "sketch". Standard libraries are also available for tasks such as output to an LCD panel or communication with a GSM module. Lots of other libraries and code have been contributed by enthusiasts and are available on the Arduino website.
A basic code editor/compiler is available on the Arduino website which can be used for developing programs. However the editor is basically just like Wordpad and doesn't provide any color coded highlighting or have sophisticated debug features. Atmel Studio, a cut-down, customized version of Visual Studio is an alternative which provides these features.
Programs are downloaded onto an Arduino board using either a serial port or USB connection. A bootloader then loads the program into memory on reset so that an external programmer isn't required.
Simple Arduino Sketch
Which Arduino to Buy?
For kids and absolute beginners, I recommend the Grove Beginner Kit from the IoT hardware enabler Seeed Studio - It's an all-in-one Arduino Uno compatible board with 10 Sensors & 12 Projects. Interestingly the board is supplied with breakout sections for each transducer which can be detached if desired. Jumper cables are supplied to connect the main controller board to each transducer section:
- Light Sensor
- Sound Sensor
- Temperature & Humidity Sensor
- Air Pressure Sensor
- 3-Axis Accelerator.
- OLED Display
- Rotary Potentiometer
The first Arduino board I bought was the Arduino Leonardo. It has a modest amount of I/O including 20 digital I/O ports, Seven PWM channels, twelve 12 bit analog input channels and five analog output channels. Headers are soldered onto the board, but you may be able to find a version without them if you need more space.
In addition to an Arduino board, you need a way of displaying information such as measured values from a sensor, typed text or status messages. Two useful modules are:
Other Arduino Boards Available
A smaller board that can be fit into tight spaces, e.g. hand held devices is the Seeeduino XIAO. It has 11 digital/analog pins, 10 PWM Pins, 1 DAC output, 1 I2C interface, 1 UART interface and 1 SPI interface.
A board with WIFI connectivity for Internet of Things projects is the Arduino MKR1000
This article is accurate and true to the best of the author’s knowledge. Content is for informational or entertainment purposes only and does not substitute for personal counsel or professional advice in business, financial, legal, or technical matters.
Questions & Answers
Question: How can I learn more about programming an Arduino board?
Answer: A good place to start is on the Arduino website "Getting Started" page:
© 2014 Eugene Brennan
zafrinazara on August 16, 2019:
Thank you for giving me a wonderful explanation about Arduino microcontrollers. We also conduct embedded system course in chennai for all streams of engineering students using sensors and microcontrollers.
PDXBuys from Oregon on December 01, 2014:
If I am lucky Santa will bring me one of these for Christmas.