Iron Man Potentiometer Controlled Toy by Liam Luther and Franco

by PHS_Engineering in Circuits > Arduino

122 Views, 1 Favorites, 0 Comments

Iron Man Potentiometer Controlled Toy by Liam Luther and Franco

IMG_0565.jpeg

We created a modified Iron Man toy that’s lights are activated when the reading from a potentiometer we connected with it is over a certain value. The process that we used could also be applied to many other toys as well as household items that have some sort of on/off switch.

Supplies

Screen Shot 2021-12-07 at 10.30.09 AM.png
  • Arduino Uno
  • Captain America Toy with candy dispenser
  • Wires
  • Breadboard
  • 5V Relay
  • Aligator Clips
  • Potentiometer
  • Screwdriver
  • Wire Stripper
  • Cardboard Box

Open Iron Man

Screen Shot 2021-12-07 at 10.32.36 AM.png
Screen Shot 2021-12-07 at 10.42.07 AM.png
Screen Shot 2021-12-07 at 10.41.52 AM.png
Screen Shot 2021-12-07 at 10.41.40 AM.png

We removed all of the screws from the body of the Iron man toy and took the pieces apart, starting with the head and chest and moving down the body. The yellow cylinder on the bottom of the body was discarded, because its only purpose was to hold candy, and we didn't need it.

Wire the Relay

Screen Shot 2021-12-07 at 10.36.32 AM.png
Screen Shot 2021-12-07 at 10.40.08 AM.png
Screen Shot 2021-12-07 at 10.40.33 AM.png

We wired the relay based on the diagram shown above. We didn’t incorporate the potentiometer yet, we just wanted to see if we could get the relay working. This relay wiring could be used for almost any project as the diagram that we followed was a very general template.

Connect the Potentiometer

Screen Shot 2021-12-09 at 10.35.53 AM.png
Screen Shot 2021-12-12 at 9.49.41 PM.png

We used this diagram to wire up a potentiometer to the Arduino. The diagram that we used was a very general template that can be used for any project involving a potentiometer. As far as the circuits go, all we did was take two basic Arduino tools and use them together. Attached is a photo of the completed circuit, including the potentiometer and relay.

Attach Alligator Clips to the Toy, and to the Uno

Screen Shot 2021-12-12 at 9.34.18 PM.png
Screen Shot 2021-12-12 at 9.58.59 PM.png

We connected the red and black alligator clips to the wires on the arduino and the toy shown above. On the toy, we had to use a wire stripper to remove a short section of the white wires in order to make space to clip on the alligator clips. We had some trouble when the alligator clips began to touch each other or to push the button on the toy, but after designing the box and changing up the wires we found the solution.

Write the Code

arduino_logo_1200x630-01.png

We then wrote out the code for the program, pasted below.


int potPin = A0; // The potentiometer is connected to pin A0

int Relay = 13; // The relay is connected to pin 13


void setup() {

 Serial.begin(9600); // This command sets up the serial monitor at 9600 baud

 pinMode(potPin,INPUT); // The potentiometer is defined as an input, so the arduino is taking in its readings

 pinMode(Relay, OUTPUT); // The relay is defined as an output, so the arduino is sending commands to it

}


void loop() {


 int potData=analogRead(potPin); // The variable potData is defined as the value of the reading from the potentiometer 

 Serial.println (potData); // This command prints the value of potData to the serial monitor

 delay (25); // This command sets a delay of 25 milliseconds

 Serial.begin (9600); // This command sets the monitor to 9600 baud

 if(potData > 500){ // This 'if' statement asks if the potentiometer value is greater than 500


 digitalWrite (Relay, HIGH); //if the potentiometer value is over 500, this command turns on the relay

 delay(25); // 25 millisecond delay

 digitalWrite (Relay, LOW); //this command turns off the relay

 delay(2000); // 2 second delay

  }

  else{

   digitalWrite(Relay,LOW); // if the potentiometer value is equal to or under 500, this command keeps the relay off

  }

 }


Make the Box

F457E27D-AC01-4494-A664-5B1CBCCCA993_1_105_c.jpeg

Finally, with all of the wiring and coding complete, we used the screwdriver to poke one hole in the side of a cardboard box to feed the wires through. Then, we placed the toy in the box, but left the breadboard outside. We then positioned the arms of the toy so that they were sticking out of the box, and drew a dog face to make it seem as though the dog was eating the toy. We also used a small amount of tape on the arms to make sure they stayed upright.