Introduction: How to Make an Arc Reactor Prop Using TI Msp430

Hello all! In this Instructable I'm going to be showing how I made my arc reactor from Iron Man. I originally created this project almost two years ago as a Halloween costume when I dressed as Tony Stark (not Iron Man, just Tony Stark). Since then, I have tweaked bits and pieces of it and now consider it to be Instructables-worthy.

The arc reactor is driven by a TI MSP430 G2553 chip and uses bit shifting to control which lights stay on. The program uses register manipulation to work and although the code works on the msp430 it can be modified to work on an Arduino ATmega chip as well.

This Instructable will cover the following topics:

  • 3D printing a case with an interchangeable face plate
  • Soldering a proto board
  • Programming an MSP430

This is my first Instructable, so I hope you enjoy it enough to make one yourself. Now, on to building!

Step 1: Tools and Materials

To make this project you will need the following tools:

  • Soldering iron and solder
  • Computer, USB mini cable and an MSP430 Launchpad
  • 3D printer
  • Volt Meter (recommended)
  • Hot glue gun (recommended)
  • Heat gun and heat shrink tubing (recommended)

You will also need the following parts:
Control Circuits (1x each):

  • Single pole switch (like the one in the picture)
  • Microswitch or some kind of button
  • 2.2k Ohm Resistor (for microswitch)
  • Potentiometer

Lights (8x each):

  • LED (I used blue)
  • NPN transistor
  • 100 Ohm Resistor (for LEDs)
  • 1k Ohm Resistor (for transistor bases)

Micro Controller (1x each):

  • MSP430G2 IC
  • 20 Pin socket
  • 220 Ohm Resistor (for reset pin)
  • 3.3v battery
  • 2x right angle pin headers or other battery connector
  • Circuit board

Step 2: 3D Printed Case

I designed the 3d printed case using Autodesk 123D design.

The base should be printed with support because it has slots for all the components, including:

  • Holes for the eight LEDs
  • Two holes for the circuit board screws
  • Holes in the side for the switches and potentiometer
  • Loops for the heart rate monitor strap
  • Slot for the diffuser and face plate (make sure you get all the support out of the track other wise the face plate won't slide properly)

The diffuser should be printed using natural color filament, or any filament that is translucent. I do recommend having some sort of diffuser because the LEDs can be very bright and the diffuser helps nullify that intensity of the light. Despite being translucent on the spool, natural filament tends to lose a lot of its translucency during the printing process because of the different layers. To help preserve the translucency of the natural filament, print the diffuser at a slower speed. If you don't have translucent, you could also tape a circle of wax paper or the tape itself to the back of the face plate to act as a diffuser.

The face plate does not need any special printing treatment. The pattern can be swapped with any circular pattern with a diameter of 83.75 mm, however I recommend that you leave some sort of border between the tabs for stability. The pattern with the border has a diameter of 78.75 mm. See step 9 for more details.

Step 3: Circuit Diagram

If the circuit looks a little daunting at first, don't worry, it's really not that complicated. You can look over the pictures for information on the circuit and how it works as well as read the following: The circuit uses an MSP430 G2553 chip and a 3 volt battery for power. The msp430 chip can be standalone as long as it has 3v to the reset pin (#2 below). It doesn't in the breadboard picture because I couldn't find the chip by itself in Fritzing. The battery's positive terminal should be connected to these 3 things:

  1. The MSP430 vcc pin (top left corner)
  2. The MSP430 reset pin (fifth down on the right) through a resistor, I used a 22k ohm one. This needs to be connected when the msp430 is out of the launchpad to run. When the power is cut (by button, forgetting to connect it, etc.) the msp430 will reset. This can be useful if you want to reset it, but otherwise its best to leave it connected.
  3. The LED power supply (the switch connected to the pot) The switch here will only cut power to the LEDs, not the msp430 itself. I like this because it keeps the pattern, even when the LEDs are off. If you would rather have it cut off all the power, put the switch so that it cuts off power to the 3 things in this list.

The LED power supply goes to the anode (long side) of each of the LEDs (so in parallel.) The cathode (short side) of the LED is connected to a 100 ohm resistor which goes to the collector of the NPN transistor. The emitter of the transistor goes to ground. The base of each transistor is wired to each of the Port 1 (P1_x) pins through a 1k ohm resistor. If you don't care about brightness and plan to just use standard, low power LEDs, you can just skip the transistors and wire up the LEDs like normal. However, because the LEDs are wired through transistors, you can use higher power LEDs as long as the msp430 still has 3v to run (use a voltage divider), the transistors can handle the added voltage/current, and the MSP430 can still supply the trigger voltages to the transistors.

The final part of the circuit is the button for changing the pattern. The button is wired by having ground go to a 220 ohm resistor and then through the switch to P2_0.

Although it is not necessary, I do recommend prototyping this on a breadboard before soldering everything.

Step 4: Programming the Msp430

The Arc Reactor code is thoroughly commented, so check that for a more detailed explanation on all the parts, but I will also give the basics of how it works here. The code stores the state of each LED (on/off) as a bit in one byte. The LEDs that are set on remain on during the off phase of the other LEDs to create a dimming effect. After so much time, the bits shift one place to the right, shifting which LEDs stay on and creating the illusion of them turning in a circle.

/* == ARC REACTOR PROP USING MSP430 CODE == By Antyos
 *
 * This is the code for the Arc Reactor prop by Antyos
 * Instructions can be found here: https://www.instructables.com/id/How-to-Make-an-Arc-Reactor-Prop-Using-TI-Msp430
 * This code uses bit shifting to choose which leds have an altered duty cycle to give the illusion that the leds turning in a circle
 *
 */
 
#include 
 
#define BUTTON BIT0 // Button is PX_0 (P2 will be used in this program)
 
int patType = 0; // Light pattern, will be variable for first element of the "lights" array (Base 0)
const int time[2] = {5, 20}; // Delay for duty cycle: on time, off time
 
const int buttonCount = 10; // Delay for how long the button press should be to trigger the special pattern
int buttonTimer = 0; // Value for storing how long the button has been pressed
 
int lightStat; // Value that stores each light's state
 
int lightDat[3][3] = {  // Array for storing all the data for the patterns
    // Stay on lights | Shift | End pattern (last one is 1, all others are 0)
      {0xff,            1,      0x00},  // Pattern is solid
      {0x01,            8,      0x00},  // Pattern has 1 bright led that goes in a circle
      {0x11,            4,      0x01}   // Pattern has 2 bright leds that go in a circle
 
    /* Variable descriptions:
     * Stay on lights: which lights are the ones that stay on at the beginning of the pattern and will then turn with the rest
     *      0x11 (hex) -> 0001 0001 (binary)   lights 0 and 4 stay on at the beginning and are then shifted one over
     * Shift: How many times the pattern shifts to the right before it needs to be reset
     *      0001 0001 >>SHIFT>> 0010 0010 >>SHIFT>> 0100 0100 >SHIFT>> 1000 1000 >>RESET>> 0001 0001 (repeat)  went through 4 times before needing a reset, so shift = 4
     * End pattern: This value needs to be set to 0x01 for the final pattern, it is used to know when to cycle back to the first pattern
     */
 };
 
 
void delay_ms(int del) { // Function for delay
  while(del--) { // While there is more than one delay left
      __delay_cycles(80); // Equivalent clock cycles for a time
  }
}
 
void delay_flare(unsigned int del) { // More accurate delay for the flare pattern
    while(del--) __delay_cycles(8); //Wait for delay
}
 
void patChange(void) { // Pattern change function, runs when the pattern should be changed
  // If the button is held for a half second or less, move to the next pattern
  if(lightDat[patType][2] & 0x01) patType = 0; // If the selected pattern has reached the last one, then reset the selected pattern to the first one
  else patType ++; // Go to the next pattern
  lightStat = lightDat[patType][0]; // Set the lights to have the next pattern
  //buttonTimer = 0; // Reset buttonTimer
}
 
void patFlare(void) { // Pattern for changing the pattern to a pulsating light -- the unibeam
  // This pattern has a pulsating light where all the lights glow brighter and then switch to dimmer and repeat
  // This pattern does not involve shifting
  float i;
  int j;
  const unsigned int flareDel[2] = {100, 60}; // Values for duty cycle
  // Spin faster and pick up speed and glow brighter
  // Will go 30x, 29x, 28x and so on
  for(i = 30; i > 0; i -= 0.25) {
    for(j = i; j > 0 ; j --) {
      // Duty cycle for lights dimming
      P1OUT = 0xff;  // Turn all lights on
      delay_flare(time[0]*10); // Delay for duty cycle on time
      P1OUT = lightStat; // Keep on only the lights in the light byte dedicated by the pattern
      delay_flare((time[1]*(i/2))/4); // Delay for duty cycle off time
    }
 
    // Shift lights - Check main loop for more detail
    lightStat = lightStat << 1;
    if (lightStat > 255)  lightStat = lightStat >> lightDat[patType][1];
 
  }
 
  i = 60; // Set count to 50 cycles
  P1OUT = 0x00; // Turn off all the lights
  do {
       for(i; i > 7; i --) { // Flash 50 times, stops at 7 so that it doesn't blink faster than the strobe
           for(j=0; j < 2; j ++) { // Flash one time
               P1OUT ^= 0xff; // Toggle lights
               delay_flare(flareDel[j]*50); // Delay
           }
       }
 
       i = 8; // Reset it back to 1 cycle
       if(P2IN & BUTTON) buttonTimer = 0; // If the button is no longer pressed, reset the button timer and return to the main program
  }  while(buttonTimer != 0); // Will continue with flashing the lights, will go forever if the button is held,
 
}
 
 
 
int main(void) {
  WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
 
  P1DIR = 0xff; // Set all Port 1 pins to output
  P2DIR = 0x00; // Set all Port 2 pins to input
 
  P2OUT |= BUTTON; // Set button, reset everything else
  P2REN |= BUTTON; // Set button to pull up
 
  lightStat = lightDat[patType][0]; // Set the lights to be the first pattern
 
  while(1) { // Infinite loop
    // Keep all secondary lights at a lower brightness with a duty cycle
    int i = 0;
    for(i = 33; i > 0 ; i --) {
      // Duty cycle for lights dimming
      P1OUT = 0xff;  // Turn all lights on
      delay_ms(time[0]); // Delay for duty cycle on time
      P1OUT = lightStat; // Keep on only the lights in the light byte dedicated by the pattern
      delay_ms(time[1]); // Delay for duty cycle off time
    }
 
    // Shift lights
    lightStat = lightStat << 1; // Shift lights over one
    if (lightStat > 255)  lightStat = lightStat >> lightDat[patType][1]; // If the mapped registers exceeds the mapped LEDs, then set them back to the default position if the last light goes off, reset the pattern
    // Change the pattern
    if ((P2IN & BUTTON) == 0) { // While the button is pressed
      buttonTimer++; // If the value of P2_0 is high (pressed), add one to the button timer
      while(buttonTimer >= buttonCount) patFlare(); // If the button is held for more than half a second then go to the special pattern
    }
 
    else if(buttonTimer < buttonCount && buttonTimer > 0) {
      patChange(); // If the button isn't pressed and the timer has been triggered but not surpassed, switch patterns
      buttonTimer = 0;
    }
 
  }
 
}

The code was originally written in Code Composer Studio (CCS), and can be uploaded to an MSP430 using it as well. Just create a new project and paste the code into main.c and it should be ready to go. However, you may not want to install CCS nor want to figure out how to use it. For those of you in this category, you can install and use Energia, an Arduino IDE equivalent for the msp430. The code will still work in Energia, just make sure you have the correct board and serial port selected.

  • The board can be selected at Tools > Board > Launchpad w/ MSP430G2553 (16 MHz) | The g2553 is the chip we're using.
  • The Serial port is selected at Tools > Board > Serial Port | The serial port for the msp430 will be under com ports in the decide manager. You may need to install the MSP430 driver which should be included in the Energia zip file.

A link to the code can be found here: http://pastebin.com/UnPfJNuD

A link to download Energia can be found here: http://energia.nu/download/

After you program the msp430, place it into the circuit to see if it works. If so, you're ready to begin soldering, if not, make sure to go back and check everything.

Step 5: Soldering the Circuit Board

Once you get the breadboard circuit working you are now ready to being soldering. The soldering is broken up into 3 steps:

  • Soldering the proto board (this step)
  • Soldering the LEDs
  • Finishing the proto board

To start out, place the 20-pin socket somewhere in the middle of the proto board where it won't short itself out. Now it is time is to connect the LED modules. I recommend doing one LED module at first to make sure it works before doing the rest. For the LED module, solder a transistor on the proto board. In my example, I have them going opposite directions on each side so the emitters (ground) can be in the middle. Connect the base of the transistor (middle) to the 1k ohm resistor and the collector to the 100 ohm resistor. The second picture shows how I did the wiring on my proto board. The colors signify that something is soldered across there with each color meaning a different thing:

  • Red: LED anode / LED power supply (3v)
  • Purple: LED cathode / transistor emitter
  • Blue: Ground
  • Green: Transistor base
  • Yellow: Component is across here on the other side of the board (Do not solder)

Connect the msp430 and led like on the breadboard to make sure that the wiring works. If so, solder the rest of the LED modules. After you finish soldering the modules, connect all the emitters of the transistors to ground. Then, connect the resistors going to the transistor bases to each of the pins corresponding to Port 1 of the msp430. Make sure that you connect them in the right order, otherwise they will blink in the wrong order and the circle animation won't look right. Also solder a wire coming off of P2_0 for the button.

Step 6: Soldering the Lights

The LEDs are relatively simple to solder. If your LEDs can reach the holes in the frame from the circuit board with enough room, then I recommend skipping this step. If not, just solder a wire to each of the leads of the LEDs and put some insulation on the wires so it doesn't short. Insulation can be heat shrink tubing, electrical tape, hot glue, or something else. I also recommend soldering a red wire to the anode of the LED (long side) and a black to the cathode (short side) so that it is easier to keep track of which side is positive and which side is negative. Even if you don't use black and red wires, it is a good idea to use different colored wires and to be consistent.

Step 7: Finishing the Wiring

After you have finished soldering wires to all the LEDs, you will solder the LEDs to the circuit board as shown in the diagram. But first, solder a wire coming off of ground for the button while the wiring is still relatively clean. Moving on, solder the red wire to nothing (for now) and the black wire to the resistors connected to the collectors of the transistors. After this, you may want to consider putting some hot glue on the solder joints as strain relief so that the LEDs do not bend and break off.

Now it is time to add the wires for the LED power. Before you add too many more wires, add the reset resistor. The reset resistor is VERY important because the arc reactor will not work without it. Connect the reset resistor to the reset pin and connect the other side to Vcc on the MSP430 or 3v. Next connect all the red wires of the LEDs together.

Solder on the battery connector to the proto board. Connect the ground wire to ground and the positive wire to your msp430's Vcc. If you are not using a 3v battery, make sure to use a voltage divider to get 3v. Solder one end of your switch to the battery's positive and the other end to one side of your switch. Solder the other terminal of your switch to your potentiometer. To figure out when the switch is closed, test the different terminals with a multimeter in resistance mode across them. When the switch is closed, it will read at 0 ohms, when it is open, it will read open. Solder the middle connector of the potentiometer to the LED red wires. You should only need to connect to one because they should all connected..

If your potentiometer slides in from the front like mine does (which is good, pressing down on it in use will not accidentally lodge it inside) then you will need to make some sort of connector. I just got two different colored jumper cables and cut them up. I attached a male and female cable each to the proto board and potentiometer so that the potentiometer can be easily bypassed. If you do this, make sure to put a female jumper cable coming off of the battery so that it does not accidentally short on something.

The button is relatively simple to solder. Once again, check using a multimeter in resistance mode to figure out which two terminals of the button complete the circuit (show 0 ohms) when pressed. After you do that, solder the switch to the wire coming off of P2_0 and ground.

Congratulations! You are now done soldering!

Step 8: Finishing Touches

You are now ready to assemble the 3D printed frame. Place each of the 8 LEDs into the 8 holes of the frame. Make sure they are in the right order otherwise the lights won't spin in a circle. If you by chance messed up with the connections of the MSP430 pins, you can fix that by swapping the LED positions here. Place the potentiometer in the thin slot on the top left. Place the button in the slot on the right and screw it in. Place the switch in the bottom slot and screw the nut that likely came on it down to secure it in its hold. The LED holder is modified slightly on the bottom to hopefully make it easier to insert the switch into its slot. Finally, put the diffuser and face plate on and turn it on, it should work.

If you were unable to find the same parts I used in this build, you can add in your own slots for your own parts to a modified version of the base in the CAD file from part 3. The video in the next part covers it briefly, but I will explain it in this step too.

Open the CAD file and click show meshes on the right side. The middle of the three objects will be an unmodified version of the arc reactor base with one exception: it is divided into separate pieces. I did this so that it is much easier to change the LED slots or any other part that you may desire. To add in slots for your parts, just draw in appropriate boxes to cut away portions of the base. When you are done, merge the base together, hide or delete everything else and export it to a .stl file.

Tony Stark's arc reactor is on his chest, and this prop is designed to be worn like his. To accomplish this, I added slots on the sides for a heart rate monitor strap I found lock into. I can then position it on my chest (and under my shirt) and dress as Tony Stark.

If you decide to wear it under your shirt, you may find that it is a bit painful, with all the solder joints poking through the back and all. To solve this, I recommend putting some kind of insulator on the back. I covered the back of mine in electrical tape, however hot glue would also work fine. You could also use the loop side of an adhesive back Velcro. Then the back would be soft and if you wanted, you could put some more Velcro on the battery and connect the two.

Now to move on to the last bit, customizing the face plate.

Step 9: Customizing the Face Plate

The triangle pattern of Tony Stark's arc reactor is cool enough, but this arc reactor has an added bonus--it can have any pattern on it. Some patterns certainly work better than others, especially those that have rich, open features on the edges to see the LEDs moving. The default face plate is a good example of a good face plate. Unfortunately I must say that my symbol shown in the picture does not look as good as the main Iron Man logo.

To customize your own, watch the video or read the instructions below. The design download (in part 3) also has a face plate template hidden. Open the design up and select "Show Solids/Meshes" on the side bar. There should two full bases, hide those because you will not need them. Hide or delete the triangle pattern in the remaining face plate which should leave the border and tabs. Create a circle in the middle with a diameter of 78.75 mm. This circle will be the base of the pattern. Draw your pattern and extrude it 4 mm so that it is flush with the rest of the border. Make sure everything else is hidden or deleted except the border and pattern, then export to .stl and send it to print. After you print it, just slide it on like a normal face plate and you can be your own Iron Man.

-----------------------------------------------------------------------------------------------------------

Thanks for getting all the way through my Instructable! Hopefully you enjoyed it and/or have made one for yourself. Please show pictures of your own makes, I'd love to see them!

- Antyos

Heroes and Villains Contest

Participated in the
Heroes and Villains Contest