Can you tell me what this means and

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

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.

Or even sillier! :roll_eyes:

PerryBebbington: 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

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

What is attached to the pin in question?

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.

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.

TheMemberFormerlyKnownAsAWOL: What is attached to the pin in question?

Nothing other than the scope.

PerryBebbington: 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.

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.

hextejas:
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.

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.

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.

I get the concept of master and slave. It sounds a bit like ethernet.

Hmmm, not really like ethernet.

So, how do i tell the circuit (?), that the Arduino is the master?

On the Arduino you use

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?).

Is this what the pull-up, pull-down resistor is supposed to do, indicate that a slave is present?

No, see my reply #11

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.

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.

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 ?

TheMemberFormerlyKnownAsAWOL:
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.

Could you tell me if this is an accurate representation of what you mean by a pull-up resistor ?

There is a clue: “RP

raschemmel:
There is a clue: "RP

I guess this is not it.

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.