Go Down

Topic: Voltmeter Project  (Read 716 times) previous topic - next topic

Bringamosa

~US$2.00 including worldwide shipping is too expensive?

This sketch might be the best a bare Arduino can do.
Leo..
Code: [Select]
/*
  0 - ~17volt voltmeter
  works with 3.3volt and 5volt Arduinos
  uses the stable internal 1.1volt reference
  10k resistor from A0 to ground, and 150k resistor from A0 to +batt
  (1k8:27k or 2k2:33k are also valid 1:15 ratios)
  100n capacitor from A0 to ground for stable readings
*/

unsigned int total; // holds readings
float voltage; // converted to volt

void setup() {
  analogReference(INTERNAL); // use the internal ~1.1volt reference | change (INTERNAL) to (INTERNAL1V1) for a Mega
  Serial.begin(9600); // ---set serial monitor to this value---
}

void loop() {
  total = 0; // reset
  analogRead(A0); // one unused reading to clear any ghost charge
  for (int x = 0; x < 64; x++) { // 64 analogue readings for averaging
    total = total + analogRead(A0); // add each value
  }
  voltage = total * 0.0002567; // convert readings to volt | ---calibrate by changing the last three digits---

  Serial.print("The battery is ");
  Serial.print(voltage); // change to (voltage, 3) for three decimal places
  Serial.println(" volt");
  delay(1000); // readout delay
}

Now i did it anyways. This works for me. 12v battery powering my arduino, measuring the same 12v battery. Or you can measure voltage of something else.

fl4sh

Hi,
Have you googled         auto o2 sensor and arduino

Tom.... :)
no!!!!!  :o  :o  :o
you are a genius...  two months for that.... i'm going that just now!!! you have already found some projects ???

...

I have 5 minutes antiflood..... meanwhile..... I found that for previous user that ask me major details about sensor:

http://www.partinfo.co.uk/files/Lambda%20Sensors%20QA.pdf

(always remember that I'm talking about narrowband, not wideband one)

...

https://www.youtube.com/watch?v=OQV7SV5TdHc

this guy has done it!!!!!!!!  who could help me repeat this project? I don't need bar graph.... I will be very happy with only 3 digit display  ".xxx" V  !!

...

Also found this:

https://forum.arduino.cc/index.php?topic=69351.0

and

http://forum.arduino.cc/index.php?topic=17481.0

fl4sh

Now i did it anyways. This works for me. 12v battery powering my arduino, measuring the same 12v battery. Or you can measure voltage of something else.
Bringamosa, thanks. I think that in previous post kind users explained to me that the problem wasn't to measure the same voltage, but the impediance of the input.  I understand that input must have sufficient impedance otherwise it will drop the sensor voltage down.

standard multimeter impedience is enought, since I have always read the sensor in that way.

wvmarle

Just connect one output of the sensor to an analog input, the other to GND, and measure away. It's that simple. For 0-1V you should get readings of 0-200, give or take. If you're sure you're staying under 1V enable the internal 1.1V reference and you get a scale of 0-1000 or so (max 1023).
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

fl4sh

#19
Oct 13, 2018, 02:58 am Last Edit: Oct 13, 2018, 02:58 am by fl4sh
Thanks! that's sound cool!!

I never did a sketch before, can I use some of sketch posted above??

If I will go over 1v I will damage something or just read out of scale?? In the second case, it's ok . I don't care reading over 1v , so out of scale is fine for me over 1v.

How can I enable 1.1 internal reference?
Would you help me to create schematic and sketch?

Many thanks in advance!

Grumpy_Mike

#20
Oct 13, 2018, 04:24 am Last Edit: Oct 13, 2018, 04:25 am by Grumpy_Mike
Quote
If I will go over 1v I will damage something or just read out of scale??
No damage, you just get the maximum reading no matter what voltage you put in. Only when you go above the chip's supply voltage do you get damage. See my reply #7.

Start looking here https://www.arduino.cc/reference/en/language/functions/analog-io/analogreference/

fl4sh

Ok thanks, I understand what I should do now but I don't know how do it.

Can you suggest me a forum category or something similar "for dummies" ??? I would see how do the sketch and the circuit .

thanks to everybody for helping!

Bringamosa

Welllll, post #18, a couple of posts back, wvmarle tels you how to do it exactly. Please tell us what part is giving you troubles..... after you read the post of course

fl4sh

Yeah I have read yet... ok for connections (no resistors, no other components ?) but I don't know what I shuold write in the sketch  ? 

many thanks and sorry for my incompetence

Grumpy_Mike

Quote
but I don't know what I shuold write in the sketch  ? 
Just write it out to the serial monitor first and get that going.
See the code in the IDE under the menu
Files -> Examples -> 0.1 Basics -> AnalogReadSerial
and don't forget to change the code to switch to the internal reference in the setup function.

Go Up