Introduction: I - V Curve With Arduino
I decided to create I–V curve of leds. But I have only one multimeter, so I created simple I-V meter with Arduino Uno.
From Wiki: A current–voltage characteristic or I–V curve (current–voltage curve) is a relationship, typically represented as a chart or graph, between the electric current through a circuit, device, or material, and the corresponding voltage, or potential difference across it.
Step 1: List of Materials
For this project, you will need:
Arduino Uno with USB cable
breadboard and duponts cable
leds (I used 5 mm red and blue leds)
drop resistor (shunt resistor) - I decided for 200 ohm (for 5V is maximum current 25 mA)
resistors or potenciometer, I use mix of resistors - 100k, 50k, 20k, 10k, 5k, 2.2k, 1k, 500k
Step 2: Circuit
Circuit consist from testing led, shunt resistor (R_drop) for measure current. To change voltage drop and current I use various resistors (R_x).
Basic principle is:
- get total current I in circuit
- get voltage drop on testing led Ul
Total current I
To get total current, I measure voltage drop Ur on shunt resistor. I use analog pins for that. I measure voltage:
- U1 between GND and A0
- U2 between GND and A2
Different of this voltages is equal voltage drop on shunt resistor: Ur = U2-U1.
Total current I is: I = Ur/R_drop = Ur/250
Voltage drop Ul
To get voltage drop on led, I substract U2 from total voltage U (which should be 5V): Ul = U - U2
Step 3: Code
float U = 4980; // voltage between GND and arduino VCC in mV = total voltage
float U1=0; // 1 probe
float U2=0; // 2 probe
float Ur=0; // voltage drop on shunt resistor
float Ul=0; // voltage drop on led
float I =0; // total current in circuit
float R_drop=200; // resistance of shut resistor
void setup()
{
Serial.begin(9600);
pinMode(A0, INPUT);
pinMode(A1, INPUT);
}
void loop()
{
U1 = float(analogRead(A0))/1023*U; // get voltage between GND and A0 in milliVolts
U2 = float(analogRead(A1))/1023*U; // get voltage between GND and A1 in milliVolts
Ur=U2-U1; // drop voltage on shunt resistor
I=Ur/R_drop*1000; // total current in microAmps
Ul=U-U2; // voltage drop on led
Serial.print("1 ");
Serial.print(U1);
Serial.print(" 2 ");
Serial.print(U2);
Serial.print(" //// ");
Serial.print(" voltage drop on shunt resistor: ");
Serial.print(Ur);
Serial.print(" voltage drop on led: ");
Serial.print(Ul);
Serial.print(" total current: ");
Serial.println(I);
// pause
delay(500);
}
Step 4: Testing
I testing 2 leds, red and blue. As you can see, blue led has knee voltage bigger, and that´s why blue led need blue led start to blow around 3 Volts.
Step 5: Testing Resistor
I do I - V curve for resistor. As you can see, graph is linear. Graphs show, that Ohm´s law work only for resistors, not for leds. I calculate resistance, R = U/I. Measurements are not precise at low currents value, because analog - digital converter in Arduino has resolution:
5V / 1024 = 4.8 mV and current -> 19.2 microAmps.
I think measurement errors are:
- breadboard contants are not super contants and makes some errors in voltage
- used resistors has around 5 % variety in resistance
- ADC values from analog read oscilate