Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Adafruit PCA9685 issues

2016-02-13
2021-10-12
  • johnfarrugia - 2016-02-13

    I am playing with a pi2 and the PCA9685 16 channel pwm board from adafruit. i have a led across pwm and grd of the channels. i cant get them to increase or decrease intensity.
    i have no jumpers on the board for the address. i have the address in codesys for this board set to 0 and the freq set to 50. i've adjusted the array values of Adafruit_PWM.alrPWM[0] from 0 to 4096 without any changes. any ideas what im doing wrong? how do i know the board is even connected? the green light is on.

     
  • johnfarrugia - 2016-02-13

    ok i managed to figure out that the address needs to be set to 0 when the address isn't set on the pwm board. you also need to set the axEnable bit high that corresponds to the channel you are adjusting.

    i just cant seem how to get the led to go bright and dim out. i can only manage to adjust the brightness slightly. ive tried adjusting from 0 to 1 and 0 to 4096...any idea?

     
  • Anonymous - 2016-02-14

    Originally created by: gnom4

    I have used it with a rc servo and it worked OK on PI2 withe the standard library that is provided with the PI package for Codesys.
    You probably get library errors because the library that You downloaded was made for earlier version of Codesys.
    Try to open the library file with Codesys, update it when Codesys asks and then try again. But the update may be also impossible - I think that I saw somewhere that the library code handling raspberry peripherals was changed in some version...

     
  • johnfarrugia - 2016-02-15

    so i had issues with the original files to run the Adafruit 16 channel pwm boards. I then decided to use the files from moderator3s on this forum. after having library errors and screwing around with that for a few hours, i managed to get the first board dimming leds as required.
    i now added a second same board to the ic2 channel, added the A0 jumper, changed the address in the plc to 1 and now this one wont show it as running....arg!

     
  • johnfarrugia - 2016-02-15

    OK think I figured it out. Seems the Address for these boards start at 64 decimal. So with no jumpers the address is 64 dec, when I add a jumper to A0 on the board the address in codesys becomes 65 dec

     
  • Anonymous - 2016-02-15

    Originally created by: gnom4

    If You look at the library code You will see that it automatically sets address specified as 0 to the right one (when without jumpers), but it doesn't change it when the address is different than 0...

     
  • elconfa - 2018-04-04

    johnfarrugia hat geschrieben:
    so i had issues with the original files to run the Adafruit 16 channel pwm boards. I then decided to use the files from moderator3s on this forum. after having library errors and screwing around with that for a few hours, i managed to get the first board dimming leds as required.
    i now added a second same board to the ic2 channel, added the A0 jumper, changed the address in the plc to 1 and now this one wont show it as running....arg!

    Hy, I'm using the same board, but compiler says "failed to insert library..." how do you changed the library?
    Does it is possible for you to insert correct library here? thanks

    Massimo

     
  • elconfa - 2018-04-06

    I fixed all error in Library. I would like to use this chip as digital output, not pwm.
    I use PCA9685.axEnable with an 'array [0..15] of bool' to set PWM output channel. I don't understand how to set the pwm value for single exit pin or how to turn ON/OFF single exit bit.

    Can you help me?
    Thanks

     
  • Anonymous - 2018-04-23

    Originally created by: ŁukaszPowała

    Hi
    I use Raspberry Pi3 with newest Codesys V3.5 SP12 Patch 2. I updated all librarys.
    I try to make communication witch Adafruit PWM pcb, using Adafruit PWM library and servo connected to channel 0. I don't use any shortcircuit in address pads.
    I open I2C example, compile and send to RPi, and nothing- servo doesnt run. In next step, I open SoftMotion Servo Example, compile and send to RPi and servo is running. But I don't understand how this program refer to Adafruit PWM library.

    Could anybody can send, working example for RPi3, for servo connected to channel 0 (FBD will be best).

    Thanks for any response.
    Best regards.

    Łukasz

     
  • Anonymous - 2018-04-25

    Originally created by: ŁukaszPowała

    ŁukaszPowała hat geschrieben:
    Hi
    I use Raspberry Pi3 with newest Codesys V3.5 SP12 Patch 2. I updated all librarys.
    I try to make communication witch Adafruit PWM pcb, using Adafruit PWM library and servo connected to channel 0. I don't use any shortcircuit in address pads.
    I open I2C example, compile and send to RPi, and nothing- servo doesnt run. In next step, I open SoftMotion Servo Example, compile and send to RPi and servo is running. But I don't understand how this program refer to Adafruit PWM library.
    Could anybody can send, working example for RPi3, for servo connected to channel 0 (FBD will be best).
    Thanks for any response.
    Best regards.
    Łukasz

    Hi

    Is anybody could help me with using Adafruit PWM and Raspberry Pi 3 in Codesys?

    Łukasz

     
  • elconfa - 2018-05-31

    elconfa hat geschrieben:
    I fixed all error in Library. I would like to use this chip as digital output, not pwm.
    I use PCA9685.axEnable with an 'array [0..15] of bool' to set PWM output channel. I don't understand how to set the pwm value for single exit pin or how to turn ON/OFF single exit bit.
    Can you help me?
    Thanks

    Does anyone use this chip as a simple digital output?
    Thanks

     
  • elconfa - 2018-07-06

    Does anyone use this chip as a simple digital output?
    How to set the ouput high or low?
    Please
    Thanks

     
  • agrobot - 2019-04-25

    ŁukaszPowała hat geschrieben:
    Hi
    I use Raspberry Pi3 with newest Codesys V3.5 SP12 Patch 2. I updated all librarys.
    I try to make communication witch Adafruit PWM pcb, using Adafruit PWM library and servo connected to channel 0. I don't use any shortcircuit in address pads.
    I open I2C example, compile and send to RPi, and nothing- servo doesnt run. In next step, I open SoftMotion Servo Example, compile and send to RPi and servo is running. But I don't understand how this program refer to Adafruit PWM library.
    Could anybody can send, working example for RPi3, for servo connected to channel 0 (FBD will be best).
    Thanks for any response.
    Best regards.
    Łukasz

    Could you do it?

     
  • bpalacio - 2020-04-30

    Hello:

    I am using the adafruit pwm to control a DC motor but I cannot get it to work. Could someone give me a hand or share an example project in which the PWM output of said card is configured.

    Cheers

     
  • eschwellinger

    eschwellinger - 2020-05-01

    Hi,
    did you check:
    "c:\Users\<yourwindowsusername>\CODESYS Control for Raspberry PI\3.5.15.40\Examples\I2CExamples.project"
    "c:\Users\<yourwindowsusername>\CODESYS Control for Raspberry PI\3.5.15.40\Examples\SoftMotion Servo Example.project" </yourwindowsusername></yourwindowsusername>

    or here a lot of older snippets not only for the Adafruit PWM
    https://forge.codesys.com/forge/talk/Runtime/thread/04361f89ec/?limit=25#333d

    BR
    Edwin

     
    • bpalacio - 2020-05-01

      Hello: I have specified the projects but they do not provide enough information about the adafruit pwm library. I have already made it move in one direction but without a specific procedure. I would like to know what each of the parameters of the adafruit pwm library mean in addition to the connections.

       
  • eschwellinger

    eschwellinger - 2020-05-03

    hm.. what happens if you use "c:\Users\<windowsusername>\CODESYS Control for Raspberry PI\3.5.15.40\Examples\I2CExamples.project" </windowsusername>

    if wiring to the first port is done your motor should move if you set here
    .
    .
    Adafruit_PWM.alrPWM[0] := lrvalue;

    additional it should be possible to use the Softmotion part (sure only MC_MoveVelocity might work with this)

    BR
    Edwin

     

    Last edit: eschwellinger 2020-05-03
    • bpalacio - 2020-05-03

      Hello: In the configuration that you started, a servo motor appears and I want to move a dc motor. Would it serve me in the same way with that configuration that you send me? Do you have any scheme with rl wiring for a dc motor

       
    • bpalacio - 2020-05-03

      Hello: In the configuration that you started, a servo motor appears and I want to move a dc motor. Would it serve me in the same way with that configuration that you send me? Do you have any scheme with rl wiring for a dc motor

       
  • eschwellinger

    eschwellinger - 2020-05-04

    not really a scheme, but a picture, there was quadcopter for a fair which was controlled by Raspberry PI and the adafruit pwm card

     

    Last edit: eschwellinger 2020-05-04
  • davewkoenig - 2021-10-12

    I am trying to use the PCA9685 board with PWM output. I can only seem to change the voltage never full range of 0V for no PWM, and 5V for full PWM. I can only change Frequency [Hz] the higher the frequency the higher the voltage range, also other parameters do not effect it like _alrMin, _alrMax, _freq, _rPeriod

    100hz Frequency = Adafruit_PWM.alrPWM[0] :=0 is 0.468V and 1 is 0.972 output does not appear to actually PWM, higher frequency

    400hz Frequency = Adafruit_PWM.alrPWM[0] :=0 is 1.949V and 1 is 3.894 PWM does not go to zero, and closer to 100%

    A attached program archive.

     
  • davewkoenig - 2021-10-12

    Here is 100hz PWM signal

     
  • davewkoenig - 2021-10-12

    Here is 400Hz PWM

     

Log in to post a comment.