[Solved]Fire, PaHUB, & ADC (ADS1100)
-
Hi all, so just started playing with M5 - Nice!
Although early days, i've just ploughed into a possible noob problem! I'm needing to connect ADC (unit) via PaHub (unit) to M5 Fire (port A). All good except i'm getting way out comparison readings.. As follows
--> Using the ADC via PaHub to Fire (portA ) vs running ADC directly via Fire (portA) no PaHub.
So using ADC via PaHub reading ~ 2610 (Int), using ADC to Port A directly ~ 3120 (int), 1.2 VDC battery connected to ADC.
I'm aware that I2c pullUp resisters exist on HUB & ADC, in parallel (total ~ > 3 kOhm), which should be ok.
Any thoughts would be appreciated..
Cheers
/* hardware: M5Stack Fire, unit's --> M5 Mux (TCA9548A) + ADC (ADS1100) test00: connecting ADS board to TCA9548A then to M5 Stack Fire (port A) test01: TCA connected directly into Fires port A, not via TCA9548A connect: PORTA(21, 22) */ #include <Wire.h> // ADS1100 I2C address is 0x48 // TCA9548A I2C address is 0x70 #define ADC_Addr 0x48 #define MUX_Addr 0x70 //Hub range is 0 to 5 //Select port on mux 0-5 void muxPortSelect(uint8_t i) { if (i > 5) return; Wire.beginTransmission(MUX_Addr); Wire.write(1 << i); Wire.endTransmission(); } void setup() { int error = 0; // Initialise I2C communication as MASTER Wire.begin(); // Initialise Serial Communication, set baud rate = 115200 Serial.begin(115200); // Set Mux channel muxPortSelect(0); // <--- Comment out and plug ADC directly into port A // Set ADC Wire.beginTransmission(ADC_Addr); // Continuous conversion mode, 8 SPS, 1PGA //Wire.write(0x0C); // Stop I2C Transmission error = Wire.endTransmission(); if (error == 0) { Serial.println("OK we have ok"); } else { Serial.println("No Good -- Bummer"); } delay(100); } void loop() { unsigned int data[2]; // Request 2 bytes of data Wire.requestFrom(ADC_Addr, 2); // Read 2 bytes of data // raw_adc msb, raw_adc lsb if (Wire.available() == 2) { data[0] = Wire.read(); data[1] = Wire.read(); } // Convert the data float raw_adc = (data[0] * 256.0) + data[1]; if (raw_adc > 32767) { raw_adc -= 65536; } // Output data to serial monitor Serial.print("Digital Value of Analog Input : "); Serial.println(raw_adc); delay(300); }
-
sorry for reply too later, i will go to test
-
Solved...
Remove 4.7K Ohm pull up's from i2c lines!, un-soldered from ADC (Mux resistors were too small/difficult to get to) would have liked to remove resistors from Mux as possible issue will also effect other connected units.
-
Nice find.
Just reached my knowledge of i2c and yeh found that the pullups have bee put on the hubs i2c lines as well as the line to the M5Stack port a.
nice but of bug fixing.
Just don't forget to put them back if you want to connect the ADC directly to the M5stack in future. -