Optoisolate analog input on arduino?

Hello again,

since i'm quite a beginner in this stuff i'm not sure if this question is even sensible, but still: :slight_smile:

I have a somewhat silly situation in my current prototype project. I have a temperature sensor that goes to the arduino analog input and it is powered externally by a 12 v supply. However the input voltage is from 1 - 2.5V in the mV resolution (5-10 mV).
The arduino is powered separately by a different supply and the peripheral attachments (dc motor, leds, ...) also by another separate supply.

I learned the hard way that having so many different supplies can lead to electrical loops (and grounding) complications since they can interact with each other in a way i don't fully understand. :smiley:

Obviously the most sensible thing would be to tidy up the connections, something i plan to do in the final version, but i'm curious:
Is there a simple way i could optoisolate the analog input to the adruino that would actually be sensitive enough (5-10mV range)?
From what i read optocouplers are in general meant for switching not analog signal transmition. I'm thinking along the lines of using a transistor amplification but i'd like to keep it as simple as possible. Would a photodiode+led cut it?
Oh and the input signal is all relatively adjusted, so i'm not looking for absolute accuracy.

Thank you for any comments/help and patience. :slight_smile:

I learned the hard way that having so many different supplies can lead to electrical loops (and grounding) complications since they can interact with each other in a way i don’t fully understand

Your best bet it to learn to understand them. It is not difficult, most of the time it is keep the grounds ( negative ) common and don’t common the positive leads.

Would a photodiode+led cut it?


The problem with an opto transferring an analogue value is that the transfer function ( what goes in against what comes out ) is not at all linear. The best way to linerise it is with feed back on the opto isolator going into an op amp. You need a special sort of opto to do this. It has one LED in it and two opto receptors. The sort of thing is shown in the photo in the attachment.


I suspected it wouldn't be straightforward. :slight_smile:

It would be better to figure out all the connections yes.

Thanks anyway for the info.

If all these supplies are from the same mains input in the same enclosure, can you not
just star-ground all their 0V outputs together? Star grounding means a single common
point for all the circuits and supplies using ground - so no loops.

Its having big loops where two supplies have earthed grounds coming in on separate
electrical outlets that the problems happen, as such a loop will pick up induced noise
and experience noise currents.

Something like this can be used:


I admit i don't know fully what is going on in the system. An adapter is powering the arduino (the adapter has no earth ground just Hot/Neutral leads). The peripherals also similar. The "temperature sensor" has another separate PSU that is earth grounded.

I can't recall exactly right now what i did, but i remember something along the line, if i had connected the GND sensor input to the arduino gnd pin, things went haywire. The peripheral transistors would turn on (guessing the loop went through the analog input to the digital outputs, which lit on the transistors).
To be honest, it's quite a mess and i'm amazed i didn't melt the arduino by now. Once i noticed that 7.5V were somehow delivered to the analog input, which during normal operation never goes beyond 2.5 volts.
The peculiar thing is that 7.5V is exactly the voltage of the peripheral power supply.

So yeah. There are unwanted loops running around. But i haven't yet systematically dealt with the problem. For now it seems that i can power the arduino and the sensor from one supply, and the peripherals from another without problems. My goal is to power everything from just one supply.
In the worst case scenario i plan to optoisolate the peripherals because i suspect the problem lies somewhere there.

I'm really impressed with the arduino for taking so much abuse and still working properly. Learning by the trial and error method in electronics can get quite expensive. :smiley:


Thank you, i'll take a look.