Quick Links:

Gadget Shield

What would you do with a single shield that has an accelerometer, speaker, microphone, infrared transmitter, infrared receiver, RGB LED, four discrete LED’s, two pushbuttons, a potentiometer, and a visible light sensor?

The Gadget Shield is an add-on (shield) compatible with the Arduino Uno, Duemilanove, Mega/Mega2560, Ruggeduino, or other compatible boards. It extends the functionality of the microcontroller board by adding several interesting sensors and actuators. Fully assembled and ready to go, the Gadget Shield opens up a whole world of fun and learning.

 

  • The Gadget Shield

    ../assets/images/AD040_08.gif

    The Gadget Shield comes with a wide variety of sensors and actuators

    Gadget Shield
  • Arduino Uno/Duemilanove

    ../assets/images/AD040_12.gif

    The Gadget Shield is shown mounted on an Arduino Duemilanove (also compatible with the Uno, Mega/Mega2560, and Ruggeduino). The RGB LED has its blue LED turned on (at just 12% of its maximum brightness!) and the 4 general-purpose LED's are illuminated.

    Gadget Shield
  • Arduino Mega

    ../assets/images/AD040_14.gif

    The Gadget Shield is shown mounted on an Arduino Mega

    Gadget Shield
  • Stacking Headers

    ../assets/images/AD040_03.gif

    The Gadget Shield uses stacking headers, meaning you can plug more shields on top of it. This picture shows a Duemilanove with a Gadget Shield and a Rugged Motor Driver on top. Control your motor with an infrared remote control? Why not!

    Gadget Shield
  • External Power Input

    ../assets/images/AD040_04.gif

    A 2-pin terminal block easily allows external power connections for battery-powered installations.

    Gadget Shield
  • The Gadget Shield

    ../assets/images/AD040_13.gif

    The Gadget Shield comes fully assembled and ready to use, compatible with the Arduino Uno, Duemilanove, Mega/Mega2560, Ruggeduino, and other compatible boards

    Gadget Shield

 

 

$29.95

Features

The Gadget Shield includes:

  • A Freescale MMA7660FC 3-axis digital accelerometer
  • This is a 1.5g 120 sample-per-second digital accelerometer with 6-bit resolution and neat features such as tap/shake detection and tilt/orientation detection. Here is a direct link to the Freescale datasheet.

  • A high-brightness RGB LED
  • This module contains three independent LED’s (red, green, and blue) with independent brightness control for each color since each LED is connected to a separate microcontroller PWM output. This gives you an incredibly wide color palette to choose from. This thing is bright -- the manufacturer does not recommend looking directly at it when operating at maximum power, and we usually just run it at about 10%-20% duty cycles because that’s plenty bright.

  • A 38 kHz logic infrared detector
  • This module outputs a digital low signal when 38kHz-modulated infrared energy is detected, as output by most infrared remote controls. See our sample software for using this module to decode infrared remote control transmissions. Together with the infrared LED emitter, this can be also be used as a non-contact object sensor (again, we have some sample software that demonstrates this).

  • An infrared LED
  • This LED emits light in the 940nm wavelength range and can be used to generate infrared remote control signals. This LED is controlled by a microcontroller timer pin so it is simple to generate the 38 kHz frequencies recognized by most receivers. See our sample software for using this LED together with the IR logic detector to turn your microcontroller board into a universal remote control.

  • A speaker
  • Use this to generate tones, alerts, or to play simple melodies (see our sample software below). The speaker uses PWM to generate frequencies up to 3000 Hz.

  • A microphone
  • Use this for sound sensing or tone detection. The microphone’s raw output is amplified (gain of 100), low-pass filtered to 15.9 kHz, offset by 2.5V then connected to an A/D input pin.

  • A visible light sensor
  • This device outputs an analog signal inversely proportional to the intensity of visible light (more light means lower voltage). This signal is connected to an A/D input pin.

  • A thumbwheel potentiometer
  • The potentiometer’s rotation can be read using an A/D input pin.

  • Four LED’s
  • 4 general-purpose LED’s are connected to four independent digital outputs (active high) for displaying status information, or perhaps a 4-bit binary value. We use these LED’s as a “VU meter” for displaying light level and sound level in our sample software below.

  • Two pushbuttons
  • Two general-purpose momentary-contact pushbuttons are connected to two independent digital inputs (active low).

  • Two-pin terminal block for external voltage input
  • For battery-powered operation or self-contained installations, it can be a pain to power an Arduino and its shields. The Gadget Shield makes this a little easier by providing a two-pin screw terminal block for easily connecting wire leads from battery packs or other power supplies. This voltage connects to the Vin node on the Arduino (through a reverse-voltage-blocking diode -- see the schematic) so is the same as plugging in a DC power jack.

  • Stacking Headers
  • Stacking headers let you stack another shield on top of the Gadget Shield, or you can plug wires right into each header socket for direct control over the on-board gadgets.

  • Cuttable Jumpers
  • What if you don’t want to use the microphone and want to reclaim analog pin A0 for something else? No problem! Every pin connection on the Gadget Shield goes through a cuttable jumper that is easily cut with a hobby knife. The Arduino pin is then disconnected from that pin’s gadget. You can then use the Arduino pin for something else by connecting to it through the stackable header. Changed your mind? Just short the jumper by soldering in a small wire, or solder in a two-pin 0.1” header and use a shunt to re-make the connection. More details below.

Arduino Library

The Gadget Shield comes with an Arduino library to help you get started quickly.

  1. Download the latest GadgetShield library for Arduino 1.0, or this version of the GadgetShield library for Arduino-0022.
  2. Unzip it in the libraries directory of your Arduino installation. See the Contributed Libraries section of this reference page for help with installing third-party libraries.

Documentation for the library is in the GadgetShield.h header file, or see the sample code below for usage examples. Here’s a quick taste to show you how easy it is to work with the Gadget Shield. This sketch plays a tone on the speaker whenever pushbutton #1 is pressed.

 

/* Play a tone on the speaker whenever pushbutton #1 is pressed */

#include <GadgetShield.h>

void setup(void) {

  GS.Setup();

}

void loop(void) {

  if (GS.IsSwitch(0)) GS.Speaker(440);

  else GS.Speaker(0);

}

Sample Code

Here are some sample programs for demonstrating the applications of the Gadget Shield. These sketches are also included as part of the GadgetShield library described above.

  • Object Detector
  • The IR LED and detector are good for more than just remote control. Since they are both pointing in the same direction you can use them together as an object detector. Turn on the IR LED at 38 kHz, then if an object reflects the IR light back to the detector, you will be able to sense that the IR detector’s output is low. Download this sketch and try it out for yourself! Instructions are at the top of the file.

     

  • Melody
  • The on-board speaker is good for playing simple tones and melodies. Here is an example of a full song, Rimsky-Korsakov’s “Flight of the Bumblebee”.

     

  • Universal Remote Control
  • This demonstrates the infrared logic detector and emitter by constructing a simple universal remote. Instructions are provided at the top of the PDE file. Once you teach the application what one or more buttons do on your remote, you can then either have the application recognize them when pressed again, or have the application output them on command. Use this application as a starting point for your own IR control applications.

     

  • Accelerometer Color Control
  • This fun application demonstrates how the 3-dimensional orientation of the Gadget Shield can be sensed using the on-board accelerometer. The orientation is used to control the color of the RGB LED module.

     

  • Microphone Volume Meter
  • Display the ambient sound level using a 4-LED “VU meter”. The louder it is, the more LED’s light up.

     

  • Light Meter
  • Like the microphone volume meter above, this “light meter” illuminates more LED’s as the ambient light level goes up.

     

  • Everything
  • This application is what we use for production testing. It exercises every sensor and actuator on the Gadget Shield. Use it as an example for how to interface with all of the devices on the board. Instructions are at the top of the PDE file.

Arduino Mega

The Arduino Mega and Mega2560 have the two TWI pins (SCL and SDA) in a different place than the Arduino Uno and Duemilanove. These two pins are needed for communicating with the accelerometer. To use the accelerometer with a Mega, you will need to connect two wires to jumper the SCL and SDA pins from the Mega header to the Gadget Shield header. There are two ways to do this, directly to the stacking header pins A4/A5 or to a special two-pin header location (JP1) which is also connected to A4/A5. The figures below show these possibilities.

 

Connect SDA/SCL on a Mega by directly connecting to header pins A4/A5

or

Connect SDA/SCL on a Mega by connecting to a separate header JP1

Note that to connect to JP1 you will either need to solder the wires there for a permanent connection or solder in a two-pin 0.1” socket header (not included).

If you are not using the accelerometer on the Gadget Shield then these two wire connections are not needed.

Pin Mapping

The pin usage of the various sensors and actuators on the Gadget Shield is shown in the following table.

 

Arduino Uno/Duemilanove

and Ruggeduino

Arduino Mega

Connection

Pin

Function

Special

Pin

Function

Special

Accelerometer SCL

A5/PC5

TWI

ADC5/ SCL

PD1

TWI

SDA

Accelerometer SDA

A4/PC4

TWI

ADC4/SDA

PD0

TWI

SCL

LED #4

A3/PC3

Digital Out

ADC3

A3/PF3

Digital Out

ADC3

Potentiometer

A2/PC2

Analog In

0V-5V

ADC2

A2/PF2

Analog In

0V-5V

ADC2

Visible Light Sensor

A1/PC1

Analog In

0V-5V

ADC1

A1/PF1

Analog In

0V-5V

ADC1

Microphone

A0/PC0

Analog In

0V-5V

ADC0

A0/PF0

Analog In

0V-5V

ADC0

LED #3

D13/PB5

Digital Out

Active High

SCK

D13/PB7

Digital Out

Active High

PWM

OC0A/OC1C

Pushbutton #1

D12/PB4

Digital In

Active Low

MISO

D12/PB6

Digital In

Active Low

PWM

OC1B

LED #1

D11/PB3

Digital Out

Active High

MOSI/PWM

OC2A

D11/PB5

Digital Out

Active High

PWM

OC1A

RGB Blue LED

D10/PB2

Digital Out

Active High

SSn/PWM

OC1B

D10/PB4

Digital Out

Active High

PWM

OC2A

Speaker

D9/PB1

Digital Out

Active High

PWM

OC1A

D9/PH6

Digital Out

Active High

PWM

OC2B

Pushbutton #2

D8/PB0

Digital In

Active Low

ICP

D8/PH5

Digital In

Active Low

PWM

OC4C

Accelerometer Interrupt Output

D7/PD7

Digital In

Active Low

AIN1

D7/PH4

Digital In

Active Low

PWM

OC4B

RGB Green LED

D6/PD6

Digital Out

Active High

AIN0/PWM

OC0A

D6/PH3

Digital Out

Active High

PWM

OC4A

RGB Red LED

D5/PD5

Digital Out

Active High

PWM

OC0B

D5/PE3

Digital Out

Active High

AIN1/PWM

OC3A

LED #2

D4/PD4

Digital Out

Active High

 

D4/PG5

Digital Out

Active High

PWM

OC0B

IR Transmitter

D3/PD3

Digital Out

Active High

PWM

OC2B

D3/PE5

Digital Out

Active High

PWM

OC3C

IR Receiver

D2/PD2

Digital In

Active Low

INT0

D2/PE4

Digital In

Active Low

INT4/PWM

OC3B

 

Cuttable Jumpers

All of the Arduino pins connect to the gadgets through cuttable jumpers on the bottom side of the board. Here is a picture of part of the board bottom:

If you don’t want to use a particular gadget but you want to use an Arduino pin for something else, cutting the gadget’s jumper lets you do so. If you want to reconnect it, just make a solder bridge over your cut, solder in a short bare wire, or solder in a 2-pin 0.1” jumper and use a shunt to make a removable connection.

You can also use the cuttable jumpers as cross-wiring points. Suppose you really don’t like the pin mapping we have chosen. You can use cuts and wires over our cuttable jumpers to create your own pin mapping.

Here is a picture of the PCB layout on the bottom of the board showing where all cuttable jumpers are. The connector numbers (J1, J2, etc.) refer to the jumper names shown in the schematic.

J21 is a normally-open jumper that you can connect to make a connection between +3.3V and the AREF pin for the analog-to-digital converter. This is just a handy way to create an alternative reference voltage for the converter.

External Power Input

For standalone or battery-powered operation, the two-pin terminal block allows you to make a sturdy connection to a battery or other power source, without having to insert wires into stacking headers and hope they stay put.

This power input is essentially the same as the DC power jack on the Arduino. Provide a DC power source of the same voltage and current that is required by your Arduino board (e.g., 7-12VDC for an Arduino Uno, at least 100mA is recommended). The power input is reverse-voltage protected by a diode, just like the DC power jack input on the Arduino. Power you apply to the two-pin terminal block is available at the Vin pin on the stacking headers.

Technical Data

Here is the schematic of the Gadget Shield. Here is the schematic of the previous revision (part number AS010).

 

The Gadget Shield was designed in the USA and is assembled in the USA using lead-free components and lead-free manufacturing and assembly processes.

Proudly located in Michigan, USA

Copyright © 2013 Rugged Circuits LLC