d1 mini + SHT30 + OLED(SSD1306)
I try to setup follow Sketch
D1 Mini + Sensor SHT30 + OLED Display. The problem is that both devices expect to use same pins SCL SDA
How can I assign some other PINs for the the Display? For example SHT30 on default pins D1(SCL) , D2(SDA) and OLED on D5 and D6? I'm using Arduino IDE.
Hello @dobriloff ,
please try to get familiar with the concept of I²C bus.
You can connect both, SHT30 and the OLED Display to the same SCL and SDA signals. The protocol of the I²C bus uses addresses to access to either module.
The OLED typically use 0x3C or 0x3D, the SHT30 use 0x44 or 0x45. So no problem to have both shields on the same pins, just make sure that your sketch will take care for the different addresses.
To follow up on the comment by @Seventh-Dwarf , each i2c module is assigned an address by the maker.
The WeMos OLED Module, for example, will be at either address 0x3c or 0x3d depending on how the address pads on the rear of the board are soldered. If the middle and top pads are connected together then it's at 0x3c. If the middle and bottom pads are connected then it's a 0x3d.
The Wemos SHT30 sheild will be at i2c address 0x45 if the two address pads on the back of the board are not bridged by a blob of solder. If those two pads are bridged then the board will be at address 0x44.
You can confirm what address your device uses, by running an i2c scanner program to find devices on the i2c bus.
Generally, when your program creates an instance of the i2c object, you specify the address that you want to use.
Sometimes you'll have two identical devices connected to the same D1 Mini. For example, you might have two temperature sensors that will be monitoring different areas (e.g. inside temperature and outside temperature). Each of the sensors will need to be set to different addresses. In that case, you'd have to change the jumper or solder pad on one of them so they are a different addresses.
@Seventh Dwarf Thank you very much for the hint about I2C
@Roo-ster Thank for comprehensive explanation