Introduction: Make an Arduino Voltmeter

Picture of Make an Arduino Voltmeter

This is a very simple project for microcontroller beginners.

Board I'm using in this tutorial is Arduino Uno (R3), but you can use any board with slight changes in code (or no changes at all!).

Good luck!

Step 1: Make an Arduino Voltmeter

Picture of Make an Arduino Voltmeter

This is a very simple project for microcontroller beginners.

Board I'm using in this tutorial is Arduino Uno (R3), but you can use any board with slight changes in code (or no changes at all!).

Good luck!

Step 2: Parts List:

Picture of Parts List:
  • Arduino Board
  • PC with Arduino IDE
  • 5 LEDs (Light Emitting Diode)
  • 5 resistors (about 300Ω, you don't have to be very accurate here)
  • potentiometer (value does't really matter, you will only use it to simulate voltage change)
  • some jumper wires
  • a breadboard
  • and basic programming knowledge

Step 3: The Logic Behind It:

Picture of The Logic Behind It:

Each LED represents 1 volt, potentiometer is used as a fake "load", program is very simple simply determine the "space" between each volt and use if loops to make LEDs turn on/off

Step 4: Connecting Everything Together

Picture of Connecting Everything Together

Use the picture as a guide (i use pins 2-6 for LEDs and A0 for potentiometer and I use the same in the code so change if necessary)

Don't forget to connect GND to LEDs too!!!(Sorry, I missed that while making this picture)

Step 5: The Code

Picture of The Code

//I will just dump the entire code in the section below

//code looks a bit long, but it's not

//enjoy

//check the value with multimeter, pretty accurate huh

//you have the code now play with it, change it, make it better, add buzzer or some sh*t have fun with it.

//this code is open source but please keep the last line of it (the comment)

int pot = A0;
int gled0 = 2; //all LEDs are connected with 330Ω resistor int gled1 = 3; int gled2 = 4; int yled0 = 5; int rled0 = 6; void setup(){ Serial.begin(9600); pinMode(pot, INPUT); pinMode(gled0, OUTPUT); pinMode(gled1, OUTPUT); pinMode(gled2, OUTPUT); pinMode(yled0, OUTPUT); pinMode(rled0, OUTPUT); digitalWrite(gled0, LOW); digitalWrite(gled1, LOW); digitalWrite(gled2, LOW); digitalWrite(yled0, LOW); digitalWrite(rled0, LOW); } void loop(){ Serial.println(analogRead(pot)); if(analogRead(pot) >= 205){ // 1V digitalWrite(gled0, HIGH); delay(4); } if(analogRead(pot) >= 410){ // 2V digitalWrite(gled1, HIGH); delay(4); } if(analogRead(pot) >= 615){ // 3V digitalWrite(gled2, HIGH); delay(4); } if(analogRead(pot) >= 820){ // 4V digitalWrite(yled0, HIGH); delay(4); } if(analogRead(pot) >= 1023){ // 5V digitalWrite(gled0, HIGH); digitalWrite(gled1, HIGH); digitalWrite(gled2, HIGH); digitalWrite(yled0, HIGH); digitalWrite(rled0, HIGH); delay(150); digitalWrite(gled0, LOW); digitalWrite(gled1, LOW); digitalWrite(gled2, LOW); digitalWrite(yled0, LOW); digitalWrite(rled0, LOW); delay(150); } else{ // 0V digitalWrite(gled0, LOW); digitalWrite(gled1, LOW); digitalWrite(gled2, LOW); digitalWrite(yled0, LOW); digitalWrite(rled0, LOW); } } //by filip.skalec //\\I hope you liked this tutorial//\\

Comments

amberrayh (author)2015-03-13

Nice first Instructable. This would be a good project for beginners like me! I hope to see more from you in the future!

FilipS1 (author)amberrayh2015-03-13

Thank you, i hope you keep visiting my projects. There will be more very soon.

About This Instructable

3,281views

37favorites

License:

More by FilipS1:Make an Arduino voltmeter
Add instructable to: