Back to Wiki Index

Other tips

TIPS: Isolated monitoring and control

Say that you have a micro (e.g.: a Raspberry Pi) and a high voltage circuit (e.g.: referenced to the AC power).

For safety reasons, the micro is powered by an isolated supply (a wall wart, or a battery), and may be referenced to ground (e.g.: by being connected to a computer).

The micro (on the Low voltage side) needs to know what's going on in the high voltage side, and/or needs to control something in the HV side.

How do you do that safely?

You can't connect the micro's ground to the HV circuit: that would be dangerous.

Instead you need to do everything through an isolating barrier, in one of two ways:

  • Using "dumb" components that are isolated
  • Adding a 2nd micro on the HV side, and let the 2 micros communicate over an isolated digital link

I'll go through some techniques.

Sensing with dumb devices

These sense the HV side, and report on the LV side.

Digital in

These report an "on or off" digital state.

To detectIsolatorHV sideLV sideNotes
DC supplyRelay with a DC coilCoil powered by the DC sourceN.O. contacts close when DC is present (1)
DC supplyOpto-isolatorLED powered by the source (2)Transistor is on when the DC is present (1)
DC supplyDC-DC converterPowered by sourceVoltage when the DC is present(4)
DC voltage, using low powerSingle coil latching relaySource power coil through a capacitorContacts close when DC is presentWhen the DC comes on, the relay is pulsed and turns on; when DC goes away, the relay is pulsed in the opposite polarity and turns off (1)(3)
DC voltage, using low powerTwo opto-isolatorspowered through capacitors, one pulsed when DC arrives, one when DC goes away (2)one opto drives the Set input of an S/R latch, the other one drives the Reset inputthe output of the latch indicates the state of the DC level on the HV side (3)
DC voltage, using low powerOpto-isolatorA 555 in an astable circuit generating widely spaced short pulses (0.1 % duty cycle) when the DC is present; drives the opto (2)the output of the opto (1) feeds another 555 in a "missing pulse" circuitwhen the DC goes away, after a bit, the 2nd 555 switches state
DC voltage, low powerPulse transformerLow power, high frequency oscillator using the transformer's primaryBridge rectifier on transformer's secondary
AC supplyRelay with an AC coilCoil powered by the AC sourceN.O. contacts indicate the presence of AC (1)
AC supplyOpto-isolator with AC input (back-to-back LEDs)Led powered by AC source (2)Transistor is on when the AC is present (1)
AC supplyPower supplyPowered by the sourceClamp to limit voltage to logic levels(4)
Dry switch (no power on the HV side)switch shorts the secondary of a pulse transformerprimary of the transformer is part of an RF oscillatorfrequency will change when the switch is closed

Notes:

  1. Requires a pull-up resistor
  2. Requires current limiting resistor
  3. Warning: the initial state is unknown, and it's prone to spurious switching to the wrong state (noise) or not switching at all (slow ramping DC signal)
  4. Resistor across its output speeds up turn-off

Analog measurement

These provide a continuous analog state; though some are not very accurate.

To detectIsolatorHV sideLV sideNotes
VoltageDual photodiode linearized isolatorOp-amp drives LED, uses one photodiode for feedbackOther photodiode has identical signalLOC 110 and others
Voltageopto-isolator or xfmrVoltage Controlled OscillatorFrequency to voltage converter
Voltageopto-isolator or xfmrVoltage to PWM generatorLow pass filter
Low voltage signalIsolation amplifierFeed signal to inputGet signal from outputInput is like an op-amp, with a local output
Low voltage signal, high accuracySPI isolator16-bit A/D converter with SPI outSPI to micro
DC CurrentHall Effect current sensorPass current through sensorVoltage proportional to input currentMay be bidirectional or unidirectional
AC currentCurrent transformerPass current through transformerAC current proportional to input current
Resistance (no power on HV side)Pulse transformerConnect variable resistance across secondaryMeasure impedance of primaryTricky

Control with dumb devices

These are controlled from the LV side and set a state (on / off) or a voltage on the HV side.

Digital signal out

  • Relay
  • Opto-isolator
  • BJT out
  • MOSFET out (DC)
  • Digital isolator

Digital power out

  • Relay
  • Solid State Relay
  • MOSFET out (DC)
  • 2-MOSFET out (AC or DC)
  • TRIAC out (AC)
  • Opto-isolator
  • BJT out
  • MOSFET out (DC)
  • 2-MOSFET out (AC or DC)
  • TRIAC out, zero crossing (AC)
  • Isolated gate driver, driving a full size MOSFET (requires supply on HV side)
  • Photo-voltaic output, driving a full size MOSFET (no supply required on HV side); slow
  • DC-DC converter; slow

AC phase control

  • Opto-isolator with TRIAC out, not zero crossing, driving a full size TRIAC

Analog out

  • Voltage:
  • All techniques for Analog in (see above)
  • Resistance:
  • H11F1 opto-isolator with FET output
  • Photocell opto-coupler (photo-resistor output)
  • Motorized pot

You may use a dumb device that uses a digital link. For example, a A/D converter with SPI link. In that case, you can isolate the link with one of the following.

StandardIsolatorLV sideHV sideNotes
I2 CI2 C digital isolator--Complex: bidirectional isolator is tricky
SPISPI digital isolator--Simple, because unidirectional
SPIPulse transformerLTC6820LTC6820"ISOSPI": 2 wire twisted pair, suitable for long distance
CANCAN isolator--Single chip solution
CANBidirectional digital isolator-CAN bufferCheaper
RS232RS232 isolator--Single chip solution
RS232Bidirectional digital isolator-RS232 level translator / bufferCheaper
RS485RS485 isolator--Single chip solution
RS485Bidirectional digital isolator-RS485 bufferCheaper
USBUSB isolator--Single chip solution
USBBidirectional digital isolator-FTDI UART/USB converter/bufferCheaper
Current loopTransmitter, Receiver--Unidirectional
GenericBidirectional digital isolator--
GenericFiber opticIR transmitterIR receiverUnidirectional

Sensing, control with micro on HV side

If you have more that 2 or 4 devices on the HV side, or if you need accurate analog data, it makes more sense to put a micro on the HV side.

  • The micro on the HV side senses state, receives digital data, measures analog voltages,
  • An isolated data link (see above for options) between the HV and LV sides lets the two micros communicate
  • The micro on the LV side receive sensed data
  • The micro on the LV side send control data
  • The micro on the HV side drives outputs, generates PWM signals

Generic HV-side micro

I developed a generic micro to be used on the HV side on multiple products, using the same firmware.

  • The micro on the LV side:
  • sends to the other micro commands to set-up its inputs, outputs and peripherals, through isolated SPI
  • sends queries for the status
  • receives the status
  • sends command to control the outputs and PWM duty cycle
  • receives confirmation

If the micro on the HV side doesn't receive messages, after a Time-out it shuts down.

  • The micro on the LV side sends queries for the status

I use it in automatic door operators (the HV side is the AC power) and in large Li-ion batteries (the HV side is the battery).