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
Adafruit DC & Stepper Motor HAT for Raspberry Pi
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- pbgorman
- Posts: 3
- Joined: Thu Aug 13, 2015 8:16 pm
- adafruit_support_mike
- Posts: 67454
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi
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.
- pbgorman
- Posts: 3
- Joined: Thu Aug 13, 2015 8:16 pm
Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi
So then my best bet would probably be an Arduino and a stepper shield then?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.
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi
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
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
- pbgorman
- Posts: 3
- Joined: Thu Aug 13, 2015 8:16 pm
Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi
Excellent Bill! I have read that and am absorbing all I can about them.
Thanks so much!
Thanks so much!
- rafoid
- Posts: 10
- Joined: Fri Oct 02, 2015 3:36 pm
Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi
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?
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi
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.
- rafoid
- Posts: 10
- Joined: Fri Oct 02, 2015 3:36 pm
Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi
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:
Is there a bug in Adafruit code? Is this a known issue? Please advise.
Code: Select all
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
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
Reason: Please use [code] tags when submitting code to the forums
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi
There is a github issue regarding microstepping problems. No ETA on a fix yet.
viewtopic.php?f=50&t=81479&p=411981&hil ... ep#p412963
viewtopic.php?f=50&t=81479&p=411981&hil ... ep#p412963
- rafoid
- Posts: 10
- Joined: Fri Oct 02, 2015 3:36 pm
Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi
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.
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.
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi
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.
- rafoid
- Posts: 10
- Joined: Fri Oct 02, 2015 3:36 pm
Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi
I'm connecting ground, 5V SCL and SDA. The image can be found here: https://goo.gl/photos/WsHwrBf92m56U5Kh7
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi
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.
- rafoid
- Posts: 10
- Joined: Fri Oct 02, 2015 3:36 pm
Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi
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?
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi
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.When the device is connected, there is no communication happening on it -
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.The wires to the device are about 5" long, but so are the wires to the steppers.
Please be positive and constructive with your questions and comments.