Need help: Analog readings change when i restart device

Discussion in 'The Projects Forum' started by Toebs, Jan 23, 2015.

  1. Toebs

    Thread Starter Member

    Oct 9, 2014
    52
    1
    Hello
    I build a small sensor node with 4 analog inputs for soil moisture sensors (the Vh400 from vegetronics).
    The sensor uses the electric imp 002 chip as uC and for WiFi connectivity.

    I power the PCB with 12V from an external PSU.
    On board I have a 3.3V dc-dc converter to power the electric imp.
    I also have a 3.5V LDO - The VH400 moisture sensors need at least 3.5V in to work properly.
    The Vh400 outputs 0-3V analog which I feed through up-amp buffers to analog-in pins on the imp.
    The soil moisture sensors are connected with TRS (stereo jack) connectors.

    However I have a problem. If i disconnect and reconnect power to the board, measurements change.

    With the analog sensors connected and the board powered up it measures as it should, let's say the sensors measure:
    Sensor 1: 26%
    Sensor 2: 68%
    Sensor 3: 68%
    Sensor 4: 62%
    (These are the right measurements checked with reference measurement equipment).
    If I measure voltage on the 5V rail i read ~5,02V

    If i then disconnect the 12V power and put it back in, i get different measurements, even thou I should get the same:
    Sensor 1: 5%
    Sensor 2: 46%
    Sensor 3: 45%
    Sensor 4: 42%
    If I measure voltage on the 5V rail i read ~4,82V

    And now the tricky part: If i disconnect and reconnect a sensor by pulling out the mini-jack connector and putting it back in, readings go back to being normal. Also voltage on the 5V rail reads 5,02V again.

    I have a feeling it has to do with the 5V LDO somehow, but don't know.
    With no sensors connected via the mini jack connectors there a low volume but high frequency pitch sound coming from the board.

    Please see attached schematics, I really cannot figure out what the problem might be.
     
  2. Toebs

    Thread Starter Member

    Oct 9, 2014
    52
    1
    Also if I power the board with 6.5V instead of 12V i have no problems.
     
  3. ScottWang

    Moderator

    Aug 23, 2012
    4,850
    767
    Could you measure the resistance for the load?
    And measure the current for when you connect and disconnect the 12V, and also measure the current for load when you plug and unplug the sense.
     
  4. Toebs

    Thread Starter Member

    Oct 9, 2014
    52
    1
    Hi Scott thanks for the reply.
    Do you mean measuring the resistance of the soil moisture sensor when they are not connected?

    How should i measure the current?

    If I look at the power supply it reads: 0.07A drawn (to entire board) before i disconnect 12V with all sensors reading correctly. When i reconnect 12V and they read wrong it also draws 0,07A.
    Disconnecting and reconnecting a sensor has no influence on this, 0,07A before and 0,07A after.
    Sensors are rated to use <7mA btw.
     
  5. ScottWang

    Moderator

    Aug 23, 2012
    4,850
    767
    Any parts need the power then they are the load, you need to measure their resistance and current separated, and measure the total current when they connected together.
    In series with a current meter(or multimeter current range) between the sensor and connector then it can measure the current.
     
  6. bertus

    Administrator

    Apr 5, 2008
    15,638
    2,344
  7. Toebs

    Thread Starter Member

    Oct 9, 2014
    52
    1
  8. Toebs

    Thread Starter Member

    Oct 9, 2014
    52
    1
    I removed it, didn't help :/
     
  9. Toebs

    Thread Starter Member

    Oct 9, 2014
    52
    1
    Measured 40M Ohm resistance on disconnected sensor from GND to VCC.
    1.9M Ohm from "signal" to GND on sensor.

    Current through sensor is 10 mA. Stays the same when i connect and disconnect sensors.
    Current for board 50mA without sensors. Goes up 10mA for each sensor i connect.

    What am I looking for here?
     
  10. ronv

    AAC Fanatic!

    Nov 12, 2008
    3,281
    1,232
    It kind of sounds like a power on sequence problem though I don't see it.. If I understand correctly if the 12 supply comes up slowly all is well. If it comes up quickly (plug/unplug) it fails.
    If that's the case you might try powering the low voltage regulators off the 5 volt one instead of +12.
    Read about protecting analog pins. I think it starts at fig. 4.1
     
    Last edited: Jan 26, 2015
  11. Toebs

    Thread Starter Member

    Oct 9, 2014
    52
    1
    You understand it correctly

    THanks I will try to read about that, but read which "document" are you referring to when you say "it starts at fig. 4.1"? :)
     
    Last edited: Jan 26, 2015
  12. ronv

    AAC Fanatic!

    Nov 12, 2008
    3,281
    1,232
    The data sheet for the op amp. It may be the 3.5 volts comes up faster than the 5 volts.
     
  13. Toebs

    Thread Starter Member

    Oct 9, 2014
    52
    1
    Ok im back and I put a scope to the two voltage rails and did a little testing.

    See attached pics please

    There is some sort of ripple on the 5V rail after connecting 12V.
    The ripple disappears when i disconnect/reconnect a soil-moisture sensor.
    The ripple also disappears if I power up the board slowly going from 0 to 12V.
    Ripple is there whether or not I start with sensors plugged in or not.

    What to make of this, could it be due to sequencing of the PSU's somehow?
    scope1.jpg scope2.jpg scope3.jpg
     
  14. MrChips

    Moderator

    Oct 2, 2009
    12,415
    3,354
    Try changing C11 from 22μF to 0.1 μF ceramic.
     
    Last edited: Jan 30, 2015
  15. RamaD

    Active Member

    Dec 4, 2009
    254
    33
    This appears to be a stability issue with the 5V LDO.
    Manufacturer recommendation is 10uF tantalum at the input for all applications, and, the output cap should meet both min. capacitance of 10uF tantalum, and ESR value between 0.3Ohms and 22 Ohms. Larger output cap improves loop stability. Though this is for a part from TI/National (which I noticed just now), it could be similiar.
    BTW, when using Tantalum caps, the voltage rating of 100% more is preferable.
     
  16. ronv

    AAC Fanatic!

    Nov 12, 2008
    3,281
    1,232
    You might also want to scope the +12 to make sure it is not doing something funny.
     
  17. Toebs

    Thread Starter Member

    Oct 9, 2014
    52
    1
    Thanks for all the good advice. I will have some time to look at it monday again.

    The 5V LDO I use is this one:
    http://www.digikey.com/product-detail/en/AP1117E50G-13/AP1117E50GDICT-ND/1301523
    Data sheet specifies: "The output of the regulator. A minimum of 4.7µF capacitor (0.15Ω ≤ ESR ≤ 0.5Ω) must be connected from this pin to ground to insure stability."

    The cap I am using is this one:
    http://www.digikey.dk/product-detail/en/C2012X5R0J226M125AC/445-1422-1-ND/569088
    I cannot find any specific ESR but it says "low ESR" in datasheet.

    On monday I will try to change the cap to a tantalum one and see what happens :)
     
  18. MrChips

    Moderator

    Oct 2, 2009
    12,415
    3,354
    Even though the data sheet calls for 4.7µF, try a 1µF capacitor and see what happens.
     
  19. Toebs

    Thread Starter Member

    Oct 9, 2014
    52
    1
    I swapped the output cap with a 10uF tantalum cap and the problem seems to have disappeared. I would have gone on to trying your solution next MrChips, if this had not worked :)

    Thanks alot for all the inputs!
     
  20. Toebs

    Thread Starter Member

    Oct 9, 2014
    52
    1
    Ok I am back with new misfortunes hehe. There seems to be some kind of spill-over or noise from one sensor reading to another.
    What I experience is that if I connect or disconnect a sensor and leave it in (or out) it will have a slight influence on the readings of the sensors still plugged in.

    If I do not change the sensor setup and just leaves lets say 1 sensor in its value will stay pretty fixed +-1%, and never jump like I see it when I connect or disconnect sensors.

    I do not change the position or touch the sensors them selves, I only plug them in or out of the stereo jack.
    See these results ("raw is ADC reading):

    (three sensors connecte)
    2015-02-06 16:19:11 UTC+1 [Device] 0 raw: 38793 44%
    2015-02-06 16:19:11 UTC+1 [Device] 1 raw: 41642 47%
    2015-02-06 16:19:11 UTC+1 [Device] 2 raw: 45611 53%
    2015-02-06 16:19:11 UTC+1 [Device] 3 raw: 16 0%

    (disconnected sensor "1" - Readings from "0" and "2" are affected
    2015-02-06 16:20:23 UTC+1 [Device] 0 raw: 36953 40%
    2015-02-06 16:20:23 UTC+1 [Device] 1 raw: 32 0%
    2015-02-06 16:20:23 UTC+1 [Device] 2 raw: 44586 51%
    2015-02-06 16:20:23 UTC+1 [Device] 3 raw: 0 0%

    2015-02-06 16:21:22 UTC+1 [Device] 0 raw: 39145 43%
    2015-02-06 16:21:22 UTC+1 [Device] 1 raw: 16 0%
    2015-02-06 16:21:22 UTC+1 [Device] 2 raw: 32 0%
    2015-02-06 16:21:22 UTC+1 [Device] 3 raw: 48 0%

    2015-02-06 16:22:53 UTC+1 [Device] 0 raw: 37049 41%
    2015-02-06 16:22:54 UTC+1 [Device] 1 raw: 32 0%
    2015-02-06 16:22:54 UTC+1 [Device] 2 raw: 44858 51%
    2015-02-06 16:22:54 UTC+1 [Device] 3 raw: 16 0%

    2015-02-06 16:28:59 UTC+1 [Device] 0 raw: 40729 46%
    2015-02-06 16:28:59 UTC+1 [Device] 1 raw: 16 0%
    2015-02-06 16:28:59 UTC+1 [Device] 2 raw: 46171 53%
    2015-02-06 16:28:59 UTC+1 [Device] 3 raw: 42026 47%

    Can sense be made of this?
     
Loading...