My i2c components are not working (please help)
lubos , 01-02-2024, 09:08 AM
Hello everyone,I'm new to PCB design. Could somebody please check my schematic? Will it work?**Brief Backstory:** I built my first ESP32 board, which took me about 3 months. (I was just starting with electronics and also learning how to use PCB design software). After 3 months of work, I was pretty confident about my ESP32 board. When the 5pcs of PCB board arrived, I started soldering components. Yesterday I spent the whole day trying to program the RTC and Temperature sensor, but I could not even find the I2C addresses, and then I realized that maybe my I2C components weren't connected properly.**The problem:** My I2C components are not working.
Mini , 01-02-2024, 01:47 PM
Hey. DS3231 and BME680 both are very common so you can find schematics, libraries etc from whole internet. I personally haven't used them. I just checked DS3231 datasheet and i find connecting VCC to ground kinda weird. If you have no backup battery why not connect 3.3V to VCC instead of VBAT? I made a quick google search and it seems everyone has connected 3.3V to VCC. Although i saw from datasheet that you can connect VCC to GND if not used, seems kinda weird for me, don't know the details.
Mini , 01-02-2024, 01:50 PM
DS3231 I2C address is definitely written in datasheet also quick google says its 0x68. Always worth confirming from datasheet though. You can see from datasheet from the picture or from text it's 1101000 in binary which equals 0x68.
Mini , 01-02-2024, 02:12 PM
Your DS3231 connections other than VCC look fine. It even might work with your connection VCC to GND, not really sure.
Mini , 01-02-2024, 02:14 PM
If you have problems with communications like I2C, SPI, UART you need logic analyzer or oscilloscope to debug. Otherwise there's no way to know whats going on. You need to get ACK signal after sending correct I2C address first.
Mini , 01-02-2024, 02:15 PM
Just checking your BME680. There is so detailed datasheet. Everything is written. You can find I2C address from there easily.
Mini , 01-02-2024, 02:17 PM
I2C address depends on SDO pin connection. SInce you connected it to GND your I2C address is 1110110 (0x76).
lubos , 01-02-2024, 02:17 PM
Hi, @Mini thanks for your response. I power RTC through Vbat because I saw in the datasheet, that it has a much lower power consumption (Vcc around 130uA and Vbat around 3uA). I also found this post https://www.eevblog.com/forum/projects/surprising-power-reduction-mods-for-ds3231-rtc-in-zs-042-module/ which tells the same thing. I know the I2C address of these devices, but when I try to program them (with Arduino or ESP IDF), they do not respond. So I run the basic I2C scanner program ( https://learn.adafruit.com/scanning-i2c-addresses/arduino ) to check the I2C address of these devices and I get the output: No I2C devices found. I don't know where is the problem. I would really appreciate your help. Thanks
Mini , 01-02-2024, 02:22 PM
I have not much time at the moment to go deep. But i can tell if u look EEVBlog post schematics he has still connected VCC pin to 3.3V. I think maybe you have to power it up first and then switch to battery power? Not sure, but if i would be you i would first try to get it working with VCC normal way and then try different configuration to reduce power.
Mini , 01-02-2024, 02:23 PM
Also if you use I2C scanner and you get no response thats weird indeed. Maybe your code is the problem? To know that you need to check what's going on I2C data lines. And only way to know that is using logic analyzer or osilloscope.
Mini , 01-02-2024, 02:27 PM
Also if you have Arduino or anything you know better you can just solder wires and try to communicate with Arduino first since it should be simpler. There's so much libraries and support for it. Just a thought.
Mini , 01-02-2024, 02:28 PM
Your BME680 connections look fine.
lubos , 01-02-2024, 02:33 PM
Thanks a lot.
lubos , 01-02-2024, 02:35 PM
Can the problem be that I used IO14, FSPIWP ? ( I found in the datasheet that this pin (IO14) is used with SPI: page 568 https://www.espressif.com/sites/default/files/documentation/esp32-s2_technical_reference_manual_en.pdf )
Mini , 01-02-2024, 03:10 PM
I can't help you with that. I have no experience with ESP32 and have no clue how pin mapping is done. I can advise you on STM32 or PIC. But since you said you can't get any reponse with I2C scanner you indeed might have some mismatch between pins. Logic analyzer or oscilloscope would come handy to see if any signal is present. I can recommend to you to just try to connect it with Arduino and see if you get any response. If you have wrong pin connections you should still be able to communicate with Arduino. Although it would be best if ESP32 is not present on that board since it might intefere, but should not.
lubos , 01-02-2024, 03:17 PM
Thanks @Mini, I really appreciate your help. I don't have a logic analyzer or oscilloscope, but I will definitely try to connect it with Arduino.
lubos , 01-02-2024, 03:17 PM
Btw this is a project I'm currently working on: https://github.com/LubosNoska13/ESP32-Weather-station
Mini , 01-02-2024, 06:35 PM
Since you are doing someone else project this schematic is more likely to work. Of course you can't copy everyone's work and expect it to work, many people also do mistakes. But in my opinion you should of mentioned in the beginning that you are doing this project. I see you copied his schematic. So it is more likely your code or soldering quality. But i would still try Arduino first and of course find how pin mapping is done.
lubos , 01-02-2024, 07:22 PM
@Mini Sorry for the confusion, but this is my GitHub. I'm Lubos Noska
Mini , 01-02-2024, 07:25 PM
Oh sorry, i didn't even notice, my bad. In this case everything applies what i said earlier. Hopefully someone can confirm ESP32 pin mapping who is more familiar. If you have made any progress let us know. Cool project. Also boards look nice.
lubos , 01-02-2024, 07:26 PM
Thank you very much.
QDrives , 01-02-2024, 08:27 PM
Isn't table 40 of the ESP32 reference manual stating where to connect SDA and SCL?
Robert Feranec , 01-03-2024, 08:31 AM
be careful with I2C address. Basically, when you talk to something on I2C, first 7 bits are the address, the 8 bit is read or write. This means, sometimes there is a confusion if you should or should not shift the I2C address one bit to the left. Double check this, if that is not the problem here.
Robert Feranec , 01-03-2024, 08:33 AM
also, probe I2C signals, that helps a lot
Mini , 01-03-2024, 12:17 PM
Yes usually you need to shift one bit for the reason you just said, but if he is using libraries they usually take care of it.
Mini , 01-03-2024, 12:22 PM
He can't probe since he has no osilloscope or logic analyzer and that's the biggest problem. It would be easiest way to solve this. I always probe with logic analyzer and it has helped me so many times that i can't imagine doing it without logic analyzer. Btw i truly recommend for @lubos to at least buy really cheap logic analyzer from Ali or Ebay. They cost like under 10 euros.
Robert Feranec , 01-03-2024, 02:00 PM
I agree, debugging without probing signals can be extremely time consuming and frustrating. Any simple scope will be super useful
Use our interactive
Discord forum to reply or ask new questions.