Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

DC power crossover

  1. Oct 10, 2009 #1
    I am a ecologist and I have been playing around with a water conductivity sensor, however in seawater there is the obvious oxidation issue. I have found that with the right correction factors and with the polarity frequently reversed, the electrodes have reasonable accuracy.

    The Question: Is there an crossover circuit, that can be controlled by a microcontroller, that would allow the power circuits to be flipped. I am running 5v DC.

    The circuit would normally be like this,

    5VDC In (+)----------------- - ----------- (+) 5VDC Out

    Grnd In (-)------------------ - ----------- (-) Grnd Out

    The dashed lines represent the existing cables, the 'out' are the plates of the electrodes.

    And when crossed over,

    5VDC In (+)------------------ \/ ----------- (-) Grnd Out
    Grnd In (-)------------------- /\ ----------- (+) 5VDC Out

    Basically, I need to flip the polarity of the electrode plates.

    Because of the equipment, there is no way to use AC and the switching needs to be at low frequency to allow reading to stabilize.

    Any suggestions? I've searched and am having no luck.

  2. jcsd
  3. Oct 10, 2009 #2


    User Avatar
    Science Advisor
    Gold Member

    I would use a double pole double throw(DPDT) relay and a driving timer circuit.
  4. Oct 10, 2009 #3


    User Avatar
    Science Advisor

    You could use something like the attached diagram.

    Two outputs of a Micro are used and they are alternately sent to 5 volts while the other is kept low. To the water sample, this would look like AC.

    The outputs are fed back to A to D converting inputs (A and B ) where readings of voltage are obtained. The voltage depends on the conductivity of the sample and the values of the series resistors R1 and R2.

    One advantage of using a micro like this is that the output voltages only need to be present for the very short time it takes to do an A to D conversion. Maybe 2 or 3 milliseconds.
    The probes could have no voltage at all on them for the rest of the time.
    So, if you only took a reading every second or so, the the voltage would only be present for about 0.3% of the time.

    This and the alternating voltages would limit Chlorine production and corrosion of the probes.

    I have mentioned the Picaxe chip, but any Micro you are familiar with could probably be used like this.

    Attached Files:

  5. Oct 10, 2009 #4
    The solution using the switch is the easiest.

    The solution to implement a micro-controller is brilliant. A thought occurred to me to use a voltage inverter, but that's redundant.
  6. Oct 11, 2009 #5
    I think the DPDT relay is going to be the tune for the project. There are 64 electrodes in the array so using microcontrollers might push past the meager budget. However, the microcontroller solution is inspired and I have set out on making one for bench testing of samples.

    Thanks vk6kro and dlgoff for your advice! I really do appreciate it.
  7. Oct 12, 2009 #6
    final question: Is it possible to use a 4 or 6 transistor configuration similar to an h-bridge to replicate the DPDT relay. I've build the timing circuit and it works fine with the relay, however with the number of cycles necessary per minute, the relay will have a very short life.

    Something of the kind where when the timer signal is HIGH, the polarity is one way, and when the timer signal goes LOW, it swiches.

    Any options?
  8. Oct 12, 2009 #7
  9. Oct 12, 2009 #8


    User Avatar
    Science Advisor
    Gold Member

    I did a search for a DPDT solid state relay but couldn't find any. You could use a couple of DPST SSRs to do the job. But yes, you could build a h-bridge.
    http://en.wikipedia.org/wiki/H-bridge" [Broken]
    Last edited by a moderator: May 4, 2017
  10. Oct 14, 2009 #9
    I'm giving the microcontroller a try, and so far it looks promising. The problem that i ran into was the pwm analog outputs don't provide a proper voltage signal for a dc sensor. The solution i have on the bench now is similar to the schematic from vk6kro but with the outputs fed into pair of 556 chips as pulse generators.

    In this setup i can feed the chips a conditioned 5vdc source.

    Any obvious flaws in this setup?
  11. Oct 14, 2009 #10


    User Avatar
    Science Advisor
    Gold Member

    A pair of 556 chips? That is four timers, right?
  12. Oct 14, 2009 #11


    User Avatar
    Science Advisor

    Whatever works is fine, but I don't understand why the Micro couldn't give you suitable PWM out. The Picaxe chips will give 0% to 100% PWM in 1024 steps. This can be used as is to drive a meter or filtered to give actual DC out.
    All outputs can send Ascii text to a serial port of a computer or a serial LCD, if you wanted to go that way.

    The Picaxe chips need 5 volts and preferably a clean regulated 5 volts.

    What sort of DC sensor are you using?
  13. Oct 14, 2009 #12
    the pwm output is read by the input as a series of '0' and '1023' pulses (tried it before i started thinking about the nature of a pwm signal), the average of which is the specified voltage; The high frequency of the signal means you don't notice when you use it to light an led or drive an inductive load.. You could, in theory, average the pulses through software or filter the pulses through a RC circuit...but that seems like way too much trouble.

    I went with 2 556 chips because the pulse of the 555 timer is initiated by the trigger going LOW. By using the 556 chip, I use one side as a pulse generator and the other as a 'not' gate to invert the digital signal from the microcontroller.

    Am i overcomplicating this?
  14. Oct 14, 2009 #13
    The sensor is a proprietary electrode. Build like a brick ****house so it can be left in the ocean for weeks.
  15. Oct 14, 2009 #14


    User Avatar
    Science Advisor

    Just rereading what you said...
    The solution i have on the bench now is similar to the schematic from vk6kro

    The actual readout for this would come from a different output, not the ones connected to the water sample. A picaxe 14 has 6 outputs. A 20 M has 8 outputs.

    So, you would use the circuit above to get a reading on the A to D inputs of the chip and then do any calculations and present the output to one of the other outputs.

    The high resolution input A to D command for a Picaxe is
    readadc10 4, w1
    where it is reading from input pin 4 and the reading is put into a variable W1. W1 would be a number between 0 and 1023 where each step would be about 5 mV. (Pin numbers are just examples).

    The PWM output command is:
    pwmout 2, 255, w1
    where 2 refers to output pin 2 and W1 is a variable with values from 0 to 1023 where each step is about 0.1% change in duty cycle.

    If you change the 255 to 250 then the steps are actually 0.1%. So to get 60% duty cycle, you would make W1 = 600.
    the command would then be
    pwmout 2, 250, 600

    As you can see, these are VERY nice chips.
  16. Oct 14, 2009 #15
    I am using two analog outputs and two analog inputs connected to the electrode and using a serial connection to output the data. The problem I had using the pwm was that the voltage signal coming from the analogue output is a square wave.

    The square wave was was picked up exactly as transmitted (though slightly attenuated by the voltage drop across the sample) by the analog input. So you can image the the displayed values being of the nature:


    Whereas, using the 5v pulses from the timers, the input reads as

  17. Oct 15, 2009 #16


    User Avatar
    Science Advisor

    It seems like you have a continous pulse stream going to the electrodes? Why?

    I would do this:
    send one output of the Micro high and keep the other one low.
    read the ADC inputs
    Send the high output low.
    wait one second

    send the other output high and keep the first one low
    read the ADC inputs
    Send the high output low
    wait one second.

    Now, you want an average of the high readings from both inputs and an average of the low readings from both inputs.
    Subtract these to get conductivity data which will depend on the series resistors.
  18. Oct 15, 2009 #17
    in salt water, the corrosion is immediate and readily apparent in the calculations. A second of current flow would see a 10% drop in voltage.. more depending on the salinity. I haven't done the calculations yet (response time for the chips, and the micro) but i'm shooting for ~500hz to keep the surfaces clean and oxide free.

    The constantly changing current also keeps the electrodes clean, in this environment the surface conductivity would change quickly even without current flowing.
  19. Oct 15, 2009 #18
    Its certainly not a perfect answer, and there is definitely merit in what your suggesting.

    By allowing the micro to trigger the pulse timer and then switch to recording data through the ADC, the slight delay eliminates some switching noise and eliminates artificial timing constraints outside of the pulse timers themselves.

    The program triggers the timer through pulling a digital pin high and then starts listening, as soon as the positive voltage is registered on the analog input, the voltages start to be recorded. The pulse lasts 5mS. Once the current drops, the program triggers the pulse for the opposite electrode and starts listening again.

    The pulse length is being tested to maximize battery and electrode life (while still keeping numbers in the ballpark)....so the 5mS value may, and probably will change
  20. Oct 15, 2009 #19


    User Avatar
    Science Advisor

    With marine grade stainless steel electrodes and a pulse rate of 3 mS each second, I would be surprised to see any corrosion, especially as the voltage is being alternated.

    Platinum electrodes would be ideal and these are routinely used in Hoffman Voltameters as used in laboratories. The whole instrument costs about $40, so replacement electrodes can't be all that expensive.

    Note that the series resistors will need to be optimised to get best use out of the A to D converter inputs.
  21. Oct 15, 2009 #20
    the electrodes are 316 ss but platinum is a little out of the budget. The capillary electrodes used in the lab meters are too delicate for the open water..had to go with a bit of beef! and that means a lot of metal.. the problems would be a lot fewer if i could use a gold alloy.. but it would never take the sand scouring...

    why can't materials be as cheap as lines of code...

    I worry about the scaling and oxide buildup even on stainless. I'm hypothesizing that the 'trodes would have to run a kind of cleaning cycle before readings to get consistent results... but my *** does a lot of the talking these days.. so i could be completely off

    .. would save on battery power to run a 5 second cleaning pulse and then 5 seconds of readings....hmmmm... do that once a minute.. could put the chips to sleep during the interim
  22. Oct 16, 2009 #21


    User Avatar
    Science Advisor

    I have seen an effect like that where the resistance between two probes increases after a few seconds of current flow.

    It was due to polarization. This is where bubbles form on the surface of the electrodes and restrict the exposure to the electrolyte. Maybe this is what you have?

    You could limit this by having a very short current cycle and by agitating the solution in between readings. Fortunately, the ocean would do the agitating for you.

    Do you have any figures for conductivity ranges in your area?
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook