Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

INA219 Sensor wrong data display

Hello Community,

I'm using the current sensor INA219 with NRF5340dk.
Communication is through i²c protocol and using nrf SDK v1.7.0 .
I'm trying to get the data output (Voltage, Current, Power).
i worked on the sample linked on Zephyr Lib. the problem is that i'm always getting the same output which i liked below

the wiring of the sensor is like below :

Vin->VDD nrf
GND->GND
SCL->P0.26
SDA->P0.25

I'm always getting the current and power to Null values and both voltage values don't change no matter what !
do i need to change the calibration values or do i need to do something else ?
i don't get what's wrong with the data output so i need your help please
can you help me get the right values and get the data displayed out from the sensor correctly, please

Kindly,
Many thanks
 

  • Hi,

    I assume you are using zephyr/samples/drivers/current_sensing?

    Have you made any changes to the default setup of the I2C peripheral?

    If not, try changing main.c:89 from I2C_0 to I2C_1:

    	i2c_dev = device_get_binding("I2C_1");

    For I2C_1, the default SCL pin is P1.03 and the default SDA pin is P1.02

  • Hi,

    INA219 examle in Zephyr writes very strange (IMHO incorrect) value into configuration register. Try to replace it with default one:

    	/* Configurate the chip using default values */
    	data[0] = 0x39;
    	data[1] = 0x9f;

  • i already changed that before i putted the message on the forum 
    for now i changed the pins and changed my overlay file according to the new pin numbers 
    and i always took the comment of Dmitry in consideration and i changed the addresses and now it's being so strange 

  • I see that there is a new INA219 driver and sample code in NCS v1.8.0.

    Is it important to stay on v1.7.0, or can you upgrade to v1.8.0 and try the new implementation?

  • this project depends from another project which is done with V1.7.0 
    i don't know if it will be very safe if upgrade ! what do you think 
    meanwhile i will try the version of INA219 on V1.8.0 
    can you tell me if it will be safe if i upgrade my second project to the version V1.8.0 please ?

    Kindly 
    Many thanks

Related