Iron Chef Build - Motor Controlled by Sensors

In the beginning I was trying to get the IR remote to work and I did this build to see how things would come together. I had to do more than copy code. I needed to add to my library and include the IR remote information in my Arduino library. After I added the information here’s the IR Remote Build.

Well after the big buildup video of the IRON CHEF BUILD. I was excited and scared because this was the last build. I was trying to think how I could put this build together. I got a motor to work last week and we have already worked with sensors so I did some digging and dug out the “SUPER STARTER KIT”! (Sorry, not sorry, Dr. B. Your evil plan worked and I am hooked) It just has more parts and stuff than the regular starter kit. 

I ended up changing the motor and adding a 9V battery then I added an IR remote (guys are not the only ones who like remotes!). The neat thing about the super starter kit is that it allows you to use less wires to get things going. As you can see in the video the “power supply module” allows you to jack the 9v into the breadboard without having to wire everything (That is nice!). So the battery gives the motor extra power and the sensor is the IR remote that uses a remote pad to tell the motor what to do. 

 

Components: 

Arduino Uno

Breadboard 

IR Receiver Module

Remote Control

Power Supply Module

9 Volt Battery

Stepper Motor

Stepper Motor Driver Module

Wires


I researched the info, but Brainy Bits was the best resource for getting this together. Thank you Brainy Bits!

The Code

#include "Stepper.h"

#include "IRremote.h"

 

/*----- Variables, Pins -----*/

#define STEPS 32 // Number of steps per revolution of Internal shaft

int Steps2Take; // 2048 = 1 Revolution

int receiver = 6; // Signal Pin of IR receiver to Arduino Digital Pin 6

 

/*-----( Declare objects )-----*/

// Setup of proper sequencing for Motor Driver Pins

// In1, In2, In3, In4 in the sequence 1-3-2-4

 

Stepper small_stepper(STEPS, 8, 10, 9, 11);

IRrecv irrecv(receiver);            // create instance of 'irrecv'

decode_results results;         // create instance of 'decode_results'

 

void setup()

{

irrecv.enableIRIn(); // Start the receiver

}

 

void loop()

{

if (irrecv.decode(&results)) // have we received an IR signal?

 

   {

      switch(results.value)

      {

 

          case 0xFF629D: // UP button pressed

                                        small_stepper.setSpeed(500); //Max seems to be

   700

                                         Steps2Take = 2048; // Rotate CW

                                         small_stepper.step(Steps2Take);

                                         delay(2000);

                                            break;

 

           case 0xFFA857: // DOWN button pressed

                                          small_stepper.setSpeed(500);

                                          Steps2Take = -2048; // Rotate CCW

                                          small_stepper.step(Steps2Take);

                                          delay(2000); break;

 

       }

 

           irrecv.resume(); // receive the next value

   }

 

 

}/* --end main loop -- */

Image #1 to the left is the Iron Chef Build all put together. 

 

Image #2 above is the drawing snipped from Brainy Bits (Thank you again!) of the build. 

I think I got the build to work? That doesn’t sound so good. I got everything going the way it should, but I didn’t see a spinning motor. It was a challenge and I think a practical application for a build like this would be turning on and turning up or down something - like controlling a remote controlled car. I hope you enjoy the Iron Chef Build!

 

 

 

Final Note

 

This was a larger build, but I still don’t feel comfortable coding myself. I like the research and building, but there are so many things that can go wrong in the code (just a space out of place - WOW!) I want to challenge myself to work on that and learn to code. I have a fix for that too now the internet has so many answers. I am enjoying all that I learned from doing this and I want to try these builds and more. You really did get me addicted, Dr. B!