cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 NUCLEO-F446RE + SmartElex ACS37800 (I2C) – Request for Reference / Sample Code

Gnanendra
Visitor

Hello ST Community,
@pavel_A
@erwan_C

I am working on a project using STM32 NUCLEO-F446RE and the SmartElex Power Meter (ACS37800) for voltage, current, and power measurement over I²C.

https://robu.in/product/1-month-warranty-1276/?gad_source=1&gad_campaignid=18585959909&gbraid=0AAAAADvLFWd-Gp59GIu3AsyVYZj3ppOY9&gclid=Cj0KCQiA7fbLBhDJARIsAOAqhsePuiSx2qOJKlmgFcZN2-_7bfwkDHpCOUyG6G9Q4REJXpOXr7KYUEIaAq3dEALw_wcB


Hardware details:

  • MCU: STM32F446RE (NUCLEO-F446RE)

  • Sensor: SmartElex ACS37800 (Allegro ACS37800 IC)

  • Interface: I²C1

    • SCL: PB6

    • SDA: PB7

  • VCC: 3.3 V

  • External pull-ups: 4.7 kΩ on SDA/SCL

  • I²C speed: 100 kHz

Software details:

  • STM32CubeIDE v1.19.0


    The sensor works correctly with ESP32 using the SparkFun Arduino library, but I am looking for a proper STM32 HAL-based reference or sample code specifically for:

    • Correct I²C initialization and addressing

    • 16-bit register access required by ACS37800

    • Reading instantaneous voltage, current, and power

    • Recommended power-up timing and initialization sequence

    I have seen Arduino and ESP32 examples, but I would prefer:

    • An official ST reference

    • Or a known-working STM32 HAL example for the ACS37800 (or similar Allegro power monitors)

    If anyone has:

    • Sample code

    • Application notes

    • GitHub references

    • Or experience interfacing ACS37800 with STM32 (F4 series)

    your guidance would be greatly appreciated.

    Thank you in advance for your support.

    Best regards,
    Gnanendra Sai

1 REPLY 1
Andrew Neil
Super User

Welcome to the community.

 


@Gnanendra wrote:

SmartElex Power Meter (ACS37800) for voltage, current, and power measurement over I²C.ai


That's not an ST product, so you can't expect ST to provide specific support for it.

The only bit that's specific to the STM32 is the microcontroller's I2C host code - ST do provide examples of that.

 

For specific details of the ACS37800, you will need to go to the manufacturer - Allegro Microsystems:

https://www.allegromicro.com/en/products/sense/current-sensor-ics/integrated-current-sensors/acs37800

 

As you already have the SparkFun Arduino library working, you could use that as the basis of your code ...

 

PS:

Note that there is an Arduino core for the STM32:

https://www.stm32duino.com/

https://docs.arduino.cc/libraries/stm32duino-examples/ 

https://github.com/stm32duino 

 

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.