Make an Arduino Voltmeter

4,085

37

2

Introduction: 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!

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: 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:

  • 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:

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

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

//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//\\
Tools Contest

Participated in the
Tools Contest

Be the First to Share

    Recommendations

    • Backyard Contest

      Backyard Contest
    • Silly Hats Speed Challenge

      Silly Hats Speed Challenge
    • Finish It Already Speed Challenge

      Finish It Already Speed Challenge

    2 Discussions

    0
    amberrayh
    amberrayh

    5 years ago on Introduction

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

    0
    FilipS1
    FilipS1

    Reply 5 years ago on Introduction

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