Stepper motor via Raspi

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
greenman
 
Posts: 16
Joined: Wed Jul 23, 2014 6:33 pm

Stepper motor via Raspi

Post by greenman »

Hello,
I am trying to follow this tutorial to drive a small stepper motor via Raspberry PI. (https://learn.adafruit.com/adafruits-ra ... per-motors)

So I got the following
Small Reduction Stepper Motor - 5VDC 32-Step 1/16 Gearing PRODUCT ID: 858
Adafruit Assembled Pi Cobbler Breakout + Cable for Raspberry Pi PRODUCT ID: 914
Dual H-Bridge Motor Driver for DC or Steppers - 600mA - L293D PRODUCT ID: 807
ULN2803: 8 Channel Darlington Driver (Solenoid/Unipolar Stepper) PRODUCT ID: 970
Full sized breadboard PRODUCT ID: 239

Raspberry PI Powered using Amazon Kindle PowerFast Adapter (1.8A 5V)

I have tried the setup using ULN2803 and the setup using L293D. However I do not see the motor respond.
I have no idea if the motor is faulty or the driver chips or the cobbler kit or the breadboard or if i am doing something wrong.
How can I try to figure this out

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

Re: Stepper motor via Raspi

Post by adafruit_support_bill »

I do not see the motor respond.
Look closely. These motors are geared down so they move very slowly. If you attach a piece of tape to the shaft, it will be easier to see if it is turning.

Also, check to see if there is any noise or vibration coming from the motor. These motors are generally pretty quiet, but you should be able to feel some vibration as the coils are being energized.

User avatar
Franklin97355
 
Posts: 23910
Joined: Mon Apr 21, 2008 2:33 pm

Re: Stepper motor via Raspi

Post by Franklin97355 »

Could you post clear pictures of your board and the connections to it?

User avatar
greenman
 
Posts: 16
Joined: Wed Jul 23, 2014 6:33 pm

Re: Stepper motor via Raspi

Post by greenman »

I had attached a paper to the motor to notice any movement.

Sorry if the pictures are not clear. this is the best i could do.
Attachments
D7K_1135.JPG
D7K_1135.JPG (168.38 KiB) Viewed 777 times
D7K_1134.JPG
D7K_1134.JPG (171 KiB) Viewed 777 times

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

Re: Stepper motor via Raspi

Post by adafruit_support_bill »

Please answer the question.
Also, check to see if there is any noise or vibration coming from the motor. These motors are generally pretty quiet, but you should be able to feel some vibration as the coils are being energized.
Also: you mentiond both ULN2803 and L293D. Which one is shown in the photos?

User avatar
greenman
 
Posts: 16
Joined: Wed Jul 23, 2014 6:33 pm

Re: Stepper motor via Raspi

Post by greenman »

this is the L293D

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

Re: Stepper motor via Raspi

Post by adafruit_support_bill »

Please answer the question.
Also, check to see if there is any noise or vibration coming from the motor. These motors are generally pretty quiet, but you should be able to feel some vibration as the coils are being energized.
And show us how you have the cobbler connected to the RasPi.

User avatar
greenman
 
Posts: 16
Joined: Wed Jul 23, 2014 6:33 pm

Re: Stepper motor via Raspi

Post by greenman »

I held the motor in hand and sensed no vibrations or noise.
Attachments
PI is connected to the wifi dongle via a external powered USB hub. PI itself is powered by the Amazon Kindle fast charger (1.8A and 5V)
PI is connected to the wifi dongle via a external powered USB hub. PI itself is powered by the Amazon Kindle fast charger (1.8A and 5V)
D7K_1139.JPG (192.58 KiB) Viewed 768 times
Cobbler to PI connection
Cobbler to PI connection
D7K_1138.JPG (185.09 KiB) Viewed 768 times

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

Re: Stepper motor via Raspi

Post by adafruit_support_bill »

Your ribbon cable is backwards. The white stripe should align with pin 1 nearest the SD card on the Pi.

User avatar
greenman
 
Posts: 16
Joined: Wed Jul 23, 2014 6:33 pm

Re: Stepper motor via Raspi

Post by greenman »

That was it. Thank you very much.

User avatar
greenman
 
Posts: 16
Joined: Wed Jul 23, 2014 6:33 pm

Re: Stepper motor via Raspi

Post by greenman »

Hi
The motor is Small Reduction Stepper Motor - 5VDC 32-Step 1/16 Gearing
which means 512 steps should make the wheel complete 1 turn (360 degrees) right?

In the stepper.py I am having to provide delay ms as 5 and forward steps as 128 to complete 360 degrees not 512.
Am I doing the math incorrectly.

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

Re: Stepper motor via Raspi

Post by adafruit_support_bill »

Can you post the code you are using? We have seen some variation in gearing in these from the manufacturer. I may have to tear another one apart to see what is inside.

http://forums.adafruit.com/viewtopic.ph ... 8&p=210326

shanos
 
Posts: 1
Joined: Mon May 13, 2013 9:25 pm

Re: Stepper motor via Raspi

Post by shanos »

I just bought 10 of these stepper motors from adafruit and they're all 128 steps, not 512 steps as advertised! should i return them or can you just send out 512 step replacements?

User avatar
Franklin97355
 
Posts: 23910
Joined: Mon Apr 21, 2008 2:33 pm

Re: Stepper motor via Raspi

Post by Franklin97355 »

Could you post the code you are using to test them? Thanks.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Stepper motor via Raspi

Post by adafruit_support_mike »

If you're using the tutorial code that defines a 'step' as a complete cycle of:

Code: Select all

 aL  aR  bL  bR
------------------
{ HI, LO, LO, LO }
{ LO, LO, HI, LO }
{ LO, HI, LO, LO }
{ LO, LO, LO, HI }
coil activations, you'll only get 128 of those from a 512-step motor.

Each coil activation above moves the rotor to a position called a 'detente', and the 512-step motors should have 512 detente positons per rotation.

The sequence of activations above is one of the smallest repeatable patterns for driving a stepper motor, and executing all four in a single routine makes the code easier because you can run the same pattern every time. Calling that pattern a 'step' sacrifices accuracy for convenience though.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”