I have a self designed pcb that has 150 ohm resistors in parallel with the analog pins of the electron and negative. I have a two wire 4-20ma pressure transmitter that has a separate 24 volt supply with the negative of the 24 volt supply tied to the negative of the 5v supply which supplies the Vin on the electron. I believed that 4-20ma should translate to 0.6v to 3v. When I tried using the sensor it now looks like I ruined the analog pins that I tried hooking the sensor to, and now, whenever I have the five volt supply on to the electron I always have a constant 3.1 volts on the analog pins that I tried the sensor on. Any thoughts on what I did wrong? I can’t seem to see any error and I think I have 3 ruined analog pins so far. Here is the transmitter https://www.automationdirect.com/adc/Shopping/Catalog/Process_Control_-a-Measurement/Pressure_Sensors/Pressure_Transmitters/Ceramic_Sensing_Element-_M12_Cable_Connection/PTD25-20-0100H
Have you measured the voltage at these analog pins with the Electron removed from the PCB? Hopefully they are under 3.3V. Just using a resistor in parallel should be the simplest way to convert the current to a voltage, however if you used small SMT resistors I can see a failure case.
4-20mA through a 150 ohm resistor would dissipate up to 60mW of power. If the resistor was undersized it could fail open or higher resistance and cause a larger voltage to be present on the analog pin.
There is also a version of the sensor that outputs 0-10V instead of current, so double check that.
You are doing well to have the 150 ohm resistor on a PCB. This minimizes the chance that the resistor would become disconnected easily which would be bad (potentially applying a high voltage to the analog input).
When attaching long cables to external sensors, it can be a good idea to try to provide some protection from ESD as well. Since you have a direct connection to the STM32F205 without any series resistance, any ESD event on that wire will be applied in full to input. The MCU pins can only handle 2kV.
You could look into providing a 4-20mA current to voltage converter on your PCB as a buffer, and more precise way to convert the current to a voltage over a temperature range. There are IC’s made specifically for this.
Also it could be quite easy to reverse the current on these sensors, producing a negative voltage to your ADC input. That and other failures can be prevented with protection circuits specifically designed for 4-20mA current loop inputs
thank you for your reply.
I verified the pins have 3.1 volts, so yeah they must be damaged.
It's actually through hole resistors, 1/2 watt so they should be well within the limits.
I have verified the sensor part number.
what would those ICs be called? Looks like I need to find a different way to do this. I have used different resistors with this pcb and sensors that output 0-10 and 0-5 volts and jumper settings for different voltage dividers and they work correctly.
That is the original circuit with a jumper which when connected to 3 would be for digital input, 5 for a 5v analog sensor, and 10 for a 10 volt analog sensor. I know most sensors use 4-20mA, so I changed the 10k resistor to a 150 ohm resistor and the jumpers are set to the 3 input which I thought should have worked. Also I know once I do this the 5 and 10 volt dividers wont work. the resistors for those circuits are not even in since using the 150 ohm resistor.
To clarify what I mean, remove the Electron from the PCB and verify the voltage in the socket. The voltage produced by the 150 ohm resistor.
"Current Loop" products, devices, ICs, circuits, etc..
I did that just now. With the pump off it was 0.601 volts as expected. I turned the pump on and closed a valve down to bring the pressure up and it went up to around 1.1 volt. These numbers shouldn't have damaged anything. I guess I'm not sure what I have wrong. I also simulated the sensor on a pin that isn't damaged with a 4-20mA simulator fluke I have and it worked as expected and tracked accordingly and didn't ruin the pin. Either way though, those voltages I have with the electron removed shouldn't be a problem, so I'm not sure what goes wrong with the sensor connected.
I would monitor the output of the 150 ohm resistor with an oscilloscope for a while looking for peaks above 3.3V. Just set the trigger to NORMAL mode and threshold at 3.5V or so, acquisition mode PEAK DETECT.
It would also be worth adding protection to these inputs since clearly something is damaging them. A 3.3V zener or TVS diode might be a good first choice. Also clamping diodes (schottky) to the 3V3 and GND rails would be helpful. These are components you might even have laying around.
I don’t have an O scope yet, but it looks like I need one. I never added protection to my pcb as it’s original purpose was for voltage output sensors and I was trying to improvise for a 4-20mA sensor without a new pcb. Guess I might need a new board after all, as most of what I will be using is 4-20mA. Thank you for your help I will try to borrow a scope and see what I can find.
save yourself the time and get this
I use it for tons of 4-20 sensors and it works great. super simple too. Might not fit your scenario perfectly but it works very well!.
Thanks for the suggestion, though I think that would get expensive real quick for the 14 analog inputs I have
@BDub sorry if this seems newbie, it’s been a decade since my electronics courses, but would this be adequate for protection?
A unity gain follower is a “buffer”, but depending on the failure mode it might not be the answer. The big thing you are concerned about I think is making sure it can tolerate excessive voltage without passing it on to the output. If for example you powered it from 3.3V and it was a rail-to-rail amplifier, it would die pretty quickly if you applied 10V to the input. But then the question becomes in that failure mode would the 10V be applied to the output? Because the components inside your typical op amp are bunch of chained emitter follower transistors, it’s very possible that during a high voltage failure the output sees 10V as well.
I think the answer is that you need to protect against all of the failure modes specifically. The current limiting resistor in series to a pair of clamp diodes should work well enough for over voltage, but reduce some of your accuracy. You can get amplifiers with these features built in. but I’m not sure what the cost tradeoffs are (I’m assuming they are more expensive).
Just for a follow up, I added this to my circuit and it eliminates the inrush spiking.
I understand there can be some lag in the input with this setup and missed data, but that quick of readings is not imperative in any of my applications and it is less than half a second.