Danger Shield 1.0

From NYC Resistor Wiki
Jump to navigation Jump to search

Flickr Error ( Photo not found ): PhotoID 2417774518

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![edit]


Flickr Error ( Photo not found ): PhotoID 2416946543

This is the Danger Shield PCB. The red signifies danger.


<websiteFrame> website=http://spreadsheets.google.com/pub?key=pmEMxYRcQzzCo-yDnUsAKdg&output=html&gid=3&single=true&widget=true name=google height=420 width=540 border=1 </websiteFrame>

Make It![edit]

560 Ohm Resistors[edit]

Flickr Error ( Photo not found ): PhotoID 2421221606

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

10K Ohm Resistors[edit]

Flickr Error ( Photo not found ): PhotoID 2420408869

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

1M Ohm Resistor[edit]

Flickr Error ( Photo not found ): PhotoID 2420409049

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

LDR (Light Dependent Resistor)[edit]

Flickr Error ( Photo not found ): PhotoID 2421222096

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


Flickr Error ( Photo not found ): PhotoID 2420409351

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

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

Temperature Sensor[edit]

Flickr Error ( Photo not found ): PhotoID 2421222358

Warning: the silkscreen is backwards.

The flat side should face the outside of the board.

DIP Socket[edit]

Picture Needed

Solder the socket into place with the semi-circle on the socket lining up with the semi-circle on the silkscreen.

Piezo Buzzer / Knock Sensor[edit]

Picture Needed

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

7 Segment LED[edit]

Flickr Error ( Photo not found ): PhotoID 2420409639

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.


Flickr Error ( Photo not found ): PhotoID 2420409807

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.

680 Ohm Resistors[edit]

Flickr Error ( Photo not found ): PhotoID 2420409939

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[edit]

Flickr Error ( Photo not found ): PhotoID 2421222940


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)[edit]

Flickr Error ( Photo not found ): PhotoID 2420410337

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

Prepare Arduino Headers[edit]

Flickr Error ( Photo not found ): PhotoID 2420410503

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.

Insulate USB Connector[edit]

Flickr Error ( Photo not found ): PhotoID 2420410673

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.

Solder Arduino Connectors[edit]

Flickr Error ( Photo not found ): PhotoID 2421223646

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!

Insert 74HC595 Chip[edit]

Flickr Error ( Photo not found ): PhotoID 2420410971

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![edit]

Flickr Error ( Photo not found ): PhotoID 2421223956

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![edit]

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 =)


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:

//value will be an integer from 0-1023
int value = analogRead(SLIDER1_PIN);

more information on arduino.cc

Read below to learn how to control an LED.


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.

//turn LED on
digitalWrite(LED1_PIN, HIGH);

//turn LED off
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.

//always on
analogWrite(LED1_PIN, 255);

//on half the (medium brightness)
analogWrite(LED2_PIN, 128);

//on 1/8 the time (prety dim)
analogWrite(LED2_PIN, 32);

//never on
analogWrite(LED3_PIN, 0);

More information on Arduino.cc


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:

//true when pressed, false when not
boolean value = digitalRead(BUTTON1_PIN);

More information on Arduino.cc

Light Sensor[edit]

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.

//read the light sensor
int value = analogRead(LIGHT_SENSOR_PIN);

More information here

Temperature Sensor[edit]

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;

//take an analog reading
raw = analogRead(TEMP_SENSOR_PIN);

//convert it to voltage.  analogRead returns a value of 0-1023 representing the voltage level between 0.0v and 5.0v
voltage = (raw * 5.0) / 1024.0;

//finally, convert voltage to temperature.  the LM35 outputs 10.0mV per degree Celsius.  For example 1000mV (1v) would be 100C.
celsius = voltage * 100;

//of course you can combine this into one compact statement
celsius = (5.0 * analogRead(TEMP_SENSOR_PIN) * 100.0) / 1024.0;

//how about fahrenheit?
fahrenheit = (celsius * 1.8) + 32;

More information here


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);
digitalWrite(BUZZER_PIN, LOW);

More information on Arduino.cc

7 Segment Display[edit]

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:

//low tells the shift register we're sending new data
digitalWrite(LATCH_PIN, LOW);

//send the data w/ built in function

//tell the register we're done.
digitalWrite(LATCH_PIN, HIGH);

More information on Arduino.cc

Knock Sensor[edit]

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.

//read our piezo value
int value = analogRead(KNOCK_SENSOR_PIN);
if (value > 100)
  //its a knock!

More information on Arduino.cc


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


Flickr Error ( Photo not found ): PhotoID 2421984894

Eagle Files[edit]

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[edit]

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!