trinket M0 and pca9685 not working

Adafruit's tiny microcontroller platform. Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
everettdale
 
Posts: 14
Joined: Tue Mar 01, 2016 2:50 pm

trinket M0 and pca9685 not working

Post by everettdale »

I was hoping to get servos to work with the trinket m0 and a pca9685 board, but I'm not having sucess.

I'm prototyping on a breadboard

trying to duplicate what it says on this page https://learn.adafruit.com/16-channel-p ... cuitpython

here is my set up

Pin 0 on trinket to SDA pin on pca9685
Pin 2 on trinket to SCL pin on pca9685
10k resister from Pin 0 on trinket to pin 3v on trinket (pull up)
10k resister from Pin 2 on trinket to pin 3v on trinket (pull up)
4.5 volt power to trinket gnd and bat
6 volt power to pca9685
servo hooked up to channel 0 on pca9685

Here is my code

1 """Simple test for a standard servo on channel 0 and a continuous rotation servo on channel 1."""
2 import time
3 from adafruit_servokit import ServoKit
4 print ("hello")
5 # Set channels to the number of servo channels on your kit.
6 # 8 for FeatherWing, 16 for Shield/HAT/Bonnet.
7 kit = ServoKit(channels=16)
8
9 kit.servo[0].angle = 180
10 # kit.continuous_servo[1].throttle = 1
11 time.sleep(1)
13 # kit.continuous_servo[1].throttle = -1
I was hoping to get servos to work with the trinket m0 and a pca9685 board, but I'm not having sucess.

I'm prototyping on a breadboard

trying to duplicate what it says on this page https://learn.adafruit.com/16-channel-p ... cuitpython

here is my set up

Pin 0 on trinket to SDA pin on pca9685
Pin 2 on trinket to SCL pin on pca9685
10k resister from Pin 0 on trinket to pin 3v on trinket (pull up)
10k resister from Pin 2 on trinket to pin 3v on trinket (pull up)
4.5 volt power to trinket gnd and bat
6 volt power to pca9685
servo hooked up to channel 0 on pca9685

Here is my code

"""Simple test for a standard servo on channel 0 and a continuous rotation servo on channel 1."""
import time
from adafruit_servokit import ServoKit
print ("hello")
# Set channels to the number of servo channels on your kit.
# 8 for FeatherWing, 16 for Shield/HAT/Bonnet.
kit = ServoKit(channels=16)

kit.servo[0].angle = 180
# kit.continuous_servo[1].throttle = 1
time.sleep(1)
# kit.continuous_servo[1].throttle = -1
time.sleep(1)
kit.servo[0].angle = 0
# kit.continuous_servo[1].throttle = 0

There error I get is... (wait! What? MU won't let me copy and past the error)
here is the short version

ValueError: No I2c device at address: 40


This makes me think that the trinket can't see the pca9685 for some reason. I checked the jumper pads on the pca9685 to see if it was on a different address, and it seems to be on at address 40.

also I was able to get the same pca9685 to work with my arduino uno so I'm pretty sure it works.

any suggestions? I must be missing something simple.

-dale

time.sleep(1)
kit.servo[0].angle = 0
# kit.continuous_servo[1].throttle = 0

There error I get is... (wait! What? MU won't let me copy and past the error)
here is the short version

ValueError: No I2c device at address: 40


This makes me think that the trinket can't see the pca9685 for some reason. I checked the jumper pads on the pca9685 to see if it was on a different address, and it seems to be on at address 40.

also I was able to get the same pca9685 to work with my arduino uno so I'm pretty sure it works.

any suggestions? I must be missing something simple.

-dale

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: trinket M0 and pca9685 not working

Post by adafruit_support_carter »

Try removing the pull up resistors. They are not needed, the PCA breakout includes them.

Then please post a photo of your setup showing how everything is connected.

User avatar
everettdale
 
Posts: 14
Joined: Tue Mar 01, 2016 2:50 pm

Re: trinket M0 and pca9685 not working

Post by everettdale »

I tried removing the resistors and got an error saying pull up resistors needed. I also swapped out the pca9685 with a different one, to see if it was bad, still no luck. I will post a photo soon.

User avatar
everettdale
 
Posts: 14
Joined: Tue Mar 01, 2016 2:50 pm

Re: trinket M0 and pca9685 not working

Post by everettdale »

Here are some (not great) photos of my set up.
trinket.jpg
trinket.jpg (101.17 KiB) Viewed 120 times
pca9685.jpg
pca9685.jpg (96.45 KiB) Viewed 120 times
I hope these are good enough.

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: trinket M0 and pca9685 not working

Post by adafruit_support_carter »

Thanks for the photos. It looks like you don't have logic power connected:
power.jpg
power.jpg (25.68 KiB) Viewed 116 times
See here for wiring details:
https://learn.adafruit.com/16-channel-p ... wiring-9-1
and here for general pinout info:
https://learn.adafruit.com/16-channel-p ... er/pinouts

There are two separate power sources: (1) power for the servos which is connected via the screw terminals and (2) power for the PCA9685 itself.

User avatar
everettdale
 
Posts: 14
Joined: Tue Mar 01, 2016 2:50 pm

Re: trinket M0 and pca9685 not working

Post by everettdale »

it worked!

I don't see a way to tag this thread as SOLVED

Thanks!

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

Return to “Trinket ATTiny, Trinket M0”