tfcb

Members
  • Content Count

    10
  • Joined

  • Last visited

Posts posted by tfcb


  1. On 4/2/2019 at 10:52 AM, JColvin said:

    Hi @tfcb,

    I am taking a look into this; I connected a level shifter of my own (Digilent's Pmod LVLSHFT rather than the Sparkfun one you linked to) to connect an Arduino Uno and Pmod ISNS20, but I too am getting strange values (no initial offset for example), so I'm debugging some more.

    Thanks,
    JColvin

     @JColvin,

    Any update on this? Still hoping to use the modules.

    Thanks,

    Tim


  2. Hi,

    Just tested the latest update. Here is the output with nothing connected to the IP connector.  Since I'm using a Arduino Uno a https://www.sparkfun.com/products/12009 is inline to deal with 5V vs 3.3V. Any thoughts I what I might be doing wrong?

    Thanks!

    Tim

    15:06:29.519 -> 13553 mA   |  15.83 A
    15:06:29.519 -> 
    15:06:29.553 -> 
    15:06:29.623 -> 16967 mA   |  18.10 A
    15:06:29.623 -> 
    15:06:29.623 -> 
    15:06:29.726 -> 13550 mA   |  12.41 A
    15:06:29.726 -> 
    15:06:29.726 -> 
    15:06:29.829 -> 12411 mA   |  11.27 A
    15:06:29.829 -> 
    15:06:29.829 -> 
    15:06:29.931 -> 11274 mA   |  11.27 A
    15:06:29.931 -> 
    15:06:29.931 -> 
    15:06:30.033 -> 11274 mA   |  11.27 A
    15:06:30.033 -> 
    15:06:30.033 -> 
    15:06:30.136 -> 11275 mA   |  12.41 A
    15:06:30.136 -> 
    15:06:30.136 -> 
    15:06:30.238 -> 15823 mA   |  18.10 A
    15:06:30.238 -> 
    15:06:30.238 -> 
    15:06:30.341 -> 19237 mA   |  14.69 A
    15:06:30.341 -> 
    15:06:30.341 -> 
    15:06:30.441 -> 13552 mA   |  12.41 A
    15:06:30.441 -> 
    15:06:30.475 -> 
    15:06:30.543 -> 11274 mA   |  11.27 A
    15:06:30.543 -> 
    15:06:30.577 -> 
    15:06:30.645 -> 11274 mA   |  11.27 A
    15:06:30.645 -> 
    15:06:30.679 -> 
    15:06:30.748 -> 11274 mA   |  11.27 A
    15:06:30.748 -> 
    15:06:30.782 -> 
    15:06:30.850 -> 11274 mA   |  12.41 A
    15:06:30.850 -> 
    15:06:30.884 -> 
    15:06:30.953 -> 15820 mA   |  15.82 A
    15:06:30.953 -> 
    15:06:30.986 -> 
    15:06:31.055 -> 15824 mA   |  13.55 A
    15:06:31.055 -> 
    15:06:31.089 -> 
    15:06:31.157 -> 12415 mA   |  11.27 A
    15:06:31.157 -> 
    15:06:31.191 -> 
    15:06:31.259 -> 11274 mA   |  11.27 A
    15:06:31.259 -> 
    15:06:31.293 -> 
    15:06:31.361 -> 11274 mA   |  11.27 A
    15:06:31.361 -> 
    15:06:31.395 -> 
    15:06:31.464 -> 11274 mA   |  11.28 A
    15:06:31.464 -> 
    15:06:31.499 -> 
    15:06:31.567 -> 13547 mA   |  12.41 A
    15:06:31.567 -> 
    15:06:31.601 -> 
    15:06:31.669 -> 19238 mA   |  16.97 A
    15:06:31.669 -> 
    15:06:31.703 -> 
    15:06:31.771 -> 16969 mA   |  13.55 A
    15:06:31.771 -> 
    15:06:31.805 -> 
    15:06:31.873 -> 11274 mA   |  11.27 A
    15:06:31.873 -> 
    15:06:31.907 -> 
    15:06:31.975 -> 11274 mA   |  11.27 A
    15:06:31.975 -> 
    15:06:32.009 -> 
    15:06:32.079 -> 11274 mA   |  11.27 A
    15:06:32.079 -> 
    15:06:32.114 -> 
    15:06:32.182 -> 11274 mA   |  11.28 A
    15:06:32.182 -> 
    15:06:32.215 -> 
    15:06:32.283 -> 11274 mA   |  12.42 A

     


  3. I ran the supplied code on an Arduino Uno using a level shifter. The output doesn't make any sense to me. Why are the mA and A results so different? Based on the use of a DMM the A should be approx 13.

    Given the for loop wouldn't work on Arduino 1.8.8 I'm wondering if anyone has ever used this part successfully. I appreciate your insight on getting this to work.

    Quote


    21:03:59.722 -> -3 mA   |  14.91 A
    21:03:59.790 -> -17 mA   |  15.74 A
    21:03:59.824 -> 27 mA   |  16.07 A
    21:03:59.894 -> 16 mA   |  15.56 A
    21:03:59.928 -> 21 mA   |  13.81 A
    21:03:59.996 -> -37 mA   |  10.92 A
    21:04:00.029 -> -34 mA   |  7.39 A
    21:04:00.099 -> 3 mA   |  -21.73 A
    21:04:00.133 -> 14 mA   |  -24.97 A
    21:04:00.200 -> -7 mA   |  -15.56 A
    21:04:00.234 -> -5 mA   |  -18.75 A
    21:04:00.302 -> -22 mA   |  -24.99 A
    21:04:00.336 -> 3 mA   |  -25.01 A
    21:04:00.404 -> 18 mA   |  -20.24 A
    21:04:00.439 -> 31 mA   |  -21.51 A
    21:04:00.508 -> -10 mA   |  -22.08 A
    21:04:00.541 -> 8 mA   |  -22.66 A
    21:04:00.609 -> 1 mA   |  -22.27 A
    21:04:00.643 -> -35 mA   |  -21.73 A
    21:04:00.713 -> -10 mA   |  -12.20 A
    21:04:00.747 -> -33 mA   |  -8.29 A
    21:04:00.781 -> 37 mA   |  -4.85 A
    21:04:00.850 -> -27 mA   |  -1.34 A
    21:04:00.884 -> 28 mA   |  2.17 A
    21:04:00.952 -> -4 mA   |  5.09 A
    21:04:00.987 -> 10 mA   |  7.94 A
    21:04:01.056 -> 6 mA   |  10.27 A
    21:04:01.090 -> -11 mA   |  12.49 A
    21:04:01.159 -> -32 mA   |  14.11 A
    21:04:01.193 -> 37 mA   |  15.23 A
    21:04:01.261 -> -25 mA   |  15.91 A
    21:04:01.296 -> -15 mA   |  16.01 A
    21:04:01.364 -> 7 mA   |  15.20 A
    21:04:01.398 -> -28 mA   |  13.04 A

     

     


  4. Are the data lines on the ISNS20 5v tolerant? The "resource center" isn't exactly clear. From what I can tell the various data lines on the Arduino Uno are all 5v.  Obviously 3.3v will be provided to VCC. Thanks.

    BTW, as I understand, this for statement: 

    for(int i; i < NUM_READINGS; i++)

    should really be:

    for(int i=0; i < NUM_READINGS; i++)

    otherwise, the for loop might only run once (if lucky) as the variable "i" is undefined on the first run and might remain >= NUM_READINGS thereafter. The same version of gcc produces different results when executed on ARM or x86_64. More details than I understand at: https://stackoverflow.com/questions/4532871/define-integer-int-whats-the-default-value

     


  5. FWIW, the following python program, based on this code: https://github.com/DesignSparkrs/DesignSpark.Pmod/blob/master/DesignSpark/Pmod/ISNS20.py

    #!/usr/bin/python
    
    import spidev
    import time
    
    spi = spidev.SpiDev()
    spi.open(0, 0)
    spi.max_speed_hz = 100000
    spi.mode = 0b00
    try:
        while True:
            resp = spi.xfer2([0x00, 0x00])
            w = resp[0]
            w <<= 8
            w |= resp[1]
            refV = 3.3
            lsb = refV/4096
            mV= (w-2048)*lsb*1000
            amps = mV/66
            print amps
            time.sleep(1)
    except KeyboardInterrupt:# Ctrl+C pressed, so...
        spi.close()
    
    

    produces:

    -0.048828125
    15.2221679687
    16.1010742188
    13.76953125
    5.50537109375
    -3.6376953125
    -11.2182617188
    -15.4296875
    -15.576171875
    -8.69140625
    1.025390625
    9.89990234375
    14.8559570312
    15.7836914062
    9.0087890625
    -1.318359375
    -10.595703125
    -0.048828125
    -0.048828125

     


  6. Hi,

    I'm attempting to use the ISNS20 with an Arduino Uno. I am using a Sparkfun Bi-Directional Logic Level Converter to handle 5V vs 3.3V.

    I'm using the source from https://www.hackster.io/58702/using-the-pmod-isns20-with-arduino-uno-0ee8db .

    CS is connected to Pin 10, D0 is connected to Pin 12 and CLK is Pin 13.

    I wire Black/Line to IP+ and the IP- to the Black/Line connection on an outlet. Unfortunately I get the same result if I draw current or not (using a hair dryer).

    14:54:37.548 -> Courant=-33 mA
    14:54:37.582 -> Courant=28 mA
    14:54:37.582 -> Courant=-33 mA
    14:54:37.615 -> Courant=-33 mA
    14:54:37.615 -> Courant=28 mA
    14:54:37.648 -> Courant=-33 mA

    I don't have an oscilloscope. I do have a DMM.

    Thanks,

    Tim