Danger Shield v1.0

Introduction

The Danger Shield is an add-on for the Arduino micro controller board. It contains a variety of fun and useful electronic circuits that you can use to do fun and useful things. It is a fully self-contained shield. You plug it into your Arduino, and you can immediately start using it. No extra things to hook up, no external components. Just a really rad board ready to rock.

What is it for? Whatever you want to do with it!

Some of the features of the board are:

3 x linear sliders w/ integrated LEDs (each independently hooked up to PWM)

3 x pushbuttons

2 x indicator LEDs (each with a PWM)

1 x piezo buzzer (for making noise!)

1 x temperature sensor

1 x light sensor

1 x knock sensor

1 x 7 segment LED (with shift register)

power LED and reset button

Get It!

PCB

This is the Danger Shield PCB.

Components

Make It!

Insulate USB Connector

To protect from accidental shorts from the pins sticking out of the Danger Shield, put a couple pieces of electrical tape over the USB Connector on the Arduino.

DON'T SKIP THIS STEP!

Prepare Arduino Headers

The easiest way to ensure a proper mount between your shield and your Arduino is to fit the shield onto the Arduino, then solder. Insert the long ends of the headers into the Arduino receptacles.

Solder Arduino Connectors

Put the Danger Shield over the Arduino so all the pins are sticking through the board. Once they are all in place, solder the pins to the Danger Shield. When you are done, you will have a properly fitting Danger Shield!

10K Ohm Resistors

Solder the resistors into the appropriate places. Orientation does not matter.

1M Ohm Resistor

Solder the resistor into the appropriate place (next to the knock sensor). Orientation does not matter.

560 Ohm Resistors, Part 1

Solder the resistors into the appropriate places. Orientation does not matter.

LDR (Light Dependent Resistor)

Solder the resistor into the appropriate place. Orientation does not matter.

Buttons

The buttons snap into the socket. Orientation does not matter. Be gentle with the pins. Solder the buttons into the appropriate places.

Make sure to clip the pins of the leftmost button to prevent shorts with the USB Connector

Temperature Sensor

Follow the silkscreen. The flat side should face the outside of the board.

DIP Socket

Solder the socket into place with the semi-circle on the socket lining up with the semi-circle on the silkscreen. It should be facing the bottom of the board.

Piezo Buzzer / Knock Sensor

The Buzzer and Knock Sensor are the same component, just wired differently. Solder them into the board as shown.

7 Segment LED

The 7-segment LED has a notch on one corner. This should line up with the notch on the silkscreen. The LED also has a decimal point that should be towards the bottom of the board.

Make sure you solder it in properly.

LEDs

The base of the LED will have a flat side. Match this up with the silkscreen. If there is no flat, the shorter leg goes in the hole closest to the flat on the silkscreen.

Make sure you solder it in properly, LEDs have polarity and will only work in one direction.

580 Ohm Resistors, Part 2

These resistors are for the 7-segment LED. They are soldered vertically. Bend the leads on one side of the resistor all the way over. Insert them so the leads face the 7 Segment LCD. You may want to solder them in sets, as the legs get crowded and make soldering tricky.

Shift Register Headers

Optional

The board contains headers that allow you to chain additional shift registers to the board. Solder them into place if you wish.

Sliders (Linear Potentiometers)

These sliders can only be inserted in one orientation. Insert all 3 sliders. Carefully flip the board over and solder them into place.

Insert 74HC595 Chip

Insert the shift register chip. Line up the dimple on one end of the chip with the dimple on the socket (and the dimple on the silkscreen!). Carefully insert the chip. Once it is seated, press harder and fully insert it.

Plug It In!

Plug your Arduino into your USB port. Assuming everything went okay, your power LED should light up. You may want to program it with one of our Danger Shield firmwares to start playing!

Use It!

The Danger Shield provides many cool inputs and outputs. We'll cover how to use each output in your own program. Its up to you to combine them and create your own awesome programs. Almost. We do provide some cool pre-made programs you can use =)

Sliders

The sliders are actually 2 components in one: Each slider contains a Linear Potentiometer and an LED. The linear potentiometer is hooked up to an analog pin, and the LED is hooked up to a digital pin with pulse width modulation (PWM) capacity. From a programming and electronics perspective, these are two completely independent circuits.

Here's how you read the slider's value:

int value = analogRead ( SLIDER1_PIN ) ;

more information on arduino.cc

Read below to learn how to control an LED.

LEDs

LEDs are Light Emitting Diodes. When you give them current, they emit light. All the LEDs that are hooked up to pins on the Arduino are hooked up to pins that can function as both digital as well as PWM pins.

To control the LED digitally, you can turn it on or off.

digitalWrite ( LED1_PIN , HIGH ) ; digitalWRITE ( LED1_PIN , LOW ) ;

To control the LED with PWM, you give it a value. The led will pulse between on and off rapidly based on the value. The higher the value, the more time the LED is on, the brighter it will appear! The value must be in the range of 0-255.

analogWrite ( LED1_PIN , 255 ) ; analogWrite ( LED2_PIN , 128 ) ; analogWrite ( LED2_PIN , 32 ) ; analogWrite ( LED3_PIN , 0 ) ;

More information on Arduino.cc

Buttons

Buttons are hooked up to digital inputs. When a button is pressed, it sends a HIGH signal. When a button is not pressed, it sends a LOW signal. These correspond to 1 and 0, or true and false.

Here's how you use it:

boolean value = digitalRead ( BUTTON1_PIN ) ;

More information on Arduino.cc

Light Sensor

The light sensor is hooked up to an analog pin. You can read from this pin and get a value representing the amount of light hitting the sensor. The value is in the range of 0-1023 with low values representing low light, and high values representing brighter light.

int value = analogRead ( LIGHT_SENSOR_PIN ) ;

More information here

Temperature Sensor

The temperature sensor that the Danger Shield uses is an [ LM35]. Unlike thermistors, this sensor is very easy to use, and its output is linear with temperature.

Here's how you use it:

int raw = 0 ; float voltage = 0.0 ; int celsius = 0 ; int fahrenheit = 0 ; raw = analogRead ( TEMP_SENSOR_PIN ) ; voltage = ( raw * 5.0 ) / 1024.0 ; celsius = voltage * 100 ; celsius = ( 5.0 * analogRead ( TEMP_SENSOR_PIN ) * 100.0 ) / 1024.0 ; fahrenheit = ( celsius * 1.8 ) + 32 ;

More information here

Buzzer

The buzzer is a piezo buzzer. It acts just like a speaker. When you give it voltage, it flexes. If you rapidly switch between voltage and no voltage, it will vibrate. If you do this at the proper frequency, it will make a noise. This is exactly how speakers work.

Here's how to make a simple tone:

digitalWrite ( BUZZER_PIN , HIGH ) ; delayMicroseconds ( 1000 ) ; digitalWrite ( BUZZER_PIN , LOW ) ;

More information on Arduino.cc

7 Segment Display

A 7 segment display is simply 8 LEDs combined into one package. They are arranged in such a way that each LED represents a segment. When the proper LEDs are lit, the display can be interpreted by humans as a letter or number.

The tricky part is that in our situation, we don't have 8 free digital pins to hook up individually to each LED. Instead, we need to use a shift register to expand the number of pins we have available to us.

Here is a simple example that will turn all the LEDs on:

digitalWrite ( LATCH_PIN , LOW ) ; shiftOut ( DATA_PIN , CLOCK_PIN , MSBFIRST , 255 ) ; digitalWrite ( LATCH_PIN , HIGH ) ;

More information on Arduino.cc

Knock Sensor

A piezo can be used in 2 ways: when a voltage is applied, it will flex. When the piezo is flexed, it will generate a voltage. We can use this to our advantage and turn a simple piezo buzzer into a sensor! The knock sensor is a piezo wired up to an analog pin. When you knock on the piezo, it generates a small voltage, depending on the piezo and strength of your knock.

To use it, we simply read the analog value and if its above a threshold, we consider it a knock.

int value = analogRead ( KNOCK_SENSOR_PIN ) ; if ( value > 100 ) { }

More information on Arduino.cc

Files

All of the latest, up-to-date files are stored in Subversion

Schematic

Eagle Files

The files used to make this board are available from SourceForge

They contain:

Eagle schematic and board layout

GERBER files used to manufacture board

3D rendering of circuit

POVRay scene file of circuit

PDF outputs of circuit

PS outputs of circuit

PNG outputs of circuit

Example Code

Various firmwares written for the Danger Shield are available from SourceForge. Make sure you download the latest v1.0.x version of the software.

This code contains a variety of cool and interesting firmwares that will make your Danger Shield do many cool things. You don't have to write a single line of code!

Want to do more?

Here's something new: Danger Shield to the World!

This page explains how to use those light and temperature sensors to send readings to a webpage, and share them with the world!