Stepper Shield Lemonade Stand
Moderators: adafruit_support_bill, adafruit

Re: Stepper Shield Lemonade Stand

by jeff m on Fri May 09, 2014 10:29 am

We proudly display our Geekbling.
Attachments
Geekbling.jpg
Geekbling.jpg (55.96 KiB) Viewed 559 times
jeff m
 
Posts: 34
Joined: Sat Jan 11, 2014 1:29 am

Re: Stepper Shield Lemonade Stand

by adafruit_support_bill on Fri May 09, 2014 10:58 am

You'll be needing your Laser badge soon.

Image
User avatar
adafruit_support_bill
 
Posts: 30887
Joined: Sat Feb 07, 2009 10:11 am

Re: Stepper Shield Lemonade Stand

by jeff m on Mon May 12, 2014 11:36 am

Lasers and guidance system is underway.
girlwithlaser.jpg
girlwithlaser.jpg (53.04 KiB) Viewed 547 times
jeff m
 
Posts: 34
Joined: Sat Jan 11, 2014 1:29 am

Re: Stepper Shield Lemonade Stand

by adafruit_support_bill on Mon May 12, 2014 11:57 am

Don't forget the eye protection when you power it up!
User avatar
adafruit_support_bill
 
Posts: 30887
Joined: Sat Feb 07, 2009 10:11 am

Re: Stepper Shield Lemonade Stand

by jeff m on Tue May 13, 2014 2:06 am

Behold the laser mover. Now the fun part- stacking two motor shields and making the rest of the robot work with this.
jeff m
 
Posts: 34
Joined: Sat Jan 11, 2014 1:29 am

Re: Stepper Shield Lemonade Stand

by jeff m on Tue May 13, 2014 2:14 am

laserbot2.jpg
laserbot2.jpg (27 KiB) Viewed 535 times


The Laserbot development phase of the Greatest Lemonade Stand Ever (GLSE) is well underway.
jeff m
 
Posts: 34
Joined: Sat Jan 11, 2014 1:29 am

Re: Stepper Shield Lemonade Stand

by jeff m on Thu May 15, 2014 2:25 am

We had the initial shield with the two stepper motors controlling the conveyor belt and fill sensor working well. Now we are stacking two shields. The top (0 x 60) running the conveyor and fill sensor placement, and the bottom (0 x 61) running the horizontal and vertical laser.


#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_PWMServoDriver.h"


void setup()
{


Adafruit_MotorShield AFMStop(0x60);// Default address- no jmpers.
Adafruit_MotorShield AFMSbot(0x61); // Rightmost jumper closed Adafruit_MotorShield AFMStop(0x60);
Adafruit_StepperMotor *myStepper1 = AFMStop.getStepper(200,1);
Adafruit_StepperMotor *myStepper2 = AFMStop.getStepper(200,2);
Adafruit_StepperMotor *myStepper3 = AFMSbot.getStepper(200,1);
Adafruit_StepperMotor *myStepper4 = AFMSbot.getStepper(200,2);


AFMSbot.begin(); // Start the bottom shield
AFMStop.begin(); // Start the top shield

Serial.begin(9600); // set up Serial library at 9600 bps Serial.println("Stepper test!");

myStepper1->setSpeed(100); //conveyor speed
myStepper2->setSpeed(30); //fill sensor speed
myStepper3->setSpeed(20); //laser horizontal
myStepper4->setSpeed(50); //laser vertical speed


At this juncture when we try to use the stepper, ie

myStepper1->step(1000, FORWARD, DOUBLE);

in a voidloop, we get "myStepper1 not declared in this scope". it previously worked with a single shield. This has to be easy, but we can't make it debug. Any thoughts.
jeff m
 
Posts: 34
Joined: Sat Jan 11, 2014 1:29 am

Re: Stepper Shield Lemonade Stand

by adafruit_support_bill on Thu May 15, 2014 6:29 am

It's hard to say for sure just looking at a fragment of the code. But it looks like you are declaring your motors inside your setup() function. If you do that, their scope is restricted to the function in which they are defined, so you won't be able to use them in your loop function or anywhere else.

If you move those declarations to before the setup() function, they should be accessible globally.
User avatar
adafruit_support_bill
 
Posts: 30887
Joined: Sat Feb 07, 2009 10:11 am

Re: Stepper Shield Lemonade Stand

by jeff m on Thu May 15, 2014 10:04 am

Getting those things out of the setup function is accepted without an error. Thanks
jeff m
 
Posts: 34
Joined: Sat Jan 11, 2014 1:29 am

Re: Stepper Shield Lemonade Stand

by jeff m on Fri May 16, 2014 12:13 pm

We have functioning hardware, and the Stepper Shields are stacked and work great. We can aim the laser anywhere on the arc of the lemonade conveyor. Our plan is for the customer to choose 3 different products, based on the time and sequence of the laser treatment (plain lemonade, basic laser treatment, and deluxe laser treatment). We will have the customer press 1 of three buttons to make that happen. We'll figure that out.

Our only problem is making two steppers go at the same time. Doing things sequentially is easy. Do we get into the accell
laserlemonbot.jpg
laserlemonbot.jpg (66 KiB) Viewed 500 times
library for that?

Also, note the inadvertent placement of Simon Monk's arduino programming book. It is dog eared. If Simon Monk writes it, we will read it. We want a signed affidavit from Dr. Monk that we have created the best lemonade stand in the universe
jeff m
 
Posts: 34
Joined: Sat Jan 11, 2014 1:29 am

Re: Stepper Shield Lemonade Stand

by adafruit_support_bill on Fri May 16, 2014 12:43 pm

There are two basic approaches to achieve concurrent stepper motion: One is the accelstepper library. The other is to write your own timing loop with calls to "onestep()" on both motors. If the two motors are doing similar things with similar timing, then the loop approach is reasonably straightforward. AccelStepper can be useful when the interactions get more complex.
User avatar
adafruit_support_bill
 
Posts: 30887
Joined: Sat Feb 07, 2009 10:11 am

Re: Stepper Shield Lemonade Stand

by jeff m on Wed May 21, 2014 11:58 am

We fiddled with the power supplies. We have reliable operation with the shields on 5 volts (3 amp supply) and the arduino on a 12 volt 1 amp transformer. The shields are rated to a 3 amp peak. Is the 3 amp supply too much?
jeff m
 
Posts: 34
Joined: Sat Jan 11, 2014 1:29 am

Re: Stepper Shield Lemonade Stand

by adafruit_support_bill on Wed May 21, 2014 12:51 pm

Current draw is determined by the load. If you are using the 350mA/Phase steppers, then the max draw from each stepper will be 700mA or a total of 1400mA per shield. So 3A should be no problem.

https://learn.adafruit.com/all-about-st ... he-stepper
User avatar
adafruit_support_bill
 
Posts: 30887
Joined: Sat Feb 07, 2009 10:11 am

Re: Stepper Shield Lemonade Stand

by jeff m on Thu May 22, 2014 11:28 am

LM1117.jpg
LM1117.jpg (28.02 KiB) Viewed 392 times
When we are away from AC power we will use a 12 volt lawn tractor battery with LM7805, lm7812 and utc1117 to get the power for the Stepper shields, arduino, and LED sign.

If we run out of processor speed using the the Wave shield to make laser sounds via midi (the fancy audio shield is perpetually sold out) we will try to make the laser sounds with retro 555 driven square wave tone generators. We have created GIANT 555s

giant555.jpg
giant555.jpg (23.9 KiB) Viewed 392 times
jeff m
 
Posts: 34
Joined: Sat Jan 11, 2014 1:29 am

Re: Stepper Shield Lemonade Stand

by jeff m on Thu May 22, 2014 11:44 am

controlpanellemonbot.jpg
controlpanellemonbot.jpg (19.67 KiB) Viewed 467 times


This our control panel. These momentary Adafruit switches have a nice feel and look. We want each switch to run a different protocol. #1 plain lemonade, #2 basic laser treatment, and #3 Deluxe laser treatment. We have no problems writing the code for each individual protocol (mixing the Stepper shields controlling the conveyor belt and the laser canon). We are stuck on how to make the program do nothing until one of the three switches is hit.

We understand its our job to write the code, but is there a hint you could give on the best way to have a three fork decision tree?

Thanks
jeff m
 
Posts: 34
Joined: Sat Jan 11, 2014 1:29 am