M5StickC connectivity

  • Hi there!
    I would like to connect several sensors to the M5StickC and I am wondering if that is even possible with the few IO pins available. I am using Arduino framework.

    1 x U153: 8-Encoder Unit (I2C)
    2 x U005: Angle Unit / Potentiometer
    1 x U145: Limit Switch (optional)

    So this is a mixture of I2C, digital and analog inputs. Is it possible to cleverly combine some of the HUB modules and probably a proto HAT to get all these peripherals to work at the same time with the M5StickC? Or should I better look for a different board with more GPIOs? Initially I was thinking about getting a Pi Pico but I have two spare StickCs lying around.

  • @rambinator, Looking at your list:
    1 x U153: 8-Encoder Unit (I2C) --> I'd go for bottom I2C port
    2 x U005: Angle Unit / Potentiometer --> I think you only actually need 1 GPIO pin, so you could use top (hat) set of pins from proto hat (either solder in header pins and use dupont2groove or strip and solder cables in).
    1 x U145: Limit Switch (optional) --> There is the hub option, however, the I2C base port is already in use. In theory, you could chain the hub to a hub and tree down, but staying with the proto hat, there is also a 3V3 output on the hat row output. Looking at the schemes for the limit switch you could potentially bring that 3V3 in on pin 2 after the voltage divider instead of 5V (a minor cable mod inside) then back via the same GND as the angle unit via proto hat. Again it only needs the one GPIO.

    I think you could do it with 2x dupont2grooves and 1x proto hat
    1 5V (Angle) (Alt leave Limit Switch as factory and take a 2nd 5V from proto)
    1 3v3 (Limit switch with internal cable mod)
    2 GND (Angle and Limit switch)
    1 G26 Angle Unit
    1 G36 Limit Switch

    Alt Alt option Pb.Hub to top hat pins then set as custom 26/36 and daisy chain limit switch and single angle unit on (no solder option). I'm a bit wary of the hubs, so maybe hedge and order the proto hat as well (they're cheap).

  • Thank you for your quick reply @gavin67890 !
    I am not sure if you overlooked that i need 2 of the potentiometers? So I guess I would use 26 and 36 for those and solder 2 grooves to the proto hat.
    To get that additional switch I assume that I need some I2C I/O expander and a PaHUB.

    Alternative: I just saw the PbHUB. Wouldn't that work for the angle units and also the switch (I don't know what is inside the switch but with an additional pull resistor and some analogRead threshold it could work?)

  • Hi @rambinator, Yeah, I missed the 2x, very sorry.

    Let's try again. I've got some kit, so I'm going to try and see where it takes us.
    Home > Store > Sensors > Hat(s) > ENV III – the picture gives G0 I2C-SDA, G26 I2C-SCL

    I have the ENV III unit, not hat, so I used a Groove2Dupoint and made the connections to I2C on the unit (plus 5V and GND). In UIFlow, I added the unit on custom pins 0 and 26 and made the simplest temp label 1 sec loop. Run and temp reading appeared, nice.

    Next I have the PaHUB (I2C-to-I2C), so I added the hub with custom G0 I2C-SDA, G26 I2C-SCL and ENV III to PaHUB|#0
    Run and "Pahub unit maybe not connect", not shocked – read my other posts.

    Switch PaHub from custom GPIO to Port A (bottom), Run and ta-da temp reading ok on screen via the hub. And that's my concern for you with the PbHUB option (my issue might just be because I2C devices/PaHub). Now, the hub is quite cheap, so you could try it, maybe use Port A and put the 8-encoder on the top (custom pins 0 and 26).

    There are 3 pins at the top (0, 26, 36), which I would have said should suffice for proto hat option. However, I don't think all the PIN ports at the top are the same. I'm speculating here – @felmue help please – but I think the following for I2C.
    G0 - Fine SDA/SCL
    G26 - Fine SDA/SCL
    G36 - Couldn't find the unit because it's ADC, but it might be fine for the limit switch, risk with the angle units.

    In conclusion, I'd go for the PbHUB try it through the hat connection G0, G26, and connect angle units (GPIO) and limit switch (GPIO) to it. Use the bottom Port A for the 8-encoder. If you get error messages about the hub, swap top to bottom (fingers crossed).

    PS You might want the proto hat as well. The Dupont to top of StickC next to each other are a little tight. Might also save you the buy of Groove2Duponts because you will get one cable with each device (cut one in two to give bare cable to Groove).