Experience with PCA9685 16 channel 12 bit controller


+ Reply to Thread
Results 1 to 12 of 12
  1. #1
    Member basparky's Avatar
    Join Date
    Oct 2006
    Posts
    243
    Thumbs Up
    Received: 9
    Given: 28
    Total Downloaded
    751.89 MB

    0 Not allowed!

    Default Experience with PCA9685 16 channel 12 bit controller

    Hi all,

    I would like to use a PCA9685 controller to control posistion of a few RC servo's. The device is controlled by I2C.

    I have a dspic board (dsPic 33EP512MU810) connected but cannot get the device listening to my commands

    Has anyone experience with this IC?
    some info: http://wiki.sunfounder.cc/index.php?title=PCA9685_16_Channel_12_Bit_PWM_Serv o_Driver

    i
    was thinking of:
    Code:
    Address = 0x40
    MyWordCH0 = 2047 ; 50% DUTY CYCLE??
    
    
    I2COut PORTD.9, PORTD.10, Address, $6, [MyWordCH0.LowByte] 
    DelayMS 10
    I2COut PORTD.9, PORTD.10, Address, $7, [MyWordCH0.HighByte]
    DelayMS 10
    I2COut PORTD.9, PORTD.10, Address, $8, [MyWordCH0.LowByte] 
    DelayMS 10
    I2COut PORTD.9, PORTD.10, Address, $9, [MyWordCH0.HighByte]

  2. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  3. #2
    Henk57
    Guest Henk57's Avatar

    0 Not allowed!

    Default Re: Experience with PCA9685 16 channel 12 bit controller

    basparky, try this for each line;
    I2COut PORTD.9, PORTD.10, Address, $6, [MyWordCH0.LowByte]
    Into,
    I2COut PORTD.9, PORTD.10, Address, [$6, MyWordCH0.LowByte]

    Henk.

  4. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  5. #3
    Member basparky's Avatar
    Join Date
    Oct 2006
    Posts
    243
    Thumbs Up
    Received: 9
    Given: 28
    Total Downloaded
    751.89 MB

    0 Not allowed!

    Default Re: Experience with PCA9685 16 channel 12 bit controller

    Quote Originally Posted by Henk57 View Post
    basparky, try this for each line;
    I2COut PORTD.9, PORTD.10, Address, $6, [MyWordCH0.LowByte]
    Into,
    I2COut PORTD.9, PORTD.10, Address, [$6, MyWordCH0.LowByte]

    Henk.
    Thanks for your reply Henk57. No succes so far..

  6. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  7. #4
    Henk57
    Guest Henk57's Avatar

    0 Not allowed!

    Default Re: Experience with PCA9685 16 channel 12 bit controller

    I can't see the SCL and SDA line?
    Next, what do you see on your scope?

    Henk.

  8. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  9. #5
    Member Dompie's Avatar
    Join Date
    Apr 2012
    Posts
    159
    Thumbs Up
    Received: 19
    Given: 15
    Total Downloaded
    5.19 GB

    0 Not allowed!

    Default Re: Experience with PCA9685 16 channel 12 bit controller

    EDIT I have to read better!!!!

    Johan
    Last edited by Dompie; 23rd July 2018 at 10:42.

  10. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  11. #6
    Member basparky's Avatar
    Join Date
    Oct 2006
    Posts
    243
    Thumbs Up
    Received: 9
    Given: 28
    Total Downloaded
    751.89 MB

    0 Not allowed!

    Default Re: Experience with PCA9685 16 channel 12 bit controller

    Hi,

    I haven't got a scope to check the signals SDA and SCL
    Meanwhile still trying to get the device running.
    For a different project i controlled successful a SSD1306 display through I2C with the same board. I used:
    Code:
    Proc Write_Command(pData As Byte)
        BStart
        BusOut (Address)
        BusOut ($80)
        BusOut Address, [$80,pData]
        BStop
    EndProc
    To send the messages.

    I thought by using this same way for the PCA 9685 i would have the device listening....
    For the config i use:
    Code:
    BStartBusOut 0x40,[0x00,0x10]
    BStop
    BStart
    BusOut 0x40,[0xFE,121]
    BStop
    BStart
    BusOut 0x40,[0x00,0x80]
    BStop
    BStart
    BusOut 0x40,[0x01,0x04]
    BStop
    And to test the outputs i thought by sending the following i would switch led 0 to 7 on.
    Code:
    BStartBusOut 0x40 [$FB,$00010000]
    BStop
    But this is with no succes...
    Any suggestions?
    Thanks in advance

  12. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  13. #7
    Henk57
    Guest Henk57's Avatar

    0 Not allowed!

    Default Re: Experience with PCA9685 16 channel 12 bit controller

    When you start with I2C you must consider this everytime;

    Are all A0-A5 lines gnd or + 5volt, or combination.
    Are you aware of 0x40 Hex and have you included the R/W-bit, it is mostly forgotten (0x40 would be 0x80)
    Not all devices like BStop
    Some devices must be wake-up before they respond.
    Compiler issues (16F1829 is broken with .07 to .17 version, .03 is working).
    Design fault.

    I wonder if I forget something.
    Without a scope or logic analyzer (up $10,-) it is sometimes undoable to check.

    Henk.

  14. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  15. #8
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,374
    Thumbs Up
    Received: 87
    Given: 183
    Total Downloaded
    5.30 GB

    0 Not allowed!

    Default Re: Experience with PCA9685 16 channel 12 bit controller

    Without a scope or logic analyzer
    As Henk posted, without the ability to "see" whats going on your chances of success are limited.
    George.

  16. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  17. #9
    Member basparky's Avatar
    Join Date
    Oct 2006
    Posts
    243
    Thumbs Up
    Received: 9
    Given: 28
    Total Downloaded
    751.89 MB

    0 Not allowed!

    Default Re: Experience with PCA9685 16 channel 12 bit controller

    Hi,
    yes, A0-A5 lines are gnd. so address = 0x40 (0x80 incl start bit)
    I have a Zero plus logic analyser hooked up at the moment. struggling to get some readable data but i do have the following when using:
    Somehow i cannot get a address,data,data as i would expected. I do not know yet if this is code or Logic analyser related...


    Code:
    Control = 0x40
    Address = 0x21 ' Write to address 20
    MyByte = 0x22 ' The value place into address 20
    BStart
    BusOut Control;,Address, [MyByte]
    BusOut Address
    BusOut MyByte
    BStop
    Click image for larger version

Name:	I2C LA 1.jpg
Views:	17
Size:	91.3 KB
ID:	3528

  18. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  19. #10
    Henk57
    Guest Henk57's Avatar

    0 Not allowed!

    Default Re: Experience with PCA9685 16 channel 12 bit controller

    Quote Originally Posted by basparky View Post
    ....
    Somehow i cannot get a address,data,data as i would expected. I do not know yet if this is code or Logic analyser related...
    Again, base adress is always 0x80 even the LA graph shows 0x40!

    Henk.

  20. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  21. #11
    Member basparky's Avatar
    Join Date
    Oct 2006
    Posts
    243
    Thumbs Up
    Received: 9
    Given: 28
    Total Downloaded
    751.89 MB

    0 Not allowed!

    Default Re: Experience with PCA9685 16 channel 12 bit controller

    Quote Originally Posted by Henk57 View Post
    Again, base adress is always 0x80 even the LA graph shows 0x40!

    Henk.
    yes, sorry for the confusion... In The protocol analyzer you can add the read/write bit for slave address:
    Click image for larger version

Name:	I2C LA 2.jpg
Views:	7
Size:	80.7 KB
ID:	3529

    After some more testing i have a working solution:

    First init device for 50Hz freguency and auto increment feature.
    Code:
    Proc InitPCA9685(I2CAddress As Byte, PRE_SCALE As Byte)
        BStart
        BusOut I2CAddress
        BusOut MODE1
        BusOut 0x80
        BStop
    
    
        BStart
        BusOut I2CAddress
        BusOut MODE1
        BusOut 0x10
        BStop
    
    
        BStart
        BusOut I2CAddress
        BusOut PRE_SCALE
        BusOut 121
        BStop
    
    
        BStart
        BusOut I2CAddress
        BusOut MODE1
        BusOut 0xA0
        BStop
    EndProc
    Send Servo 0 to position.
    Code:
    Proc Servo0(Positie As Word)
    Dim Servo0On As Word
    Servo0On = 0
        BStart
        BusOut 0x80;I2CAddress
        BusOut LED0_ON_L
        BusOut Servo0On.LowByte
        BusOut Servo0On.HighByte
        BusOut Positie.LowByte
        BusOut Positie.HighByte
        BStop
    EndProc
    From here i have a working start to build on

    Thanks for the tips and yes i really needed the logic analyser to get this thing running!

    Thanks!

  22. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  23. #12
    Henk57
    Guest Henk57's Avatar

    0 Not allowed!

    Default Re: Experience with PCA9685 16 channel 12 bit controller

    Quote Originally Posted by basparky View Post
    yes, sorry for the confusion... In The protocol analyzer you can add the read/write bit for slave address:
    Read/Write bit is send by the Master and not 'set' externaly by the LA. but, only for display purposes.

    Proc InitPCA9685(I2CAddress As Byte, PRE_SCALE As Byte)
    BStart
    BusOut I2CAddress
    BusOut MODE1
    BusOut 0x80
    BStop
    First time I see 0x80, wow.

    Henk.

  24. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Someone experience with Delta robots?
    By basparky in forum The Lounge
    Replies: 1
    Last Post: 11th March 2018, 13:28
  2. MCP19215 4.5-42V PWM controller w/8-bit PIC
    By normnet in forum New devices and techniques
    Replies: 0
    Last Post: 16th June 2017, 07:17
  3. MCP19116/7 PWM controller with integrated 8 bit PIC for LED lighting apps
    By normnet in forum New devices and techniques
    Replies: 1
    Last Post: 23rd March 2016, 17:49
  4. LTC2348-18 low power 8-Channel 18-Bit Simultaneous Sampling ADC
    By normnet in forum New devices and techniques
    Replies: 0
    Last Post: 7th July 2015, 13:32
  5. [SOLVED !] Anyone have experience with BIM1's
    By poke_ in forum Proton Plus Compiler v3
    Replies: 4
    Last Post: 10th August 2005, 21:19

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts