Using opto couplers for isolated voltage measurement? - Page 1
Forum section: electronics / projects

author: Red Squirrel
author_rank: Super Contributor
timestamp: February 19, 2023, 11:34:11 pm
content: Been thinking of setting up a proper monitor for my solar setup so I can automate turning the inverter on/off based on the state of the battery, as well as the solar output. Ex: turn off inverter if battery voltage goes below a certain point. The state of solar input power would also influence when to turn inverter back on. I want to take both voltage readings in an isolated state to play things safe. In theory I can do this using only the battery voltage and forget the isolation as the relays would isolate the setup from everything else, but I'm thinking with monitoring solar too I can get a bit more smart. I know the voltage of a solar panel is a very poor indicator of actual power but it can still give a half decent idea that at very least power is being produced to some degree.My train of thought is to setup a voltage divider to ensure that whatever max voltage I expect to see is lower than the max of what the opto coupler can take. I understand I'm probably not going to get a very linear reading out of this, but will it at least be consistent? Or can it vary based on various parameters such as temperature?Failing that I am open to other simple options to do an isolated voltage measurement such as purpose built chips. My quick search has found some but they seem to require an isolated side power source, so it almost defeats the "simple" part as I still need to then wind a transformer and do power electronics etc... not 100% opposed to doing all that but looking into what my options are to stay simple, first.

author: alm
author_rank: Super Contributor
timestamp: February 19, 2023, 11:47:56 pm
content: There are analog opto-couplers that you can buy. They used to be somewhat common back when ADCs were expensive, so you tried to multiplex all signals in your system to a single ADC. But now, why wouldn't you stick an ADC, or even a micro-with built-in ADC, on the other side and isolate an SPI/I2C/UART signal? Either power it from a small battery or from the solar power using a buck converter.For normal opto-couplers I would be worried about temperature stability and drift. Analog opto-couplers will have a mechanism to compensate those.

author: moffy
author_rank: Super Contributor
timestamp: February 20, 2023, 12:03:37 am
content: Isolation amplifiers might be a straightforward way to go e.g.:https://toshiba.semicon-storage.com/info/TLP7920_datasheet_en_20160523.pdf?did=30395&prodName=TLP7920available from digikey.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 20, 2023, 12:34:47 am
content: I was gonna say, you can get S-D DACs very cheaply these days, pair that with a regular isolator, more or less of whatever type you like (low bandwidth --> low clock rate will suffice). But moffy beat me to it with the integrated version.Tim

author: Red Squirrel
author_rank: Super Contributor
timestamp: February 20, 2023, 01:27:53 am
content: Yeah going with that is my 2nd option but that still means I need to build out the isolation circuitry to run power and data to it. While thinking about it, it occurred to me I can just use an opto coupler directly, maybe. I might still end up doing the dac/mcu approach in the end but curious about simpler ideas as well. Temperature drift may be an issue as mentioned though. This setup is going to see temps that range from -50 to +50C at the worse extremes over an entire year, since it's in a non insulated shed.The TLP7920 sounds interesting, and is probably a better version of my idea while basically being the same but more purpose built, so maybe it will have a better linearity and temp stability. If I'm reading the datasheet graphs correctly it looks like the deviation with temp is fractions of a volt, so it won't be bad enough for my use case. Though I guess that gets amplified by the time I'm working with the data.Either way it's good to see different ideas. I haven't really experimented yet with any of them yet so that should probably be my next step.

author: dobsonr741
author_rank: Frequent Contributor
timestamp: February 20, 2023, 01:47:15 am
content: You can get ready made and cheap ADUM3160 based USB isolators. Plug in your fav MCU with its onboard ADC, add input protection and start measuring! If concerned about the isolation check the PCB for the correct gaps. The usual DC/DC converter and the ADUM isolator spec’d for >1000V. Repeat as many observation point you need.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 20, 2023, 01:50:25 am
content: If you have the means to calibrate the opto's transfer function moments before/after use, you could. Perhaps with a HV switch mux (lots of MOS type SSRs, or relays proper)? You could hook it to a DAC briefly and perform each measurement basically by nulling against the reference, then reading the value off the reference.It's not possible to calibrate once, because CTR and offset drift with temperature and age. CTR is also dependent on current, so it's no good as a proportional reading -- a two-point calibration will not suffice, at least not over more than a narrow range. (Then again, maybe that's okay for tracking batteries. Then again again, just subtract a fat offset off the top in the first place and put all those ENOB into the actually usable battery voltage range, eh?) Three points, perhaps. But you might as well do the whole range and a suitable (3-5 order?) polynomial fit, say, or skip it altogether with iterative nulling like this.At that point, you're probably putting together enough stuff that the iso amp looks tempting.Also, if it's going into an MCU anyway, no need for analog output, the bitstream will do; it could be an SPI or I2C ADC with suitable isolation, or fewer channels (CLK and DAT I suppose; maybe CLK can be built-in and DAT can be self-clocking) for S-D. (I used an AMC1035 this way, for a thermocouple receiver, a couple years ago. Not all MCUs may be able to easily receive/decode/decimate a S-D bitstream; I used an AVR-DA with some CCL to latch in and gate the data, and TCA to count the active bits.)Tim

author: Red Squirrel
author_rank: Super Contributor
timestamp: February 20, 2023, 06:00:55 pm
content: Looking more into it I may just go with the isolated ADC route. Found this:https://www.digikey.ca/en/products/detail/analog-devices-inc-maxim-integrated/MAX22530AWE/13985700?It's 4 channel but I think they all use the same ground ref so I would still want multiple of these for each measurement.

author: uer166
author_rank: Super Contributor
timestamp: February 20, 2023, 06:32:38 pm
content: Do you actuallyneedtrue galvanic isolation? Or do you need isolation for safety (shock protection; e.g. reinforced isolation). If only the latter, nothing wrong with 2 resistive dividers to PE (ground), and an ADC on that referenced to PE. Something like 6-8 1206 packages and a total resistance of 1+meg can be considered reinforced for 400VAC 3 phase mains in a benign set of conditions. It's likely to be the cheapest way, and possibly the most idiot-proof as well.

author: switchabl
author_rank: Frequent Contributor
timestamp: February 20, 2023, 07:26:08 pm
content: There are specialized opto-couplers for linear analog applications (Agilent/Broadcom HCNR200/201, Vishay IL300, IXYS LOC11x). They contain an additional matched photo-diode on the TX side that is used to stabilize the LED. See page 12 of theHCNR200 datasheetfor examples. It needs an additional op-amp (or at least a couple of transistors) on the TX side. Is it worth it? These days, usually not. I always thought it was kinda neat though.

author: Kleinstein
author_rank: Super Contributor
timestamp: February 20, 2023, 07:38:11 pm
content: Modern µCs / ADC need little power (e.g. <<1 mA). Chances are one would take the power to measure the battery state from the battery. If needed a normal opto coupler could turn on the ADC if needed.For the solar power, a hall sensor at a cable may be the better way to get an idea in the current. This signal is isolated by design.

author: Benta
author_rank: Super Contributor
timestamp: February 20, 2023, 07:59:59 pm
content: Try looking at the HP/Avago/Broadcom optoisolated sigma-delta converters. Yes, they also need a primary-side voltage suplly, but apart from that are a very nice solution:https://www.broadcom.com/products/optocouplers/industrial-plastic/isolation-amplifiers-modulators/sigma-delta-modulators

author: Doctorandus_P
author_rank: Super Contributor
timestamp: February 21, 2023, 12:58:35 am
content: What sort of solar installation is this?If it has a 600Vdc or so bus, then be very careful with that.My first go would be to have a look at the inverter for diagnostics output.Instead of measuring voltage, measuring current may be an option. Something like the ACS711 which has a copper wire near a HALL sensor, and is therefore inherently isolated (The 711 is a low voltage variant, but there are similar with higher isolation voltage and with different current ranges). You still have to break the DC circuit to insert such a sensor. Connecting a HALL sensor to the existing cable is also possible but it probably has a lower accuracy. A clamp meter like the Uni-T UT210E can measure DC currents with a resolution of 1mA, You could hack it into your setup, but it's a a bit expensive if you only use it for that. Grinding a slit into a ferrite core and inserting a simple analog HALL sensor is also a possibility.An old fashioned way is to use a voltage to frequency (or PWM Dutycycle) and push that through an isolation barrier. But as has been mentioned before, it's more common these days to have a microcontroller on the sensing side and first digitize the data, and these are available in quite thin DIN-Rails mountable standard packages too if you don't want to re-invent this wheel.Another option is to not connect anything to the solar panels at all, but just use an external light sensor.

author: Red Squirrel
author_rank: Super Contributor
timestamp: February 21, 2023, 02:52:52 am
content: This is a smaller setup, so output is under 100v. It gets close but it's under. Inverter does not have anything fancy like diagnostics, it's just a standard inverter. To turn it on/off I'm actually going to have a relay to jumper the on/off switch to simulate pressing it.And yeah for the solar side measuring the current would actually make more sense and work for my case so that saves one sensor from needing to be isolated. Come to think of it if I want to simplify this further I can just reference the micro controller and RPI (will provide IP access and logic control for the relays) ground to the battery and not even isolate the voltage reading of the battery either... Maybe that's the route I will go now that I think about it.At some point I actually want to experiment with ethernet for this sort of thing, each sensor would be POE powered and use an ethernet phy/magnetics and my own custom protocol, and by nature would be isolated as well. For this particular project I'm keeping it simple though.

author: GigaJoe
author_rank: Frequent Contributor
timestamp: February 21, 2023, 05:01:43 am
content: im wondervoltage to freq - tranformer - freq to voltagewould make sense?

author: DavidKo
author_rank: Frequent Contributor
timestamp: February 21, 2023, 10:28:37 am
content: What about using some cheap USB volt meter and ADUM3160 USB isolator (they say 1500V)? To improve the safety you can use 500V TVS diode on the voltmeter input.

author: jonpaul
author_rank: Super Contributor
timestamp: February 21, 2023, 11:58:18 am
content: easiest way buy a solar monitoring system, includes CT, isolation, data TX, apps.Solar power distribution firms should have them.j

author: Red Squirrel
author_rank: Super Contributor
timestamp: February 22, 2023, 12:24:13 am
content: I don't want something proprietary. Especially not stuff that requires apps. I rather have access to the raw data so I can do anything I want with it.I think I'm just going to go with the hall effect sensor idea for the solar side as measuring the current will work for what I want to do, and then not worry about isolating the battery side, as the entire setup can still be isolated from everything else by being powered by a wall wart or even straight from the battery itself. At some point I may actually tie everything to earth ground anyway as that's probably how it should be, but I just don't want my MCU to be that path so that's why I'm isolating it.I may still revisit the other ideas eventually though as a way to measure voltages with full isolation can be handy if you want to measure multiple voltages from one device that may be referenced from a different ground.

author: max_torque
author_rank: Super Contributor
timestamp: February 23, 2023, 09:06:21 pm
content: Solar voltage is completely irrelevant, what you need to know is battery charging current! That's easy with a non-contact hall sensor of some description (many different options)Hopefully you are using some form of MPPT controller between panels and the battery, so if you know the battery voltage and the charge current then you know the charging power where it matters ie at the battery. TBH, i not sure what that helps with unless you want to coulomb count to get a total energy figure? IF you don't have an MPPT controller, just spend your money on one of those, most come with coms / data outputs that tell you everything that's going on, so super easy to integrate into control systems!

author: Terry Bites
author_rank: Super Contributor
timestamp: February 23, 2023, 09:35:10 pm
content: IL300 optocouplers?

author: dobsonr741
author_rank: Frequent Contributor
timestamp: February 24, 2023, 02:18:31 am
content: What battery chemistry/voltage? What charging current - clarifying would help.

author: Red Squirrel
author_rank: Super Contributor
timestamp: March 01, 2023, 02:54:32 am
content: 24v (4x 6v) Lead acid is the battery chemistry. And yeah going to look at the hall effect sensor instead so I can measure current which may probably be a better measurement to take, then just measure the battery voltage directly without isolation and will power the MCU via isolated voltage. (5v isolated plug pack, for both the MCU and the RPI)Using MPPT for charge controller. So I think what I will do is measure the battery voltage and not worry about isolating it as I'll just make the whole setup reference negative as ground. Between the battery voltage and the solar current that will be enough data for me to setup logic to turn the inverter on/off at the appropriate time. If I wanted wattage then I'd want to measure voltage and current together but for now I won't worry about that.The IL300 looks interesting too actually, and probably does more or less what my original intent was.Eventually I want to play with ethernet and POE so I can make isolated sensors for all sorts of various uses, and at that point one of those sensors will probably be a voltage and current sensor. I'm not quite at that point yet though.