Adafruit 16 Channel Servo Driver with Raspberry Pi

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
razor1331
 
Posts: 8
Joined: Tue Feb 04, 2014 2:50 am

Adafruit 16 Channel Servo Driver with Raspberry Pi

Post by razor1331 »

Hi guys,
first of all I am new to RP please help me out here. (https://learn.adafruit.com/adafruit-16- ... spberry-pi)
I am using this i2c servo driver for my project. how can i get a digital signal using pwm (ON/OFF)? because i ve 2 dc motors and 5 servos to control. i want use 4 pwm channels(basically how to get a digital output from this channels ) to control 2 motors that attached to l 298d. please help me out here.
thanks

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit 16 Channel Servo Driver with Raspberry Pi

Post by adafruit_support_bill »

The "setPWM" function specifies an ON time and an OFF time. These are numbers between 0 and 4095 representing increments in PWM cycle.

To turn an output OFF, set both ON and OFF times to 0.
To turn it ON, set the ON time to 0 and the OFF time to 4095.

https://learn.adafruit.com/adafruit-16- ... -reference

razor1331
 
Posts: 8
Joined: Tue Feb 04, 2014 2:50 am

Re: Adafruit 16 Channel Servo Driver with Raspberry Pi

Post by razor1331 »

Thanks bill,
but i tried that already. it doesnt work. i even checked the voltage levels. they are 0V.but when i attached a servo its working just fine

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit 16 Channel Servo Driver with Raspberry Pi

Post by adafruit_support_bill »

Hmmm. Looking at the datasheet, to set the output HIGH, it should be ON = 4096 and OFF = 0.

razor1331
 
Posts: 8
Joined: Tue Feb 04, 2014 2:50 am

Re: Adafruit 16 Channel Servo Driver with Raspberry Pi

Post by razor1331 »

thanks anyway i ll try more.

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit 16 Channel Servo Driver with Raspberry Pi

Post by adafruit_support_bill »

it should be ON = 4096 and OFF = 0.
Look carefully. That is different from what I suggested in my earlier response. I just tested and this works on the Arduino version of the library.

razor1331
 
Posts: 8
Joined: Tue Feb 04, 2014 2:50 am

Re: Adafruit 16 Channel Servo Driver with Raspberry Pi

Post by razor1331 »

i did this modification to example..

pwm.setPWM(0,0,4096)
pwm.setPWM(1,0,0)
pwm.setPWM(2,0,4096)
pwm.setPWM(3,0,0)

i want the out put in the board to be channel 0 => 5v ,ch 1=> 0v and go on...is it possible with this board?

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit 16 Channel Servo Driver with Raspberry Pi

Post by adafruit_support_bill »

That is backwards. On (4096) comes before Off (0)
https://learn.adafruit.com/adafruit-16- ... -reference
setPWM(self, channel, on, off)
Description
This function sets the start (on) and end (off) of the high segment of the PWM pulse on a specific channel. You specify the 'tick' value between 0..4095 when the signal will turn on, and when it will turn of. Channel indicates which of the 16 PWM outputs should be updated with the new values.

Arguments
channel: The channel that should be updated with the new values (0..15)
on: The tick (between 0..4095) when the signal should transition from low to high
off:the tick (between 0..4095) when the signal should transition from high to low

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”