+ Post New Thread
Results 1 to 8 of 8
  1. #1
    Newbie level 3
    Points: 170, Level: 2

    Join Date
    Oct 2014
    Posts
    4
    Helped
    0 / 0
    Points
    170
    Level
    2

    Detect 2 PWMs in water

    Hello,

    I am trying to detect the presence of water at two different places. To do so I designed a circuit interfacing a microncontroller to the water. Two PWMs at different frequencies are generated and immersed in water. Two PWM inputs are "hanging" waiting for the level of water to rise. Note that water in both tanks can be in contact.

    See image:
    Click image for larger version. 

Name:	PWM detection.jpg 
Views:	7 
Size:	20.9 KB 
ID:	110332

    Using a STM32f051 I can detect PWM1 on PWM input 1 OR PWM2 on PWM input 2 but I can't detect anything useful if both PWM1 and PWM2 are in the same water at the same time.

    I am looking for a good combination of frequency, duty cycle and phase to be able to read the 3 different possible states (PWM1 alone, PWM2 alone, PWM1 & 2 at the same time).

    The schematic:
    Fill_decctor_ctl and Leak_detector_ctl are both PWM1 and PWM2.
    Fill_decctor and Leak_detectol are both PWM input 1 and PWM input 2.
    Click image for larger version. 

Name:	schematic.jpg 
Views:	10 
Size:	232.4 KB 
ID:	110333


    Can anyone please help me to make it work?

    Thanks,
    Pivic

    •   AltAdvertisment

        
       

  2. #2
    Super Moderator
    Points: 254,930, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    44,424
    Helped
    13527 / 13527
    Points
    254,930
    Level
    100

    Re: Detect 2 PWMs in water

    I don't see why multiple level switches in a tank (or multiple connected tanks) would use different frequencies. They are essentially impedance probes. You have an indifferent/ground electrode which can be the tank body if it's conductive and one or multiple electrodes driven by an AC source through resistors. If the electrode is immersed, it's voltage against ground falls below a threshold level.



  3. #3
    Banned
    Points: 12,436, Level: 26

    Join Date
    Apr 2013
    Posts
    2,528
    Helped
    538 / 538
    Points
    12,436
    Level
    26

    Re: Detect 2 PWMs in water

    Use Ultarsonic sensor module like US 020 to detect fluid level without contact to fluid.



    •   AltAdvertisment

        
       

  4. #4
    Advanced Member level 5
    Points: 34,834, Level: 45
    Achievements:
    7 years registered Created Blog entry Created Album pictures
    SunnySkyguy's Avatar
    Join Date
    Sep 2007
    Location
    Richmond Hill, ON, Canada
    Posts
    6,705
    Helped
    1673 / 1673
    Points
    34,834
    Level
    45
    Blog Entries
    7

    Re: Detect 2 PWMs in water

    Your suggestion may work, but it is far simpler to have an electrode pair immersed in each tank in close proximity to make each pair a capacitor. Then use a constant current source at some f to measure V proportional to depth.

    Then using the properties of water with a dielectric constant of ~60 you can measure capacitance or impedance at different sinewave frequencies for depth. Using PWM can work but also can fail with more EMI.

    To choose two pulses not harmonically related is difficult as harmonics overlap. But Dual Sinewaves are used for impedance measurement of Eddy Currents in metal. Then the vector impedance is measured for each.
    A good design question lists your overall requirements™ The best question deserves a better answer. ™
    ... Tony Stewart EE since 1975



  5. #5
    Newbie level 3
    Points: 170, Level: 2

    Join Date
    Oct 2014
    Posts
    4
    Helped
    0 / 0
    Points
    170
    Level
    2

    Re: Detect 2 PWMs in water

    Thanks for all your answers!

    I used different frequencies in order to differentiate which sensor is immersed. Using only the continuity would not work because they share the same ground and the water can be connected.
    Originally I wanted to detect the level with a no-contact technology but unfortunately the casing/enclosure of the whole system is already made and can't be changed (out of my control).

    The four electrodes are already moulded in plastic and cant be moved either :(

    I should have written water in quotes as it can be very dirty (e.g. sewer)

    One way I thought would be to have both PWMs at the same frequency, opposite phase and different duty cycle. I can detect each thanks to the duty cycle and the both together should create a frequency twice the original?



  6. #6
    Super Moderator
    Points: 254,930, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    44,424
    Helped
    13527 / 13527
    Points
    254,930
    Level
    100

    Re: Detect 2 PWMs in water

    As previously said, I don't understand your reservation about using multiple electrodes with common ground. Commercial conductive level switches don't have it.



  7. #7
    Advanced Member level 5
    Points: 34,834, Level: 45
    Achievements:
    7 years registered Created Blog entry Created Album pictures
    SunnySkyguy's Avatar
    Join Date
    Sep 2007
    Location
    Richmond Hill, ON, Canada
    Posts
    6,705
    Helped
    1673 / 1673
    Points
    34,834
    Level
    45
    Blog Entries
    7

    Re: Detect 2 PWMs in water

    Can you consider piezo echo in air remaining in vessel to compute fluid height or speaker resonant frequency to compute volume of air by resonant frequency using detect peak of sweep. Dual tanks can use non-coherent sweeps with tracking filter and peak measurement frequency to compute air volume and thus subtract from vessel,volume. This might be in sub-sonic range for large vessels.

    Otherwise Piezo echo transponders for depth detection using senders at bottom pointing up to detect reflection from surface. aka fish finder.

    - transponders might be epoxied to vessel under tank for up view of fluid height.
    A good design question lists your overall requirements™ The best question deserves a better answer. ™
    ... Tony Stewart EE since 1975



    •   AltAdvertisment

        
       

  8. #8
    Newbie level 3
    Points: 170, Level: 2

    Join Date
    Oct 2014
    Posts
    4
    Helped
    0 / 0
    Points
    170
    Level
    2

    Re: Detect 2 PWMs in water

    Update on the project.

    The technology to be used is to be kept by all means.... was not up to me...

    So for the next version I change "PWM1" and "PWM2" as inputs (of NAND gates) connected to a microcontroler. Both "PWM input 1 & 2" are now connected to the board's ground (which is isolated from the outside world through isolated DC/DC).
    To avoid false positive I'll multiplex the readings.



--[[ ]]--