All making sense. I’ll scope it out and let you know my discoveries.
Gerard
All making sense. I’ll scope it out and let you know my discoveries.
Gerard
Hi Gerard
It would be handy if we knew just what the aim is here.
Are you trying to respond to the highest reading like what will happen here .
Or do you want to get an average between 2 sensors which will require a slightly different approach.
Cheers Bob
Hi Bob,
I’m trying to determine an average reading.
With the problem we’re trying to nut out, I went back to basics and just breadboarded an LM324 with a couple of resistors, etc. It’s just a unity setup to keep things simple.
You can see the scope probe on the output. The input are 2 x sensors as per the schematic with 1k0 resistors as per the schematic.
What I noticed is that I think adding 2 x 1uf caps, one to each sensor, has corrected the creeping up problem but I’m wary about stating that definitively as I also suspect that my DVM is influencing this creeping problem. Although the DVM obviously shouldn’t, it seems to! I say ‘seems to’ because I just don’t know.
I think I’m going to give the op-amp away and just send the sensor input direct into the Atmega328 microcontroller. But I hate to give up on it!!!
Gerard
Also, while it should be unity gain, it isn’t. The output is around 2V but the input is about 1.55V.
OK, now we seem to be getting somewhere.
I read up the datasheet on the LM324 and it’s pretty straightforward.
I went back to removing the sensor on the breadboard and put in a simple voltage divider. The op-amp is solid as a rock. Vout=Vin as expected.
Going back to the schematic for the sensor, I thought about what you said about the 1M0 R bleeding the cap (as it should) so I added a 100K to the op-amp sensor input (effectively as a parallel to the 1M0 and now Vout=Vin (although <1V).
With a 2M0 instead of the 100K, my Vin approximates the input signal originally ( circa 1.224V) and Vout is still rock solid.
I think we could be onto something. Some impedance issues maybe?
Gerard
Hi Gerard
With that circuit you won’t.
The output will follow whichever input is the greater.
To average you will require 3 Op Amps. Simple circuit only the Op Amps and 3 resistors. If you are interested I will sketch up a circuit that SHOULD work but it will be untried unless I find some time, space and daylight hours.
You just doubled the time constant (1µF & 1MΩ) so you probably just slowed it down. The 1MΩ resistors are there and connected ate they not?
It will to a certain extent. How much depends on what sort of resistance it is measuring across. Consider it as a 10MΩ resistor in parallel with whatever you are measuring.
An experiment you should do to see what influence this meter has. Measure a voltage source say 5V.
Now put a 10MΩ resistor in series with the DMM. You will now measure 2.5V as the DMM resistance is forming the lower resistance of a voltage divider which is 2 X 10MΩ resistors and you are effectively measuring the voltage at the junction.
You need to be aware of instrument interferences and measurement techniques.
Cheers Bob
Hi Gerard
The probe is effectively the integrator capacitance and thus the triangle wave slope and it follows it will change the peak voltage of the triangle.so don’t fiddle with that. I am assuming that moisture in the soil increases this cap. Have not had any experience with this sort of thing so am not sure.
Adding a resistor across the 1MΩ is shortening up the discharge time constant and the cap may never charge fully. This is shown by the decrease in probe output voltage with 100k across the 1MΩ. I would not fiddle with that as the 2MΩ in parallel reduces the effective R to 666kΩ and will upset probe operation.
Could it be that it could do anything if waving around in the open air with probably minimum probe capacitance. Try sticking into some moist dirt and see what it does.
Get working with 1 probe first.
Cheers Bob
Yes, I get what you’re saying.
I upped the resistors so as to minimise the effect. Looks like 10M keeps the thing tidy without interfering with the on-sensor capacitor charging too much.
As evidenced by the fact that there’s not much difference in the sensor output voltage with the 10M resistor out of circuit or in circuit (a few millivolts) but with the 10M in circuit the op amp behaves itself.
Also, the sensors are in moist soil. They really don’t work otherwise, as I’ve found.
Hi Gerard
The Op Amp itself DOES behave itself. You proved that by substituting a voltage divider.
Those last statements above seem to indicate the 1MΩ resistor IS NOT in circuit. Disconnect the sensor and measure the resistance from signal lead to ground. This should read 1MΩ. The resistor might be there but for some reason not connected. If it was the 10MΩ should not have made a great difference but you say it stabilises everything.
Suspicious what!!!
You will still not read average.
And your Op Amp is still not rail to rail as you will probably need.
Cheers Bob
You are correct. I measured it and R4 (the 1M) on the sensor does not go to GND. The other side does get to the sensor output. Open circuit. I’ll look further into it.
Yes, the averaging is crook and I need a rail-to-rail op-amp. If you can rough up an averaging schematic, I will be most appreciative!
But I can go forward with the coding.
Gerard
Hi Gerard
This MUST be connected or the cap will charge and stay there. If it is not obvious how to do this (it may be there but a track is cut or a link not made, I don’t know) the easy way would be to connect a 1MΩ resistor from “signal” to ground.
I will cook up a circuit tomorrow. It is quite simple but you need rail to rail Op Amps with push pull outputs so it can source and sink.
Cheers Bob
Hi Gerard
As promised here is a circuit which should average the output from 2 sensors.
IC A and B are required to isolate the sensors and provide a source/sink so the following 10k resistors will provide a voltage divider to average the sensor outputs.
If the 2 sensors are both the same there will be no dividing action and that voltage will be applied to IC C. If say one was zero then the voltage at C input would be half what is at the other sensor which is the sensor output plus 0 divided by 2, the average of the 2 inputs. This should follow for all combinations. In theory if say 1 sensor is at 2V and the other at 1V the final output should be 1.5v, (1 + 2)/2.
The switch is included for 1 sensor operation. In this case it should be closed so the same signal is on both channels. If left floating the unused part of the IC could be anything and upset the whole operation. Connecting the sensor to both channels allows the output to faithfully follow the sensor in use.
The LM6484 is a quad rail to rail Op Amp. The data sheet says it will swing the output rail to rail (within a few mV from Gnd to Vcc) with a load as low as 600Ω. This configuration provides a very high input impedance with a low output (about 75Ω I think) impedance so can provide a few mA of output current.
I stress this circuit is untested but I am confident it will do as intended. If I get a chance I will simulate it or I have a couple of ICs so might actually breadboard it and check.
Cheers Bob
PS If you need a bit of gain for some reason do it at device “C”. But do not exceed Vcc value.
EDIT: LM 6484 should be LMC6484. Commonly available, Jaycar ZL3484
Thanks for that. I’ll give it a crack.
Hi Gerard
In the absence of any feedback from you I did get around to building up that circuit above and in case you are still interested it DOES output the AVERAGE of the 2 inputs correctly.
Note:
BOTH inputs have to be connected to SOMETHING for the circuit to work correctly. If one is connected to ground or 0V the overall output would be half the remaining input.
That is why I have included the switch in the case of only one input being available. In that case the overall output would be a repeat of the one input.
Cheers Bob
Hi Bob,
I’m delayed because I cannot obtain these op-amps at the moment. Jaycar are nil stock and I can’t find another supplier.
One other, similar, problem reared it’s head on the same PCB. I’m using a 4013 flipflop and setting/resetting it asynchronously with the CLK and D inputs set to ground. Every time I set it, it would immeditely reset even though the reset pin was low. BUT! When I had the scope on the reset pin, it behaved itself and latched correctly. I ended up putting 100K resistors to ground on both the set (pin 8) and reset (pin 10). Now it’s well-behaved. Some noise creeping in there somewhere.
Gerard
Hi Gerard
Unusual. I did not realise they were so scarce. Depends where you are I suppose. All the Jaycar near me seem to have them although they are listed as “In Store Only”. That is assuming the web site is up to date. This one is my preference as I know it will work down to a low voltage range.
If you have one you could try a TL084 or TL074 although the data sheets seem to differ a bit. One only gives data for ± 15V and at that a voltage swing of ± 13V while another quotes a working voltage down to 4V and rail to rail or within 100mV or so off the rails. These might be the later surface mount types .
Cheers Bob
There is the dual version LMC6482 but you would need 2. I thought the quad would be neater.
There are other types around, particularly if you can handle surface mount. The important bit is the rail to rail capability.
Hey Gerard and Bob,
I must admit I haven’t looked super closely at the specific parameters you need, just wanted to +1 Bob’s recommendation of a TL084 or TL074 as an alternative (And the associated Dual variants, TL072 and TL082). If you have any friends that are music/electronics nerds you may be able to pick some up from one of them. TL072 is basically the assumption for many hobby pedals/pre-amplifiers, generally I’ve had great rail-to-rail performance from them. I have also had good experiences with OP07’s (commonly available). But there may be a specific requirement you need that they don’t fit.
Good luck with alternative op-amps Gerard!
(Your averaging circuit is wonderfully simple Bob, well done!)
Regards,
Zach
Hi Zach
I think the TL07XX series like a few more volts. I have only used them at ± 9V or more. The LMC648X is quite happy at 3.3V.
Cheers Bob
Hi Zac
Regarding OP07. One amp only in package, NOT rail to rail, As a voltage follower will not go to Zero, Range specified 2V to 11V. This application needs to go to Zero.
Cheers Bob