background image

}

void

 

loop

(

void

) {

  TCA9548A(0);

  

float

 temperature = bme.

readTemperature

();

  

float

 pressure = bme.readPressure()/100;

  

float

 humidity = bme.readHumidity();

   

  TCA9548A(1);

  

u8g2

.

clearBuffer

();

  u8g2_prepare();

  

u8g2

.

setFont

(

u8g2_font_6x10_tf

);

  

u8g2

.

drawStr

(0, 0, 

"Temperature: "

);

  

u8g2

.

setCursor

(75, 0);

  

u8g2

.

print

(temperature);

  

u8g2

.

println

();

  

u8g2

.

drawStr

(0, 10, 

"Pressure: "

);

  

u8g2

.

setCursor

(75, 10);

  

u8g2

.

print

(pressure);

  

u8g2

.

println

();

  

u8g2

.

drawStr

(0, 20, 

"Humidity: "

);

  

u8g2

.

setCursor

(75, 20);

  

u8g2

.

print

(humidity);

  

u8g2

.

println

();

  

u8g2

.

sendBuffer

();

  

delay

(100);

}

- 17 -

Summary of Contents for TCA9548A

Page 1: ...Welcome Thank you for purchasing our AZ Delivery TCA9548A I2C Multiplexer Module On the following pages you will be introduced to how to use and set up this handy device Have fun...

Page 2: ...hematic is shown on the following image 8 How to set up Arduino IDE 9 How to set up the Raspberry Pi and Python 13 Connecting the modules with Atmega328p 14 Sketch examples 16 Connecting the modules w...

Page 3: ...be controlled by a single host on single I2C bus The TCA9548A chip has eight bidirectional translating switches that can be controlled through the I2C bus The module can connect several different dev...

Page 4: ...ressed parts By connecting the three address bits A0 A1 and A2 to VIN it can get different combination of the addresses This is how an address byte of the TCA9548A looks like First 7 bits combine to f...

Page 5: ...RON Switches Allows Voltage Level Translation Between 1 8 V 2 5 V 3 3 V and 5 V Buses No Glitch on Power Up Supports Hot Insertion Low Standby Current Operating Power Supply Voltage Range of 1 65 V t...

Page 6: ...ow it can be reconfigured to an address between 0x70 and 0x77 by matching the inputs to HIGH 5V or LOW GND INPUTS I2C BUS SLAVE ADDRESS A2 A1 A0 L L L 112 decimal 70 hexadecimal L L H 113 decimal 71 h...

Page 7: ...The pinout The module has 24 pins The pinout is shown on the following image 7...

Page 8: ...Connection schematic The connection schematic is shown on the following image The schematic represents example of multiple devices connected to different channels 8...

Page 9: ...led follow the link and download the installation file for the operating system of choice The Arduino IDE version used for this eBook is 1 8 13 For Windows users double click on the downloaded exe fil...

Page 10: ...acted directory and run the following command sh arduino linux setup sh user_name user_name is the name of a superuser in the Linux operating system A password for the superuser has to be entered when...

Page 11: ...check if your PC can detect an Atmega328p board Open freshly installed Arduino IDE and go to Tools Board your board name here your board name here should be the Arduino Genuino Uno as it can be seen...

Page 12: ...If the Arduino IDE is used on Windows port names are as follows For Linux users for example port name is dev ttyUSBx where x represents integer number between 0 and 9 12...

Page 13: ...The Headless mode enables remote connection to the Raspberry Pi without the need for a PC screen Monitor mouse or keyboard The only things that are used in this mode are the Raspberry Pi itself power...

Page 14: ...Connecting the modules with Atmega328p Connect the modules with the Atmega328p as shown on the following image 14...

Page 15: ...ck wire SDA SD0 Blue wire SCL SC0 Green wire TCA9548A pin Mc pin Wire color VIN 5V Red wire GND GND Black wire SDA A4 Blue wire SCL A5 Green wire OLED pin TCA9548A pin Wire color SDA SD1 CH1 Blue wire...

Page 16: ...U8G2_R0 U8X8_PIN_NONE void TCA9548A uint8_t bus Wire beginTransmission 0x70 Wire write 1 bus Wire endTransmission void u8g2_prepare u8g2 setFont u8g2_font_6x10_tf u8g2 setFontRefHeightExtendedText u8...

Page 17: ...A 1 u8g2 clearBuffer u8g2_prepare u8g2 setFont u8g2_font_6x10_tf u8g2 drawStr 0 0 Temperature u8g2 setCursor 75 0 u8g2 print temperature u8g2 println u8g2 drawStr 0 10 Pressure u8g2 setCursor 75 10 u8...

Page 18: ...Connecting the modules with Raspberry Pi Connect the modules with the Raspberry Pi as shown on the following image 18...

Page 19: ...lue wire A0 A1 A2 GND 14 Black wire BME280 1 PIN TCA9548A pin Raspberry Pi pin Wire color SCL SC0 Blue wire SDA SD0 Green wire VIN VIN 3 3V PIN1 Red wire GND GND GND PIN14 Black wire BME280 2 PIN TCA9...

Page 20: ...alled running the installation command only updates the library to a newer version To install the library open the terminal and run the following commands one by one sudo apt get update sudo apt get u...

Page 21: ...se the module with Raspberry Pi I2C interface has to be enabled Open following menu Application Menu Preferences Raspberry Pi Configuration In the new window under the tab Interfaces enable the I2C ra...

Page 22: ...he screen I2C address following command should be run in the terminal i2cdetect y 1 The result should look like the following image Where 0x70 is the I2C address of the multiplexer module Other I2C ad...

Page 23: ...self bus self bus smbus SMBus bus def channel self address channel if channel 0 action 0x01 elif channel 1 action 0x02 elif channel 2 action 0x04 elif channel 3 action 0x08 elif channel 4 action 0x10...

Page 24: ...re pressure bme280 get_pressure humidity bme280 get_humidity print Temperature bme280 get_temperature print Pressure bme280 get_pressure print Humidity bme280 get_humidity return temperature pressure...

Page 25: ...x py To run the script open the terminal in the directory where the script is saved and run the following command python3 tcamultiplex py The result should look like on the following image To stop the...

Page 26: ...net If you are looking for the high quality microelectronics and accessories AZ Delivery Vertriebs GmbH is the right company to get them from You will be provided with numerous application examples fu...

Reviews: