Hi all, I am using arduino uno and PCF8575 I2C board expander to read and print the values of 4 Ultrasonic sensors and 4 IR sensors. Pin connection reference and code(Cannot give all lines of code, but hope u understand the assigning of inputs and outputs) given below. The examples I referred is all using Wire library, and its must for communication, and they are using push buttons and led's. In my case, I am using Sensors to read and print the input and output. After I connected all pins from the sensors to the board, it wont read any values from the sensors. Individually, All sensors works fine. But I am getting 0 when I connected all sensors to the I2C board. I don't know how to configure it.
I would be glad if someone help me on this.
PCF8575(I2C) | Description |
---|---|
GND | Connected in Common GND |
VDD | |
P00 | Not Connected |
P01 | Connected to IR1 |
P02 | Connected to Echo pin in US1 |
P03 | Connected to Trigger pin in US1 |
P04 | Not Connected |
P05 | Connected to Echo pin in US2 |
P06 | Connected to Trigger pin in US2 |
P07 | Connected to IR2 |
GND | Connected in Common GND |
VDD | |
P10 | Connected to IR3 |
P11 | Connected to Echo pin in US3 |
P12 | Connected to Trigger pin in US3 |
P13 | Not Connected |
P14 | Connected to Echo pin in US4 |
P15 | Connected to Trigger pin in US4 |
P16 | Connected to IR4 |
P17 | Not Connected |
INT | Not Connected |
SCL | A5 |
SDA | A4 |
VCC | Connected From Battery/Arduino(5V) |
GND | Connected in Common GND |
======================================
#include "PCF8575.h"
// Set i2c address
PCF8575 pcf8575(0x20);
void setup() {
Serial.begin(9600);
Serial.println("Started");
pcf8575.pinMode(P0,INPUT);
pcf8575.pinMode(P1,INPUT);
pcf8575.pinMode(P2,INPUT);
pcf8575.pinMode(P3,OUTPUT);
pcf8575.pinMode(P4,INPUT);
pcf8575.pinMode(P5,INPUT);
pcf8575.pinMode(P6,OUTPUT);
pcf8575.pinMode(P7,INPUT);
pcf8575.pinMode(P8,INPUT);
pcf8575.pinMode(P9,INPUT);
pcf8575.pinMode(P10,OUTPUT);
pcf8575.pinMode(P11,INPUT);
pcf8575.pinMode(P12,INPUT);
pcf8575.pinMode(P13,OUTPUT);
pcf8575.pinMode(P14,INPUT);
pcf8575.pinMode(P15,INPUT);
pcf8575.begin();
}`