Need help with I2C + PCA9685 + Voltage LLC to drive servo

Post Reply
amerkay
Posts: 13
Joined: Thu Sep 06, 2018 2:09 pm
languages_spoken: english
Location: XU4Q, Ubuntu 16.04 kernel 4.14.69-135
Contact:

Need help with I2C + PCA9685 + Voltage LLC to drive servo

Unread post by amerkay » Wed Sep 19, 2018 6:12 pm

Hi all,

I read the posts I could find about this (many point towards this discussion viewtopic.php?f=97&t=24955).

I know the I2C pins are 1.8V. So my setup is:
ODROID XU4Q
PCA9685 16 Channel PWM/Servo Driver I2C with 5V/4A externally supplied for powering the servo: http://a.co/d/5SwkPva
KNACRO 8-Channel 5V/3.3V IIC Bi-Directional Logic Level Converter: http://a.co/d/4NxMFgq

I can't get it to work. i2cdetect -y 1 is too slow, showing 03, 04, etc. Not working properly.

Connections look like:

Code: Select all

ORDOID               Level Shifter         PCA9685
PIN#29 1.8V -------- VCCA
PIN#30 GND --------- GND(A)
PIN#14 SCL --------- A0
PIN#16 SDA --------- A1       
PIN#1 5V ----------- VCCB   -------------- VCC
PIN#2 GND ---------- GND(B) -------------- GND
                     B0 ------------------ SCL
                     B1 ------------------ SDA

External 5V/4A power --------------------- V+/V- power
I also tried keeping just one GND connected as found in the example connections in this tutorial https://learn.sparkfun.com/tutorials/bi ... p-examples

What am I doing wrong? I'm a newbie at this, so any guidance would be great.

Thanks!

User avatar
tobetter
Posts: 2666
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Contact:

Re: Need help with I2C + PCA9685 + Voltage LLC to drive serv

Unread post by tobetter » Wed Sep 19, 2018 6:53 pm

Can you try out i2cdetect -y 4?

amerkay
Posts: 13
Joined: Thu Sep 06, 2018 2:09 pm
languages_spoken: english
Location: XU4Q, Ubuntu 16.04 kernel 4.14.69-135
Contact:

Re: Need help with I2C + PCA9685 + Voltage LLC to drive serv

Unread post by amerkay » Wed Sep 19, 2018 7:39 pm

Thanks for the quick reply.

I just tried, it outputs: "Error: Can't use SMBus Quick Write command on this bus"

I tried i2cdetect -y 0 up until 6, 2 works fine, but nothing is connected to it. 0 and 3 output "Error: Could not open file `/dev/i2c-0' or `/dev/i2c/0': No such file or directory". The rest, I get the SMBus error.

User avatar
tobetter
Posts: 2666
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Contact:

Re: Need help with I2C + PCA9685 + Voltage LLC to drive serv

Unread post by tobetter » Wed Sep 19, 2018 7:44 pm

Then can you probe at pin #14 and #16 if the signal is ok? What I am seeing is that the level shifter is for 3.3V/5.0V, when I did build the circuit with a FET, I had to tune a gate resistor.

amerkay
Posts: 13
Joined: Thu Sep 06, 2018 2:09 pm
languages_spoken: english
Location: XU4Q, Ubuntu 16.04 kernel 4.14.69-135
Contact:

Re: Need help with I2C + PCA9685 + Voltage LLC to drive serv

Unread post by amerkay » Wed Sep 19, 2018 8:10 pm

Hmm, on the specs page, it states "Conversion level range: 1.8V-6V".

Can you give me more details on how to test?

Also, sometimes i2cdetect -y 1 runs, and shows something like:

Code: Select all

$ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          03 -- -- -- -- -- -- 0a -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- 1a -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- 2a -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: 40 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- 55 56 -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- 64 -- -- 67 -- -- -- -- -- 6d -- -- 
70: 70 -- -- -- 
40 and 70 are the correct ones as they show up when I connect the PCA9685 to my RPi3. I tried connecting to it from python, no luck. Same method works on i2c-1 on RPi3.

joerg
Posts: 820
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2
Location: Germany
Contact:

Re: Need help with I2C + PCA9685 + Voltage LLC to drive serv

Unread post by joerg » Thu Sep 20, 2018 1:34 am

I see on your level shifter board, the pull up resistors are of 10k, right? I use a self brewed level shifter where are on the 5V side are 3k3 resistors. Maybe you can try with external 4k7 resistors parallel to the 10k on board resistors. Also on the XU 1.8V side, there could be smaller resistor values.

amerkay
Posts: 13
Joined: Thu Sep 06, 2018 2:09 pm
languages_spoken: english
Location: XU4Q, Ubuntu 16.04 kernel 4.14.69-135
Contact:

Re: Need help with I2C + PCA9685 + Voltage LLC to drive serv

Unread post by amerkay » Thu Sep 20, 2018 7:42 am

Thanks for the info @tobetter, joerg. I hate to ask you this, I still could not find clear instructions, and I really don't want to fry my boards. I have the resistors handy, just not sure between which pins to connect them. Can you instruct me how to update the connection chart above?

I found this post about I2C level shifting, https://oskar456.github.io/poepi/:
Image

Does that look correct with 4k7 resistors?

Thanks

P.S: I plan on compiling all the steps onto a 'how to connect an RC car (servo and drive) to your XU4 for learning self navigating with ROS' style guide. What are you working on? PM me

User avatar
tobetter
Posts: 2666
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Contact:

Re: Need help with I2C + PCA9685 + Voltage LLC to drive serv

Unread post by tobetter » Thu Sep 20, 2018 9:29 am

Here is the similar circuit I've used, the basic circuit is same like you found.
https://electronics.stackexchange.com/q ... -high-side

Since I couldn't get the same MOSFET in the circuit, I had to use another one I had and it lead me to tune the resistors on both sides. You can build the circuit and put a 1.8V to the source and check if other side gives you 3.3V, you can do the same the other way for 3.3V to 1.8V.

joerg
Posts: 820
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2
Location: Germany
Contact:

Re: Need help with I2C + PCA9685 + Voltage LLC to drive serv

Unread post by joerg » Thu Sep 20, 2018 12:55 pm

Yes, it's the same I use many years at my home automation build with a rpi. I am now about to transfer it to a C1 with Home Assistent installed. As @tobetter told, instead the 3.3V, connect the 1.8V of the XU. And I use even 3k3 resistors on the 5V side.

amerkay
Posts: 13
Joined: Thu Sep 06, 2018 2:09 pm
languages_spoken: english
Location: XU4Q, Ubuntu 16.04 kernel 4.14.69-135
Contact:

Re: Need help with I2C + PCA9685 + Voltage LLC to drive serv

Unread post by amerkay » Thu Sep 20, 2018 1:38 pm

Thanks for the advice.

How does that look? I'll test it out next:

Code: Select all

PIN connection chart:

ORDOID                     Level Shifter (BSS138 similar)     PCA9685
PIN#30 GND +-------------+ GND(A)
PIN#29 1.8V +------------+ VCCA
PIN#14 SCL +-------------+ A0
PIN#16 SDA +-------------+ A1       
PIN#2 GND +--------------+ GND(B) +-------------------------+ GND
PIN#1 5V +---------------+ VCCB +---------+--------+--------+ VCC
                                          |        |
                                         4k7 R    4k7 R
                                          |        |
                           B0 ------------+--------|--------+ SCL
                           B1 ---------------------+--------+ SDA

External 5V/4A power --------------------- V+/V- power
Update: Tested, still not working:

Code: Select all

$ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- 12 -- -- -- -- -- -- -- -- -- -- -- -- 1f 
20: -- -- -- -- -- 25 -- -- -- -- -- -- -- -- -- 2f 
30: -- -- 32 -- -- -- -- -- -- 39 -- -- -- -- 3e -- 
40: 40 -- -- 43 -- 45 -- -- -- -- -- -- -- 4d -- -- 
50: -- 51 -- -- 54 -- -- -- -- -- -- -- -- -- -- -- 
60: -- 61 -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- 71 72 ^C
:cry:

joerg
Posts: 820
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2
Location: Germany
Contact:

Re: Need help with I2C + PCA9685 + Voltage LLC to drive serv

Unread post by joerg » Fri Sep 21, 2018 12:51 am

Could you try this configuration with your Pi to check if the level shifter is working correct? If it is working, it must be something on the 1.8V side, hardware or software.

User avatar
tobetter
Posts: 2666
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Contact:

Re: Need help with I2C + PCA9685 + Voltage LLC to drive serv

Unread post by tobetter » Fri Sep 21, 2018 11:28 am

Are you able to probe the signal with an oscilloscope and post here?
Two reasons, in my opinion, 1) signal level does not reach to lower than a threshold or even fan out is not enough to drive and 2) SDA or SCL is twisted.

amerkay
Posts: 13
Joined: Thu Sep 06, 2018 2:09 pm
languages_spoken: english
Location: XU4Q, Ubuntu 16.04 kernel 4.14.69-135
Contact:

Re: Need help with I2C + PCA9685 + Voltage LLC to drive serv

Unread post by amerkay » Sat Sep 22, 2018 6:43 am

Ordered new parts. Will update soon. Thanks for the tips :)

amerkay
Posts: 13
Joined: Thu Sep 06, 2018 2:09 pm
languages_spoken: english
Location: XU4Q, Ubuntu 16.04 kernel 4.14.69-135
Contact:

Re: Need help with I2C + PCA9685 + Voltage LLC to drive serv

Unread post by amerkay » Sat Sep 22, 2018 11:13 am

Hmm, same circuit, with or without pull up resistors work fine on the Raspberry Pi (5V on controller side, 3.3V on Raspberry Pi side. Going back to XU4 to check if a different BSS138 module will work.

Any other suggestions for pull up resistor values on the 1.8V and 5V ends?

amerkay
Posts: 13
Joined: Thu Sep 06, 2018 2:09 pm
languages_spoken: english
Location: XU4Q, Ubuntu 16.04 kernel 4.14.69-135
Contact:

Re: Need help with I2C + PCA9685 + Voltage LLC to drive serv

Unread post by amerkay » Sat Sep 22, 2018 12:07 pm

With the new BSS138 Level Shifter http://a.co/d/72QiDl8, things are better. The 40 and 70 connections show, but keep disconnecting now. No other rubbish shows on i2cdetect results. But those 2 keep disappearing and reappearing. Noise? Clock-speed of the I2C bus?

Code: Select all

$ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: 70 -- -- -- -- -- -- -- 

amerkay
Posts: 13
Joined: Thu Sep 06, 2018 2:09 pm
languages_spoken: english
Location: XU4Q, Ubuntu 16.04 kernel 4.14.69-135
Contact:

Re: Need help with I2C + PCA9685 + Voltage LLC to drive serv

Unread post by amerkay » Wed Sep 26, 2018 9:18 pm

To close this topic, I got a Shifter Shield and I2C + servo worked immediately. Thanks for all the help.

User avatar
odroid
Site Admin
Posts: 29711
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Contact:

Re: Need help with I2C + PCA9685 + Voltage LLC to drive serv

Unread post by odroid » Thu Sep 27, 2018 10:29 am

Glad to hear you found a solution. :)

Post Reply

Return to “Hardware and peripherals”

Who is online

Users browsing this forum: No registered users and 1 guest