Amazon Store

Monday 23 March 2015

Arduino Based Ohmmeter

This is a project based on Arduino board which can measure the unknown resistance values and perform diode test and continuity testing. When we connect the unknown resistor on the breadboard circuit, the 16x2 LCD displays the resistor value and when we connect a diode the LCD displays the type of diode if it is a good one. When we take the probes out from the breadboard and connect it across a continuous path, the meter indicates the continuity by blinking an LED. The project uses an Arduino pro mini board whose ADC feature is used along with the concept of Voltage Divider circuit to develop this Ohmmeter. 

 

Architecture of the project

The entire project can be divided into three basic blocks;

1)      Resistance/Diode/Continuity Sensor Unit

2)      Processor Unit

3)      Display Unit

Circuit Diagram:


The Sensor Unit takes three inputs, Unknown resistor, Diode and a Continuous path to be detected. When the unknown resistor is connected as input, the output voltage varies between 0 and 5V proportional to the value of resistance.  When the unknown diode is connected as input, the output voltage will be 4.3V for Silicon diode and 4.7V for Germanium diode. When a continuous path is connected as input, the output voltage will be 5V.

The Processor Unit takes input voltage in the range of 0 to 5V. This unit calculates the resistance value, detects the diode type and continuous path from the input voltage value. The unit then sendsa 4bit data to the Display Unit which includes the resistance value or diode type. The Processor Unit also glows an LED if it detect a continuous path.

The Display Unit takes the 4bit data from the Processor Unit and produces a 16*2 display for the resistance value, diode type.

Coding :

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

 

#define resistance_R50 100000

#define resistance_R500 1000000

#define resistance_V2 10000

#define caliberation_V2 1.1

#define range50_mul (resistance_R50 / resistance_V2) * caliberation_V2

#define range500_mul (resistance_R500 / resistance_V2) * caliberation_V2

#define resistance_Ri 10

#define resistance_Cr 100000

#define resistance_Rb 100000

#define resistance_Re 10

#define resistance_R2 1000

 

int adc_value = 0;

int voltage_peak_value = 0;

int discharge_voltage_V0 = 0;

int discharge_voltage_V1 = 0;

float voltage_average_value = 0;

float dc_voltage_V0 = 0;

float ac_voltage_V0 = 0;

float dc_voltage_V1 = 0;

float dc_voltage_V2 = 0;

float ac_voltage_V1 = 0;

float dc_current_I0 = 0;

float dc_current_I1 = 0;

float ac_current_I0 = 0;

float dc_power = 0;

float ac_power = 0;

float npn_pnp_hfe = 0;

float capacitance = 0;

unsigned long resistance;

unsigned long sample_count = 0;

unsigned long discharge_time_T0 = 0;

unsigned long discharge_time_T1 = 0;

char fn0 = 6;

char fn1 = 7;

char fn2 = 8;

char rn0 = 9;

char rn1 = 10;

char rn2 = 13;

char function_select [4];

char range_select [4];

 

void setup()

{

  lcd.begin(16, 2);

  lcd.print("    EG LABS    ");

  delay(3000);

 

  pinMode(fn0, INPUT);

  pinMode(fn1, INPUT);

  pinMode(fn2, INPUT);

  pinMode(rn0, INPUT);

  pinMode(rn1, INPUT);

  pinMode(rn2, INPUT);

}

 

void loop()

{

  function_select [0] = digitalRead(fn0) + '0';

  function_select [1] = digitalRead(fn1) + '0';

  function_select [2] = digitalRead(fn2) + '0';

  function_select [3] = '\0';

  range_select [0] = digitalRead(rn0) + '0';

  range_select [1] = digitalRead(rn1) + '0';

  range_select [2] = digitalRead(rn2) + '0';

  range_select [3] = '\0';

    

 

  //============================= RESISTANCE ========================================//

 

  voltage_average_value = 0;

  for(sample_count = 0; sample_count < 10; sample_count ++)

  {

      adc_value = analogRead(A1);

      voltage_average_value = voltage_average_value + adc_value;

      delay(10);

  }

  voltage_average_value = voltage_average_value / 10;

  voltage_average_value = voltage_average_value * 0.00488;

 

  if (range_select [2] == '0')

  {

      lcd.clear();

      lcd.setCursor(0, 0);

      if (  0 == strncmp (range_select, "01", 2) )

          lcd.print("0-10K: ");

      else if (  0 == strncmp (range_select, "10", 2) )

          lcd.print("10-100K: ");

      else if (  0 == strncmp (range_select, "11", 2) )

          lcd.print("100K-1M: ");

     

      if (voltage_average_value > 0)

      {

          if (  0 == strncmp (range_select, "01", 2) )

              resistance = (1000 * (5 - voltage_average_value)) / voltage_average_value;

          else if (  0 == strncmp (range_select, "10", 2) )

              resistance = (10000 * (5 - voltage_average_value)) / voltage_average_value;

          else if (  0 == strncmp (range_select, "11", 2) )

              resistance = (100000 * (5 - voltage_average_value)) / voltage_average_value;         

          else;

         

          if (resistance > 10000)

          {

            lcd.print(resistance / 1000);

            lcd.print(" KE");

          }

          else

          {

            lcd.print(resistance);

            lcd.print(" E");

          }

         

          if (resistance < 10)

          {

             lcd.clear();

             lcd.setCursor(0, 1);

             lcd.print("   CONTINUITY");          

          }

          else;

      }

  }

  else

  {

      lcd.clear();

      lcd.setCursor(0, 0);

      lcd.print("Diode ");

     

      if (voltage_average_value > 0)

      {

          if (  0 == strncmp (range_select, "01", 2) )

              resistance = (1000 * (5 - voltage_average_value)) / voltage_average_value;

          else if (  0 == strncmp (range_select, "10", 2) )

              resistance = (10000 * (5 - voltage_average_value)) / voltage_average_value;

          else if (  0 == strncmp (range_select, "11", 2) )

              resistance = (100000 * (5 - voltage_average_value)) / voltage_average_value;         

          else;

         

          if ((resistance > 145) && (resistance < 165))

              lcd.print("Silicon");       

          else if ((resistance > 60) && (resistance < 80))

              lcd.print("Germanium"); 

          else; 

      }

      else;

  }

 

  delay(500);

  //=================================================================================//

}

No comments:

Post a Comment