Jump to content

Hi, I'm going to preface this by saying that I'm absolute noob to servos, PWM controls, and Raspberry Pi in general. I'm currently using Adafruit's 16 channel PWM Servo/LED HAT soldered to my Rasp Pi to connect two servos. The servos move but I can't seem to understand the commands and functions of the library they included in the guide:

pwm.setPWM(channel, on, off)

 

I've gotten them to move and then stop by putting the following in:

pwm = PWM(0x40)

pwm.setPWMFreq(60)

pwm.setPWM(0,100,500)

 

The frequency I'm assuming is the speed at which the servo moves. I understand what channel is, obviously sending the PWM signals to whichever channel the servo is connected to. However I cannot quite grasp what the on/off commands mean. All I know is that when they are set equal to each other (e.g. pwm.setPWM(0,500,500) the motor does not move. The on and off signals in that function don't seem to do anything at all and I'm confused on how to change pulse widths. 

 

Essentially, I want the first servo (a continuous rotation servo) to move a certain number of degrees (from what I understand this correlates to the ms the servo is running for), then the second servo (normal micro-servo) to move a certain number of degrees then back to its starting position, then I want the first servo to return back to its original position as well, completely sequentially. 

 

I was hoping somebody would explain the basics behind these functions, maybe how to write programs in order to complete the above, or show me another directory on Github (or something else) where a different directory and set of commands will work. 

 

It's import to note that the HAT is a form of the Adafruit PCA9685 chip. 

 

Here are some links to the stuff I mentioned above: 

Servo HAT: https://www.adafruit.com/product/2327

Tutorial: https://learn.adafruit.com/adafruit-16-channel-pwm-servo-hat-for-raspberry-pi/library-reference

Continuous Rotation Servo: http://www.jameco.com/z/900-00008-Parallax-Continuous-Rotation-Servo_283039.html?CID=GOOG&gclid=CjwKEAiAn7HEBRDHwNqitoWqsQcSJAADWmI2dkPnipA2xvHFcIFgWEmdttSDgWUO_fXIvI3ryYRWNRoCcCDw_wcB

Micro Servo: https://www.amazon.com/TowerPro-SG90-Micro-Servo-2pk/dp/B01608II3Q/ref=pd_lpo_21_bs_t_2/163-6850172-8295626?_encoding=UTF8&psc=1&refRID=WNWCW831X3V0AXMKDCM9

 

20170128_204144.jpg

20170128_204138.jpg

Link to comment
https://linustechtips.com/topic/730131-servo-programming-with-raspberry-pi/
Share on other sites

Link to post
Share on other sites

Are you familiar with object oriented programming?

Quote or tag if you want me to answer! PM me if you are in a real hurry!

Why do Java developers wear glasses? Because they can't C#!

 

My Machines:

The Gaming Rig:

Spoiler

-Processor: i5 6600k @4.6GHz

-Graphics: GTX1060 6GB G1 Gaming

-RAM: 2x8GB HyperX DDR4 2133MHz

-Motherboard: Asus Z170-A

-Cooler: Corsair H100i

-PSU: EVGA 650W 80+bronze

-AOC 1080p ultrawide

My good old laptop:

Spoiler

Lenovo T430

-Processor: i7 3520M

-4GB DDR3 1600MHz

-Graphics: intel iGPU :(

-Not even 1080p

 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×