Thermal unit MLX90640 with Core2



  • Hello,

    I have obtained a Core2 with a thermal unit (MLX90640). The example code for the thermal unit does not work on the Core2. Also, in UiFlow there is no option to add the thermal unit with the "+" icon. However if I start UiFlow and select the classic Core, it is possible to add the thermal unit.

    Is the themal unit not compatible with the Core2?



  • Hello @Hexyl

    most modules, units and their associated examples have been developed before M5Core2 was available and therefore often do not just work out of the box. It is a pity that the M5Stack engineers do not (can not) spare more time to adapt / fix the existing examples from M5Stack to M5Core2.

    That said, the issue you are facing is that in M5Stack port A uses GPIO21 / GPIO22 (same as the internal I2C bus). In M5Core2 that has changed and only the internal I2C bus uses GPIO21 and GPIO22, however the external I2C bus on port A uses GPIO32 and GPIO33.

    In the Thermal unit example try replacing these lines:

      M5.begin();
      M5.Power.begin();
      Wire.begin();
    

    with

      M5.begin(true, false, true, true);
    

    the last true enables the external I2C bus on GPIO32 and GPIO33.

    Hope this helps.

    Re UIFlow: I have no idea as to if and when the thermal camera will be supported. That is another question for the M5Stack engineers.

    Thanks
    Felix



  • I just finished to adopt the example at https://github.com/m5stack/M5Stack/blob/master/examples/Unit/THERMAL_MLX90640/THERMAL_MLX90640.ino
    in Arduino IDE to Core2 and it works fine. If you are interested I can share the code.



  • @broder Hello !
    Yes, good stuff !! i'm interested by your Core2 version of the Thermal_LMX90640.ino !!
    Can you give me a link where I can download it please?

    Thx !



  • @broder Hi

    I got the Core2 without knowing that it might not work with the sensor. So, I'm quite in need of a copy of that port too!



  • Bump. No one?



  • @broder
    It would be great if you could share the code!



  • @broder Do you still have a pointer to that code? I was just looking at doing that, but if someone already did it, I would prefer to start from a working example]



  • Bump. Me too! I can't find an M5 copy of MLX90640_API.cpp and MLX90640_I2C_Driver.cpp. After commenting out calls to MLX90640_BadPixelsCorrection() I tried using Sparkfun's version, but the .ino file has calls to interpolate_image() and get_point() which the Sparkfun library does not have.

    I tried using Blockly but the data returned by the calls to unit.get(unit.THERMAL, unit.PORTA) objects return garbage data. Well, not quite garbage - it's data but it is not corrected and interleaved in a way I can figure out.

    Micropython might be a better bet but I don't know how to get the Unit libraries. I don't have a spare Arduino to test on either.