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.
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/
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/
- CaptainTrap
- Posts: 8
- Joined: Tue Mar 03, 2015 9:08 pm
- CaptainTrap
- Posts: 8
- Joined: Tue Mar 03, 2015 9:08 pm
Re: RPI B+ 16CH PWM Servo Project Servos wont Run
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...
- adafruit_support_mike
- Posts: 67454
- Joined: Thu Feb 11, 2010 2:51 pm
Re: RPI B+ 16CH PWM Servo Project Servos wont Run
Post a photo of your hardware and connections and we'll see what we can find.
- CaptainTrap
- Posts: 8
- Joined: Tue Mar 03, 2015 9:08 pm
Re: RPI B+ 16CH PWM Servo Project Servos wont Run
When i run Example_Servo.py it just hangs and returns no information until I hit ctrl+c to quit. Sorry for the size
- adafruit_support_mike
- Posts: 67454
- Joined: Thu Feb 11, 2010 2:51 pm
Re: RPI B+ 16CH PWM Servo Project Servos wont Run
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.
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.
- CaptainTrap
- Posts: 8
- Joined: Tue Mar 03, 2015 9:08 pm
Re: RPI B+ 16CH PWM Servo Project Servos wont Run
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.
- CaptainTrap
- Posts: 8
- Joined: Tue Mar 03, 2015 9:08 pm
Re: RPI B+ 16CH PWM Servo Project Servos wont Run
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
^CTraceback (most recent call last):
File "Servo_Example.py", line 32, in <module>
time.sleep(1)
KeyboardInterrupt
- CaptainTrap
- Posts: 8
- Joined: Tue Mar 03, 2015 9:08 pm
Re: RPI B+ 16CH PWM Servo Project Servos wont Run
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.
- CaptainTrap
- Posts: 8
- Joined: Tue Mar 03, 2015 9:08 pm
Re: RPI B+ 16CH PWM Servo Project Servos wont Run
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?
Now I just need to know what part of the code to change to activate servos connected to channels 13, 14 and 15?
- adafruit_support_mike
- Posts: 67454
- Joined: Thu Feb 11, 2010 2:51 pm
Re: RPI B+ 16CH PWM Servo Project Servos wont Run
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
- CaptainTrap
- Posts: 8
- Joined: Tue Mar 03, 2015 9:08 pm
Re: RPI B+ 16CH PWM Servo Project Servos wont Run
hello thank you for the support here. when i use this code i get syntax errors for your code.
- adafruit_support_mike
- Posts: 67454
- Joined: Thu Feb 11, 2010 2:51 pm
Re: RPI B+ 16CH PWM Servo Project Servos wont Run
What errors do you get?
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/
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/