INA219 conversion time


Closed Thread
Results 1 to 10 of 10
  1. #1
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326

    Default INA219 conversion time

    good day to everybody on this forum,
    I am using INA219 sensor with PICbasic and it is working well as far as the data accuracy is concerned.
    I do have a point to discuss regarding the configuration register. I did set the register in this way:

    CNFG_REG=%0011011111111111
    I2CWRITE SDA,SCL,ADDR_P,$00,[CNFG_REG]

    In accordance to the data sheet it will deal to 32 VDC, 128 samples at 68 mSec, continuous conversion.
    I do read the sensor in this way:

    HIGH SPARE_PIN ' Start the scope trace
    X:
    I2CREAD SDA,SCL,ADDR,$02,[PB2],no_ack ' GET BUS VOLTAGE

    if pb2.1=0 then ' TEST CONVERSION READY BIT
    GOTO X
    ENDIF

    IF PB2.0=1 THEN OVF=1
    IF PB2.0=0 THEN OVF=0

    'I2CREAD SDA,SCL,ADDR,$00,[PB0],no_ack 'GET CONFIG
    I2CREAD SDA,SCL,ADDR,$01,[PB1],no_ack 'GET SHUNT VOLTAGE
    pauseus 10
    I2CREAD SDA,SCL,ADDR,$03,[PB3],no_ack 'GET POWER
    pauseus 10
    I2CREAD SDA,SCL,ADDR,$04,[PB4],no_ack 'GET CURRENT
    pauseus 10
    'I2CREAD SDA,SCL,ADDR,$05,[PB5],no_ack 'GET CALIBRATION
    LOW SPARE_PIN ' STOP the scope trace

    Unfortunately my scope indicates about 28 msec that is shorter than the 68 msec declared on the data sheet.
    I also have conversion time that are not reasonable if I do set 64, or 32 or 16 samples average on the config register.
    I need to know the conversion time exactly in my application.
    What am I doing wrong on my code please ? Or am I make mistakes reading the data sheet ?
    Thanks for any help on the matter.
    Regards,
    Bye

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,379


    Did you find this post helpful? Yes | No

    Default Re: INA219 conversion time

    you have set the device to continuous conversion mode , the conversion process did not begin when you set "SPARE_PIN and read the bus voltage"
    you don't know when it started. i don't believe you are measuring conversion time. the
    CONVERSION READY BIT was cleared by reading the power reg
    it does not trigger a new conversion that i can see.

    secondly your snippet gives no indication of read frequency or how or why it would be synced to conversions ..

    thirdly the registers can be read at any time after the first
    conversion in continuous conversion mode i have never found it to be an issue
    what are you trying to do ?

    Warning I'm not a teacher

  3. #3
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326


    Did you find this post helpful? Yes | No

    Default Re: INA219 conversion time

    Thanks a lot Richard for the reply.
    I will try to indicate what I am trying to implement .... using my limited English language.
    My program applies a correction to a dc power supply by changing the duty cycle of pic pwm output. After that a change command is sent to power supply, I have to read the results from the power supply new output by reading the INA219 data: I must be sure that the reading is refered to the end of conversion to avoid any overcontrol. I also need to average ( about 128 samples ) to get a stable data reading.
    I am not able to understand how implement this operation by studing the INA219 data sheet... it could be that I do not understand it well.
    Thanks in advance for any help on this matter.
    Regards,
    Ambro

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,379


    Did you find this post helpful? Yes | No

    Default Re: INA219 conversion time

    My program applies a correction to a dc power supply by changing the duty cycle of pic pwm output.

    detail is scant, lets start with
    how often are these corrections applied and feedback samples taken ?
    why are you thinking the free running, continuously available 128 sample averaged results are inadequate ?
    Warning I'm not a teacher

  5. #5
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326


    Did you find this post helpful? Yes | No

    Default Re: INA219 conversion time

    thanks,
    let me try to explain....

    The correction is applied every 150 msec.
    let me say that at t=0 the correction is applied.
    At t+50 msec the power supply output is completely set.
    1> Should I wait 50 msec + 68 msec to get fitered data from INA219 ? ( without looking at the end of conversion bit ).
    2> what is the operation of the end of conversion bit ? Is it relevant to What start of conversion ? How is the "start of conversion" started ?
    3> what is the triggered mode ? I can not find any description on the ds.

    Thanks for helping.
    regards
    Ambro

  6. #6
    Join Date
    May 2013
    Location
    australia
    Posts
    2,379


    Did you find this post helpful? Yes | No

    Default Re: INA219 conversion time

    The correction is applied every 150 msec.
    Does that mean you take a new "reading" every 150 ms ?
    1> Should I wait 50 msec + 68 msec to get fitered data from INA219 ? ( without looking at the end of conversion bit ).
    in free run mode yes ,the "read" you get is the latest available
    2> what is the operation of the end of conversion bit ? Is it relevant to What start of conversion ?

    in free run i don't see it has any useful function


    How is the "start of conversion" started ?
    set the config to the triggered mode you desire


    what is the triggered mode ? I can not find any description on the ds.


    data sheet
    BASIC ADC FUNCTIONS
    Writing any of the triggered convert modes into the
    Configuration Register (even if the desired mode is
    already programmed into the register) triggers a
    single-shot conversion. Table 7 lists the triggered
    convert mode settings
    Warning I'm not a teacher

  7. #7
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326


    Did you find this post helpful? Yes | No

    Default Re: INA219 conversion time

    Thanks,
    it is somewhat clear to me now . I will follow that inmplementation.

    > "set the config to the triggered mode you desire " : Yes, it is OK , but when does the trigger start pls ?
    Amb

  8. #8
    Join Date
    May 2013
    Location
    australia
    Posts
    2,379


    Did you find this post helpful? Yes | No

    Default Re: INA219 conversion time

    that is the trigger
    in continuous mode the end of conversion triggers the next conversion
    any other mode (single conversion) waits for user to retrigger it
    Last edited by richard; - 14th November 2020 at 13:01.
    Warning I'm not a teacher

  9. #9
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326


    Did you find this post helpful? Yes | No

    Default Re: INA219 conversion time

    so the trigger in triggered mode is the sending of the config register ?
    Amb

  10. #10
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326


    Did you find this post helpful? Yes | No

    Default Re: INA219 conversion time

    the procedure is to send the conf register and wait for the end of conversion bit and read the data : is this OK?
    Ambro

Similar Threads

  1. INA219 interface help
    By iw2fvo in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 19th June 2017, 15:23
  2. PIC 18F1330 - first time, hard time - blink that LED
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 1st March 2015, 23:33
  3. How best to time a pin state for extended periods of time
    By Hylan in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 10th March 2011, 12:20
  4. DS1904 RTC - How to Convert Binary Time into Real Time/Date?
    By Ioannis in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 2nd December 2010, 11:45
  5. Linx RF -> HSERIN time delay / time critical app...
    By batee in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 15th October 2004, 16:04

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts