ACSSR and Atom Matrix in UIFlow over I2C



  • @m5stack @IAMLIUBO I'm trying to set the ACSSR up to work via MQTT via an ATOM Matrix in UIFlow over I2C (AtomS3 not yet supported???)
    I cant get the matrix to read the ACSSR, just returns an error because it cant find the ACSSR?



  • Hello @ajb2k3

    • UIFlow or Arduino?
    • Modbus or I2C?

    Thanks
    Felix



  • @felmue Bah ha ha, after say that to others I should have noticed!



  • Hello @ajb2k3

    I understand your issue is with controlling the ACSSR via I2C (and not so much the MQTT part), correct?

    Make sure the ACSSR is in I2C mode (LED blinks RED when powered). If the LED blinks in a different color you need to switch the ACSSR mode first. See Usage/Communication protocol here.

    Below UIFlow blocks work for me to toggle the ACSSR state and RGB LED when the M5Atom button is pressed. (I used UIFlow v1.12.8)

    0_1701771437582_UI_ACSSR_ButToggle_20231205.png

    Thanks
    Felix



  • Hello @ajb2k3

    and here are the blocks to control the ACSSR via MQTT by sending on or off to topic myACSSR.

    0_1701772097774_UIFlow_ACSSR_MQTT_20231205.png

    Thanks
    Felix



  • @felmue these are the ones we used before but we have dedicated blocks now but they are not working. I have reached out to M5Stack to look into it



  • Hello @ajb2k3

    as far as I can tell in UIFlow1 the blocks I used for ACSSR and MQTT are dedicated blocks. What am I missing?

    Care to elaborate? Which dedicated blocks do you mean?

    Just curious.

    Thanks
    Felix



  • @felmue sorry miss read the blocks. Il try again later thanks.



  • Hello @ajb2k3

    ok, thank you for explaining.

    Just thought about this: make sure your ACSSR still uses the default I2C address, e.g. 0x50. (just in case you've changed it in the past.)

    Thanks
    Felix



  • Hello @ajb2k3

    just for fun. Below the UIFlow2 alpha-28 blocks (non dedicated) to switch the ACSSR via MQTT using an M5AtomS3.

    Note: in Loop the Execute code block containing mqtt_client.check_msg() is required to get subscribed MQTT messages in a non blocking way. Please see this thread.

    0_1701782279283_UI2_ATOMS3_ACSSR_20231205.png

    Thanks
    Felix



  • @felmue oh cool thanks may have to try that with my M5Dial project



  • @felmue Can you record a video and upload to YouTube?
    I tried but still cant get it to connect as the red LED flashes for a few seconds then goes out.



  • Hello @ajb2k3

    sorry, I do not have the equipment for a video nor a YouTube account.

    The RGB LED is supposed to flash (I think about 6 times) then goes out. (Sorry if I wasn't clear about that.) BTW: The ACSSR does have a separate RED LED as well which will indicate its state.

    Please try my first UIFlow1 example (which does not include MQTT). This should help to figure out the I2C part.

    If the ACSSR still doesn't react I suggest you try to scan the I2C bus to make sure the ACSSR is seen and to figure out what I2C address the ACSSR currently is using. The default I2C address is 0x50, but maybe you've changed it in the past?

    Thanks
    Felix



  • Hello @ajb2k3

    you can use these blocks in UIFlow2 with M5AtomS3 to scan the I2C bus. If the ACSSR is recognized the result of the scan should be [80] which is decimal for 0x50.

    0_1701813788363_UI2_M5AtomS3_I2CExtScan_20231205.png

    Thanks
    Felix



  • Ok got it to scan and respond now



  • OK my brain is failed but how are you adding the 0x01 as I cant find a block to type it in?



  • Hello @ajb2k3

    yes, that is a tricky one - see post #10.

    You'll need to first create an empty bytearray variable with length 1 (I named it myByteArr), then set the first element to 0x01 (or 0x00), then you can use it with the i2c0 write buf... block.

    Thanks
    Felix



  • Hi, I have the Dial (in UIFLOW2) now talking to the home IOT server now thanks to your help, Just need to sort out some server side issues.
    I can get the ACSSR to work with the UIFLOW 1 blocks with the core and core2 but the atom just doesn't want to work.