PCA9685 Why not work?

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
nnnnff
Posts: 107
Joined: Tue Oct 04, 2011 8:55 am
Has thanked: 3 times
Been thanked: 6 times
Contact:

PCA9685 Why not work?

Post by nnnnff »

PCA9685 Why not work? What went wrong? Please help me!
PCA9685.fcfx
PCA9685 Why not work?
(9.51 KiB) Downloaded 113 times

chipfryer27
Valued Contributor
Valued Contributor
Posts: 617
Joined: Fri Jun 06, 2014 3:53 pm
Has thanked: 184 times
Been thanked: 195 times
Contact:

Re: PCA9685 Why not work?

Post by chipfryer27 »

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.

PCA9685_modified.fcfx
(8.86 KiB) Downloaded 106 times


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

nnnnff
Posts: 107
Joined: Tue Oct 04, 2011 8:55 am
Has thanked: 3 times
Been thanked: 6 times
Contact:

Re: PCA9685 Why not work?

Post by nnnnff »

Still won't do.Can you give me an example? For example, light up LED0, LED3, etc.thank you!

nnnnff
Posts: 107
Joined: Tue Oct 04, 2011 8:55 am
Has thanked: 3 times
Been thanked: 6 times
Contact:

Re: PCA9685 Why not work?

Post by nnnnff »

Ran the simulation according to your program, and it still doesn't work. Can you send up the LED flashing program you made? thank you
PCA9685 (1).fcfx
(8.67 KiB) Downloaded 107 times
simulation.jpg
simulation.jpg (130.17 KiB) Viewed 2494 times

Post Reply