🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    [Solved]Fire, PaHUB, & ADC (ADS1100)

    Units
    3
    4
    10.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • mickM
      mick
      last edited by mick

      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.
      0_1561799990671_M5MuxADC00.jpg

      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);
      }
      
      mickM 1 Reply Last reply Reply Quote 0
      • H
        heybin
        last edited by

        sorry for reply too later, i will go to test

        1 Reply Last reply Reply Quote 0
        • mickM
          mick @mick
          last edited by mick

          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.

          0_1561814829552_ADC00.jpg

          1 Reply Last reply Reply Quote 0
          • ajb2k3A
            ajb2k3
            last edited by ajb2k3

            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.

            UIFlow, so easy an adult can learn it!
            If I don't know it, be patient!
            I've ether not learned it or am too drunk to remember it!
            Author of the WIP UIFlow Handbook!
            M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

            1 Reply Last reply Reply Quote 0
            • R Richelieu referenced this topic on
            • First post
              Last post