Help with voltmeter

Hi,
I want to add to my battery charger voltmeter. So voltmeter capable of measuring up to 30V using an Arduino board and a 4 Digit 7 Segment Serial LED Module - TM74HC595.
I really want some help, because it´s my school project and I don´t know how to start.

Thanks: c2rry

look up potential divider for your voltage measurement, and look at the datasheet for the display...

regards

Allan

I know how to connect arduino board with display
74HCT595 Arduino
Vcc pin 16 +5V
SCLK pin 11 I5
RCLK pin 12 I3
DIO pin 14 I2
GND pin 8 GND

But help me with the code, and what kind of resistors I might need. I read this code http://www.allaboutcircuits.com/projects/make-a-digital-voltmeter-using-the-arduino/ but there isnt same display like I have.

Well for a start the 74HCT595 is just a shift register - how does that drive your display?

As for the resistors, - well if this is a project you're meant to learn!..... Put two resistors in series, such that the same current flows through both of them... what's the voltage at the junction of the two? Ohms law is all you need.

To drive the analog input of an arduino values in the range of a few tens of thousand ohms would be fine.

regards

Allan

Is it possible to use those components to make this voltmeter, or I have to buy some other stuff?

search ' 4 Digit 7 Segment Serial LED Module - TM74HC595' in this forum.

And figure out Ohms law as it applies to a potential divider.

you don't have to buy anything else except a couple of £0.01 resistors

regards

Allan

If you want to make accurate voltage reading, this might be of help (it certainly helped me :slight_smile: ) Measuring accurate voltage with an Arduino – AutoTT.

They have also provided the a schematic for how the measured the voltage over two different batteries, using voltage dividers, but this might be somewhat unclear as it is far more than just the voltage divider on this schematic. They measure the voltage on A0 and A1 and the strange boxes are relays. Just ignore this schematic if it does not make sense to you.

Here is how you can control the
4 Digit 7 Segment Serial LED Module - TM74HC595

// controls 4 digit 7 segment display
// test version 3
// 2015-05-02 by aarg

const byte numDigits = 4;
byte testDigit[numDigits];

// control pin definitions:
int shiftClock = 5;
int latchClock = 6;
int DIO = 7;

// count variables:

unsigned long previousMillis = 0;        // will store last time of count
const long interval = 1000;           // interval at which to count (milliseconds)

void setup ()
{
  // configure outputs:
  pinMode(shiftClock, OUTPUT);
  pinMode(latchClock, OUTPUT);
  pinMode(DIO, OUTPUT);

  // initialize display buffer
  for (int i = 0; i < numDigits; i++)
    testDigit[i] = i;
}

void loop()
{
  // update the display
  //
  displayUpdate(testDigit);
  //
  // any code in here that is non-blocking for more than the display
  // refresh interval should not
  // interfere with the display.

  // see if it's time to increment the counter
  //
  unsigned long currentMillis = millis();

  if (currentMillis - previousMillis >= interval)
  {
    previousMillis = currentMillis;
    incrementDisplay();
  }
}

// non-blocking display update
//
// every time this routine is called, 16 bits are shifted into the display
// and latched.
// The first 8 bits is the segment data, and first 4 bits of the second byte are
// the segment select.

void displayUpdate(byte displayDigit[])
{
  static unsigned long lastDisplayUpdate;
  const int scanRateHz = 60;
  const int displayScanPeriod = 1000000L / numDigits / 8 / scanRateHz;

  const byte segmentList[] =
  { // 0123456789AbCdEF-<space>
    0xC0, 0xF9, 0xA4, 0xB0, 0x99, 0x92, 0x82, 0xF8, 0x80, 0x90, 0x8C, 0xBF, 0xC6, 0xA1, 0x86, 0xFF, 0xbf, 0x7f
  };

  static byte digit = 0;
  static byte segment = 0x80;

  if ((micros() - lastDisplayUpdate > displayScanPeriod))
  {
    // send segment data
    for (byte i = 0x80; i >= 1; i = i >> 1)
    {
      if ( (i & segment) & ~segmentList[displayDigit[digit]])
      {
        digitalWrite(DIO, LOW);
      }
      else
      {
        digitalWrite(DIO, HIGH);
      }
      bitClock();
    }

    // send digit select data
    for (byte i = 8; i > 0; i--)
    {
      if (i == digit + 1)
      {
        digitalWrite(DIO, HIGH);
      }
      else
      {
        digitalWrite(DIO, LOW);
      }
      bitClock();
    }

    // data is now in the display shift register, so latch to LEDs
    //
    latchData();

    // increment variables to select the next segment and possibly the next digit:
    //
    segment = segment >> 1;
    if (segment == 0)
    {
      segment = 0x80;
      digit++;

      if (digit >= numDigits)
        digit = 0;
    }

    // reset timer for next update:
    lastDisplayUpdate = micros();
  }
  // else just return without doing anything
}

void bitClock()
{
  digitalWrite(shiftClock, LOW);
  digitalWrite(shiftClock, HIGH);
}

void latchData()
{
  digitalWrite(latchClock, LOW);
  digitalWrite(latchClock, HIGH);
}

// very dumb counter (includes "-" and <space>)
//
void incrementDisplay()
{
  if (++testDigit[0] > 17)
  {
    testDigit[0] = 0;
    if (++testDigit[1] > 17)
    {
      testDigit[1] = 0;
      if (++testDigit[2] > 17)
      {
        testDigit[2] = 0;
        if (++testDigit[3] > 17)
        {
          testDigit[3] = 0;
        }
      }
    }
  }
}

Can somebody help me with the code. I already know how to control 74hc595 led tube modul, and I have code for analog (up to 5v measurment) voltmeter. But where do I have to put the voltmeter measurment to a code, that it´s shows it with the led tube modul?

Thaks, c2rry

Some of it goes into setup() and most of it goes into loop().

Which goes where? How can we know, we cannot see your code?

(Please use code tags! If you don't know how to use code tags, don't post your code yet)

Holas, quizás les sirve esto:
https://forum.arduino.cc/index.php?topic=627693.0
Saludos.