Uncategorized

# How to read 0 -10V Analog Voltage with Lower voltage Tolerant ADCs without a voltage divider

Background Information

I want to implement an ADC as an extension to a Raspberry Pi, so that it has the capability to read analog signals. I will be using the MCP3004/3008, as I got lost in the datasheets of the TI counterparts. And for now, 10-bit resolution is good enough.

I am aware I could use a voltage divider like in here to do this:

simulate this circuit – Schematic created using CircuitLab

The Question

However because this is for a prototype that should be up to industrial safety standards, my boss wants me to isolate the 10 V from the 3.3 V logic. I don’t really know a method to do this though while reading analog signals.

My Google search didn’t yield any answers to me. So I was wondering if there is a method to read analog values, without a voltage divider that is safer to use when reading higher voltages with low logic voltage components. I would use an opto-coupler if this was a digital signal, but I am not sure if there is a way to achieve the same level of isolation while reading analog values. I would appreciate it if somebody more experienced would share his knowledge.

• 3Either build a clamping input circuit, or put an MCU with a 10-bit ADC on the input side and feed a serial stream through an optoisolator into a pi. Or just decide that a pi itself is cheap (and itself ultimately quite unreliable given the SD card) and consider the whole thing to be a sacrificial component in the overall system. You need more specific details of your boss’s motivation to chose a proper solution. – Chris Stratton yesterday
• @TonyM, be careful replacing schematics with images. The schematics provide the simulator link and we can use that to copy and edit the schematic into our answers. I can’t run the simulator on the OP’s circuit now. d:^) – Transistor yesterday
• 2@Transistor made the schematic less… dominant, whilst keeping it editable. – Marcus Müller yesterday
• @Marcus: Using a text dot to force the 640 pixel image width is a good trick. – Transistor yesterday
• @Transistor, I do understand what you mean and you’re right. With this particular one, if you need it simulated, give me a shout and I’ll get my ruler out 🙂 Away from this question, we’re getting a lot of phone-entered questions these days, with massive pictures and a solid lump of text. It’s hard for us to see the flow when we’re scrolling up and down five untrimmed, unshrunk photos of a board plus a giant hand and a lot of floor tiles. – TonyM yesterday
• Thanks for fixing that, good @Marcus… – TonyM yesterday
• 3@TonyM. Another Imgur trick is to add an ‘s’, ‘m’ or ‘l’ in front of the “.png” to force small, medium or large. – Transistor yesterday
• @Emre MUTLU, Execuse me, (1) What is the data rate, 30kps or 30sps? (2) How far is the signal source from MCU/SBC, 30 cm or 30 meters? (3) What is the long term accuracy, 12-bit, 16-bit, or 24-bit?, (4) What is the tolerance and reliability, eg. MTBF or black swan proof? (5) What is the budget, US\$100 or US\$1,000? – tlfong01 13 hours ago
• 1What do you mean by “isolate”? Do you literally need galvanic isolation, or is this something else? – Vladimir Cravero 6 hours ago
• @VladimirCravero When we last talked he wanted me to use optocouplers. But I will have a meeting next week. I made a presentation with the info I gathered I here. I will update the post with exactly what he wanted and why next week. – Emre MUTLU 5 hours ago

However because this is for a prototype that should be up to Industrial safety standards, my boss wants me to isolate the 10V from the 3.3V logic.

I question your boss’s logic when it comes to industrial standards: Where you need that level of isolation, I’d presume you want something very different than a raspberry pi running general purpose operating systems for safety reasons. But I digress.

Basically, isolating an analog signal and still reproducing it with a high number of bits is hard, and nearly impossible when you want accuracy at DC.

What you do instead is usually put the ADC on the unprotected side, and isolate the digital interface to the ADC!

Two ways to do that:

1. Using typically optocouplers to interface your ADC to your MCU. That’s easy with an SPI ADC (by the way, you could at 10 bits also just throw out the MC3004, and use any of hundreds of capable microcontrollers that have a built-in ADC and might make your solution more flexible, but I, again digress).
2. Using an isolated ADC, which does isolation internally.

• It isnt meant as an operating system. It is going to be the “brain” of a Modular Sensory system we are developing for a Pick and Place Machine. It is part of my bachelor`s thesis. I thought so too. But he insisted I look for another solution. I just wanted to be sure before I tell him there is no other solution. – Emre MUTLU yesterday
• Well, again, either you need actual isolation for a meagre 10V rail that goes beyond what a simple voltage divider (maybe with clamping diodes) can do, because you need to adhere to some industrial standards, or you use a raspberry Pi as brain. The combination makes little sense, honestly. Can you write down against which failure you’re trying to protect what here? – Marcus Müller yesterday
• He is scared that because of some fail with the resistors the Module could fry and then the whole thing is kaputt. And if there is a shortcut like that the modules are powerd with a 48V 150W powersupply. So it is very easy for everything to catch fire very quickly. These modules are meant as a replacement to the old ones we developed using beckoff. But there were a lot of cable connections there. With the new modules he wants the whole thing to operate over wifi that is why we use the Rasberries. – Emre MUTLU yesterday
• 2@EmreMUTLU yeah, well then your boss is bad at risk assessment: Bachelor students are awesome (they really are), but the risk of your code malfunctioning vs a high-value resistor divider letting through enough current to damage an ADC which, in itself (datasheet, “absolute maximum ratings”) is ESD-protected is um… ovewhelming. – Marcus Müller yesterday
• I am only the hardware designer. I picked up the ADC myself, I am asking the question because before I even staret he mentioned this and told me to look into it. I wont be doing the coding. – Emre MUTLU 23 hours ago
• 1yes, great, still, you’re the hardware guy, so what hardware risks are you actually mitigating by using isolation here? What specifically is protected against what kind of failure, i.e. under which condition does your isolation actually do anything that you need? – Marcus Müller 23 hours ago
• For example, now you’ve isolated the path where there’s high resistors in series, anyways, so even if one side sees a high voltage, only a small current flows (what happens if your resistive divider sees 1 kV instead of 10 V, like really? Yes, a whopping 200 mA flow, for a very short period. Increase both resistors by a factor of 10, and you’re mostly fine. I don’t see how that causes a fire!) Do you have the same isolation in the power supply? What use is isolating this here if that’s not the case? – Marcus Müller 23 hours ago
• I didnt decide on anything yet. I just want to be able to justify my position when asked why I have made a certain design decision. As I said this is also the topic of my Bachelors thesis, we have weekly meetings. And I cant really dismiss the opinion of my boss as you may understand. – Emre MUTLU 22 hours ago
• I am propably going to insulate the I2C bus with optocouplers. As you said it is a better idea to insulate the digital interface. – Emre MUTLU 22 hours ago
• again, isolation isn’t solving any problems that actually do exist here, almost certainly. Pinpoint one realistic problem you’re solving by isolating this one voltage. – Marcus Müller 22 hours ago
• I will ask him why he wants me to isolate the two voltages next week in our meeting. I dont really have a pinpoint understanding of the overall system. I am just tasked with developing the pcbs for the Modules, not the rest of the machine. Like I said I can’t just make these decisions on my own. If it were for me the first thing I thought was to use a simple voltage divider, so I cant really produce a counter thesis to a statement I initially agreed with. There must be a reasoning behind his demand. – Emre MUTLU 22 hours ago
• 2To second Marcus’s point, your bachelor’s thesis relies on you having a pinpoint understanding. You’re the hardware designer, so you need solid requirements including the reasons for them (your final report will most likely list those requirements in detail as the first chapter after the introduction), and you can make decisions on your own if you know the requirements. Get serious about understanding the system, because if you can’t explain your hardware to the examiners, you likely won’t be awarded your degree. – Graham 11 hours ago
• @Graham I meant the P&P machine… My bachelor thesis topic is the pcb development for these modules. If I were to pinpoint understand the whole machine that wouldnt be a bachelors thesis, not even a master thesis that would be the subject of a doctorate thesis. As the base machine we are building on top of was. I am pretty sure I will be awarded my degree, my examiner & boss are the same people 🙂 – Emre MUTLU 10 hours ago
• @EmreMUTLU but as PCB designer, you need to understand your requirements. All you got was a frankly vague and unsensible direction of your boss, not an understanding what you need to design to protect what against what failure. That’s the lack of understanding. – Marcus Müller 9 hours ago
• Which I will ask him to expand on next week, all I got in the beginning was a Table of Input/Outputs and a direction from him. And before I told him anything I wanted to have an idea about what I could do to meet his demands. And now I have a starting point thanks to the answers I got here. – Emre MUTLU 9 hours ago

I would use an opto-coupler if this was a digital signal, but I am not sure if there is a way to achieve the same level of isolation while reading analog values.

There is a product sold as a “precision linear optocoupler” for this purpose. Basically this is an optocoupler with one transmitting LED and two receivers. You use the second receiver to provide feedback to an op-amp circuit on the transmit side of the circuit to linearize the optocoupler response.

(image source — be aware that this specific product is obsolete)

I haven’t used these parts enough to know how difficult it would be to achieve 10-bit accuracy when using them.

However, based on your comments to Marcus’ answer, it seems like what you really need is not galvanic isolation but simple input over-voltage protection. You could achieve this with a simple zener diode limiter, for example:

simulate this circuit – Schematic created using CircuitLab

Now if we pick an 8 V zener (for example) it won’t interfere with the ADC voltage under normal conditions, but it will limit the voltage delivered to the ADC under fault conditions to 4 V through 1 kohm, which can be handled by the over-voltage protection circuits of typical ADCs. When the fault occurs, the zener will need to absorbPZ=(8 V)48−82kA=160 mWPZ=(8 V)48−82kA=160 mWwhich is an easily obtained rating.

It’s possible you actually need both isolation (to protect against common mode transients up to 100’s or 1000’s of volts, which may occur in circuits connected to motorized machines) and over-voltage protection (to protect against your 48 V supply shorting to this analog signal), in which case you might want to use both the zener and the opto-isolator (probably with the zener circuit protecting the input of the optoisolator circuit).shareedit  follow  flagedited yesterdayanswered yesterdayThe Photon110k33 gold badges137137 silver badges258258 bronze badges

• Thanks a lot, just learned something new. I will look into it! – Emre MUTLU yesterday
• @EmreMUTLU: Your boss is smart to isolate the inputs. This is standard practice on industrial PLC analog inputs. – Transistor yesterday
• @Transistor, in another comment it was mentioned the reason to use the RPi is to communicate with WiFi from the “module” to wherever the signal goes. That will provide “substantial” isolation already. Admittedly it’s not very clear exactly what OP or their boss really wants or needs and what faults they are protecting against. – The Photon yesterday
• @ThePhoton Didn’t know there’s linearized optoisolators! But you’re right to mention that their utility here might be limited: little help if you isolate a signal, but fail to isolate supplies. – Marcus Müller 23 hours ago
• 1Personally, I’ve recently dealt with IL300. As long as that circuit works correct, there are lots of problems with calibration. ICs may come from different production series. Different currents, sensitives, temperature dependencies. Callibration is not so easy. – Marco Svizzeri 8 hours ago

I suggest using an ADC + MCU or maybe an MCU with an onboard ADC and transmitting the data digitally over the isolation barrier.

Analog methods are possible (transformer methods are usually better than optoisolator), but it’s difficult not to significantly compromise even a 10-bit ADC.

If you want to avoid the MCU, you can find a single-chip solution to isolating the I2C bus and use an I2C ADC chip. No extra programming then.shareedit  follow  flag answered 23 hours agoSpehro Pefhany268k1111 gold badges224224 silver badges558558 bronze badges

• @EmreMUTLU Well, they claim their own product (which I have specified) works fine, and that’s been my experience. – Spehro Pefhany 23 hours ago
• 1I deleted my comment. Because on the next page they say theirs worked fine. Thanks this will be very usefull. – Emre MUTLU 23 hours ago

Another option not mentioned above are “isolation amplifiers”. They come in a couple of different flavours, but essentially act as analog buffers with isolation between the input and output. Really simple to implement, can have mediocre to excellent accuracy, can be expensive.

However because this is for a prototype that should be up to industrial safety standards, my boss wants me to isolate the 10 V from the 3.3 V logic.

Your boss is half right. They really should be insisting that you get rid of the Raspberry Pi entirely. This is not an appropriate piece of equipment to introduce into an industrial environment. It also does not make sense to prototype using this as a platform. It is not an industrial tool – full stop. Whatever proof of concept you develop with this prototype would need to be re-engineered from the ground up if it worked, so why not prototype with something that doesn’t require you to prototype twice?

The correct tool for the job would be an industrial PLC with an appropriate analog I/O module. 0-10V is a ubiquitous industrial standard. You can get cheap PLCs in the \$100 range and they ALL will support 0-10V I/O with proper isolation and protection already built in. There is absolutely no reason to go to cheap hobby toys when you are developing professional solutions. They don’t interface without a hack because they are not intended to ever be used in the same environment.

Industrial environments, further, almost exclusively work on 24VDC control logic. The RPi’s 3.3V and 5V logic are simply incompatible, so to even interface this to most industrial systems you would also need a 24VDC power supply and isolation relays between all your discrete I/O also. It doesn’t need to be stated how silly this would be.shareedit  follow  flagedited 7 hours agoanswered 9 hours agoJ…78444 silver badges1111 bronze badges

• That is against the whole point of the prototype. We were using a PLC before. But it wasnt wifi integrated. The new generation of the modules, should have wifi connection possibility and PLC interface. That is the whole point of the reasearch we are doing. Eventually we want to develop our own PLC. I think I should have clarified that I am working for a R&D Institute in the beginning. My bad. – Emre MUTLU 8 hours ago
• What part of eventually dont you understand? If it were so simple there wouldnt be what 4 different proposals from multiple people. It is a proof of concept & the rasberry pi was chosen by my instructor with a doctor title… – Emre MUTLU 8 hours ago
• @EmreMUTLU A PhD isn’t a ticket that automatically makes someone correct. Your boss is concerned about industrial safety (and, by extension, ipso-facto, reliability) but also seems OK with using an RPi. These are incompatible views. It’s one or the other. Selecting an RPi and toy electronics is unlikely to ever result in a device that is broadly suitable for industrial application where safety, noise immunity, robustness, and reliability are important. – J… 8 hours ago
• The new rasberry compute module is a good alternative when you are going for network integration. If you have another proposal what to use instead of the pi I am all ears. – Emre MUTLU 8 hours ago
• 1Silly us actually that was exactly what we were thinking of doing. – Emre MUTLU 8 hours ago
• I ll send you a copy of my thesis when I am done with it no worries 🙂 – Emre MUTLU 8 hours ago
• @J… I have before me a Pi that I’m setting up to be the control system for an instrument that is intended to go to the Moon. That doesn’t mean I intend to deploy a Pi on the Moon, it just means that I’m working on other parts of the system, and the Pi allows me to avoid addressing the hardware details of the digital controls at this point. When I’m done with this round, I will have elucidated the requirements for the digital controls, based on actual operating experience with the instrument front end. I’ll be able to direct an FPGA designer to design a Pi replacement. Prototyping… – John Doty 4 hours ago
• @JohnDoty Sure, and I’ve done much the same. I’m sure you’re not approaching this from a level where you’re struggling to understand how analog signal conversion works, and you’re also not worried about the shortcomings of the Pi because it’s not intended to ever be part of your final solution. Here OP’s boss IS worried about industrial reliability and OP seems to be struggling to mitigate those shortcomings in a way that suggests the Pi is intended to be part of the final solution. There’s a significant difference. You’re using the Pi as a development tool – it’s not a design subcomponent. – J… 3 hours ago
• @J… If the final system needs isolation, putting isolation in the prototype may make good sense as part of the development process. My prototype Lunar instrument has various features a benchtop instrument doesn’t need, even though it will never operate outside the lab. For each stage of development, you choose the problems you need to address. Isolation fixes some problems, causes others, maybe you want to see if the others will be trouble. – John Doty 3 hours ago
• @JohnDoty Sure, but if that was the only question then this doesn’t have anything at all to do with an RPi – it’s just a question of how to isolate a signal, whether it’s the RPi consuming it or a proper analog module. OP apparently already understands how to make a divider to drop the voltage range, and it would be silly to implement the isolation with a 10->3.3V conversion when you could simply do a 10V to 10V isolation (assuming a sane final design withoun an RPi) and then the 10V->3.3V is just a divider hack applied to the (properly) isolated 10V/10V signal for testing purposes. – J… 2 hours ago
• @Emre MUTLU，You do make me laugh. Your Dr Boss should at least consider CM4, which is sort of toy upgraded pseudo industrial. – tlfong01 38 secs ago   Edit