1 Rev per hour

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

1 Rev per hour

Postby randwulf » Mon Apr 16, 2012 10:41 pm

Anyone know how to get an accurate 1 rev per hour from the adafruit motor shield. What is the smallest increment the shield recognizes? Ive tried to get it to do 3.33 steps per minute but it doesnt work. Any suggestions?
randwulf
 
Posts: 3
Joined: Mon Apr 16, 2012 10:38 pm

Re: 1 Rev per hour

Postby adafruit_support_bill » Tue Apr 17, 2012 5:17 am

You can call "onestep()" every 18000 milliseconds.
Code: Select all
  uint8_t onestep(uint8_t dir, uint8_t style);
User avatar
adafruit_support_bill
 
Posts: 16027
Joined: Sat Feb 07, 2009 9:11 am

Re: 1 Rev per hour

Postby randwulf » Wed Apr 18, 2012 10:27 pm

Im sorry, I'm a newbie at this and have had the shield for only a week. How would i implement the speed when using the one.step? I have scoured the internet and cannot find any examples on setting the speed for a one step. Please help.
As it stands now, this is the only code i have.



// AFMotor_MultiStepper.pde
// -*- mode: C++ -*-
//
// Control both Stepper motors at the same time with different speeds
// and accelerations.
// Requires the AFMotor library (https://github.com/adafruit/Adafruit-Mo ... ld-library)

#include <AccelStepper.h>
#include <AFMotor.h>



The one step seems to be a possible answer to my question but i am unsure where you are supposed to put in the time increment between steps. I thought this should be a fairly basic problem but it seems there is no supporting documentation for it anywhere on the web.



AF_Stepper stepper1(200, 2);

// you can change these to DOUBLE or INTERLEAVE or MICROSTEP!
// wrappers for the first motor!
void forwardstep1() {
stepper1.onestep(FORWARD, SINGLE);
}


void setup()
{
stepper1.setMaxSpeed(200.0);
stepper1.setAcceleration(100.0);
stepper1.moveTo(24);
randwulf
 
Posts: 3
Joined: Mon Apr 16, 2012 10:38 pm

Re: 1 Rev per hour

Postby adafruit_support_bill » Thu Apr 19, 2012 4:57 am

I have scoured the internet and cannot find any examples on setting the speed for a one step.

The function is "onestep". If you search these forums (or look at the library code) you will find examples of it.

You cannot set a speed for one-step. Because, as the name implies, it only steps once. You control the speed by how often you call it. To do one rev per hour with your motor, you want to call it once every 18000 milliseconds. The code below is the simplest implementation. Depending on what precision you need and what else you want to do in the loop, you may want to look into timers also.


Code: Select all
void loop()
{
   stepper1.onestep(FORWARD, SINGLE);
   delay(18000);
}
User avatar
adafruit_support_bill
 
Posts: 16027
Joined: Sat Feb 07, 2009 9:11 am

Re: 1 Rev per hour

Postby randwulf » Thu Apr 19, 2012 9:46 pm

Thanks a million! That worked perfectly. Im going to try to work on counting /positioning and hopefully I will be able to figure this thing out.

Thanks again.
randwulf
 
Posts: 3
Joined: Mon Apr 16, 2012 10:38 pm


Return to Arduino Shields from Adafruit

Who is online

Users browsing this forum: No registered users and 3 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [103]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
BeagleBone[24]
 
Android[6]
 
XBee[10]
More Dev Boards[30]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[33]
LCDs & Displays[48]
Components & Parts[69]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[109]
 
Wireless[14]
Cables[61]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[70]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]