RPI B+ 16CH PWM Servo Project Servos wont Run

Moderators: adafruit_support_bill, adafruit

Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Locked
User avatar
CaptainTrap
 
Posts: 8
Joined: Tue Mar 03, 2015 9:08 pm

RPI B+ 16CH PWM Servo Project Servos wont Run

Post by CaptainTrap »

Hello All,

I am running the latest version of Raspbian and followed this guide to the T https://learn.adafruit.com/adafruit-16- ... i?view=all and yet when i run Example_Servo.py my servos do not run. I have ensured that everything has been configured and cannot figure out what I am missing. Admittedly, this is my first Pi project next to setting up RetroPi on my RPI 2 which is running flawlessly save for some N64 glitches.

User avatar
CaptainTrap
 
Posts: 8
Joined: Tue Mar 03, 2015 9:08 pm

Re: RPI B+ 16CH PWM Servo Project Servos wont Run

Post by CaptainTrap »

could this be related to the device tree updates included in the latest rasbian release? I did go into setup and turn on SPI and 1c2 modules...

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

Re: RPI B+ 16CH PWM Servo Project Servos wont Run

Post by adafruit_support_mike »

Post a photo of your hardware and connections and we'll see what we can find.

User avatar
CaptainTrap
 
Posts: 8
Joined: Tue Mar 03, 2015 9:08 pm

Re: RPI B+ 16CH PWM Servo Project Servos wont Run

Post by CaptainTrap »

When i run Example_Servo.py it just hangs and returns no information until I hit ctrl+c to quit. Sorry for the size

Image

Image

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

Re: RPI B+ 16CH PWM Servo Project Servos wont Run

Post by adafruit_support_mike »

Your connections between the Cobbler and the breakout look good.

Flat cables are notoriously easy to connect backwards though, so let's check the basic connections. What do you get when you measure the voltage between the Cobbler's 5v pin and one of the GND pins?

If that gives you the expected 5v, try `i2cdetect -y 1` and `ic2detect -y 0` to see if the I2C bus is happy.

User avatar
CaptainTrap
 
Posts: 8
Joined: Tue Mar 03, 2015 9:08 pm

Re: RPI B+ 16CH PWM Servo Project Servos wont Run

Post by CaptainTrap »

thanks for the idea, unfortunately the ribbon cable only powers the PWM board when plugged in one direction. Furthermore, sudo i2cdetect -y 1 yields the correct i2c readout, the same as below. Image

User avatar
CaptainTrap
 
Posts: 8
Joined: Tue Mar 03, 2015 9:08 pm

Re: RPI B+ 16CH PWM Servo Project Servos wont Run

Post by CaptainTrap »

i am running raspbian v2.6, my modules are activated and NOT blacklisted, the blacklist file is blank. my i2c detect returns the correct output. i am not sure what is going wrong here. when i run sudo python Servo_Example.py the system just sits there until i hit ctrl+C and it outputs

^CTraceback (most recent call last):
File "Servo_Example.py", line 32, in <module>
time.sleep(1)
KeyboardInterrupt

User avatar
CaptainTrap
 
Posts: 8
Joined: Tue Mar 03, 2015 9:08 pm

Re: RPI B+ 16CH PWM Servo Project Servos wont Run

Post by CaptainTrap »

also, just to specifically answer your question - the voltmeter reads 3.29 on the 3.3v rail of the cobbler and 5v on the 5v rail of the cobbler.

User avatar
CaptainTrap
 
Posts: 8
Joined: Tue Mar 03, 2015 9:08 pm

Re: RPI B+ 16CH PWM Servo Project Servos wont Run

Post by CaptainTrap »

ok i figured that the Servo_Example.py was probably coded to activate a servo on Channel 0 of the PWM board so i hooked some pins up to channel 0 and ran the script again and low and behold the servo activated!

Now I just need to know what part of the code to change to activate servos connected to channels 13, 14 and 15?

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

Re: RPI B+ 16CH PWM Servo Project Servos wont Run

Post by adafruit_support_mike »

The function pwm.setPWM() takes the channel, a starting count value, and an end count value as parameters:

Code: Select all

  pwm.setPWM( 0, 0, servoMin )  // channel 0, go high at 0, go low at servoMin
  pwm.setPWM( 13, 0, servoMin )  // channel 13, go high at 0, go low at servoMin
  pwm.setPWM( 14, 0, servoMin )  //   etc
  pwm.setPWM( 15, 0, servoMin )  //   etc

User avatar
CaptainTrap
 
Posts: 8
Joined: Tue Mar 03, 2015 9:08 pm

Re: RPI B+ 16CH PWM Servo Project Servos wont Run

Post by CaptainTrap »

hello thank you for the support here. when i use this code i get syntax errors for your code.

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

Re: RPI B+ 16CH PWM Servo Project Servos wont Run

Post by adafruit_support_mike »

What errors do you get?

Locked
Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/

Return to “Adafruit Raspberry Pi® accessories”