analog inputs: op-amp - kb1gtt

Hardware inside and outside of the ECU
Post Reply
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: analog inputs: op-amp - kb1gtt

Post by kb1gtt »

Yes I agree greatly with your comments. I once talked with a person who did thermal testing of PCB's for a living. He noted that 1206 sized parts typically had about a 50% failure rate in an industrial temperature cycle. Because of this talk, I try to use 0805 and smaller. I agree that high resistances are easily skewed by creepage, and that it varies based on "pollution" categorization.

I'm almost happy with this input circuit. I'm seeing some great things in a QUCS simulation I did. This circuit maintains a high impedance for a large voltage swing and can step down from 500V down to 5V. The next stage has no effect below 5V and will clamp the signal below 5.3V max. This signal is fed into a programmable amplifier that can bump this low voltage signal back up to ADC levels. The ADC will never see beyond the rails of the op-amp supply. I intend to make a small board and test this circuit out. I'm hoping the MOSFET and op-amp in my simulation are close to what the real world parts will do.

Here's a picture snap shot of the simulation.

Image

Based on this simulation, I created a KICAD schematic. Here's a link to the PDF copy of the schematic. https://daecu.googlecode.com/svn/Hardware/trunk/MCU_pin_protect_PCB_1channel/IO_protect_1x_schematic.pdf

The QUCS and KICAD source files are found here. https://code.google.com/p/daecu/source/browse/Hardware/trunk/MCU_pin_protect_PCB_1channel/

I'm tempted to add an anti-ailiasing filter, and I'd like to add an option to add some bias to prevent issues with op-amp offset. So I'm not done with the circuit, but wanted to toss it out there hoping for discussion.

Also a friend pointed me to this chip https://www.intersil.com/content/dam/Intersil/documents/fn30/fn3082.pdf it's for DMM's and allows + and - polarity readings. The circuit I note above is only good for + referenced to GND.
Welcome to the friendlier side of internet crazy :)
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: analog inputs: op-amp - kb1gtt

Post by kb1gtt »

I posted a PCB layout.

Can I get someone to review this before I order some from OSH park? It would be nice if I can find and remove potential issues before the order. It takes several weeks to get the PCB.

PCB PDF copy found here https://daecu.googlecode.com/svn/Hardware/trunk/MCU_pin_protect_PCB_1channel/IO_protect_1x_PCB.pdf
Welcome to the friendlier side of internet crazy :)
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: analog inputs: op-amp - kb1gtt

Post by kb1gtt »

I guess I'll order the board even though I didn't get any feed back about it. I know there is at least one issue with it, i was hoping someone would make note of that before I ordered it. I guess I'll order in about 12 hours to give people a last opportunity to comment before I spend some $ on it.
Welcome to the friendlier side of internet crazy :)
User avatar
AndreyB
Site Admin
Posts: 14331
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: analog inputs: op-amp - kb1gtt

Post by AndreyB »

I would love to help but that's the area where I am useless :(
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: analog inputs: op-amp - kb1gtt

Post by kb1gtt »

Ordered on November 24th 2013.
Cost 3 boards at $4.10 per batch of three. $4.10

Now I to order the components.
Welcome to the friendlier side of internet crazy :)
User avatar
AndreyB
Site Admin
Posts: 14331
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: analog inputs: op-amp - kb1gtt

Post by AndreyB »

kb1gtt wrote:Cost 3 boards at $4.10 per batch of three. $4.10
No hablo Ingles. Did you say $4.1 for THREE boards? Oh, is it less than one sq. inch? For some reason I was under the impression that oshpark has a 2 sq inches minimum but apparently my brain just made this up.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: analog inputs: op-amp - kb1gtt

Post by kb1gtt »

From SeeedStudio's PCBA, they'll be populating the resistors, caps and screw terminals, providing 2 assembled and 3 bare boards, for $21, plus $10 shipping. Sweet deal :) I still have to populate the op-amp, and a couple items they didn't have in the OSL, however they are populating 11 of the parts and I'll have to do the remaining 9 parts.
Welcome to the friendlier side of internet crazy :)
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: analog inputs: op-amp - kb1gtt

Post by kb1gtt »

Order shipped, yipee! Looks like this will be here before X-mas.
Welcome to the friendlier side of internet crazy :)
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: analog inputs: op-amp - kb1gtt

Post by kb1gtt »

Sweet order recieved. Total lead time from when ordered to when received here in the USA was about 1 month. The assembly time was less than 1 week, and an initial inspection shows they probably did the assembly correctly.

Image

Larger picture found here http://daecu.googlecode.com/svn/Hardware/trunk/MCU_pin_protect_PCB_1channel/pictures/IMAG0018.jpg
Welcome to the friendlier side of internet crazy :)
User avatar
AndreyB
Site Admin
Posts: 14331
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: analog inputs: op-amp - kb1gtt

Post by AndreyB »

Based on your experience, what do you think about the quality of the assembly?
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: analog inputs: op-amp - kb1gtt

Post by kb1gtt »

From an eyeball inspection, I'd say it's good assembly.

These are hand soldered, so assembly quality will probably vary from build to build. However for this board it appears they used enough solder, they did allow it to reflow long enough to bond to via's properly, they either cleaned it, or used a flux free solder so there is no residual residue or anything like that to clean off. They do not have any solder balls to pick off, components are very straight, the PCB seems to be build to be of good quality, same for the silk screen(s). The solder is shinier than what I'm used to seeing with leaded solder, so it's probably lead free, and soldered well. Screw terminal is of good quality. They did not use a solder mask, they either placed the solder by hand like I do with a syringe, or they did it with a wire and then ran it through an oven after, as the solder is lumped as it does when it's run though an oven. Using a solder mask would be better quality. However for a $20 assembly fee, your not going to get a $50 mask made.

All in all, from a visual inspection I'd say it's done well and I'm happy with the craftsmanship.
Welcome to the friendlier side of internet crazy :)
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: analog inputs: op-amp - kb1gtt

Post by kb1gtt »

I finally got to solder it up, only to find I purchased the wrong op-amp, and the op-amp I want is hard to get. To fix this would require a respin, and waiting a month. Blah.

The op-amp I wanted was the SOIC package with this part number, MCP6G01T-E/SN. However I ordered MCP6G01T-E/OT in a SOT-23 package. The SOIC package is hard to obtain, so the board needs to change for that other package. Blah. This is why it's always a good idea to print it on paper then verify the components against the paper copy before purchasing the board.

At least I can start testing the voltage limiting, but I won't be able to test the op-amp gain.
Welcome to the friendlier side of internet crazy :)
User avatar
AndreyB
Site Admin
Posts: 14331
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: analog inputs: op-amp - kb1gtt

Post by AndreyB »

kb1gtt wrote:...and the op-amp I want is hard to get
ops.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: analog inputs: op-amp - kb1gtt

Post by kb1gtt »

I got to play with this a bit. I had a couple small-ish problems. I had to disable D1, as the leakage currents were buggering things. I'll have to hunt for a different diode option. That diode was so that this circuit would protect when the board was not powered, so it's not a huge issue, just nice to have the extra protection. The next issue is that I need to change D2, it needs to be more like 3V instead of 4.096V. Other than that, it seems to be working as expected. I used an adjustable power supply to input a voltage and measured the current. I get to see it shunted almost 0 current all the way up to the cut off voltage, then it started shunting current fairly steeply as the voltage raised. When it was .3V above the cut off voltage, it was shunting about 7mA. Which is fairly good as it was shunting about 18mA when it was .4V over the cut off point. Now if I had used a correct reference diode, I could have correctly set the cutoff voltage to 5V instead of 5.9V.

Here's some data I took.
Image
*** The right top graph is showing that cut off voltage is 5.9V, then at .3V above that voltage (6.2V) it's shunting about 7mA.
*** The left middle graph, shows it shunted very little current until 5.9V.
*** The right middle graph shows that at .4V above the cut off voltage, it was dumping almost 20mA, and raising rapidly.
*** The bottom graph shows the overall picture, just zoomed way out.

I also ran the DSO Quad's frequency response program on this circuit. Basically the DSO Quad sends out a sine wave, then it looks for the change in amplitude and change in frequency and plots each point to show how the circuit under test, manipulates the signal. The quad claims it's fairly good about it's response up to 100kHz.
Image
Here's a snap shot with shorting the leads together. Basically the device under test in the below, was the coaxial cable. This is the same test as the above, but with the quads signal generator and measurement ports connected together.
Image
(Ignore the claimed file name, I can only store one picture at a time, so they all have the same file name.)

As you can see, the tests done with and with out this board, are almost identical. So it appears this board is not shunting AC energy to GND. Which is good. Basically this circuit is not manipulating the AC portion of the signal.

This circuit has nearly no effects on the passing signal, until you exceed the working voltage. Then it will manipulate the signal clamping it to a save voltage. Which is operating just perfect.
Welcome to the friendlier side of internet crazy :)
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: analog inputs: op-amp - kb1gtt

Post by kb1gtt »

I got around to updating this for the second spin. This next one should work a bit better. I believe the above noted issues have been addressed.
Welcome to the friendlier side of internet crazy :)
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: analog inputs: op-amp - kb1gtt

Post by kb1gtt »

I ordered RA.01 yesterday evening. I now have about a month until I get the mostly populated board.
Welcome to the friendlier side of internet crazy :)
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: analog inputs: op-amp - kb1gtt

Post by kb1gtt »

Shipped Feb 21st. With an eagerly awaiting kb1gtt.
Welcome to the friendlier side of internet crazy :)
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: Power supply - kb1gtt

Post by kb1gtt »

Draft 2 PCB received. Now I just need to find the parts that need to be populated. I may have lost them at this point, and I may need to re-order those parts.
Attachments
Draft 2
Draft 2
IMAG0122.jpg (320.96 KiB) Viewed 22692 times
Welcome to the friendlier side of internet crazy :)
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: analog inputs: op-amp - kb1gtt

Post by kb1gtt »

I finally got a chance to solder this thing up over the last weekend. Now I just need to find a time when I can power it up and start testing it. I also installed the wrong D2, so I expect the voltage threshold to be a bit high.
Welcome to the friendlier side of internet crazy :)
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: analog inputs: op-amp - kb1gtt

Post by kb1gtt »

As noted in the first couple posts of this thread, the op-amp offset voltage is blah, which can technically be accounted for in software, but is still blah. Because of this, I've been trying to put in at least some time into researching a better approach for a Programmable Gain Amplifier (PGA). I have recently stumbled upon PGA117 and PGA113 from TI. Their offset voltage is around 25uV instead of 5mV, and they have low long term drift. With a 20X gain, the offset voltage is less than 1 bit of the ADC. So future spins of this board would likely use this PGA113 series of chip, unless someone points me to a better option, or points me to a flaw with this opamp.

I was also looking at the MAX4239AUT with a 3.5uV offset. However I couldn't find a way to make it easily and accurately programmable. So I know that lower offsets are obtainable, but I haven't found one that's also a PGA. Don't forget if you use external resistors, the tolerance stack up in the gain can also be a bugger and can cause the equivalent issue of the offset voltage. Dropping the offset voltage by 10X is worth considering, as that would allow for much higher gains before the op-amp noise causes problems with the ADC. However for now, I can't find better so the PGA113 it is.
Welcome to the friendlier side of internet crazy :)
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: analog inputs: op-amp - kb1gtt

Post by kb1gtt »

I got to do a pile of testing on this board this weekend. The end results are fairly good. There was an assembly problem where D1 was installed backwards, which was easily fixed. After that, there was a problem with the Sallen-key filter, as the current coupled via C3 into the input signal was creating ripple on the output, so I updated the design adding a DNP 0603 which disables that part of the input filter. The files are posted here http://code.google.com/p/daecu/source/browse/Hardware/trunk/MCU_pin_protect_PCB_1channel/ which produce the below.

This is the frequency response when the Quad was connected to the 5V input with a gain of 1X. Sorry the DSOQuad doesn't play nice when the gain is increased, so those pictures aren't posted. This matches the expectations see PDF's in the repo's simulation directory.
Image

This is the frequency response when the Quad was connected to the 250V input with a gain of 50X. Notice that this is almost identical to the above graphic. I would generally suggest using this input with this gain, unless you are looking for smaller signals, or signals over 250V.
Image

This is the frequency response when the Quad was connected to the 500V input with a gain of 50X. Notice the input signal is attenuated significantly, but really isn't all that bad.
Image

This is the frequency response when the Quad was connected to the 500V input with a gain of 1X. Notice the 5V signal is attenuated significantly, which is important as it allows the input signal to go as high as 500V.
Image

I had a problem with the Sallen-key, when connected to 250V input and 1X gain, it looked like this.
Image

However when I added the 10X gain, it looked like this. Basically the energy coupled across C3 over powered the actual signal, as we are dealing with vary small currents. So I simply disabled it by adding R9 a DNP 0603.
Image

The difference with how it reacts now, vs how it would react with the C3 part of the sallen-key is seen below. Notice the amplitude drops faster when above 10kHz, as well the phase shifts more. However when dealing with less than 10kHz, they are almost identical. I would prefer to toss more of the data when above 10kHz as most ADC have trouble with that and there can be issues with fold back and such. However this is a reasonably good filter.
Image

As for the over voltage protection, that was working great as well. I tuned it such that it started to dump .1mA when you hit 5V, and at 4.95V it didn't dump anything I could measure. Then when I was at 5.3V on the input, it was dumping 1.5mA, and when I was at 5.7V on the input it was dumping around 5mA. If you are using the 250V input as I would suggest this is provide over voltage protection of up to about 500V. So I'm quite pleased with that, as it does not dump this energy into the + rail. It goes direct to GND. My only biff with the design is that you need to adjust it manually via that POT. This is required as the MOSFET gate voltage will vary from MOSFET to MOSFET. It would be nice if I could find a MOSFET with a tighter gate voltage tolerance.

All in all, this is turning out to be a very flexible very well protected input circuit, and I would suggest many designs should have it for at least 1 if not 3 inputs.
Welcome to the friendlier side of internet crazy :)
Post Reply