0

Adafruit DC & Stepper Motor HAT for Raspberry Pi
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Adafruit DC & Stepper Motor HAT for Raspberry Pi

by pbgorman on Thu Aug 13, 2015 8:24 pm

So I just ordered my first Raspberry Pi with the intent on building a CNC router. My question is regarding the Adafruit DC & Stepper Motor HAT for Raspberry Pi. Will this work with GRBL or LinuxCNC or will I have to code through Python? I'm a total noob with this so forgive my ignorance if this is a dumb question. I am a professional CAD guy and I'm wanting to design and create stuff. Nothing too serious just yet as I get my feet wet with this project.

Thanks!
P

pbgorman
 
Posts: 3
Joined: Thu Aug 13, 2015 8:16 pm

Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi

by adafruit_support_mike on Fri Aug 14, 2015 1:38 am

The Motor Hat doesn't support any of the NC dialects, but more importantly, it can only handle about 1.6A per channel. That will limit you to a light duty CNC rig unless you use the Hat's output to control external H-bridges.

adafruit_support_mike
 
Posts: 58799
Joined: Thu Feb 11, 2010 2:51 pm

Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi

by pbgorman on Fri Aug 14, 2015 7:21 am

adafruit_support_mike wrote:The Motor Hat doesn't support any of the NC dialects, but more importantly, it can only handle about 1.6A per channel. That will limit you to a light duty CNC rig unless you use the Hat's output to control external H-bridges.


So then my best bet would probably be an Arduino and a stepper shield then?

pbgorman
 
Posts: 3
Joined: Thu Aug 13, 2015 8:16 pm

Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi

by adafruit_support_bill on Fri Aug 14, 2015 7:26 am

For CNC applications I'd recommend an Arduino and a gShield. https://www.adafruit.com/products/1750
The gShield is designed for CNC applications running the tinyG G-code interpreter on Arduinos. It can handle larger motors than the stepper shield and has current limiting.

https://learn.adafruit.com/all-about-st ... he-stepper

adafruit_support_bill
 
Posts: 74337
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi

by pbgorman on Fri Aug 14, 2015 12:40 pm

Excellent Bill! I have read that and am absorbing all I can about them.

Thanks so much!

pbgorman
 
Posts: 3
Joined: Thu Aug 13, 2015 8:16 pm

Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi

by rafoid on Fri Oct 02, 2015 3:39 pm

I just received mine and planning to use it with 2 stepper motors. But I have a slightly different question - since the HAT goes over all of the GPIO pins on the PI, how can I access other pins that I am planning to use? My guess is I can simply solder wires on top of the HAT, since the HAT itself doesn't utilize all GPIO pins, or does it?

rafoid
 
Posts: 10
Joined: Fri Oct 02, 2015 3:36 pm

Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi

by adafruit_support_bill on Fri Oct 02, 2015 4:17 pm

Other than power and ground, the HAT only uses the SDA and SCL pins. And these can be shared with other I2C devices. All other GPIO pins are accessible via the breakout holes in the HAT.

adafruit_support_bill
 
Posts: 74337
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi

by rafoid on Wed Oct 14, 2015 9:23 pm

I connected two steppers I purchased from Adafruit which were recommended for this project and modified sample code to test them out. What I see is with step set to 1, the FORWARD direction doesn't work properly - it goes forward and then immediately backward. When direction is BACKWARD, it works as expected. Here is my code:


Code: Select all | TOGGLE FULL SIZE
mtr2 = mh.getStepper(1, 1)  # steps/rev, motor port #1
mtr2.setSpeed(1)            # RPM
mtr1 = mh.getStepper(1, 2)  # steps/rev, motor port #2
mtr1.setSpeed(1)            # RPM

step = 1
stepType = Adafruit_MotorHAT.MICROSTEP

# move motor 2 forward 1 step
mtr2.step(step, Adafruit_MotorHAT.FORWARD,  stepType)

# move motor 1 forward 10 steps
j = 0
while (j <= 10):
    mtr1.step(step, Adafruit_MotorHAT.FORWARD, stepType)
    j += step

# move motor 2 forward 1 step
mtr1.step(step, Adafruit_MotorHAT.FORWARD,  stepType)
       
# move motor 1 backward 10 steps
j = 0
while (j <= 10):
    mtr2.step(step, Adafruit_MotorHAT.BACKWARD, stepType)
    j += step


Is there a bug in Adafruit code? Is this a known issue? Please advise.
Last edited by adafruit_support_bill on Thu Oct 15, 2015 5:51 am, edited 1 time in total.
Reason: Please use [code] tags when submitting code to the forums

rafoid
 
Posts: 10
Joined: Fri Oct 02, 2015 3:36 pm

Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi

by adafruit_support_bill on Thu Oct 15, 2015 5:51 am

There is a github issue regarding microstepping problems. No ETA on a fix yet.
viewtopic.php?f=50&t=81479&p=411981&hilit=python+microstep#p412963

adafruit_support_bill
 
Posts: 74337
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi

by rafoid on Fri Oct 30, 2015 9:21 pm

With two stepper motors connected to the hat, things work perfectly, until ...

I recently purchased another device which sits on I2C address 0x62. If I unplug this device from the hat, both steppers rotate as expected. As soon as I connect this device, steppers still rotate but frequently enough I get this error: "Error accessing 0x60: Check your I2C address". The program doesn't engage the newly connected device, it still only rotates steppers, but without 0x62 device I get no such errors and with the device connected, same exact program gives me errors. I see that one of the steppers is sitting on 0x60 address. Is this a known issue? Can this address be re-assigned somehow? I am ok with changing C code and recompiling it if needed. Any pointers are greatly appreciated.

rafoid
 
Posts: 10
Joined: Fri Oct 02, 2015 3:36 pm

Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi

by adafruit_support_bill on Sat Oct 31, 2015 6:03 am

As long as the addresses are different there should be no addressing conflict. It sounds like maybe a problem with bus loading, capacitance or noise when you connect the new device. If you post photos showing your soldering and wiring we can take a look.

adafruit_support_bill
 
Posts: 74337
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi

by rafoid on Sat Oct 31, 2015 12:30 pm

I'm connecting ground, 5V SCL and SDA. The image can be found here: https://goo.gl/photos/WsHwrBf92m56U5Kh7

rafoid
 
Posts: 10
Joined: Fri Oct 02, 2015 3:36 pm

Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi

by adafruit_support_bill on Sat Oct 31, 2015 12:36 pm

How long are your wires? i2c was designed for communication between chips on the same board, so it works best when wires are kept short. Long wires can cause problems like too much capacitance which will affect the rise-time of the signals on the bus. Longer wires are also more susceptible to noise. This can be a real concern in a CNC type application with lots of high-current inductive loads being switched on and off.

adafruit_support_bill
 
Posts: 74337
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi

by rafoid on Mon Nov 02, 2015 9:33 pm

The wires to the device are about 5" long, but so are the wires to the steppers. When the device is connected, there is no communication happening on it - the program I execute is only designed to rotate both steppers. I see that the HAT board also has some I2C addresses marked in the middle (A0 through A4) - what are they intended for? Is it to change I2C addresses via hardware?

rafoid
 
Posts: 10
Joined: Fri Oct 02, 2015 3:36 pm

Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi

by adafruit_support_bill on Tue Nov 03, 2015 6:42 am

When the device is connected, there is no communication happening on it -

It doesn't matter if you are communicating with the device or not. i2c is a bus so all devices on the bus - including the shield - see all of the communication and all of the noise.
The wires to the device are about 5" long, but so are the wires to the steppers.

So you have 2x 5" receiver antennae connected to the bus and 4x 5" antennae transmitting interference from the stepper motor windings. Any noise picked up on the receive side will impact i2c communication with the shield. Make sure that these wires are well separated. You can minimize noise pickup by using twisted pair and/or shielded wiring.

adafruit_support_bill
 
Posts: 74337
Joined: Sat Feb 07, 2009 10:11 am

Please be positive and constructive with your questions and comments.