PCA9685 Why not work?
Moderator: Benj
-
- Valued Contributor
- Posts: 777
- Joined: Fri Jun 06, 2014 3:53 pm
- Has thanked: 185 times
- Been thanked: 204 times
Re: PCA9685 Why not work?
Hi
I haven't used one of these in a long time so I might be a little mistaken
The module is "stand alone" if I remember correctly. By that I mean that it handles everything itself, you just need to provide certain details and it will do the rest.
In the component properties you have it configured for ~50Hz so I assume you are connecting a Servo.
Your chart is a little confusing in that you are constantly setting the frequency, address and setting the same output by different means. You don't need to do that.
The Set Frequency command will overwrite clock to your new value of 1000Hz, so perhaps you are attempting to drive something else like an LED?
You then tried setting the same output by different methods, all whilst continually looping.
Possibly the easiest way to familiarise yourself would be to use the Set Pin command. Using it you just specify which pin (output 0-15), the Duty Cycle (0-4095) and whether it is Inverted or not.
Once this command has been sent then the module will set the chosen output to the value specified. You do not need to keep writing the same value.
I have edited your chart and attached.
In this I set Output 3 to a duty cycle of 1024 before entering a "Do Nothing" endless loop.
If you have a servo, and assuming it has 180-degrees of travel, then it should move to approximately 45-degress and stay there. If you change the duty cycle to 2048 then it should move to approximately 90-degrees.
If you are connecting to an LED then you will need to change the frequency from ~50Hz to much higher and now the duty cycle will control the brightness of the LED. The higher the duty cycle the brighter the LED.
If you have a scope then it can be used to verify what is happening on the output pin. If you are still having problems then I might be able to connect up a module over the weekend.
The above is from memory so I might have forgotten something
Regards
I haven't used one of these in a long time so I might be a little mistaken
The module is "stand alone" if I remember correctly. By that I mean that it handles everything itself, you just need to provide certain details and it will do the rest.
In the component properties you have it configured for ~50Hz so I assume you are connecting a Servo.
Your chart is a little confusing in that you are constantly setting the frequency, address and setting the same output by different means. You don't need to do that.
The Set Frequency command will overwrite clock to your new value of 1000Hz, so perhaps you are attempting to drive something else like an LED?
You then tried setting the same output by different methods, all whilst continually looping.
Possibly the easiest way to familiarise yourself would be to use the Set Pin command. Using it you just specify which pin (output 0-15), the Duty Cycle (0-4095) and whether it is Inverted or not.
Once this command has been sent then the module will set the chosen output to the value specified. You do not need to keep writing the same value.
I have edited your chart and attached.
In this I set Output 3 to a duty cycle of 1024 before entering a "Do Nothing" endless loop.
If you have a servo, and assuming it has 180-degrees of travel, then it should move to approximately 45-degress and stay there. If you change the duty cycle to 2048 then it should move to approximately 90-degrees.
If you are connecting to an LED then you will need to change the frequency from ~50Hz to much higher and now the duty cycle will control the brightness of the LED. The higher the duty cycle the brighter the LED.
If you have a scope then it can be used to verify what is happening on the output pin. If you are still having problems then I might be able to connect up a module over the weekend.
The above is from memory so I might have forgotten something
Regards