Connect with us

Using Arduino to read bipolar signal (from plants)

Discussion in 'Microcontrollers, Programming and IoT' started by chiara, Jul 31, 2013.

Scroll to continue with content
  1. chiara

    chiara

    5
    0
    Jul 31, 2013
    Dear all,
    I'm an art student, I'm building a circuit that monitors electrical signals in plants, and I'm trying to read it with an Arduino.

    The circuit I found is this:
    [​IMG]

    Description: "The signal from the electrode was transmitted into a CA3140 impedance converter,which is an integrated circuit operational amplifier that provides very high input impedance, very low input current, and high speed performance (Intersil Corporation), and is then connected to an AD620 amplifier. After amplification, the amplitude range of the electrical signals was 4000mV. In the greenhouse, the distance from the detection site to the computer is 30m, so a voltage to current converter (V/I ) is used so that the signal could be transferred reliably. After the long distance transfer, the current signal is converted back into a voltage signal by an I/V converter."

    In my case, I have an Arduino instead of a computer, and it is near to the plant, so I assume that
    - I don't need the V/I I/V
    - I have to use an Op Amp Summing Amplifier for arduino, like here:
    http://masteringelectronicsdesign.com/measure-a-bipolar-signal-with-an-arduino-board/

    Do you have any advice on what would be the best way to adapt the circuit? How to choose the right OPAMP? I tried AD820 with no success.

    Thanks a lot in advance!
     
  2. Harald Kapp

    Harald Kapp Moderator Moderator

    11,513
    2,651
    Nov 17, 2011
    The CA3140 is being used for its high input impedance. You should use that opamp or an equivalent high impedance amplifier for the front end.
    Since you don't want/need the noise immunity of the current output, remove the complete circuit to the right of the AD620s input pins (2 and 3), leaving only the two CA3140 plus the respective passive compnents.

    Use a difference amplifier to compute the diference between the outputs of the two CA3140 amplifiers. A tutorial on difference amplifiers is here. You should use a low offset opam for this section to ensure stability.

    Your next issue is that the output of the difference amplifier can be both positive and negative. The Arduino's analog input requires between 0...+5V. It cannot handle negative signals. Therefore you need to create a virtual zero and have the signal swing around that level. What this means is:

    - Set an arbitrary level (her 2.5V would be suitable) as reference for 0. Voltages >2.5V are then considered positive, voltages below 2.5V are considered negative (V=Vin-2.5V). You now add 2.5V to the output of the difference amplifier. Your output voltage is then:Vout=2.5V+(Vmeasure - Vreference). This voltage is input to the arduino.

    - Connect Vout to the Arduino's ADC input, thus Vadc=Vout.

    - In the arduino compute Vdiff=Vadc-2.5V=Vout-2.5V (since Vout=Vadc of the arduino) = 2.5V+(Vmeasure - Vreference)-2.5V = Vmeasure - Vreference.
    The arbitrary 2.5V zero reference votage has thus been eliminated.

    A suitable circuit for adding the 2.5V reference voltage is a summing amplifier[/URL. You put that circuit after the difference amplifier from above.
    Note that the summing amplifier is inverting!. Therefore yu need to add -2.5V to create a +2.5V output offset. You may also want to swap the inputs of the difference amplifier in order to keep the difference in correct polarity after the summing amplifier. Alternatively you can swap the sign with the math routine of the arduino.

    The opAmps for the difference and the summing amplifier are not critical, even a humble LM324 could be sed.
     
    Last edited: Jul 31, 2013
  3. chiara

    chiara

    5
    0
    Jul 31, 2013
    Thank you!
     
  4. Harald Kapp

    Harald Kapp Moderator Moderator

    11,513
    2,651
    Nov 17, 2011
    Here is the basic circuit:
    [​IMG]

    You may need to tweak the gain of the difference amplifier by modifying R3 and R5 (note: R3=R5) to fit the difference in output voltage of U1 and U2 to the ADC input range.
     

    Attached Files:

  5. chiara

    chiara

    5
    0
    Jul 31, 2013
    Thank you very much for your big help!
     
  6. CDRIVE

    CDRIVE Hauling 10' pipe on a Trek Shift3

    4,960
    652
    May 8, 2012
    Chiara, did you design and draw the original schematic that you attached in your first post?

    Chris
     
  7. chiara

    chiara

    5
    0
    Jul 31, 2013
    Hi Chris,
    I found it on a engineering paper.
     
  8. CDRIVE

    CDRIVE Hauling 10' pipe on a Trek Shift3

    4,960
    652
    May 8, 2012
    Oh ok. I asked because drawing a schematic in a professional manner is an art form unto itself. Though it needed the mods that Harald gave you it was none the less drawn quite well.

    Chris
     
  9. chiara

    chiara

    5
    0
    Jul 31, 2013
    I totally agree :)
     
  10. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,271
    Nov 28, 2011
    That's very good advice Harald.

    I have a couple of suggestions. You can combine the DC offset into the summing amplifier; just replacing the 10k resistor from the non-inverting input to ground with a 20k+20k voltage divider would do it I think.

    If the ADC is operating with a voltage reference, the voltage for the DC offset in the summing amplifier should be taken from that reference voltage, so that the midpoint voltage scales with the reference voltage. If the ADC is using a 5V supply rail as its reference, then take the DC offset from the 5V rail.

    Edit: In the original design, the op-amps are running from a positive supply of only 5V. The CA3140 can't pull its outputs very close to the positive rail; it only swings to about 2V below its supply rail, typically (3V below the rail, worst case). So the ADC input voltage range must be 0~2V or lower, unless you increase the positive supply rail for the op-amps. I suggest using 9~12V for the op-amp positive supply, and around 5~9V for the negative supply. The ICL7660 is good for generating a -5V rail from a +5V rail.

    Second, you might want to add some explicit clipping, or at least a series resistor, on the signal from the summing op-amp to the ADC to prevent significant current from flowing into the ADC input when the op-amp output voltage is outside its 0~5V operating range.

    Third, there is a practical issue with the use of a probe. Since the probe inputs (the measuring electrode and the reference electrode) are not galvanically connected to the circuit at all, you will need to ensure that the instantaneous voltages on the probes, relative to the 0V rail of the measurement circuit, will not go outside the operating range of the input op-amps, which is determined by the DC supply voltages (in the example circuit, these are +5V and -5V).

    The plant, and everything galvanically connected to it, such as the soil and the plant pot, assuming the plant is potted, is a (somewhat) electrically conductive mass and will assume some voltage relative to other electrical devices nearby, including the monitoring circuit.

    Because the resistance from each probe to the monitoring circuit is almost infinite, there is no real conductive path to bring the voltage of the plant "assembly" within 5V of the monitoring circuit's voltage. The voltage on the plant assembly is free to float anywhere, and could be influenced by mains voltage (through tiny leakage currents that we can't detect, flowing in resistances and stray capacitances), and other kinds of interference.

    I suggest that each plant should have a third connection for common, which should be connected to the 0V rail of the monitoring circuit, to keep the plant and its probes close (in voltage terms) to the monitoring circuit's ground rail. It could connect to the screen around one of the probe wires.

    At the plant, the ground connection could be made to a metal plate or lining, or just a section of metal gauze, placed under the soil under the plant, or lining the inside of the plant pot.

    I think this was the original intention of the design, and the reason why high-impedance differential inputs were used.

    What do you think?
     
    Last edited: Aug 6, 2013
  11. Harald Kapp

    Harald Kapp Moderator Moderator

    11,513
    2,651
    Nov 17, 2011
    Right, I thought about that, too, but discarded the idea. My reasoning: the difference amplifier may need some tweaking of the gain. When you integrate the summing function into the difference amplifier, you'd have to adjust the resistor for the offset input every time you change gain. Merely changing R3 (I understand that's what you suggest) will, as far as I see it, not add a constant offset but influence the diference equation in a more complex way. I thought it easier to keep the two functions eparate.

    In theory a very good advice, only that with my circuit you need -2.5V for the offset due to the inverting nature of the summing amplifier. Possibly the DC value is not important if chiara only wants to look at the changes in the electrical signals? Then you can easily eliminate any DC offset error by averaging the input signal and corecting for the resulting DC offset in software.

    This too sounds good. However (note: I didn't study the original article), we don't know what nature the signals to be detected are and how they are related to ground. What will happen to these sinals in the presence of a ground electrode? If the signals are rather high in frequency, maybe the stray capacitance from the pot to ground may suffice for ground referencing the signals?
     
  12. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,271
    Nov 28, 2011
    [​IMG]

    This is what I suggest. I've tested it with various combinations of input voltages and it works as I expected. The output is biased at half the reference voltage and the differential gain is 1. I can't see any reason to adjust the differential gain in this application.

    Right. I have no experience measuring voltages generated by plants either. My intention was to point out that the circuit needs both electrodes to be within a few volts of circuitry ground, and that if the plant is electrically floating, some galvanic connection will need to be made from the measuring circuit to the plant, to ensure that the measurement circuit will work.
     

    Attached Files:

  13. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,271
    Nov 28, 2011
    Regarding my previous suggestion. Changing the gain is not that difficult. It could be useful to be able to increase the differential amplifier's gain. Just change R1 and R2 (in my schematic). Their values must be the same. A double-pole slide or rotary switch could be used here. As long as the Thevenin resistance of the divider (R3 and R4 in my circuit) is equal to the feedback resistance R5, and R1 == R2, the differential amp is properly balanced, I think.

    I also suggest some kind of clipping arrangement - for example, to bring the probes within the common-mode input range of the op-amps using diodes to a tapped voltage divider across +V and -V or something like that, as well as clipping the differential amplifier op-amp's output voltage to suit the ADC.
     
    Last edited: Aug 7, 2013
  14. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,271
    Nov 28, 2011
    This is the circuit I suggest.

    [​IMG]

    The circuit requires a positive power supply (VP) and a negative power supply (VN). If you want a 0~5V voltage range on the signal going to the ADC, VP must be at least 8V. This is because most op-amps cannot drive their outputs all the way to their positive supply rail; a "dropout voltage" of 3V is typical.

    There is a soil ground connection from the main 0V rail of the circuit. This ensures that the reference and measuring electrode voltages will be within the input range of the circuit.

    D1~4 protect U1 and U2 from possible voltages outside the power supply rails, which would damage the sensitive input stages. They will reduce the input resistance somewhat; look up the 1N914/4148 data sheet to see the typical and maximum leakage currents. You may want to use diodes with lower leakage currents. I can't suggest any part numbers.

    The electrodes are buffered independently by U1 and U2, which are FET-input op-amps with extremely high input resistance. CA3140 and CA3140A types are suitable, but have a significant and variable input offset voltage (15 mV for CA3140, 5 mV for CA3140A, maximum). This can be nulled out with an offset null adjustment - see the CA3140/A data sheet.

    Alternatively, the offset adjustment can be performed in software - connect the two probes together, measure the ADC reading, and regard that reading as the value for 0V differential voltage.

    U3 is a differential amplifier with voltage offset from the VREF voltage. This is shown as a voltage source in this diagram, but it could be a shunt reguator such as a TL431 that is supplied from the +5V or VP voltage. The VREF voltage should be in the range 2~5V, as indicated on the diagram. VREF feeds the VREF input of the ADC in the Arduino.

    R1~5 should have 1% or better tolerance, for best common-mode voltage rejection. Also, U3's input offset voltage can be nulled if desired. The IC type for U3 is not specified; characteristics are not critical (low input offset voltage would be desirable). Personally I would use a TLE2021 in this position.

    Q1~3 and associated components clip the circuit's output voltage to slightly less than the ADC's voltage limits, to prevent damage to the Arduino. Because this clipping action will be somewhat soft, ADC readings outside around 2~98% of scale should be considered inaccurate.

    Q1~3 can be any general purpose silicon transistors. The associated resistors (R6~8) are not critical.

    The offset voltage introduced by R3 and R4 causes the nominal voltage at the output to be half the reference voltage. This means that with the probes shorted together, VOLTAGE_TO_ADC should be about half of VREF_TO_ADC. As I mentioned before, any error can be compensated by trimming the input offset voltages of the op-amps or in firmware.

    If you want to increase the gain of the differential amplifier, to measure smaller differential voltages more accurately, you can reduce R1 and R2 (keep them the same value, and don't go below about 1k) and/or increase R3, R4 and R5 (again, keep them in the correct ratios). I would not recommend a gain higher than about 100. Increasing the gain will reduce the bandwidth.
     

    Attached Files:

  15. arch

    arch

    2
    0
    Aug 23, 2013
    Hi KrisBlueNZ,

    I came accross this thread and all the proposed designs.
    I'm an artist too working with plants of a source of information through electrical activity detection and arduino.

    I have some small knowledge that I'm trying to improve about electronic circuits and instrumentation signal amplifiers.

    It might be obvious for circuit experts but I don't get in depth all the functioning , and some elaboration would be appreciated :)

    So, I would have a couple of questions regarding your design.

    * For GSR (Galvanic Skin Response) measurement, I often see some input voltage to a first electrode, then a second one connect to inverter op-amp with a circuitry acting as a wheastone bridge and voltage calculation.

    It look like you design does not inject voltage and current within the 2 electrodes.
    Could you elaborate on this?

    * Could you elaborate how the setup you propose with NPN and PNP transistors actually limit the output voltage, and the input diodes limiting rôle (positive and negative voltages)?

    * Would it be possible to add the offset ajustment for the op-amp circuitry and a variable gain adjustment pot as well, so that we can adapt to different plants type et sensitivity?


    Thank you!
     
  16. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,271
    Nov 28, 2011
    Hi arch, and welcome to Electronics Point :)

    You're right. That circuit doesn't inject any current into the circuit being monitored. That design monitors voltages GENERATED BY the plant. GSR meters measure skin RESISTANCE, which requires some current to be passed through the skin being measured.

    Resistance (of a section of skin between two electrodes) can be measured by injecting a current and measuring the voltage that appears between the electrodes, or by applying a voltage between the electrodes and measuring the current that flows. The formula is called Ohm's Law and is I = V / R. It can be rearranged to V = I R and R = V / I.

    In this formula, V is voltage (measured between the electrodes), in volts; I is the current (flowing into one electrode and out of the other), in amps (although the current is usually in the milliamp or microamp region), and R is the resistance, in ohms.

    Skin (and any biological material, really) cannot really be described as having a measurable resistance, because it is not ohmic (Wikipedia that word). If you measure voltage and current at different values and calculate the resistance in each case, you will not get the same answer. Therefore GSR measurement is not an exact science.

    The voltage limiting circuitry (the NPN and PNP transistors) is applied at the output of the differential amplifier (U3) and is just intended to protect the ADC from voltages outside the acceptable range, which is 0V~VREF.

    The diodes on the inputs (D1~4) are there to protect the input buffers (U1 and U2) against voltages outside their supply rails. Such voltages might possibly damage the input stages of those ICs.

    Offset voltage adjustment is probably best applied to U3. Many single op-amps in 8-pin packages have offset adjustment capability, usually with a trimpot connected to pins 1 and 8. Google offset null circuit for more information.

    Adjusting the gain of the differential amplifier in real time is not simple. You can make R1 and R2 variable, but they must always be the same value (i.e. they must track each other accurately), otherwise the common-mode rejection of the differential amplifier will be badly compromised and the circuit will not simply respond to the differential voltage. It is probably better to apply gain AFTER the differential amplifier, using 1/2 VREF as the reference point for the amplifier.

    If you want any more specific information, describe your project and your requirements in as much detail as possible.
     
  17. arch

    arch

    2
    0
    Aug 23, 2013
    Hi KrisBlueNZ,

    Thank you for your insights.

    Like the author of the original post, i'm trying to capture the electrical activity coming from plants (both natural and when submitted to electrical excitation)

    As for the design you suggest, this would be for the natural electrical activity as I understand.

    I've already worked with some basic amplifiers circuits and conducted some measurements and found out the resulting signal is easily noisy and requires some filtering

    So, regarding that point, what would you think of updating your design with the following suggestions:

    * Add a low pass and high pass filter (if possible variable) so that signal can be filtered and cleared against unwanted annoying noise.

    * Add the variable gain amplifier circuit after the differential amplifier as you mentionned in your last comment, so that it is a more comprehensive experimental setup

    Thank you again!
     
  18. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,271
    Nov 28, 2011
    Regarding filtering... I'm not very knowledgeable about analogue filtering. What is the nature of the interference? Did you earth the soil that the plant is planted in? Would it be possible to do the filtering digitally?

    Regarding variable gain... Again it might be better to do this in the digital domain. You might need to acquire the signal using an ADC with higher resolution though. What resolution (how many bits) is the ADC you are you currently using?
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-