Saturday, February 23, 2013

Ardunio - Silly Ohm Meter

Good Afternoon Everyone,

Well, our recent fever in Arduino is cracking up with silly projects. Although I have used it for many years now, the introduction to a new budding Engineer is always intriguing. The Arduino main site many simple and silly projects and tutorials to play and study. After going through some site, we found that something as simple and silly such as Ohm Meter, Voltmeter and Ammeter were not really covered. It may sound quite silly but for new aspirants its something new to learn.

So, getting back to the silly ohm meter, the setup is quite simple. Arduino has a very interesting way to display circuits in a picture manner. Hence, we would like to follow the same. Here is the wiring of the silly ohm meter.


Just a simple project that calculates the resistance of a resistor.  The circuit is based on a simple voltage divider.  First, a wire is connected from the 5V pin on the Arduino to the breadboard +5V bus. Then, another wire connects the Gnd pin on the Arduino to the GND bus on the breadboard.  

Now that you have power, put two resistors in series.  One should be your “known” resistance, we have used a 10K ohm resistor.  The other is the “unknown” resistor that we are trying to find the resistance.  In between these two resistors, another wire should be connected to one of the analogue pins on the Arduino, here we have used the Analog 0 pin.

Here is the Arduino code which calculates the unknown resistance, and outputs it to Serial Monitor on the Sketch program:
 
 //Silly Ohm Meter - RnD LAB's

 int aPinIn = 0;             // Analogue Input on Arduino  
 int val = 0;               // The raw analogue value  
 float Vout = 0.0;          // Voltage at point between resistors (relative to ground)                  
 float Vin = 5.0;           // Vcc (5 Volts)     
 float Rknown = 10000.0;    // The known resistor (10 kohms)   
 float Runknown = 0.0;  
    
 void setup(){  
    
  Serial.begin(9600);  
  digitalWrite(13, HIGH);  
    
 }  
    
 void loop(){  
    
  val = analogRead(aPinIn);           // Read in val (0-1023)  
  Vout = (Vin/1024.0) * float(val);   // Convert to voltage  
  Runknown = Rknown*((Vin/Vout) - 1); // Calculate Runknown  
    
  Serial.print("Vout: ");  
  Serial.println(Vout);               // Output everything  
  Serial.print("R: ");  
  Serial.println(Runknown);  
    
  delay(1000);                        // Delay for readability  
    
 }  



No comments:

Post a Comment