16 channel servo driver and raspberry-pi problems

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
BenRocks
 
Posts: 7
Joined: Wed Apr 22, 2015 5:20 pm

16 channel servo driver and raspberry-pi problems

Post by BenRocks »

Hi Forum,
I'm facing a problem with the 16 channel servo driver (https://www.adafruit.com/product/815) and my Raspberry Pi (B, 512Mb), I'd like to document everything so you may figure where the problem is and how to debug it. Let's start with the OS: Raspbian (2015-04), here's the system:

Code: Select all

root@pi:~# i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: 40 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: 70 -- -- -- -- -- -- --                         
root@pi:~# lsmod 
Module                  Size  Used by
i2c_dev                 6709  0 
snd_bcm2835            21342  0 
snd_pcm                93100  1 snd_bcm2835
snd_seq                61097  0 
snd_seq_device          7209  1 snd_seq
snd_timer              23007  2 snd_pcm,snd_seq
snd                    67211  5 snd_bcm2835,snd_timer,snd_pcm,snd_seq,snd_seq_device
i2c_bcm2708             6200  0 
uio_pdrv_genirq         3666  0 
uio                     9897  1 uio_pdrv_genirq
As you can see I'm detecting the board through the I2C bus and kernel modules seems to be loaded fine.

As described from learning section (https://learn.adafruit.com/adafruit-16- ... spberry-pi) I have downloaded the source code from github (https://github.com/adafruit/Adafruit-Ra ... ython-Code) and in Servo_Example.py I have modified

Code: Select all

pwm = PWM(0x40)
with

Code: Select all

pwm = PWM(0x40, debug=True)
as suggested in the python code in order to get some debug

I don't have a capacitor because I'm using just one PWM motor for testing purposes, it's connected on port 0 (as tutorial suggests) and is an Hossen SG90 9g Servo (http://www.amazon.com/gp/product/B00CCZ ... UTF8&psc=1).
On your board I can see the power led on and it seems to be communicating the the Pi.... but the motor never moves.
What am I missing ?

Thank you in advance for your reply

Ben


Here's the output of the python program

Code: Select all

root@pi:~/pwm/Adafruit-Raspberry-Pi-Python-Code/Adafruit_PWM_Servo_Driver# python Servo_Example.py 
Reseting PCA9685 MODE1 (without SLEEP) and MODE2
I2C: Wrote 0x00 to register 0xFA
I2C: Wrote 0x00 to register 0xFB
I2C: Wrote 0x00 to register 0xFC
I2C: Wrote 0x00 to register 0xFD
I2C: Wrote 0x04 to register 0x01
I2C: Wrote 0x01 to register 0x00
I2C: Device 0x40 returned 0x01 from reg 0x00
I2C: Wrote 0x01 to register 0x00
Setting PWM frequency to 60 Hz
Estimated pre-scale: 100
Final pre-scale: 101
I2C: Device 0x40 returned 0x01 from reg 0x00
I2C: Wrote 0x11 to register 0x00
I2C: Wrote 0x65 to register 0xFE
I2C: Wrote 0x01 to register 0x00
I2C: Wrote 0x81 to register 0x00
I2C: Wrote 0x00 to register 0x06
I2C: Wrote 0x00 to register 0x07
I2C: Wrote 0x96 to register 0x08
I2C: Wrote 0x00 to register 0x09
I2C: Wrote 0x00 to register 0x06
I2C: Wrote 0x00 to register 0x07
I2C: Wrote 0x58 to register 0x08
I2C: Wrote 0x02 to register 0x09
I2C: Wrote 0x00 to register 0x06
I2C: Wrote 0x00 to register 0x07
I2C: Wrote 0x96 to register 0x08
I2C: Wrote 0x00 to register 0x09
I2C: Wrote 0x00 to register 0x06
I2C: Wrote 0x00 to register 0x07
I2C: Wrote 0x58 to register 0x08
I2C: Wrote 0x02 to register 0x09
I2C: Wrote 0x00 to register 0x06
I2C: Wrote 0x00 to register 0x07
I2C: Wrote 0x96 to register 0x08
I2C: Wrote 0x00 to register 0x09
^CTraceback (most recent call last):
  File "Servo_Example.py", line 32, in <module>
    time.sleep(1)
KeyboardInterrupt

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: 16 channel servo driver and raspberry-pi problems

Post by adafruit_support_mike »

Post a photo of your hardware and connections and we'll make sure those are good.

User avatar
BenRocks
 
Posts: 7
Joined: Wed Apr 22, 2015 5:20 pm

Re: 16 channel servo driver and raspberry-pi problems

Post by BenRocks »

Here they are:
https://docs.google.com/file/d/0BxfbAii ... edit?pli=1 5V (1.5A) from outside PSU to the driver
https://docs.google.com/file/d/0BxfbAii ... edit?pli=1 2 connectors (3pin and 1pin) from the RPi to the Driver
https://docs.google.com/file/d/0BxfbAii ... edit?pli=1 16 channel servo driver with the servo on port 0
https://docs.google.com/file/d/0BxfbAii ... edit?pli=1 16 channel servo driver with the servo on port 0
https://docs.google.com/file/d/0BxfbAii ... edit?pli=1 the entire system
https://docs.google.com/file/d/0BxfbAii ... edit?pli=1 inside view of the Pi
https://docs.google.com/file/d/0BxfbAii ... edit?pli=1 and here's the servo (tried externally with a 293, it works)
I have double checked the two cables with a tester and there's nothing attached on the external PSU

Thanks
Ben

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: 16 channel servo driver and raspberry-pi problems

Post by adafruit_support_mike »

Everything looks correct..

Try connecting an LED between the PWM and GND pins for channel 0 and see if any signal is reaching the pin.

User avatar
evarg2unh
 
Posts: 2
Joined: Fri Apr 24, 2015 12:02 pm

Re: 16 channel servo driver and raspberry-pi problems

Post by evarg2unh »

Hello:

I am working on a project that involves communication between two Raspberry pi B+, and in prep for that I had ordered a second pi on March 31st (Order number 750079-1021406721 i believe). When I tried to connect this second pi this week I found that it will not connect to the network via the Ethernet port (same way I connected the first pi) and that both the red power light and the green activity light come on and stay on. With the other pi, the activity light blinks to show the disk activity, and I can access that one with no troubles at all. Since I am only using the USB for power and the Ethernet cord for network access, I do believe it is something wrong with the pi. Is it possible to get a replacement??

User avatar
evarg2unh
 
Posts: 2
Joined: Fri Apr 24, 2015 12:02 pm

Re: 16 channel servo driver and raspberry-pi problems

Post by evarg2unh »

I am also trying to post the pictures of the pi's connections but it is giving me a "the picture you are trying to upload is invalid" error and I am not sure why - is there another way to provide you with the images your tech support requests?

User avatar
BenRocks
 
Posts: 7
Joined: Wed Apr 22, 2015 5:20 pm

Re: 16 channel servo driver and raspberry-pi problems

Post by BenRocks »

I'm back again Mike,
I have removed the Servo on channel 0 and placed a 5mm Led between PWM and GND, I can see it blinking so I guess the board is fine, isn't it ?
I have several servos of the same type (SG90 9g TowerPro as I told you before) but even after switching them I have the same result. What should I do now ? I have seen the setPWMFreq and the pulseLength variable with a 60Hz default, may I touch them or is there something I can do to make some tests ?
Unfortunately I don't have an oscilloscope so I cannot help you on that or see pulse waves ...

User avatar
BenRocks
 
Posts: 7
Joined: Wed Apr 22, 2015 5:20 pm

Re: 16 channel servo driver and raspberry-pi problems

Post by BenRocks »

Another update for you.
I have also tested the same servo with a direct connection to the Pi. I have used tutorial, code and schematics from http://razzpisampler.oreilly.com/ch05.html (O'Reilly website). this circuit is quite simple and a little bit rough but it works.
I'm using the same Pi, same servo and same external PSU (5V 1.5A). I'm using two power supply units: first one is for the Pi and is directly connected to the microUSB cable, the second generates 1.5A at 5v and it's what I use on the bench with breadboard circuits.
The PWM generated is not that nice because it's not stable (the Pi doesn't perform well on it) and the servo is shaking a little bit; I'm aware of it but it's just a test, I obviously prefer to use your board or generate the PWM with something else (Atmega but even ST micros, Launchpad and something like that is good). I'm planning to add more servos to the board and solder a proper capacitor on it (currently unpopulated)
Any Ideas ?

Cheers
Ben

User avatar
Franklin97355
 
Posts: 23912
Joined: Mon Apr 21, 2008 2:33 pm

Re: 16 channel servo driver and raspberry-pi problems

Post by Franklin97355 »

evarg2unh please start your own thread and post pictures that are less than 1 meg in size (800x600) and either .jpg or .png. If you still can't you can post them on a sharing site like photobucket and then post the link here.

User avatar
BenRocks
 
Posts: 7
Joined: Wed Apr 22, 2015 5:20 pm

Re: 16 channel servo driver and raspberry-pi problems

Post by BenRocks »

Solved and working !
I have changed the PSU with a reliable one and to avoid troubles this is what I do to have the samples working.
Turn on the dc power supply for the 16channel board, turn on the dc power supply for the Raspi. After the login I can safely run the demo without troubles.
If I turn on the Raspberry before the adafruit board it doesn't work at all, even better and safer to use just one power supply, if you use two of them the order it's really important.

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

Return to “Microcontrollers”