Introduction: Zombie Attack! Easy to Build!

About: Hey YOU! Yeah, I'm talking to you who is reading this. Send me ideas for instructables, like things that you are wondering how to make or build, or really anything electronically related, and I'll get back to …

Hello, I am here, presenting you, another project, which is low in cost, that is easy to build. Zombies are attacking, and you need a way to defend against them, so you decide to build the zombie rifle to defend against Zombies. Overall, this project is a low cost, quick build. Most if not all of the materials, you can buy at Radio Shack, or Sparkfun. No, this project is not on an Arduino, because the next step of this project, is to bare-bones it. You will be using the cheapest development board known to man, it is by Texas Instruments; yes, TI is a calculator company, but they also manufacture cool development kits. The name of the Development kit is MSP430 LaunchPad; which you can order at the TI E-Store or Sparkfun, or really any other major electronics distributor. It costs about $6 by the way, and it comes with one of the chips you will use, and another free chip, which you can use for any other project.
**Please click on the orange vote ribbon in the upper right-hand corner of this page if you enjoy this Instructable.**
This is a Zombie Game and it uses processing to create a GUI based thread. I used Processing because it is easy for anybody to use and I used the TI MSP430 LaunchPad because it is a versatile platform and also easy to use. I worked on this project, by myself, for about an hour. My plans and ideas did not change while creating the project, because I thoroughly calculated all of the needed resistances and capacitances, so there should be not problem. I made this at home, so I think that anybody could really be able to build this. I learned that it is always best to calculate values to my electronic components because it shortens build time and brings the cost down. The biggest challenge in this build was actually calculating the needed component values. I think that the only thing that I would change, when I do another build of this project, is embed a serial adapter on the board with the MSP430G2553 embedded, so that there would be no extra headers on board.
(Thank-you juani_c [the original]:

Step 1: Materials

You will need:
1 .01uF Polyester-Film capacitor
1 .022uF Polyester-Film capacitor
1 10K POT
1 22K Resistor
1 small Perf-Board
1 8 pin DIP socket, or 8 pin female Headers
1 Five pin Male headers (or just 2 pin male headers and one 3 pin male headers)
1 Button
Some wire
1 USB-B mini B cable 

Step 2:

Take one perf-Board out of the packaging. Then take one DIP socket and cut it in half, unless you are using Female Headers.

Step 3:

Now solder the socket onto the Perfboard, as close to the outside of the right side and as far up as possible. (if you are confused look at the picture)

Step 4:

Flip the board over, now position your POT with the VCC pin two holes to the left of the "headers", but the pin must line up with the header pin which is closest to the big hole. Now solder the VCC pin to the header pin which is two holes across from the POT.

Step 5:

Now get the 22K resistor, and solder one leg (lead) to the VCC pin on the POT and the other lead to the Fifth header pin.

Step 6:

Now break you headers into a group of 3 and bend them in the holes of your board. Place them on the opposite side of the female headers. Solder them down. (These headers will be called the Signal Headers)

Step 7:

Now get the other male headers, and bend them in the holes on the other side of the POT right next to the hole (not diagonal from the POT though nor next to the other headers you just placed) Now solder the headers down. (These headers will be called the power headers.)

Step 8:

Now take out the .01uF Capacitor. Take one lead, and solder it onto the Pin on the Power headers which is farthest from the big hole (known as GND) and solder the other lead, to the 22K resistor meets pin 5 of the Female headers.

Step 9:

Now take out your .022uF capacitor out.  Flip the board, so you can solder it underneath. Position this Capacitor to have the leads connect to GND and pin 6 of the female header. Flip the board. Solder the Capacitor leads to GND pin and to pin 6 of the Female Header.

Step 10:

Cut a wire to connect GND to the pin Farthest from the hole on the Signal Header. Solder it down.

Step 11:

Now solder another wire from the Middle pin of the the Signal Header to pin 3 of the POT.

Step 12:

Make a solder bridge, from pin 3 of the POT, under the .01 uF capacitor lead, to pin 6 of the Female header.
(or connect a wire from Pin 3 of the POT to pin 6 of the Female header.)

Step 13:

Now attach the another wire to the sensor header pin which is closest to the hole, to pin 5 of the Female Header pin.

Step 14:

Now solder a wire from Pin 1 of the Female header, to the Power header's pin which is closest to the big hole.

Step 15:

Now put it on the Launchpad, lining up Female Pin 1's female side to the connector on the Launchpad, which is labeled VCC and says a small 1 next to it.

Step 16:

Now attach a Female-Female wire to GND and GND on the LaunchPad.

Step 17: Now for the "Gun"

All you need to use for this part is: the button and the LDR.

Step 18:

Solder one LDR pin to one of the pins on the switch.

Step 19:

Now attach a Long wire to the LDR and Switch joint. Connect that wire to another wire that has a female end connector. Then plug the connector into the Signal header's pin which is farthest from the big hole.

Step 20:

Now solder another wire, connected to a female connector on the other side, to the LDR's other pin, and use the nut on the switch to hold the LDR in place. Then plug the female connector to the middle Signal header pin.

Step 21:

Now solder another wire to a female connector, then solder it to the other lead of the switch. Plug the female wire into the pin of the signal connector which is closest to the big hole.

Step 22:

Twist all of the wires together to get a neat single strand.

Step 23: Program the MSP430

Install CCS (Code Composer Studio) Here 
After installing, open CCS use when it asks you about the workspace, allow it to make one with the name it generated.
Then press File->New->CCSProject
A window will pop up, name your project, Zombie Game.
Then Select MSP430 series
Then in the search type in: MSP430G2553 (or just find it)
Select the template Blink LED and on opening of the blink program, Delete all of it.
Paste the code posted here and press the little bug. If you have no problems, then you will have a small toolbar after it programs the chip, which is a debug console, and there will be a > button, press it and the MSP430 Launchpad will be sending back data via UART, so you can check the data on terminal. 

#include "msp430g2553.h"
#include <intrinsics.h> // Intrinsic functions
#include <stdint.h> // Standard integer types

#define TXD BIT1 // TXD on P1.1
#define Bitime 104 //9600 Baud, SMCLK=1MHz (1MHz/9600)=104

unsigned char BitCnt; // Bit count, used when transmitting byte
unsigned int TXByte; // Value sent over UART when Transmit() is called

unsigned int i,j,h;
unsigned int ADCVal;
// Function Definitions
void Transmit(void);
void Single_Measure(unsigned int);
#define NSAMPLES 16 // Number of samples in each block

void main(void)

  unsigned int uartUpdateTimer = 10; // Loops until byte is sent

  uint32_t average=0; // Average value of block

  BCSCTL1 = CALBC1_1MHZ; // Set range

  P1DIR |= 0x01;                            // Set P1.0 to output direction
  P1SEL |= TXD; //
  P1DIR |= TXD; //

  __bis_SR_register(GIE); // interrupts enabled\

  /* Main Application Loop */
    if ((--uartUpdateTimer == 0))
      //__bis_SR_register(CPUOFF + GIE);        // LPM0, ADC10_ISR will force exit

      if(0x08 & P1IN){
        for (i = 0; i < 1000; i++);        // Dummy delay for debounce
        if(0x08 & P1IN){
         P1OUT &= ~0x01;  //board led OFF
       for (i = 0; i < NSAMPLES; ++i) {
         ADCVal = ADC10MEM;
         average += ADCVal; // Accumulate sum
         average /= NSAMPLES; // Arithmetic mean of samples
        P1OUT |= 0x01;//board led ON
        average=average & 0xFF;
        TXByte = average;
      average=0;//reset avarage
      uartUpdateTimer = 10;
      for (h = 0; h < 10000; h++);        // Dummy delay between communication cycles

// Function Transmits Character from TXByte
void Transmit()
  CCTL0 = OUT; // TXD Idle as Mark
  TACTL = TASSEL_2 + MC_2; // SMCLK, continuous mode

  BitCnt = 0xA; // Load Bit counter, 8 bits + ST/SP
  CCR0 = TAR;

  CCR0 += Bitime; // Set time till first bit
  TXByte |= 0x100; // Add stop bit to TXByte (which is logical 1)
  TXByte = TXByte << 1; // Add start bit (which is logical 0)

  CCTL0 = CCIS0 + OUTMOD0 + CCIE; // Set signal, intial value, enable interrupts
  while ( CCTL0 & CCIE ); // Wait for TX completion
  TACTL = TASSEL_2; // SMCLK, timer off (for power consumption)

// Timer A0 interrupt service routine
#pragma vector=TIMER0_A0_VECTOR
__interrupt void Timer_A (void)
  CCR0 += Bitime; // Add Offset to CCR0
  if ( BitCnt == 0) // If all bits TXed, disable interrupt
    CCTL0 &= ~ CCIE ;
    CCTL0 |= OUTMOD2; // TX Space
    if (TXByte & 0x01)
      CCTL0 &= ~ OUTMOD2; // TX Mark
    TXByte = TXByte >> 1;
    BitCnt --;

// ADC10 interrupt service routine

#pragma vector=ADC10_VECTOR
__interrupt void ADC10_ISR(void)
  __bic_SR_register_on_exit(CPUOFF);        // Clear CPUOFF bit from 0(SR)

void Single_Measure(unsigned int chan)
ADC10CTL0 &= ~ENC; // Disable ADC
ADC10CTL0 = ADC10SHT_3 + ADC10ON + ADC10IE; // 16 clock ticks, ADC On, enable ADC interrupt
ADC10CTL1 = ADC10SSEL_3 + chan; // Set 'chan', SMCLK
ADC10CTL0 |= ENC + ADC10SC; // Enable and start conversion

Step 24:

This is the processing sketch, open it and run it; it will look for the COM port.

Step 25: Enjoy!

Enjoy the Game!
Game.Life 3 Contest

Finalist in the
Game.Life 3 Contest

Make-to-Learn Youth Contest

Participated in the
Make-to-Learn Youth Contest