Arduino Forum

Using Arduino => General Electronics => Topic started by: hextejas on Nov 21, 2020, 10:57 pm

Title: Can you tell me what this means and
Post by: hextejas on Nov 21, 2020, 10:57 pm
if I need to do something ?
Board is a Feather ESP32

Quote
#20 / SDA - GPIO #20, also the I2C (Wire) data pin. There's no pull up on this pin by default so when using with I2C, you may need a 2.2K-10K pullup.
#21 / SCL - GPIO #21, also the I2C (Wire) clock pin. There's no pull up on this pin by default so when using with I2C, you may need a 2.2K-10K pullup.


What do I need to do and what happens if I don't do it



Title: Re: Can you tell me what this means and
Post by: PerryBebbington on Nov 21, 2020, 11:01 pm
Quote
if I need to do something ?
Board is a Feather ESP32

What do I need to do and what happens if I don't do it ?
It means that you didn't provide enough information for anyone to help you. Is it April 1?

You need to provide more information or you will get silly answers like this one.
Title: Re: Can you tell me what this means and
Post by: Paul__B on Nov 22, 2020, 03:53 am
Or even sillier!  :smiley-roll:
Title: Re: Can you tell me what this means and
Post by: hextejas on Nov 22, 2020, 08:36 am
It means that you didn't provide enough information for anyone to help you. Is it April 1?

You need to provide more information or you will get silly answers like this one.
For some reason the board would not let me put in the quote 
Title: Re: Can you tell me what this means and
Post by: hextejas on Nov 22, 2020, 01:52 pm
Having read about pull up and pull down resistors leads me to the question of:
1) What is the state of the pin if no resistor is attached ? And for my question assume it is a GPIO pin that is not being used by the sketch.
Is it undefined in that it could be anything ?
While I was trying to run the Servo example, and before I was successful, the scope on the SDA pin showed what looked to be either a flat line at 3.3V or a wildly fluctuating line.
I don't know how putting some value resistor on the SDA pin would have any effect but I guess I will have to try it to see.

thanks
Title: Re: Can you tell me what this means and
Post by: TheMemberFormerlyKnownAsAWOL on Nov 22, 2020, 01:57 pm
What is attached to the pin in question?
Title: Re: Can you tell me what this means and
Post by: PerryBebbington on Nov 22, 2020, 02:11 pm
Search for floating input, this is a common question for newbies, it shows up in various ways.

From the processor point of view there are 2 and only 2 possible states a pin can be in: 0 or 1. An unconnected input can only be one or the other, which one will be unknown until you read the pin.
Title: Re: Can you tell me what this means and
Post by: PerryBebbington on Nov 22, 2020, 02:16 pm
I2C is designed to allow 2 or more devices to communicate over the same wires. There has to be a way to allow any device to transmit data without the others interfering. Open collector or open drain means a device can drive SDA or SCL low but not high. No device on an I2C can output high, only low. If no device can output high something else has to do that instead, which is what the pull up resistors do.
Title: Re: Can you tell me what this means and
Post by: hextejas on Nov 22, 2020, 02:50 pm
What is attached to the pin in question?
Nothing other than the scope.
Title: Re: Can you tell me what this means and
Post by: hextejas on Nov 22, 2020, 02:57 pm
I2C is designed to allow 2 or more devices to communicate over the same wires. There has to be a way to allow any device to transmit data without the others interfering. Open collector or open drain means a device can drive SDA or SCL low but not high. No device on an I2C can output high, only low. If no device can output high something else has to do that instead, which is what the pull up resistors do.
Does this mean that any device attached to the SDA pin is talking to it even though the sketch may have no intention to try and control(signal ?) it ?
As an example, the Blink example sketch does not use the SDA pin but there might be an SDA device attached to it. Is there interaction between the pin and the processor ? ( I dont know who/what controls the SDA pin. Is there a separate chip on the Feather board that handles this ?)
I may be getting too deep into the weeds here.
Title: Re: Can you tell me what this means and
Post by: CrossRoads on Nov 22, 2020, 03:07 pm
If your sketch is not performing I2C transfers, there doesn't need to be anything connected.


If your sketch is performing I2C operations, you will have at least one other device connected. One will be the master for an transfer, one will be the slave. The master drives the clock for data going out and in.

If you are not using I2C, the pin is commanded like an other IO pin for reads and writes or PWM or whatever.

Like any other IO pin, the pin should not be left floating, as it can fluctuate. It should be pulled High or Low to a valid level to reduce energy use, especially important battery operation. With Atmega328P & similar, internal pullups can be used for that.  I don't know what ESP32 has. Fluctuating pins lead to internals switching, which leads to higher current draw.
Title: Re: Can you tell me what this means and
Post by: PerryBebbington on Nov 22, 2020, 03:22 pm
Does this mean that any device attached to the SDA pin is talking to it even though the sketch may have no intention to try and control(signal ?) it ?
As an example, the Blink example sketch does not use the SDA pin but there might be an SDA device attached to it. Is there interaction between the pin and the processor ? ( I don't know who/what controls the SDA pin. Is there a separate chip on the Feather board that handles this ?)
I2C is designed around the idea of 1 master and 1 or more slaves. If you look at any I2C slave device (an I2C OLED display for example) it will have an address. Usually it will have a choice of addresses that you can set with jumpers, for example I have some OLED displays that can have the address 0x78 or 0x7a, this is set by a solder bridge on the board. All I2C devices on the same bus must have different addresses. When the master wants to communicate with a slave it send the address first, this tells the slaves which one is to respond. The others then ignore the data on SDA. The master sends commands and data to the slave. If the master wants data from the slave it sends a command telling the slave to reply with the required data. SCL clocks the data on the bus in either direction.

I2C is normally taken care of by dedicated hardware in the microcontroller that is designed to do in hardware all the I2C functions. This means the processor can instruct the hardware to transfer some data then go and do something else while the hardware takes care of the data transfer.

It is also possible to implement I2C in software, you will see this referred to as 'bit banging', which is a crude way of saying the processor has to set and clear SCL and SCA using software for every single bit. Software I2C is very processor intensive and very slow. My first use of I2C was on a Z80, I wrote a soft I2C interface in Z80 assembly language and it took, so far as I can remember, about 1 second to read the temperatures from 4 I2C temperature sensors.
Title: Re: Can you tell me what this means and
Post by: hextejas on Nov 23, 2020, 02:55 pm
I get the concept of master and slave. It sounds a bit like ethernet. 
So, how do i tell the circuit (?), that the Arduino is the master?
And do I need to do something to each slave, (I have 2) to indicate that they are slaves ? Probably, at least assure that they have unique addresses.
Is this what the pull-up, pull-down resistor is supposed to do, indicate that a slave is present?
 Given the need for a resistor it seems that the explanation should be more clear as to its value.
Title: Re: Can you tell me what this means and
Post by: TheMemberFormerlyKnownAsAWOL on Nov 23, 2020, 03:02 pm
There is no pulldown resistor on I2C, just a pullup.

The pullup is there because the open-collector can only pull down, so something else has to return the line high.

The only thing that indicates that a slave is present is the slave's response to the master.
Title: Re: Can you tell me what this means and
Post by: PerryBebbington on Nov 23, 2020, 03:28 pm
Quote
I get the concept of master and slave. It sounds a bit like ethernet.
Hmmm, not really like ethernet.

Quote
So, how do i tell the circuit (?), that the Arduino is the master?
On the Arduino you use
Code: [Select]
Wire.begin();
in setup, that makes it the master.
Most of the devices you are likely to connect to I2C are slaves and have addresses. There is no option for them to be master (how could an OLED display be a master?).

Quote
Is this what the pull-up, pull-down resistor is supposed to do, indicate that a slave is present?
No, see my reply #11

Quote
Given the need for a resistor it seems that the explanation should be more clear as to its value.
2k2 or thereabouts will be fine.
Title: Re: Can you tell me what this means and
Post by: raschemmel on Nov 23, 2020, 04:57 pm
The short answer is it means that pin #20 is a GPIO that doubles as the SDA I2C pin (Bi-Directional Serial Data signal) and pin#21 is a GPIO that doubles as the I2C SCL (Serial Clock). The typical pullup value used is 4.7k or 10k but as shown the value is not fixed because it is based on how many devices are on the bus. For a small number of devices 4.7k is fine. For larger numbers of devices you need to look up the value on the pullup reference page of the I2C standards doc.  That's pretty much all it means.
Title: Re: Can you tell me what this means and
Post by: hextejas on Nov 23, 2020, 06:15 pm
I have been reading more and more about this and came across this drawing.
Could you tell me if this is an accurate representation of what you mean by a pull-up resistor ?
I was planning on using this in my project where VDD is +5V.
What happens if the device already has a pull-up resistor ?

(https://forum.arduino.cc/index.php?action=dlattach;topic=714823.0;attach=390679)
Title: Re: Can you tell me what this means and
Post by: hextejas on Nov 23, 2020, 06:20 pm
There is no pulldown resistor on I2C, just a pullup.

The pullup is there because the open-collector can only pull down, so something else has to return the line high.

The only thing that indicates that a slave is present is the slave's response to the master.
How can that work ? Does the master issue a general purpose request to see if anyone is listening ? I was wondering how the master can respond to the slave if the master doesn't know the slaves address. Perhaps the slave announces itself when it attaches ? Very curious.
Title: Re: Can you tell me what this means and
Post by: raschemmel on Nov 23, 2020, 06:20 pm
Quote
Could you tell me if this is an accurate representation of what you mean by a pull-up resistor ?
There is a clue: "RP"
Title: Re: Can you tell me what this means and
Post by: hextejas on Nov 23, 2020, 06:25 pm
There is a clue: "RP

I guess this is not it.
Quote
RP
It's a sexual roleplay game where you take on the role of a character and do whatever it takes to earn a sexual response. It is a sexual relationship designed to provide for a sexual relationship of similar character. It is not a family relationship.
Title: Re: Can you tell me what this means and
Post by: raschemmel on Nov 23, 2020, 06:28 pm
Quote
Does the master issue a general purpose request to see if anyone is listening ? I was wondering how the master can respond to the slave if the master doesn't know the slaves address. Perhaps the slave announces itself when it attaches ? Very curious.
I don't think anyone said that it could. The master only talks to known slaves. Your code needs to have the I2C
address. This sometimes comes up as an issue for I2C LCD displays where the user doesn't know the address.
In that case they run the I2C scanner and it "goes out " and finds all the slaves and reports their address.
You could call it a "Slave Finder" but what with everything going on right now that might not be politically correct.
It's best just to call it the I2C SCANNER (https://create.arduino.cc/projecthub/abdularbi17/how-to-scan-i2c-address-in-arduino-eaadda).

Quote
Rp
It's a
sexual roleplay game where you take on the role of a character and do whatever it takes to earn a sexual response. It is a sexual relationship designed to provide for a sexual relationship of similar character. It is not a family relationship.
I thought RP would obviously mean ResistorPULLUP, but that's just me.
And FYI, "RP" does NOT equal  "RP". (P is a SUBSCRIPT)

This reads verbally as "R sub P equals Resistor, pullup"
Title: Re: Can you tell me what this means and
Post by: hextejas on Nov 23, 2020, 06:29 pm
There is a clue: "RP"

My snide response aside, actually it does not. RP could be either Resistor Pull-Up or Resistor Pull-Down, although member AWOL says that there is no such thing as a Pull Down.
Title: Re: Can you tell me what this means and
Post by: TheMemberFormerlyKnownAsAWOL on Nov 23, 2020, 06:32 pm
No, I never said there is no such thing as a pull down, because that would be stupid.

I'm not stupid.
Title: Re: Can you tell me what this means and
Post by: raschemmel on Nov 23, 2020, 06:36 pm
Quote
No, I never said there is no such thing as a pull down, because that would be stupid.
Quote
RP could be either Resistor Pull-Up or Resistor Pull-Down, although member AWOL says that there is no such thing as a Pull Down.
Actually it could NOT be a pulldown because it is connected to VDD , which by definition is "UP".
Just for the record, GND is "DOWN". So if the resistor labeled RP had the lower end connected to GND, then it
would indeed be a "PULLDOWN" , but the image you posted  shows it connected to Vcc ,(which is UP, just FYI)
Title: Re: Can you tell me what this means and
Post by: hextejas on Nov 23, 2020, 06:40 pm
No, I never said there is no such thing as a pull down, because that would be stupid.

I'm not stupid.
I apologize for any offense AWOL, but that is how I read this.
Quote
There is no pulldown resistor on I2C, just a pullup.
Title: Re: Can you tell me what this means and
Post by: raschemmel on Nov 23, 2020, 06:46 pm
Quote
The pullup is there because the open-collector can only pull down,
What AWOL is saying here is that "Open-Collector" is a reference to the COLLECTOR of a TRANSISTOR, WHICH
because it is the COLLECTOR, and the transistor is an NPN, it CANNOT be connected to GND (which is DOWN),
so , by definition, an NPN transistor collector can only be pulled UP (like to Vcc).
In order for this to make sense to you , you would first need to know what a transistor is and how it works.
And secondly, you would need to know what "open-collector" means and what it's application is. You would also
need to be aware that in electronics, the convention with respect to schematic illustration, is that the POSITIVE
supply (Vcc/Vdd) is at the TOP of the page and the GND or negative supply is at the bottom of the page. Hence
the origin of the "up" in "pullup" or the "down" in "pulldown".

Do you ?
Title: Re: Can you tell me what this means and
Post by: hextejas on Nov 23, 2020, 06:52 pm
What AWOL is saying here is that "Open-Collector" is a reference to the COLLECTOR of a TRANSISTOR, WHICH
because it is the COLLECTOR, and the transistor is an NPN, it CANNOT be connected to GND (which is DOWN),
so , by definition, an NPN transistor collector can only be pulled UP (like to Vcc).
In order for this to make sense to you , you would first need to know what a transistor is and how it works.
And secondly, you would need to know what "open-collector" means and what it's application is.
Do you ?
No, I was hoping for clarity in the terms of the sketch, SDA, SCL, VCC, VDD, etc.
And thank you
Title: Re: Can you tell me what this means and
Post by: raschemmel on Nov 23, 2020, 07:03 pm
Quote
No, I was hoping for clarity in the terms of the sketch, , SDA, SCL, VCC, VDD, etc.
If by "No" you mean you do not know what a transistor is or how it works or schematic convention or what open-
collector means and why it is used, then clarifying the below is not going to explain a whole lot because knowing
everything I just mentioned is almost a requirement for understanding SDA,SCL,Vcc, and Vdd, . (Vcc and Vdd are
functionally the same thing except Vdd is used for CMOS and MOS circuits that use mosfets , whereas Vcc is used
when the circuit uses transistors. (that's a simplistic definition)


Clarification
SDA: Signal name for the Serial Data I2C signal
SCL: Signal name for the I2C Serial Clock signal
Vcc (NOT shown in schematic posted)
Quote
VCC stands for "voltage at the common collector.". The letter "V" on a circuit stands for the supply voltage. The letters "CC" indicate that the supply voltage is positive or negative.
What does Vee stand for? (https://jestineyong.com/what-is-vcc-vee-vbb-vdd-and-vss-stand-for/)
VDD : Drain Supply Voltage
etc:  et cetera et cetera ? (are there other terms you wanted clarified as well ?)

For single supply circuits Vee is replaced with GND. Vee was used with ECL (https://en.wikipedia.org/wiki/Emitter-coupled_logic) that had a -5V supply and has not
been used since ECL (https://en.wikipedia.org/wiki/Emitter-coupled_logic) was phased out. (it may still be in use somewhere but is largely obsolete.

Just for the record , I can barely remember the day I asked myself "What does Vcc mean ?" but unfortunately
there was no Google 40 years ago.
Title: Re: Can you tell me what this means and
Post by: aarg on Nov 24, 2020, 01:37 am
Vee is still in use for bipolar op amps negative supply.
Title: Re: Can you tell me what this means and
Post by: raschemmel on Nov 24, 2020, 01:44 am
I couldn't remember if op amps used -Vcc or -Vee.
Title: Re: Can you tell me what this means and
Post by: hextejas on Nov 24, 2020, 10:27 am
Thanks again to all who are trying to help me understand this.
And no offense meant Raschemmel, but I am hoping that I will not have to dig too deeply into why and how transistors work in order to get a sketch to work.
My background is that I have a lot of experience designing programs((sketches) and making them work and I didn't need nor want to know what was needed (a. Pull rexistor) on the wire that connects the devices that will need to talk to each other.
As Perry said, this is not ethernet but that was how I was coming at this. As if I were plugging a new slave device into a network and I might or might not need something called a resistor on the connection.
That bit is a whole new concept and I cannot imagine why my simple little temperature sensor would need a resistance between me and the master. And what the heck do I do when I need 3, SDA and SCL connections and there is only 1 tiny little hole in the Master? Does that mean that I will need to tie them together somehow? I understand the addressing bit so that's a start, and  the above schematic helps a bit.
When I have tried  something similar before,, it would had lead to smoke.
Electronics stuff is weird and that bit about VCC (collector) being at the top of the page is very interesting.  That explains why it is not V+
VCC must share a place with North. Isn't N(North) always at the top :=)  ?
Enough for now, I am going to go think about this in light of what y'all have tried to explain to me.
Yes, Google is my friend but you need to know what to ask.
Title: Re: Can you tell me what this means and
Post by: raschemmel on Nov 24, 2020, 01:44 pm
" Does that mean that I will need to tie them together somehow? I "
Yes. They are all tied together on the 'bus'. Google it.
That's the function of open collector. All devices share the SDA & SCL lines.
Vcc is V+ but your schematic is a MOS schemaic so it uses Vdd (Drain Supply) because mosfets don't have collectors. They have Drains. But maybe that's TMI.  No one can force you to learn anything until you are ready to learn it. As you recall, you asked us what it means. It's almost impossible to explain why pullups are needed for I2C without talking  about 'open-collector' and it's hard to discuss 'open-collector' without discussing transistors.  Some people like to be perfectly correct so they will insist it's 'open-drain' not 'open-collector' but most people just call it open-collector when talking about I2C. Each signal needs one resistor so if you have less than 10 'little things'  then you only need to put pull-UP  resistors on one of them.  Also, there probably won't be any 'holes' because 'through-hole' technology has been mostly replaced by surface mount so there will be pads for SMD resistors that will have numbers instead of colored stripes. That's progress...
Title: Re: Can you tell me what this means and
Post by: hextejas on Nov 24, 2020, 05:24 pm
Thanks again for your patience. My TMI starts when you start talking about drain vs collector. I am only interested in SDA and SCL as they are my interface to the sketch (program). The sketch is complicated enough.
Referring to the sketch that I posted, it shows VDD connected to the SDA and SCL buss. I am only aware of +5V and +3.3V as furnished by the Arduino, or the +5V as furnished by my external power supply. There are no VDD and VCC indicated on the board.
So, using a breadboard, i guess that I will wire the SDA from the ESP32, and the SDA from each device to the breadboard, and then wire the breadboard to a 4.7k resistor to the +5V. And keep a fire extinguisher handy.
We'll see what happens.
Title: Re: Can you tell me what this means and
Post by: TheMemberFormerlyKnownAsAWOL on Nov 24, 2020, 05:35 pm
What makes you think pulling a 3.3V-only capable pin to 5V is a good idea?

Don't have a fire-extinguisher on standby, just a credit card.
Title: Re: Can you tell me what this means and
Post by: raschemmel on Nov 24, 2020, 05:38 pm
Quote
There are no VDD and VCC indicated on the board.
As mentioned before, your boards are MOS so Vcc does not apply,
Also, "Vdd" and "Vcc" are generic terms that represent whatever power supply you are using.
The 'little things' have some specific power supply voltage that they operate at, and whatever that is, that is "Vdd".
It's really that simple.
I looked at your OP and I didn't see any link for the 'little things'.
Please post a vendor link so we can look at the supply voltage of the 'little things'.
Quote
What makes you think pulling a 3.3V-only capable pin to 5V is a good idea?

Don't have a fire-extinguisher on standby, just a credit card.
I was trying to get to that detail but I have to edge the information in little by little to avoid TMI.
Title: Re: Can you tell me what this means and
Post by: TheMemberFormerlyKnownAsAWOL on Nov 24, 2020, 05:55 pm
Sometimes it is better to have TMI than TLM
Title: Re: Can you tell me what this means and
Post by: raschemmel on Nov 24, 2020, 06:08 pm
TLM ?
Title: Re: Can you tell me what this means and
Post by: TheMemberFormerlyKnownAsAWOL on Nov 24, 2020, 06:20 pm
"Too Little Money"
Title: Re: Can you tell me what this means and
Post by: hextejas on Nov 24, 2020, 10:20 pm
What makes you think pulling a 3.3V-only capable pin to 5V is a good idea?

Don't have a fire-extinguisher on standby, just a credit card.
Hahah, that is probably why I have spent way too much $$$ on this "intermediate" grade project.
And I don't usually do just guess and plug.. What I do is look at the pin descriptions for the addon devices to see what they say as to voltage.
Mine are:
BNO055 VIN 3.3-5.0V (easy to understand)
PCA9685 VCC This is the logic power pin, connect this to the logic level you want to use for the PCA9685 output, should be 3 - 5V max! 
==============================================
So it sounded like I could use either 3.3 or 5
==============================================
However when I read the following it gave me pause cause I had no idea what I had to do if anything.
=================================================
It's also used for the 10K pullups on SCL/SDA so unless you have your own pullups, have it match the microcontroller's logic level too!
Does this mean that whatever voltage the Feather ESP32 or Feather Huzzah uses as a logic level, I should use the same ? Never mind that I have no idea what that means.
I know of only 1, voltage on my microcontroller. 5V from the USB or battery, though the board does furnish 3.3V output.
HAH ! I just did a google search of Feather ESP32 and Feather Huzzah, logic level and it came back as 3.3V.
So maybe I will need to do some rewiring.
I think writing programs is easier.
Title: Re: Can you tell me what this means and
Post by: raschemmel on Nov 24, 2020, 11:35 pm
No comment.
Title: Re: Can you tell me what this means and
Post by: hextejas on Nov 25, 2020, 04:55 am
Well, I am back to my original post.
I want to connect a PCA9685 to a Feather ESP32, SDA and SCL and here is what is said about those 2 devices.
ESP32:
Note that the I2C pins do not have pullup resistors already! You must add them if you want to communicate

PCA9685 
SCL - I2C clock pin, connect to your microcontrollers I2C clock line. Can use 3V or 5V logic, and has a weak pullup to VCC
SDA - I2C data pin, connect to your microcontrollers I2C data line. Can use 3V or 5V logic, and has a weak pullup to VCC

It sounds like the pullup resistors is there. Being weak is probably important but I sure don't know why or if it is important.

This is getting me nowhere as I can't seem to get a straight answer.

Let me see if I can re-phrase it.

Given the above 2 devices that I want to connect via SDA and SCL, do I need a resistor in series with the connection? If yes, what value?






Title: Re: Can you tell me what this means and
Post by: PerryBebbington on Nov 25, 2020, 09:48 am
The resistors don't go in series with anything, they go between Vcc and SDA and similarly to SCL. If it has weak pull up resistors it might work ok. If not try maybe 2k2 to 4k, exact value unimportant.
Title: Re: Can you tell me what this means and
Post by: hextejas on Nov 26, 2020, 02:28 pm
The resistors don't go in series with anything, they go between Vcc and SDA and similarly to SCL. If it has weak pull up resistors it might work ok. If not try maybe 2k2 to 4k, exact value unimportant.
Thank you Perry, your answers are clear and to the point. Though they lead me to ask this.
I have 1 SDA connector on the Feather and I need to connect it to both VCC and the SDA on the slave device.
Doesn't that describe a parallel circuit ?
Title: Re: Can you tell me what this means and
Post by: TheMemberFormerlyKnownAsAWOL on Nov 26, 2020, 02:31 pm
You don't ever connect SDA directly to Vcc; how would you pull it down if you did?
Title: Re: Can you tell me what this means and
Post by: aarg on Nov 26, 2020, 04:09 pm
From the Adafruit PCA9685 page,

Quote
R3 and later Arduino wiring (Uno, Mega & Leonardo):
(These boards have dedicated SDA & SCL pins on the header nearest the USB connector)

    +5v -> VCC (this is power for the BREAKOUT only, NOT the servo power!)
    GND -> GND
    SDA -> SDA
    SCL -> SCL
Try it and come back if you have any problem.
Title: Re: Can you tell me what this means and
Post by: PerryBebbington on Nov 26, 2020, 04:55 pm
Thank you Perry, your answers are clear and to the point. Though they lead me to ask this.
I have 1 SDA connector on the Feather and I need to connect it to both VCC and the SDA on the slave device.
Doesn't that describe a parallel circuit ?
I can't help wondering if something is being lost in the descriptions here. Please can you post a schematic, hand drawn is fine, showing your interpretation of what we are saying?

I don't understand why you thought I was saying connect SDA to Vcc, it would help if you explained what I said that made you think that.

Thanks,
Title: Re: Can you tell me what this means and
Post by: hextejas on Nov 26, 2020, 05:23 pm
From the Adafruit PCA9685 page,

Try it and come back if you have any problem.
Thank you aarg and that leads me to this :
I now have 2 (or more ) slave devices that need to connect to SDA. Do i do this via a breadboard?
And the ESP32 seems also seems toto need a pull up resistor to SDA.
From the page ESP32:
Note that the I2C pins do not have pullup resistors already! You must add them if you want to communicate
In my ignorance I would also wire the resistor from VCC to the breadboard. I am probably doing something wrong.
Title: Re: Can you tell me what this means and
Post by: hextejas on Nov 26, 2020, 05:48 pm
You don't ever connect SDA directly to Vcc; how would you pull it down if you did?
Part of my confusion i suppose is that I use VCC, VDD, and V+, 5V+, interchangeably. 
Referring to the sketch at post 17( I think), VDD (5V+), is connected to SDA.
For my projects, and on some of the boards, there is no VDD. There is VCC and V+ and VIN and 3.3V
Title: Re: Can you tell me what this means and
Post by: PerryBebbington on Nov 26, 2020, 05:53 pm
Referring to the sketch at post 17( I think), VDD (5V+), is connected to SDA.
Where on here is SDA connected to Vdd?
(https://forum.arduino.cc/index.php?action=dlattach;topic=714823.0;attach=390679)
Title: Re: Can you tell me what this means and
Post by: hextejas on Nov 26, 2020, 06:02 pm
Where on here is SDA connected to Vcc?
(https://forum.arduino.cc/index.php?action=dlattach;topic=714823.0;attach=390679)
Its not and I had gotten your explanation all wrong.  My apologies. 
My confusion stems from:
i suppose,  is that I use VCC, VDD, and V+, 5V+, interchangeably. 
Referring to the sketch ( I think), VDD (5V+), is connected to SDA.
Which led to my series/parallel statement.
For my projects, and on some of the boards, there is no VDD. There is VCC and V+ and VIN and 3.3V. So I connect things  wrongly.
Where the heck is VDD anyways? 
Title: Re: Can you tell me what this means and
Post by: PerryBebbington on Nov 26, 2020, 06:07 pm
Quote
Its not and I had gotten your explanation all wrong
Now you are contradicting yourself because right after you say it's not you go on to say
Quote
Referring to the sketch ( I think), VDD (5V+), is connected to SDA.
So again, where in that sketch is Vdd connected to SDA?

Without wishing to cause offence, you've been told multiple times how to do this but you keep asking the same question, I am beginning to think you are behaving like a troll.
Title: Re: Can you tell me what this means and
Post by: hextejas on Nov 26, 2020, 06:09 pm
I now know that VDD is drain voltage. Well maybe not. It might mean voltage at the drain. Ditto with VCC.
Mass confusion and this is really getting into TMI. I think.
Why do I need to know this in order to be able to connect multiple I2C devices and write a sketch for them ?
Title: Re: Can you tell me what this means and
Post by: hextejas on Nov 26, 2020, 06:14 pm
Now you are contradicting yourself because right after you say it's not you go on to saySo again, where in that sketch is Vdd connected to SDA?

Without wishing to cause offence, you've been told multiple times how to do this but you keep asking the same question, I am beginning to think you are behaving like a troll.
No perry, not a troll. The sketch shows VDD--->resistor------>SDA buss. So not directly connected,  there is a resistor in between. 
Title: Re: Can you tell me what this means and
Post by: hextejas on Nov 26, 2020, 06:50 pm
Now you are contradicting yourself because right after you say it's not you go on to saySo again, where in that sketch is Vdd connected to SDA?

Without wishing to cause offence, you've been told multiple times how to do this but you keep asking the same question, I am beginning to think you are behaving like a troll.
I resent being called a troll. You folks seem to come from an EE background and explain things in those terms, EG Collector and Drain.
Those are meaningless to me and I wish yours and others answered my questions in MY terms 
For example:

Quote
As mentioned before, your boards are MOS so Vcc does not apply,
Also, "Vdd" and "Vcc" are generic terms that represent whatever power supply you are using.
Hence my confusion re VCC, VDD, 5V+, and V+
And an Example of clarity in MY terms: Thank you Perry.

Quote

Quote

Quote
So, how do i tell the circuit (?), that the Arduino is the master?
On the Arduino you use
Code: [Select]

Code: [Select]
Wire.begin();
Title: Re: Can you tell me what this means and
Post by: hextejas on Nov 26, 2020, 06:58 pm
And here is another diagram that seems to contradict what y'all are saying. That VDD is not V+ ((((SOMETIMES)))



(https://forum.arduino.cc/index.php?action=dlattach;topic=714823.0;attach=391062)
Title: Re: Can you tell me what this means and
Post by: hextejas on Nov 26, 2020, 07:46 pm
And here is another diagram that seems to contradict what y'all are saying. That VDD is not V+ ((((SOMETIMES)))



(https://forum.arduino.cc/index.php?action=dlattach;topic=714823.0;attach=391062)
And what would this look like if I were to add a 2nd I2C device. <----Hooray, I figured out how to use a superscript.
Title: Re: Can you tell me what this means and
Post by: PerryBebbington on Nov 26, 2020, 08:27 pm
Quote
I resent being called a troll.
I didn't call you a troll, I said 'I am beginning to think you are behaving like a troll', which is a statement of fact about my state of mind having read many of the replies to this discussion.

The reason has nothing to do with my background or yours, it has to do with seeing the same question being answered multiple different ways and answered multiple different ways and you still keep asking. The final trigger was you not answering when I asked in reply #48 where SDA is connected to Vdd. I hoped you would finally see that it wasn't, but instead you went on to say both that it was and it wasn't, which in my experience is classical troll type dodging the question to keep the answers flowing.

I get that you think VCC, VDD, and V+, 5V+ are the same, I have not commented on it because for the purposes of this discussion it does not matter. You can learn the difference later, when you know more generally.
Title: Re: Can you tell me what this means and
Post by: hextejas on Nov 26, 2020, 09:22 pm
Where on here is SDA connected to Vdd?
(https://forum.arduino.cc/index.php?action=dlattach;topic=714823.0;attach=390679)
Perry, are you serious ? Unless you differentiate between:
SDA--->Rp--->VDD and
SDA------>VDD
Or is VDD different from Vdd ? I hope not.
Sure, they will do different things but they are connected. Another thing that bothers me is that in the sketch at post 49, the VDD has been changed to VCC. How the heck did that happen ?
I think that I will need to get answers and clarifications somewhere else as I seem to be acting "troll like". No surprise in that I disagree with you.
I will continue to drill down until I get answers that don't contradict each other from posters that seem to have a lot of experience.
The recent examples are:
From you
Quote
I get that you think VCC, VDD, and V+, 5V+ are the same, I have not commented on it because for the purposes of this discussion it does not matter.
and from AWOL apparently it does matter
Quote
You don't ever connect SDA directly to Vcc; how would you pull it down if you did?
and referring to my post #55, it never did get answered nor did my other posts that asked how to connect to SDA, V(something) and 2 different slave boards. I am assuming a breadboard but the choice and source of the V(something) is still a mystery.
thanks anyway and happy turkey day
Title: Re: Can you tell me what this means and
Post by: TheMemberFormerlyKnownAsAWOL on Nov 26, 2020, 09:45 pm
Ok, it seems you need very specific advice.
You don't ever connect SDA directly to VDD, VDD, VCC, Vcc, +5V, + 3V, +3.3V, +1.8V +ve  supply or Gnd,

How would you pull it down if you did?

To connect more than one device to SDA (and SCL of course) you make sure the devices don't have the same address, then you connect all the SDA (and SCL) lines together, and make sure that SDA is pulled up, and that SCL is also pulled up
And no, you can't use a single resistor to pull up both.
Title: Re: Can you tell me what this means and
Post by: hextejas on Nov 26, 2020, 10:04 pm
Ok, it seems you need very specific advice.
You don't ever connect SDA directly to VDD, VDD, VCC, Vcc, +5V, + 3V, +3.3V, +1.8V +ve  supply or Gnd,

How would you pull it down if you did?

To connect more than one device to SDA (and SCL of course) you make sure the devices don't have the same address, then you connect all the SDA (and SCL) lines together, and make sure that SDA is pulled up, and that SCL is also pulled up
And no, you can't use a single resistor to pull up both.
I understand the addressing bit, it is hardwired at each board by a jumper or a default(I think).


Quote
and make sure that SDA is pulled up, and that SCL is also pulled up 
I also understand to treat SDA and SCA pull ups differently though how do I wire this pull up ?
Title: Re: Can you tell me what this means and
Post by: hextejas on Nov 26, 2020, 10:06 pm
Does attaching a slave device to the SDA and SCL ports automatically pull them up ?
Title: Re: Can you tell me what this means and
Post by: raschemmel on Nov 26, 2020, 11:45 pm
"Does attaching a slave device to the SDA and SCL ports automatically pull them up ?"

Are I2C internal pullups automatcally enabled ?

LOOKAHEAD_CARRY QUOTE FROM Paul_B:

"Apparently, the "wire" library does so unless modified."
Title: Pulling up
Post by: Paul__B on Nov 27, 2020, 10:49 am
OK, why not, in for a penny, in for a pound!  :smiley-lol:

The vast majority of I2C devices have no pull-up - it is not part of the specification.  The pull-up is provided externally.

It happens however that a microprocessor - such as the ATmega - has both I2C hardware and as an independent feature of the processor, a pull-up function so you can enable the pull-ups in your code.  Apparently, the "wire" library does so unless modified.

However those pull-ups are quite weak, about 47k.  The recommended pull-ups for I2C are more in the range of 4.7k down to perhaps 1k.  You use a lesser value of resistor for longer connecting wires which have more capacitance.  So in general, you want to provide external pull-ups in your design.

Note that resistance value is the total value of any pullups connected anywhere on the same bus in parallel and resistors in parallel reduce the total value.  On a fairly long bus it is desirable to put a pullup at each end so that in parallel the resistance is about that 1 to 4.7k.

Now if you are using pre-made I2C modules such as the "backpack" for a LCD display or a "port expander", this often (if not always) includes pull-up resistors.  If that is the only thing to which you connect your Arduino, that is fine and convenient.  But if you connect - because they are all in parallel - a substantial number of such modules, then the parallel resistance of the pullups may drop very low.  The Arduino (ATmega328) will happily pull down a 330 Ohm load (less than 20 mA) but slave devices also are required to pull the lines down in order to exchange data and they generally have a lesser capability, so you need to keep the total pullup resistance above 1k by removing the pullups on all but a couple of the modules.

The final complication is mixing 5 V and 3.3 V devices (such as the 3.3. V ESPs).  5 V devices will generally operate at 3.3 V so you can connect your pullups to 3.3 V and not 5 V in this situation.  If that does not work, you need to use a particular bi-directional level converter.

Did I miss anything?  :smiley-cool:
Title: Re: Can you tell me what this means and
Post by: raschemmel on Nov 27, 2020, 11:04 am
"Did I miss anything?"

Yes, the OP is software guy and anything hardware
related is TMI.



Title: Still going
Post by: Paul__B on Nov 27, 2020, 01:16 pm
"Does attaching a slave device to the SDA and SCL ports automatically pull them up ?"

Are I2C internal pullups automatically enabled ?
Well, strictly separate questions.

Attaching a slave device pulls them up if - and only if - there are pullups on the slave device module.  It has nothing to do with the microcontroller.

The "wire" library chooses to enable the internal pullups which may however in themselves be insufficient,.
Title: Re: Can you tell me what this means and
Post by: hextejas on Nov 27, 2020, 04:36 pm
"Did I miss anything?"

Yes, the OP is software guy and anyhing hardware
related is TMI.

"Without wishing to cause offence, you've been told multiple times how to do this but you keep asking the same question, I am beginning to think you are behaving like a troll"


63 posts to ask about a pullup resistor ?
Really ?


And we're not out of the woods yet...

Raschlamiel, please stay out of my thread. Your snarkieness has gone too far IMO. And I have not been told multiple times how to do this. Or you have tried to tell me in terms that are foreign to me. Or you have answered questions and the answers made no sense. Enough for me.
Yes, 63 posts, because it is not a simple topic when 1st presented to a noob like me. Plus for some reason posters like yourself somehow refuse to answer my easy-to-answer posts:
For example, my post #59
Quote
Quote
Quote
and make sure that SDA is pulled up, and that SCL is also pulled up
I also understand to treat SDA and SCA pull ups differently though how do I wire this pull up ?
My question is "How do I wire this pull up ?
No need to draw a picture, something along the lines of " one end of a 4.7k resistor into the merged SDA leads and the other end into (VCC or +3.3V or 5V). And therein lies a rub. One of my slave boards is at 3.3V and the other is at 5V. Though the Feather Huzzah and ESP32 are at 3.3V. After much tired hammering at this, I have realized that I might need to go somewhere else to try and get help.
As shown by Paul__B, there is more to this than just hooking wires. There are a lot of "ifs" here.
Quote
Attaching a slave device pulls them up if - and only if - there are pullups on the slave device module.  It has nothing to do with the microcontroller.

The "wire" library chooses to enable the internal pullups which may however in themselves be insufficient,.
Title: Re: Can you tell me what this means and
Post by: TheMemberFormerlyKnownAsAWOL on Nov 27, 2020, 04:53 pm
Quote
One of my slave boards is at 3.3V and the other is at 5V. Though the Feather Huzzah and ESP32 are at 3.3V.
So, you need level-shifters.
Title: Re: Can you tell me what this means and
Post by: raschemmel on Nov 27, 2020, 05:11 pm
That wasn't my quote.
It was from Reply#50.
Title: Re: Can you tell me what this means and
Post by: jpollard on Nov 28, 2020, 12:11 am
No need to draw a picture, something along the lines of " one end of a 4.7k resistor into the merged SDA leads and the other end into (VCC or +3.3V or 5V). And therein lies a rub. One of my slave boards is at 3.3V and the other is at 5V. Though the Feather Huzzah and ESP32 are at 3.3V. After much tired hammering at this, I have realized that I might need to go somewhere else to try and get help.
As shown by Paul__B, there is more to this than just hooking wires. There are a lot of "ifs" here.
You don't want to pull the SDA/SCL lines up to 5V if you have 3.3V devices on the bus, because if their pins are not 5V tolerant you can damage your 3.3V board. As Paul mentioned it is safe to pull the bus up to 3.3V, but this logic level may not be high enough to reliably be interpreted as a high input at your 5V devices. You can try it without breaking anything, if it doesn't work you need to look at voltage level shifting. You can buy premade modules to do this without too much messing around, such as the below module

https://www.sparkfun.com/products/15439

So for your first test, one end of your 4.7k should connect to your SDA lines, the other end should connect to the 3.3V supply. Grab another 4.7k resistor and do the same thing with the SCL lines.