0

Problems with BBGW I2D 16 Channel Servo Driver
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Problems with BBGW I2D 16 Channel Servo Driver

by 3DRoboGuy on Wed Sep 06, 2017 2:17 pm

Hi,
Totally new to the BB range of SBCs. Have worked with Atmel Megas for years but Linux and BBs are still pretty arcane to me - although I'm learning...

I'm making a 40cm R2D2 with my 3D Printer and a BeagleBone Green Wireless.

I have 75% of the R2 unit printed and assembled complete with all sorts of gizmos that now need the be interfaced to the BBGW.

I also have an Adafruit 16-channel 12-bit I2C PWM Servo Driver to drive some of the servos. Whilst I have GPIO and PWM pretty well sussed out I'm struggling with the finer points of accessing the Servo Driver board via I2C. The I2C bus (bus 2 on a BBGW) is fine and I can detect the board and dump its contents to the screen etc, via terminal.
I have the all the necessary Adafruit / Python libraries / packages installed and seemingly working.

What I am totally stuck with (bearing in mind even the necessary phraseology is new to me) is how to access the board via Python - like setting Servo 0 to work / move... (No problem at all with PWM, via say, P9_22 but with the I2C and Adafruit libraries - I'm totally in the dark - or so it seems ! )
I've tried to follow many different examples but... I just don't 'get' it. Is there someone who's willing to drop me a few lines of example Python script - simply to configure the board and write something to a servo / make a servo move... I'll figure out the rest but I really do need a heads up / bunk up here please ? !

The BBGW is running headless (Mac ssh / terminal) with Debian-Jessie.
Maybe I've simply missed the obvious(?) tutorial for the BB / 16Ch Servo Driver but... I really could use some help, please ?

Many thanks.

3DRoboGuy
 
Posts: 2
Joined: Wed Sep 06, 2017 2:05 pm

Re: Problems with BBGW I2D 16 Channel Servo Driver

by drewfustini on Fri Sep 08, 2017 1:40 am

You should be able to use:

Adafruit Python PCA9685
Python code to use the PCA9685 PWM servo/LED controller with a Raspberry Pi or BeagleBone black.

drewfustini
 
Posts: 944
Joined: Sat Dec 26, 2015 1:19 pm

Re: Problems with BBGW I2D 16 Channel Servo Driver

by drewfustini on Fri Sep 08, 2017 1:46 am

The I2C2 bus uses pins P9.19 (I2C2_SCL) and P9.20 (I2C2_SDA).

This command will show what I2C devices are connected:
sudo i2cdetect -y -r 2

drewfustini
 
Posts: 944
Joined: Sat Dec 26, 2015 1:19 pm

Re: Problems with BBGW I2D 16 Channel Servo Driver

by drewfustini on Fri Sep 08, 2017 2:14 am

You'll need make this 2 line change to use busnum=2:

Code: Select all | TOGGLE FULL SIZE
debian@beaglebone:~/Adafruit_Python_PCA9685/examples$ git diff
diff --git a/examples/simpletest.py b/examples/simpletest.py
index 92b6b6d..18e2794 100644
--- a/examples/simpletest.py
+++ b/examples/simpletest.py
@@ -14,10 +14,10 @@ import Adafruit_PCA9685
 #logging.basicConfig(level=logging.DEBUG)
 
 # Initialise the PCA9685 using the default address (0x40).
-pwm = Adafruit_PCA9685.PCA9685()
+#pwm = Adafruit_PCA9685.PCA9685()
 
 # Alternatively specify a different address and/or bus:
-#pwm = Adafruit_PCA9685.PCA9685(address=0x41, busnum=2)
+pwm = Adafruit_PCA9685.PCA9685(address=0x41, busnum=2)
 
 # Configure min and max servo pulse lengths
 servo_min = 150  # Min pulse length out of 4096

drewfustini
 
Posts: 944
Joined: Sat Dec 26, 2015 1:19 pm

Re: Problems with BBGW I2D 16 Channel Servo Driver

by 3DRoboGuy on Wed Sep 27, 2017 6:55 am

Hey, hey, hey ! Superb !

Fantastic ! Thank you - it was a link to the library that I was missing. Thanks a million !
Downloaded and installed the library (Adafruit_PCA9685) and was up and running with multiple servos in less than 15 minutes. Again, thank you for both the 'heads up' to the library link and the example. Neat !

I have two questions, if I may ?
-1- When I "i2cdetect - r 2" (I'm using the 2nd I2C bus on my BBGW-BeagleBone Green Wireless) it reports I2C responses from *both* address 0x40 *and* 0x70. I tried both addresses with my test script (individually) and both seem (to me with a very cursory test) to produce the same results ? Why TWO addresses please ? How would I disable / inhibit one of them (0x70) should I want / need to ?
-2- More general; where would I find the Adafruit libraries on my BBGW please ?

Like I say, I'm new the BBs and Linux but I'm definitely 'getting there' !

Again, thanks a million. Much appreciated.
Trax

3DRoboGuy
 
Posts: 2
Joined: Wed Sep 06, 2017 2:05 pm

Re: Problems with BBGW I2D 16 Channel Servo Driver

by drewfustini on Fri Sep 29, 2017 9:54 pm

3DRoboGuy wrote:Hey, hey, hey ! Superb !
-1- When I "i2cdetect - r 2" (I'm using the 2nd I2C bus on my BBGW-BeagleBone Green Wireless) it reports I2C responses from *both* address 0x40 *and* 0x70. I tried both addresses with my test script (individually) and both seem (to me with a very cursory test) to produce the same results ? Why TWO addresses please ? How would I disable / inhibit one of them (0x70) should I want / need to ?


The PCA9685 does have a selectable i2c address between 0x40-0x7F (selectable with solder jumpers). That does sound a bit unusual for there two be two addresses on the bus. Please post the output of i2detect and a photo of the wiring if possible.

3DRoboGuy wrote:-2- More general; where would I find the Adafruit libraries on my BBGW please ?


Adafruit_BBIO is included on the official BeagleBoard.org image. However, I don't believe other Adafruit Python libraries are included for various sensors and displays. The best place to look is probably the Adafruit Learning System in the BeagleBone section.

drewfustini
 
Posts: 944
Joined: Sat Dec 26, 2015 1:19 pm

Please be positive and constructive with your questions and comments.