Its a quad op amp… except I screwed up the prefix. It should have read HA 17902P… sorry about that.
I’m using it with a single supply voltage… thought I was going to need +ve and -ve, but with just a single supply, it appears to be doing just what I need. Not sure what the correct protocol is for posting curcuits is… I’ve drawn this as best I can in fritzing. Attached is screengrab of it…
The 3.5mm jack at bottom left is the input from the current sensor - YHDC. The Control and Detect optos are from my main bore pump… which fills my tank. I have NOT SHOWN the VL53L1X distance sensor (on I2C bus)… simply because I haven’t figured out how to do that in fritzing yet but, that is actually the main reason for this project! More on this later…
Hi Trevor.
Well that is a nice change. Someone providing a decent Vcc (12V) instead of trying to make do with 3.3V or whatever is popular at the moment.
The circuit looks like it is will be a half wave rectifier with some gain (R6 and R7) which should be OK. Apparently it does what you want which at the end of the day is all that matters.
One thing though. The data sheet says (for single supply operation) the input should be from -0.3V to Vcc. The -0.3V is the worry. There does not seem to be any internal protection for the inputs so in your case I would recommend a Schottky diode with a foreword voltage drop of 300mV or less connected from non inverting input to ground with the cathode to the IC input (+).
This will clamp negative going signal to ground minus the diode voltage drop thus providing protection for the IC input. The negative going signal might seem small (400mV on your scope screen shot) but there is no guarantee it will stay that way. A Schottky diode is affordable insurance.
Cheers Bob
PS: It would not hurt to put another diode (same type) from + input to Vcc with Anode to + input. This will do the same for excessive positive going signal by clamping to Vcc plus the diode voltage drop. I know the sensor output is only supposed to be 1V but I tend to be a bit over cautious. Don’t like failures at the most inopportune times.
Hi Trevor
What is the actual value of c3. You have shown a polarised electrolytic cap but I would not think 0.1µF would be this type. I would have expected more like 100µF here with about 1k or so in series to limit charging current to a safe value
Cheers Bob
Thanks again Bob… and you addressed a concern I had about putting the negative voltage input on the op amp. I’ll heed your advice!
The smoothing cap is not 0.1 uF… it is 0.1 mF, 100uF. Actually, I put a couple in parallel (I have limited options immediately at hand) Fritzing did not give me the option of labelling it as 100uF… that is why it is rendered as it is. I think R7 is also different - again, limited by the values fritzing gave me. No matter just tweak the pot. The variable resistor value of around 90 k gave me a gain of about 19. Bottom line: measured the voltage presented to GPIO15, it is just fine.
This was all done on my bench, using the 1kW heater as test load. Tomorrow, I hope to be able to test it in the field as it were, connected to my pressure pump, Output from the pump should be lower… but dirtier, than using my 1kW heater. Might be wise to install the Schottky BEFORE I do that, as I guess inrush might cause a significantly higher spike on pump startup.
I so appreciate your help… really great!
Thanks,
T.
The data sheet specifically says -0.3V absolute maximum negative.
You might destry the Op Amp if you don’t.
I certainly would. The inrush current of a motor (AC or DC) could be something like 8 or 10 times the operating current. If you have a figure for the “stall” current that will be close.
That will be 100k. I don’t think 90k is available.
Surely Fritzing gives you the option of changing component properties. If it doesn’t, give up on it. I tried it not long after it first appeared and in about half an hour had it uninstalled and removed from my computer. Have not looked at it since. To draw circuits I use KiCad in my mac and Abacom’s SPlan on a Windows laptop.
It certainly DOES MATTER. When trying to help, ACCURACY is paramount. There is no use publishing any sort of circuit if it is wrong. And when it is KNOWN to be wrong that is inexcusable. That is when I get a bit angry as I don’t like chasing my tail.
C1 (now 100µF) will not do much smoothing. When the op amp output goes positive it will charge up and when the op amp output goes to zero it will discharge back through the op amp. R8 is really doing nothing.
If you are measuring the DC with a DMM at the GPIO input you will be measuring the AVERAGE DC voltage of the rectified sine wave. Measurement with a scope at this input will check this.
A word of warning here. when discharged C1 will be a short circuit to ground and in the initial moment of charging will require quite a large current from the op amp. probably exceeding absolute maximum. The same goes for discharge. This will probably stress the op amp to the point of eventual failure.
If you want a DC voltage to the GPIO input I think you need something like this.
The extra resistor (1k to 10k) will limit the charging current to a safe value and the diode will prevent discharging back via the op amp.and allow the cap C1 to charge to the op amp peak value. This will then discharge via R8 when the motor stops and pulses from the op amp cease.
If you are a bit low on op amp level use a Schotttky diode but if you have some voltage in hand (due to op amp gain) a 1N4148 will be OK.
Cheers Bob
Great to see some discussion/circuit design going on here! Don’t have too much to add in the design aspect, just wanted to give my 2 cents regarding Fritzing.
Haven’t ever used it, so I can’t properly comment on its effectiveness. Personally, I primarily use LTSpice for super quick simulations, and Altium Designer (don’t recommend paying for this, I am a student and get a free student license) when I need some heavy lifting/PCB design. I know KiCad is a fantastic free alternative for PCB design and spice simulation, and have also used EasyEDA for spice sim (supplier component lookup is useful).
Thanks … @Robert93820 I will check out SPlan, and when I catch my breath, other alternatives. I doubt I really need LTSpice…
I think you misunderstood my comment re resistor values… sure it “matters”. I was only saying that a small change in R7 can be compensated for by a corrsponding tweak of the R6 pot… which I have currently got at 90K of the 100K trimpot to give the desired output. If there are other implications, I’m unaware, but my guess is the important bit is the ratio of R6/R7… not so much the absolute values. Happy to be corrected!
Of course fritzing allows you to specify component values, but does not include a full set of resistor values to select in its dropdown to create the designated value text. My actual resistor is 5.1K… fritzing offers 4.7k or 6.8k… There is no 5.6… Yep… weird.
@Zach - thanks for the comments. as a newbie I am still figuring out what tools to use. fritzing seemed to have the advantage of showing both schematic and also breadboard layouts, which seems pretty nice, but happy to explore better alternatives.
Now… I just need my remaining bits on order to arrive (RF transceivers), and I might actually get this project completed!
That is a big jump. I can see your problem if Fritzing only offers a drop down list of values. KiCad lets you completely edit component properties by typing in the value you want. Very flexible.
Yes that ratio sets the gain. With a non inverting situation such as this the gain can never be less than 1. With R6 being 5k1 the theoretical gain (R7 = 100k) would be 20.6.
I have a sneaky feeling that R6 should be equal to R5 for best results. I think this has something to do with minimising any offset currents in the IC itself. Keeping any funnies equal for both inputs. If i get some time I will try to find the info and refresh the old grey matter.
If you increase R6 to 10k to match the gain will reduce to 11. If this is not enough and you need R6 to be 5k1 then reduce R5 to 5k1 to match.
Cheers Bob
Hi Trevor
Add on to above:
I think you can ignore the paragraph above regarding R5 and R6 being equal. I can find no reference to it. The output voltage will always be a value which will keep the + and - inputs equal. So having effectively infinite input Z.
I must have been getting mixed up with the inverting amplifier where a resistor from + input to ground (or reference) could be required under some circumstances.
Cheers Bob
Cool - thanks. Meanwhile, I got some BAT85 Schottky’s this AM, put one across the CT device with NOTHNG else, and set my CRO to capture the startup waveform of my pump (not my blow heater… this is the real deal). See below. It is doing it’s rectifying thing fine… but I am still left with a inrush spike of around 2V. Given my op amp datasheet says +ve input is fine up to Vcc - I believe this is NOT an issue… right?
As a follow-up question… I did wonder if, with the BAT85 in place if I even need the op amp. I’d be putting AC swinging between -0.3 and +2V at startup, and about -0.26 to +0.4V after it settles down, on the Pico GPIO pin, and would then need to detect the pulse (which I can do now
I’m still unsure of how terrible a neg voltage - even a small one - on a GPIO pin is. If its absolutely a no-no, I’ll just keep the op amp!
Negative voltages are considered a no-no in most case but you may get away with it this time. The Pico’s GPIO pins are rated for -0.3V to 3.3V so with the values you are detecting you should be fine considering this range especially if it settles down after startup.
I should have done this earlier… ie, reviewing the notes provided for interfacing the SEN-1105 to an Arduino. Shows a simple method to bias the voltage to the positive. That said… I am not using the SEN-1105 (a current device?), but a similar thing I got from YHDC, a voltage device. I think they have an internal burden resister and a couple diodes built-in.
Probably safest to just use the output from my op amp… I know it will always be positive, and makes reading the on/off status real easy. Which is all I require.
Hopefully, tomorrow I will have it all sorted.
Thanks,
PS… Samuel… where do I find the specs for the GPIO pins , ie the rating from -0.3 to +3.3V?
T.
Hi Trevor.
You still have not said whether you need a steady DC for your output or pulses.
If DC you need the capacitor, diode and resistors as the circuit (hand drawn) I replied earlier.
If you are happy with pulses you don’t need the capacitor or 100k resistor on the op amp output.
The op amp input and gain setting circuit remains the same.
DO still put the Schottky diodes at the op amp input as I described earlier.
Put these diodes right at the input after the series resistor NOT across the sensor. You apparently are not learning much.
I said before NOT to do this as you are upsetting the sensor by putting a short circuit across it on the negative transition. The diode to ground goes AFTER the resistor right at the op amp input to protect this input.
Still using the diode at the op amp output will make sure you get no negative transitions into the GPIO pin.
Cheers Bob
Bob… I believe your earlier comments about not putting a diode across the CT output related to the SEN-11005 device. I am no longer using the SEN-11005.
The YHDC website provides details of two variants of their current sensor… one, which outputs current, I expect is in effect equivalent to the SEN-11005. They also provide an alterntive device, which has a built-in burden resistor plus a transient voltage suppressor, which outputs a voltage. That is what I have.
I (now) could use either DC or a pulse outpt. Our recent discussions about the op amp were based on massaging things to present a DC voltage within the range 0 - 3V DC on the GPIO pin. When I started this journey, detecting pulses seemd just another difficulty, but, I have now achieved this on a separate input (one that monitors my main bore pump)… hence my comment that I could happily work with either.
I understand the role of the capacitor in smoothing the op amp output… I am not entirely clueless!
I have to make another one of these… think I will experiment with shifting the voltage with a summing op amp, but the second unit will be connected to an ESP32… not a Pico, but I expect similar principles will apply there also.
My comments really were not specific to that device. They were directed to putting a diode across anything of that nature without some sort of current limiting resistor. Putting the diode to ground at the op amp input has such a resistor in series with the sensor output as depicted in your earlier circuit. Having the diode directly across the sensor output will stress the sensor winding as there will be a direct short circuit on the negative signal and if this winding is capable of sourcing a bit of current possibly damaging the diode in a cumulative fashion so it will fail at some later time.
I thought that some time ago it was established that the sensors you have ARE voltage output types. It got a bit confusing for a bit.
I said the cap as you drew in your circuit would not do much except maybe exceed the op amp current capability when charging and discharging. It would not smooth the output. It would charge when the output was positive and discharge when the output was zero. The circuit I sketched WILL charge up to the pulse peak positive value then slowly discharge via the 100k resistor when the pulses stop. Discharge via the op amp is prevented by the diode. The GPIO input Z is usually so high it can be ignored. BUT I don’t know exactly what the input Z is and only speaking in general terms so don’t take that assumption as gospel.
I expect they will. The safe bet would be to assume so.
Cheers Bob
All good Bob. Improved circuit as I intend to deploy it below (I also learned how to use fritzing better…). I might play with the value of R10… unless it works just fine as-is.
I have not yet hooked it up and looked the trace on my CRO… been a tad busy with other stuff.
Hi Trevor
That circuit looks OK.
It should give you a steady DC voltage at C1+ equal to the peak voltage found at the op amp output minus 1 diode voltage drop.
The R10/C1 time constant is almost 0.5Sec and an electrolytic is said to be fully charged at 5 time constants so it could take up to 2.5Sec to achieve full value. This could be a bit quicker in practise as you get a bit of a boost with motor inrush current causing higher spikes at start up.
If you are playing around with R10 I would not go below about 1k to keep the charging current through the diode to a respectable figure.
If I get a chance to morrow I will try and simulate that cap charging section using your values and see what it looks like.
Cheers Bob
Thanks. The time to charge is not a concern to me… I don’t need instantaneous results! Checking every 5 or 10 seconds for my purposes would be fine… so once again… all good !
If I can tell if the pump is on or off, without blowing anything up, I’m a winner! The other (main) pump is much the same. I’m checking if my large water holding tank is full or not… not dispensing chemotherapy drug doses! So precision is not remotely relevant. Reliability is…