Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
DerPandaHammer
Published © GPL3+

Power in a Box

A transportable and stackable 12V PowerBox with laboratory clamps and Arduino powered voltmeter. Useful to tinker everywhere you want.

IntermediateShowcase (no instructions)996
Power in a Box

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Systainer Mini TL3
×1
Emergency Stop Switch, 4PST-2NO
Emergency Stop Switch, 4PST-2NO
×1
Resistor 10k ohm
Resistor 10k ohm
×1
Resistor 100k ohm
Resistor 100k ohm
×1
AC/DC Converter 230V AC to 12V DC
×1

Story

Read more

Schematics

Fritzing Sketch

Code

VoltageMeter

Arduino
/*
DC Voltmeter 
*/

int analogInput = 0;
int meterOutputPin = 3;
int minMeter = 0;
int maxMeter = 18;
int delayMeter = 100;
int newVal;
float vout = 0.0;
float vin = 0.0;
float R1 = 100000.0; // resistance of R1 (100K) -see text!
float R2 = 10000.0; // resistance of R2 (10K) - see text!
int value = 0;


void setup()
{
  pinMode(analogInput, INPUT);
  pinMode(meterOutputPin, OUTPUT);
  Serial.begin(9600);
}

void loop()
{
  // read the value at analog input
  value = analogRead(analogInput);
  vout = (value * 5.0) / 1024.0; // see text
  vin = vout / (R2/(R1+R2)); 
  if (vin<0.09) 
  {
    vin=0.0;//statement to quash undesired reading !
  } 

  if (vin>13) 
  {
    vin=13; //statement to quash undesired reading !
  } 

  newVal = map(vin, 0, 13, minMeter, maxMeter);
  setMeter(newVal); 
  Serial.print("Voltage is: ");
  Serial.println(vin);
  Serial.print("Gemappt is: ");
  Serial.println(newVal);
  delay(500);
}

int setMeter(int valAfter)
{
  
  analogWrite(meterOutputPin, valAfter);
  delay(delayMeter);
  
    

}

Credits

DerPandaHammer

DerPandaHammer

1 project • 0 followers

Comments