Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

filtering input for ADC

Status
Not open for further replies.

arhi

Member
I have machine working in dry environment and as there's bunch of moving parts there is a build up of static electricity. I managed to insulate electronics pretty good from all external "interference" but I still have one nasty line coming in. The problem is in a NTC resistor that is sitting embedded in aluminium heater block that can collect some static from time to time. The worst problem is current design that goes like

Code:
3V3
 |
600R
 |
 +-----ADC INPUT ON PIC32MX
 |
NTC 200K
 |
GND

so if the spark from the Al block hit the thermistor leg that is connected directly to ADC input of PIC32MX (that is not even 5V tolerant) I get all kind of weird issues (PC jumps to unknown location, PIC reset, PIC freeze). The WD makes sure no real damage can happen when this happens (except if once I get spark powerful enough to burn the PIC) but I want to solve this as fast and as simple as I can. I have 3 of these circuits going to 3 different ADC inputs.

As the PCB is already laid in and not cheap to change, mine idea was to add, inside the connector something like this:

Code:
3V3
 |
600R
 |
 +----------[ferite bead]---[ + MCP6021  out]--+ ADC INPUT ON PIC32MX
 |                          [               ]  |  
 |                      +---[ -             ]  |  
NTC 200K                |                      |
 |                      +---------Rx-----------+
GND                     |
                       10K (Ry)
                        |
                       GND

Now, questions .. the Rx shoud be 0 in order to have the same voltage on the ADC as there was before this change (but I was never very good with op-amps) anyhow, does anyone have idea if this is viable solution at all - it's not that I can test easily if spark will travel trough op-amp or not .. I also considered adding a 3V zener between +op-amp and GND

So - Any suggestions? Better calculation for Rx and Ry? (I know I suck with op-amps, the little I know I learned on this forum from nice guy's like audioguru, ericgibbs and others :D ) .. better way to filter the input and prevent nasties to kill my pic? all the digital lines go trough opto-couplers but I can't solve this 3 analog ones :(
 
Last edited:
Whats the value of the resistor that is embedded. If it is low ohms and your using a divider to scale it's reading from 0 to 3.3 volts there a simple fix just place a higher value resistor on the adc then the resistor going to ground and ground your pic to the metal your spark will go to ground.
 
Whats the value of the resistor that is embedded.

Except for Rx all values are there. If you ask about resistor in voltage divider with NTC - it is 600Ω.

If it is low ohms and your using a divider to scale it's reading from 0 to 3.3 volts there a simple fix just place a higher value resistor on the adc then the resistor going to ground and ground your pic to the metal your spark will go to ground.

Not really, no, even with 10K on the input the spark still reset's the pic. The pic is on a ground plane, the pcb is nicely shielded, the thing is that this is wire taking a spark directly into pic's adc input. Adding just a resistor does not help (tried already).
 
My recommendation is to look for a Transient Suppressors; Transient Voltage Suppression Diode (TVS) or Metal Oxide Varistor (MOV). These are special clamping components meant just for this. They come in uni-directional and bi-directional configurations, depending on the polarity of the spike. Take a look at Vishay and Murata for some examples.
 
Last edited:
Put a capacitor to ground from the input of the PIC. You want 1 µF or more.

A resistor in series (between the PIC + capacitor and the thermistor) will also help.

These will slow down the response, but as you are reading temperature, a few milliseconds won't hurt.
 
The op-amp won't really help, as it could be damaged as easily as the ADC.

If you have two resistors in series, with a zenner diode in the middle, that is really very robust. It will stand static spikes very well.
 
the idea with op-amp was - I put the mcp602x into a socket and if it dies, I throw it away and put another one :), but I kinda believe the spike won't go trough it... that was the idea anyhow .. but looks like it is not needed (reading all the suggestions here) and that my first idea, that I scrapped as "not good enough" is the way to go?! I attached the initial idea how to solve it (the one I gave up on) - I changed the capacitors to 1uF (initially there were 100n), any suggestions for the R3/R4 values?
 

Attachments

  • screenshot4.png
    screenshot4.png
    12.8 KB · Views: 179
For the resistors you can't go too high since your going into the ADC, but I would start with 1k each and move up to 10k. I'm going to guess the supply for the MCU is not the same as the supply for the heavy machine. You may be also getting some heavy ground bounce (which the TVS won't help with). If this is the case you may want to look at heavier isolation (even optocouplers). At that point having some OPAMP would help, since there are some which are built for this type of things.
 
For the resistors you can't go too high since your going into the ADC, but I would start with 1k each and move up to 10k.

I was thinking about 2k2 for both of them but .. I'm still not sure if this is going to be enough protection...

I'm going to guess the supply for the MCU is not the same as the supply for the heavy machine. You may be also getting some heavy ground bounce (which the TVS won't help with). If this is the case you may want to look at heavier isolation (even optocouplers). At that point having some OPAMP would help, since there are some which are built for this type of things.

rest of the machine work on +-12V, GND is common with the board with mcu, +-12V go to some heaters (controlled by this thermistor) and +12-GND go to bunch of solenoids and unipolar steppers... the problem is that there is lot of "rubbing" (plastic to aluminium, plastic to rubber, rubber to aluminium, rubber to rubber .. ) and that creates a lot of static .. lot of chunks of the machine are earthed but some cannot be ... the control circuit is already separated with opto couplers (so no direct connection between motor and solenoid drivers and mcu exist except that GND is the same)

If you read thread from the beginning, my initial idea was to put op-amp between thermistor and mcu .. thing is the solution with few capacitors and zenner / tvs is something I know how to make (like on attached pic in prev post) but the op-amp solution I suck at big time (I suck at all analog electronics, if it is other then 0 / 1 I'm in trouble)... as for the opto's, I don't understand - are you saying that there is opto coupler that can translate analog signal linearly ?
 
Took a closer look at your initial post and have some questions/comments?

The NTC is tied to +3.3V and GND. Are this the same used for the MCU? If you leave everything in place and disconnect only the NTC connection to the MCU (everything else stays the same, NTC still connected to +3.3V and GND as shown in diagram), do you still have the problem?
 
The NTC is tied to +3.3V and GND. Are this the same used for the MCU?

NTC is connected to 600R resistor that is then connected to Vdd. This is the same Vdd mcu uses. The other side of the NTC is connected to GND, the same GND mcu uses.

If you leave everything in place and disconnect only the NTC connection to the MCU (everything else stays the same, NTC still connected to +3.3V and GND as shown in diagram), do you still have the problem?

No, I don't, but I have to connect a trimmer (10K from Vdd to GND with center lead going to ADC ) otherwise my firmware don't run (as it can't work if temp is not detected) ... So when trimmer is connected (NTC still connected trough 600R to Vdd and GND) there are no resets nor freezes nor any other unwanted behaviours .. I suspected too that maybe a spark could go to Vdd and produce some error but it looks like I have too many capacitors on the power rails that this does not affect mcu.
 
Well, if you haven't tried it yet; then use the 2k2 resistors with the TVS and caps as per your illustration. Out of curiosity, what TVS are you using? Do you have access to an oscilloscope that you can look at the signal going to the MCU?
 
Well, if you haven't tried it yet; then use the 2k2 resistors with the TVS and caps as per your illustration. Out of curiosity, what TVS are you using? Do you have access to an oscilloscope that you can look at the signal going to the MCU?

Ah, I just had idea to do it like that, then decided it's not going to be enough and thought of using op-amp and then I wrote the message here ... so the machine is working with R1 (ntc), R2 (600R) and C1 (100nF) only attm. I do have a scope but the problem is that the signal looks ok for hours at a time so this is not something I can easily catch. I did leave scope running on single trigger once and it did record a spike and the machine was frozen ... but as I mentioned catching this is not simple as I don't have this sparks all the time (nor I have some fancy scope, just on picoscope usb small one and one gw-instek dso so looking for this type of spikes is very hard)... I think I'll try it with 2k2x2 and 3vX zenner, those I have a lot in the house ... in combo with 1uFx2 might get the job done. If you have some suggestion (farnell part number for e.g. :D ) for the TVS, don't hold back :D I only have some in 250+V range so I'll have to purchase them anyhow if I'm to use them.

Even if this solution works, I was still interested in op-amp solution and "would it work" ... so if anyone have something to add, I'd appreciate it
 
If you are using a TVS then consider this.

1) Unidirectional units respond up to 5 X as fst as Bidirectional ones.
2) If the transient is of the load dump variety...then backup the TVs with a MOV rated at a max Vclamp below the max Vclamp of the TVs but above the min Vclamp of the TVs.
3) Place a reasonably fast recovery diode (1n4001 should work or a schottky) forward biased in series with the TVs (rev biased)
4) Place the max resistance that you can in series with the incoming transient.
5) The power MOV acts as a capacitor as well...prob around .001/.002 uF.
 
mosaic, thanks for the info ... I think I will go with schottky and zenner for start as I don't have any tvs at home + this design (if works) will solve the problem without modifications of the current system (both sw and hw). I don't know what the voltage drop will be on the D2 considering it is Schottky and that ADC don't pull much current, so it should be close to nothing but if it is significant I will remove D2 and try with rest of the circuit only... if it does not help, then a more serious thing need to be done as I should solve the problem without having to modify existing board (as many are made, and this protection is part of separate "Break-out board" connecting to original one.
 

Attachments

  • screenshot4.png
    screenshot4.png
    17.5 KB · Views: 180
Depending on your supply, you could connect the fast diode (low dropout) to supply directly (as shown on attachment). This is what most of our low-cost products use. We do use TVS for heftier protection (and when power supply can't take surge - such as lightning applications).
 

Attachments

  • diode_protection.PNG
    diode_protection.PNG
    13.2 KB · Views: 339
What's the importance of D2...do u expect -ve going transients?

The circuit u have there is wrong.

The schottky (fwd bias) is in series with the zener (rev Bias) and this series pair is placed across the ADC/ground lies.
 
As a comment... I was using a dig output to drive a FET via a 1K gate Resistor while also having a 27k/9k voltage divider node attached to the MCU pin. The 27K is fed by unregulated V and the 9k goes to gnd.

At a certain point in the code, the MCU digital Out would be switched to ADC input to read the voltage from the voltage divider.

I observed that I needed at least 30 uSec for the voltage to stabilise, otherwise I got a low adc value. This is in excess of the acquisition delay as stated in the spec sheet. The 27K is also much larger than the max impedance of the pin...so it needed more time to stabilise the local capacitances.


Even a 100V transient on the 27k would be cut to 25V by the voltage divider...which calcs to under 1 mA current for the MCU clamping diode to handle.
Resistors are your friend vs transients.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top