Introduction: Arduino Zombie Detector Game

About: I am an education technology junky and love helping teachers be successful. I think building and creating things is one of the best ways to learn new things.

The following activity is based on a lesson for teachers who use the Ardusat Space Kit (http://ardusat.com). However, this activity will work for anybody with an Arduino, luminosity sensor (we are using the SparkFun TSL2561), and an Infrared Thermometer (MLX90614) sensor.

To make this successful you'll need to get the right parts and install a few items including adding the Ardusat SDK library to the Arduino IDE software. For those looking for an introduction to Arduino for the Ardusat Space Kit check out the website: https://www.ardusat.com/launch.

Step 1: Gather Parts and Install Software

Install

Gather Parts

  • 1 Arduino UNO
  • 14 Jumper Wires
  • 1 Breadboard
  • 1 IR Thermometer (MLX90614)
  • 1 Luminosity Sensor (TSL2561)
  • 1 Red LED
  • 1 Green LED
  • 1 USB B Cable
  • 1 Cold Can of Soda
  • 3 to 5 Room Temperature Cans of Soda
  • 1 Large bag (not see through)

Step 2: Wire Sensors

Wire the IR and Luminosity sensors.

Pay special attention to how you wire the IR thermometer. Make sure the small nob is facing toward you.

Step 3: Add Sketch to Arduino

Plug the Arduino into your computer using the USB cable.

Copy and paste the following code into the Adruino IDE software and click upload.

Note: this code requires the Ardusat SDK library.

#include <Arduino.h>
#include <Wire.h> #include <ArdusatSDK.h>

void setup(void) { Serial.begin(9600); if (!beginInfraredTemperatureSensor()) { Serial.println("Can't init IR temperature sensor"); } if (!beginLuminositySensor()) { Serial.println("Can't init luminosity sensor"); } }

void loop(void) { temperature_t temp; luminosity_t lum;

readInfraredTemperature(&temp); readLuminosity(&lum);

Serial.print("temp: \t"); Serial.println(temperatureToJSON("infared", &temp)); Serial.print("lum:\t"); Serial.println(luminosityToJSON("luminosity", &lum)); delay(1000); }

Step 4: Connect the Arduino and Sensors to the Experiment Platform

Connect to the Ardusat Experiment Platform Chrome App and you're ready to go.

Time to test!

Hold your hand over the sensors. What happened to the temperature? What happened to the luminosity? Next hold a piece of paper over the sensors. What happened to temperature and luminosity?

Hold other stuff over the sensor and see what happens. Try a flashlight on a smart phone. Try a bottle of water. Can you predict what will happen before you put it over? If so, you are ready for detecting zombies!

Step 5: Game Instructions

Zombie Detection Game Instructions

At least one zombie has made it into the population. It's up to the strike team of zombie hunters to identify and neutralize the threat!

Instructions

In this game we will have several zombie hunters and one zombie. The zombie gets 2 points by convincing the hunters that they are not a zombie. A hunter gets 1 point for correctly identifying the zombie and -1 point for falsely accusing a fellow hunter. Place 1 cold soda can and enough room temperature cans of soda for the rest of the players to have one each into a bag.

Gameplay

The game goes for 3 rounds.

At the beginning of round 1 each player reaches into the bag and grabs one can of soda with their right hand and continues to hold it until they are tested.

The players take 1 minute and trying to identify the zombie by talking to each other. The hunters should try to figure out who the zombie is, as the zombie tries to implicate one of the hunters.

At the end of the 1 minute and starting with the oldest player and moving clockwise, each player should declare out-loud who they think the zombie is. Once all of the accusations have been made, each player (in-turn, again starting with the oldest player) puts their soda-holding hand over the sensors.

Hunter's hands should be room temperature so the Ardusat Experiment Platform should show a slight rise in temperature.

The zombie's hand should be cold (from holding the cold can of soda) and the Ardusat Experiment Platform should display a drop in temperature.

If a hunter correctly identifies the zombie they receive 1 point. If a hunter picked another hunter as the zombie, then the accusing hunter loses -1 point. If the zombie successfully avoided detection, that player receives 2 points.

The round ends with all the players returning the soda cans into the bag.

Round 2 proceeds just like round one except now the person who was the zombie last round declares who they think the zombie is this round first. Then the declarations continue clockwise. Round 3 proceeds exactly like round 2.

At the end of the three rounds, tally up each player's points. The one with the most points wins!

Step 6: Additional Challenge Activity

Great job rooting out the zombies cadet! As a precaution, let's add two LEDs and two wires with a modified version of the code so that you can have lights turn on when a zombie is detected.

Modify your existing setup to match the diagram above. You'll need a red LED (connected to pin 7) and a Green LED (connected to pin ~9).

The Code

Copy and paste the code below the line into the Arduino IDE software and upload it to the Arduino. Can you find the numbers to change in the code below to change the sensitivity of the sensors?

#include <Arduion.h>
#include <Wire.h> #include <ArdusatSDK.h>

luminosity_t lum; temperature_t temp;

int baselineTemp = 0; int baselineLight = 0;

int greenLight = 7; int redLight = 9;

void setup(void) { Serial.begin(9600);

pinMode(greenLight, OUTPUT); pinMode(redLight, OUTPUT);

if (!beginInfraredTemperatureSensor()) { Serial.println("can't init IR temperature sensor"); } if (!beginLuminositySensor()) { Serial.println("can't init luminosity sensor"); }

digitalWrite(greenLight, HIGH); digitalWrite(redLight, HIGH);

readInfraredTemperature(&temp); readLuminosity(&lum);

baselineLight = lum.lux; baselineTemp = temp.t;

for(int x = 0; x < 100; x++) {

readInfraredTemperature(&temp); readLuminosity(&lum);

baselineLight += lum.lux; baselineTemp += temp.t;

baselineLight /= 2; baselineTemp /= 2; }

digitalWrite(greenLight, LOW); digitalWrite(redLight, LOW); }

void loop(void) { readInfraredTemperature(&temp);

Serial.print("temp: \t"); Serial.println(temperatureToJSON("infared", &temp));

readLuminosity(&lum);

Serial.print("lum: \t"); Serial.println(luminosityToJSON("luminosity", &lum));

if( lum.lux <= (baselineLight * .6) ) { if( temp.t >= (baselineTemp * 1.05 )) { digitalWrite( greenLight, HIGH ); digitalWrite( redLight, LOW ); } else if ( temp.t <= (baselineTemp * 1.03) ) { digitalWrite( redLight, HIGH ); digitalWrite( greenLight, LOW ); } else { digitalWrite( redLight, HIGH ); digitalWrite( greenLight, HIGH ); }

} else if ( lum.lux >= (baselineLight *.9) ) { digitalWrite( redLight, LOW ); digitalWrite( greenLight, LOW ); } delay(100); }