Related Post: Precision analog opto-isolation amplifier using HCNR200/201

 

Hardware Setup:

{gallery} Analog Opto-Isolator Hardware

tinyMonster - Analog Precision opto-isolator - output stage power supply

IMAGE TITLE: tinyMonster - Analog Precision opto-isolator - output stage power supply

tinyMonster - Analog Precision opto-isolator - Breadboard prototype

IMAGE TITLE: tinyMonster - Analog Precision opto-isolator - Breadboard prototype

tinyMonster - Analog Precision opto-isolator - Final Strip Board prototype

IMAGE TITLE: tinyMonster - Analog Precision opto-isolator - Final Strip Board prototype

tinyMonster - Analog Precision opto-isolator - Breadboard and Final prototype

IMAGE TITLE: tinyMonster - Analog Precision opto-isolator - Breadboard and Final prototype

tinyMonster - Analog Precision opto-isolator - prototype setup

IMAGE TITLE: tinyMonster - Analog Precision opto-isolator - prototype setup

.

Testing After Calibration:

.

{tabbedtable} Tab LabelTab Content
MAX. and MIN. OUTPUT

Maximum and minimum possible output voltage are limited to integrate it with microbit analog input and to avoid any damage to microbit. Maximum output voltage will not exceed microbit analog input maximum limit 3.6V and similarly minimum output voltage will not go below 0V even if negative voltage is applied at the input.

 

MAX. OUTPUT

 

MIN. OUTPUT

 

Negative INPUT Blocking

MAX. OUTPUT limit to 3.0V

Before connecting it to microbit the supply voltage at microbit 3V ring is tested and it is ~3.2V instead of 3.3V when supplied through usb and it was also momentarily dropping (~3.1) when something is displayed on leds matrix. So in order to avoid any possible damage to analog input, the maximum output of opto isolator circuit is limited to 3.0V. Because maximum possible IO voltage for microbit is VDD+0.3 volt.

Testing at Different Input Voltages

After Calibration and max min limit setting, it is tested at different voltages to check output linearity.

 

1.5V INPUT

 

1.0V INPUT

 

0.5V INPUT

 

0.1V INPUT

.

Final Demos with micro:bit

.

.

Under voltage and Over Voltage Indicator

To indicate under and over applied voltage LM393 based circuit is used. Even though these voltages will not harm the microbit but it is handy when measuring unknown voltage and unknown positive and negative terminals.

.

.

micro:Bit mbed Code

.

#include "MicroBit.h"

MicroBit uBit;

int main()
{
    // Initialise the micro:bit runtime.
    uBit.init();

    int val = 0;
    float val_f = 0.0f;
    char str[10];
    int i=0;

    // uncomment to get int value of adc on startup.
 /*   
    for (i=0; i<10; i++){
        val += uBit.io.P0.getAnalogValue()-3; // P0 is a value in the range of 0 - 1024
        wait(0.01f);
    }
    val_f = (val)/10;
    sprintf (str, "%.1f", val_f);
    uBit.display.scroll(str);

    uBit.sleep(1000);
*/
    while (1){
        val = 0;
        for (i=0; i<10; i++){    // average the 10 values of adc.

            val += uBit.io.P0.getAnalogValue()-3; // P0 is a value in the range of 0 - 1024
            wait(0.01f);
        }
        val_f = (val*0.30f)/967;    // (970 - 3 = 967) adc values for 3 volt
        sprintf (str, "%1.2f", val_f);
        uBit.display.scroll(str);
        
        uBit.sleep(1000);
    }
 }

.

Application Examples

Measuring voltage across inductive loads

Ground isolation between 2 analog circuit

DC Current measurement.

Adding protection against possible over voltage and negative voltage at ADC input