0

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

Please be positive and constructive with your questions and comments.

Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi

by rafoid on Tue Nov 03, 2015 1:12 pm

i'll stop by the store and buy CAT6e wire which should be shielded. What about:

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 1:17 pm

Yes. You can re-address the board using those address jumpers as described in the guide:
https://learn.adafruit.com/adafruit-dc- ... g-the-hats

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 Tue Nov 03, 2015 1:41 pm

Would it be better to connect new device via PWM? Would it remove noise from I2C channel? Do I need a shielded wire for PWM as well?

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 2:04 pm

Would it be better to connect new device via PWM?

What device are you connecting? PWM is just pulse width modulation. It is not commonly used as a communication protocol.

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

Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi

by ajmadison on Wed Mar 29, 2017 7:28 pm

How do I access the pins labeled xtra pwm through python code and what is the voltage off of those pins? I am trying to control mg90s via one of the pwm pins.

ajmadison
 
Posts: 1
Joined: Mon Mar 27, 2017 9:45 pm

Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi

by adafruit_support_bill on Wed Mar 29, 2017 8:49 pm

How do I access the pins labeled xtra pwm through python code

Use the channel number in setPWM.
and what is the voltage off of those pins?

The PWM pulses are 3.3v.

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

Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi

by theis_cube on Sun Apr 02, 2017 5:03 pm

Is there a datasheet available that provides the pin correlation from the Raspberry Pi to the HAT?
For example, if I were to be using the GPIO pin 12 on the Pi for pwm, I would use Python code looking something like this:

import Rpi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
p = GPIO.PWM(12, 0.5)
p.start()

What is the corresponding way to do this using the HAT? I am a beginner regarding this concept.

theis_cube
 
Posts: 1
Joined: Sun Apr 02, 2017 4:57 pm

Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi

by adafruit_support_bill on Sun Apr 02, 2017 5:15 pm

The Pi communicates with the HAT using i2c. That is the SDA and SCL pins. The PWM generator chip on the HAT has 16 PWM channels. You set the PWM duty cycle for a channel using the library setPWM function as described in the guide:
https://learn.adafruit.com/adafruit-16- ... nel-on-off

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

Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi

by nahueltaibo on Thu Nov 15, 2018 3:38 pm

adafruit_support_bill wrote:The Pi communicates with the HAT using i2c. That is the SDA and SCL pins. The PWM generator chip on the HAT has 16 PWM channels. You set the PWM duty cycle for a channel using the library setPWM function as described in the guide:
https://learn.adafruit.com/adafruit-16- ... nel-on-off


I don´t think this is possible, the MotorHat library hides the ServoMotor library within. I´m not expert in python, so I might be missing something, but It looks like there is no way to get to the underlying _motorHat._pwm.setPwm()

If I'm wrong, could you please show me what would be the correct way of doing this?

Thanks

nahueltaibo
 
Posts: 6
Joined: Wed Mar 07, 2018 11:26 am

Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi

by nahueltaibo on Thu Nov 15, 2018 4:50 pm

nahueltaibo wrote:
adafruit_support_bill wrote:The Pi communicates with the HAT using i2c. That is the SDA and SCL pins. The PWM generator chip on the HAT has 16 PWM channels. You set the PWM duty cycle for a channel using the library setPWM function as described in the guide:
https://learn.adafruit.com/adafruit-16- ... nel-on-off


I don´t think this is possible, the MotorHat library hides the ServoMotor library within. I´m not expert in python, so I might be missing something, but It looks like there is no way to get to the underlying _motorHat._pwm.setPwm()

If I'm wrong, could you please show me what would be the correct way of doing this?

Thanks


OK, it was just me with my c# mindset, if I just call: _motorHat._pwm.setPWM() works fine, even dough intellisense in Pycharm does not show those properties / methods

nahueltaibo
 
Posts: 6
Joined: Wed Mar 07, 2018 11:26 am

Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi

by Skyice on Thu Nov 15, 2018 9:00 pm

Can this HAT ouput 5V PWM signal? given that pi is running 3.3V control logic as well as the I2C. I need a 5V PWM signal for a step and direction stepper drive, is there a way to do that with this product ID:3416(bonnet instead of HAT). Thanks!

Skyice
 
Posts: 2
Joined: Thu Nov 15, 2018 8:57 pm

Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi

by adafruit_support_mike on Fri Nov 16, 2018 12:50 am

You'll need a level shifter.

The PCA9685 PWM generator has to operate at 3.3V to avoid damaging the RasPi's GPIO ports, so it can only generate 3.3V output.

The 74AHCT125 is a good 3.3V-to-5V converter:

https://www.adafruit.com/product/1787

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

Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi

by Skyice on Fri Nov 16, 2018 1:04 am

Do I level shift the I2c from RPI 3.3v to 5v or the 3.3v pwm to 5v? Will the conversion be fast enough for the PWM to work correctly? Thanks

Skyice
 
Posts: 2
Joined: Thu Nov 15, 2018 8:57 pm

Re: Adafruit DC & Stepper Motor HAT for Raspberry Pi

by adafruit_support_bill on Fri Nov 16, 2018 6:49 am

You can leave the i2c as-is and just shift the 3.3v PWM outputs of the HAT to 5v. The 74AHCT125 should be plenty fast for PWM signals from the HAT>

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

Please be positive and constructive with your questions and comments.