» Electronics » Arduino »Car voltmeter on Arduino

Car voltmeter on Arduino



Greetings to all lovers homemade, today we will assemble a car voltmeter on Arduino and a seven-segment indicator for monitoring on-board voltage in auto. This device is easy to assemble and requires setup only once.

Tools and materials
-Arduino Pro mini
-Resistor for 10 Kom 0.5 W
- Resistor at 2 Kom 0.5 W
- Indicator on tm1637
-Wire (in my case - MGTF 0.12)
-Programmer
-Klem
-Thermokley
-Glue gun
-Soldering iron
-Solder
-Rosin


Step one. Scheme:
The circuit is easy to assemble. R1 = 10 Kom, R2 = 2 com.


Step Two. Assembly:
Assembling a voltage divider

Solder wires to the indicator

We solder everything according to the scheme


Places where short-circuiting can occur, you can fill with hot glue


Arduino glue to the back of the indicator (to reduce the size)


Step Three. Sketch:
There are 4 variables in the sketch that you need to adjust for yourself

#include 

// --------- Variables to configure ------------
#define CLK 2 // Digital port on Arduino where the display CLK is connected
#define DIO 3 // Digital port on Arduino where the DIO display is connected
int analogInput = A0; // Analog port where the output from the voltage divider is connected
double inaccuracy = 0.5; // voltage in volts that must be taken away from the voltmeter reading so that it matches the readings on the power supply (or add)
// ----------------------------------------------

GyverTM1637 disp (CLK, DIO);
byte tire [] = {0x40, 0x40, 0x40, 0x40}; // conclusion ----
float R1 = 10000.0; // Resistance R1 (10K) in OMAH
float R2 = 2000.0; // Resistance R2 (2K) in OMAX
float vout = 0.0;
float vin = 0.0;
int value = 0;
double ptr;
void setup () {
pinMode (analogInput, INPUT);
 disp.brightness (7);
 disp.point (0);
  disp.displayByte (tire);
  delay (500);
  disp.clear ();
}
void loop () {

value = analogRead (analogInput);
vout = (value * 5.0) / 1024.0;
vin = vout / (R2 / (R1 + R2));

vin = vin - inaccuracy;
double V1 = floor (vin);
double V2 = modf (vin, & ptr);
V2 = V2 * 100;
disp.displayClock (V1, V2);
if (vin <0.95) {
vin = 0.0;
disp.displayClock (00.00);
}
delay (1200);
}


Fourth step. Test:
We connect the battery and see the result:


Done! Now it remains to install this device in the car and you can use it.
4.8
5.7
7.3

Add a comment

    • smilesmilesxaxaokdontknowyahoonea
      bossscratchfoolyesyes-yesaggressivesecret
      sorrydancedance2dance3pardonhelpdrinks
      stopfriendsgoodgoodgoodwhistleswoontongue
      smokeclappingcraydeclarederisivedon-t_mentiondownload
      heatirefullaugh1mdameetingmoskingnegative
      not_ipopcornpunishreadscarescaressearch
      tauntthank_youthisto_clueumnikacuteagree
      badbeeeblack_eyeblum3blushboastboredom
      censoredpleasantrysecret2threatenvictoryyusun_bespectacled
      shokrespektlolprevedwelcomekrutoyya_za
      ya_dobryihelperne_huliganne_othodifludbanclose
8 comments
Author
Alexey Evgenievich
aftor, where did you get this library, can you share it ?! everything was covered and the syntax from the downloaded libraries the whole curve in your program
Guest Alex
Author
No, I understand that the resistors have an error and in my case it is as much as 5%
I just forgot to indicate this in the article
Thank you very much for the advice.
Author
Thanks for the comment, I forgot about the interference from the generator
The author does not take into account the accuracy of resistors, assuming its absolute. It is not possible to adjust the characteristic by adjusting only the initial bias. Instead of using R1 and R2, you should add a fifth variable for tuning - the division factor of the divider with the original value of 1/6.
And about the interference, protection and irrationality of the product, I agree with previous commentators.
The car voltmeter on Aliexpress costs the same as the tm 1637 indicator. Arduino two more times as much. The task book asks, to hell with a horseradish garden, if both are bought in one place?
Guest Alex
The crap is complete. From acb it will work, by car - no. Prots will fly out after several engine starts. There are wild obstacles in the car’s network, for dunya you need to block a separate power supply with filters, and at least cover the analog inputs with suppressors and you won’t have any problems.

We advise you to read:

Hand it for the smartphone ...