Introduction: BMO Candy Dispenser

Picture of BMO Candy Dispenser

This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com)

Hello,

This is how to make a BMO Candy Dispenser. Some features of this device include dispensing candy out of the right foot which is controlled by a step motor, and doing a karate chop which is controlled by a servo. Watch my video for the live action of BMO!

Step 1: Create Your 3D Printed Parts

Picture of Create Your 3D Printed Parts

First, you'll need a 3D design software like Inventor or Solidworks. I am more familiar with Solidworks so I used that program for my project.

Body:

I chose to make BMO's body 125x90160mm. Don't forget to round the corners of his body as well. Then, I made a hole for the left leg 16mm in diameter and two holes for the arms 11mm in diamter.

Legs and feet:

His legs are both 15mm for their outer diameter and 14mm for their inner diameter because the legs are hollow. His feet are slots with a radius of 7.5 mm and a length of 15mm from one radius to another. You then cut the top half of the left foot only up until the second radius so you can grab the candy that fall out of the leg.

Arms and hands:

Next, the arms are both hollow with am inner radius of 9mm and an outer radius of 10mm. His shoulder to elbow is 40mm while his elbow to wrist is 50mm in length. The curved elbow has a center distance of 11.3mm. His hands have a 8.5mm peg that you insert into the wrist. Aside from that I created a peace sign for his right hand and a normal hand for his left side.

Wheel:

The wheel is actually a pentagon. I started with drawing a cylinder with a 5.5mm radius and 20mm in height. From there I drew a 1x15mm rectangle from the perimeter of the circle protruding straight outwards. I used the circular pattern feature to create four more of these rectangles evenly spaced about my cylinder. Then I used boss extrude at 20mm. Then I used the feature "rib" to make the walls of the wheel 1mm thick. I cut out a rectangle right in the middle of the cylinder 5.5x7mm in size. This is so the wheel is able to be attached to the step motor. The hollow cylinder that holds and dispenses that candy to the wheel is the same measurements as the legs.

Make sure to save your part files as a .STL file for 3D printing purposes.

Step 2: Circuit Board and Arduino

Picture of Circuit Board and Arduino

First, connect your power rail to GND and 5V.

IR Remote:

Connect a 10k resistor to the positive power rail and the furthest left wire of your IR sensor. Then, connect the IR sensor the the arduino pin 4. The middle wire connects to the negative power rail and the right wire connects to the positive.

Servo:

The servo connects to pin 3 and the other two wires connect to the power rails.

Step Mottor

The step motor connects to pins 8-12 on the arduino and you need two wires to connect the step motor to the power rails.

Step 3: Arduino Code

Picture of Arduino Code

I have uploaded screen shots of my code and the libraries that I used but I will also attach a commented version.

Defining:

First, I start with four libraries, IR remote, servo, stepperAK, and wire. Then I define my servo pin, gear ratio (64) and my IR sensor. Then I attach the stepper to pins 8-11.

Setup:

For my void setup, I do serial begin and activate my IR sensor and attach my servo to the servo object. I also set my stepper speed by multiplying the gear ratio by an integer from 0.2-.15 rpm.

Loop:

For my void loop, I have four conditional statements. If I press button 1, the stepper rotates 1228 step which is one third of a revolution. If I press button 2, the stepper rotates one whole revolution. Then, if I press button 3, the servo rotates downwards 90 degrees. Finally, if I press the plus button, the servo rotates upwards 90 degrees. Then I set the IR sensor ready to carry out the next function.

Commented version of code:(excluding libraries)

#define servopin 3

#define gearratio 64 //1:64 gear ratio

int My_Receiver = 4; int stepCount; // store the servo position

int pos; // store the servo position

IRrecv irrecv(My_Receiver); // receive on pin 11 decode_results results;//instantiate a decode_results object. //const int stepsPerRevolution = 2048; //the Arduino Kit motor is geared down. By experiment I determined that 2048 steps turn the shaft one round.

Servo My_Servo; // servo object

Stepper myStepper(stepCount, 8, 9, 10, 11);

void setup() { // set the speed at 0.15 rpm (0.15-0.2 (dep. on particular motor) seems the fastest they can go...set it higher and it stops moving, just makes noises):

myStepper.setSpeed(gearratio * 0.13); //the motor appears to be geared down 1/64, meaning that the speed needs to be set 64x. // initialize the serial port:

Serial.begin(9600);

My_Servo.attach(servopin); // attaches the servo on pin 9 to the servo object

irrecv.enableIRIn(); // Start the receiver }

void loop() {

if (irrecv.decode(&results)) {//has a transmission been received?

Serial.println(results.value);//If yes: interpret the received commands...

if (results.value == 16724175)

{ stepCount = 1228; myStepper.step(stepCount); }

if (results.value == 16718055)

{ stepCount = 2048; myStepper.step(stepCount); }

if (results.value == 16743045)

{ pos = 180; My_Servo.write(pos); }

if (results.value == 16754775)

{ pos = 90; My_Servo.write(pos); }

irrecv.resume(); // receive next value

} }

Step 4: Put Together Your BMO

Picture of Put Together Your BMO

I would recommend getting double sided tape and super glue to hold pieces in place. I secured my step motor to my breadboard and glued my wheel to the extruded peg on the step motor. Then, I taped mt adruino to it stands upright. I taped the servo to the step motor pins so the arm can connect to the servo. Make sure you grab a battery and you are good to go!

Comments

gerardomaduro1 (author)2016-12-20

AdventureĀ“s Time rulez!!

Swansong (author)2016-12-08

I love that you made it look like an old gaming system :)

jihomake (author)Swansong2016-12-08

yeah!

About This Instructable

634views

14favorites

More by cfernando6:BMO Candy Dispenser
Add instructable to: