Feb 06

I2C – Hundreds of Components on 2 Pins

There are several ways to communicate with components using an Arduino. When you want to go beyond basic individual input like buttons and potentiometers or single outputs like an LED, new methods need to be adopted. One of the options to communicate with additional inputs and outputs is I2C. Philips developed I2C to communicate with peripherals. It is a serial computer bus protocol which means that many devices can be hooked up to the bus and communicates via 2 wires. The Arduino is able to naively communicate with I2C using the wire library.

This opens up a lot of possibilities for projects; one notable example is the Wii Nunchuck. The Nunchuck is an I2C peripheral and communicates over I2C. This means that using I2C and the Wii Nunchuck you can add a joystick, acceleratorometer and 2 buttons to any Arduino project for a very reasonable price. For more information check out the WiiChuck, a simple adapter that breaks the necessary connections to 4 pins; you can also find the required code at the same page.

In addition to the Wii Nunchuck, there are many other I2C components that can be used in projects including temperature sensors, RGB LEDs, LCDs, RFID readers, and a host of other components. All you will ever need is the same 2 analog pins on the Arduino to communicate with all of them.

Nov 01

Powering an Arduino

There are 3 ways to power an Arduino; through USB, the barrel jack, or directly into the VIN pin. Each option has pros and cons and the method used depends on the project the Arduino is a part of.

Powering an Arduino from a USB is the way used by most people. When an Arduino is connected to a computer to load code, it also provides power for testing. If a project involves interaction with the USB port, in order to send or receive serial data for example, the USB is an easy, no hassle method. However, if a project is mobile or not in close proximity to a computer, a different power option will need to be considered.

Barrel Jack
The Arduino Uno, Mega and Ethernet (as well as the many of the older boards) have a standard 2.1mm center positive barrel jack connector. This jack has a diode to protect the Arduino from reversed polarity. This allows the Arduino to be easily connected to an AC-to-DC adapter or a battery pack. The recommended input voltage for this jack is 7 to 12 volts.

Stationary projects that will be near a wall outlet can be powered with a 9v or 12v wall wart power supply rated at either 1amp or 500ma.

For a mobile project, batteries can also be plugged into the barrel jack. The most basic option is to create a 9v battery adapter. There is a simple tutorial on Arduino’s webpage. To power a project with standard 1.5 volt alkaline AA and AAA batteries requires at least a 6x battery holder. If using rechargeable batteries remember that they provide different voltages, NiMH for example is only 1.2 volts. If the power supplied to the Arduino drops below 7v the output of the 5v pin may not be a full 5 volts and the board may become unstable.

The VIN pin on Arduino boards can be used to tap into the power source plugged into the barrel jack. Some shields will use this as their power source. The VIN pin is after the polarity protection diode so keep in mind that the output will be about .6 to .7 volts less than the input voltage.

This pin can also be used as an input for power. The only difference between the barrel jack and the VIN pin is that the VIN pin is after the polarity protection diode. This means 2 things: first if the power is connected with polarity reversed it will destroy the Arduino and second the power used by the Arduino will be slightly less, leading to longer life if powered from a battery. Once again the type of project and components will determine if this is the best route.

These are the 3 most common ways to power up an Arduino, however keep in mind that not all Arduino boards are exactly alike. The more specialized boards like the Lilypad, Fio and Pro have different power requirements. The new Arduino Ethernet also has an optional Power over Ethernet (PoE) option. Just keep in mind the type of project you are working on and keep experimenting!