Hello,
For school, we need to make something with a generator.
I want to display the voltage on an LCD, so I'm using an Arduino Mega
But if I print the voltage out, my max input is 3,07V
Does someone know what I'm doing wrong?
Hello,
For school, we need to make something with a generator.
I want to display the voltage on an LCD, so I'm using an Arduino Mega
But if I print the voltage out, my max input is 3,07V
Does someone know what I'm doing wrong?
If you could help us, help you by posting your code and schematic diagram it would be most... Helpful.
Tell us about the generator. Post a link to the product page, for example.
Do not connect an AC generator to an Arduino input.
Its a generator from the teacher we don't know anything about it,
But I also tried a battery and it is still 3,07V
Ask the teacher for the details on the generator, and post them.
But I also tried a battery and it is still 3,07V
Your wiring might be wrong. Post a hand drawn wiring diagram, showing all the connections, with the pins and parts labeled.
Also, please explain the division factor of 333 in the two lines below. The reading of 3.07 V indicates that the analog input is reporting 1023, the maximum possible value, at all times.
value = analogRead(Vpin);
volts = value / 333;
for the diagram, I watched some videos on YouTube and everyone does it like that.
I looked with a voltmeter and then I looked at which values I got and so I arrived at /333.
I there a way to get more than 1023?
Please read and follow the directions in the "How to use this forum" post.
OP's code.
int Vpin = 0;
float value;
float volts;
float mamps;
float amps;
float watts;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
//volts
value = analogRead(Vpin);
volts = value / 333;
if(volts < 0){
volts = 0;
}
//amps
mamps = (((long)value * 5000 / 1024) - 500 ) / 133;
if(mamps < 0){
mamps = 0;
}
amps = mamps/1000;
//vermogen
watts = volts * amps;
Serial.println(String("V: ") + volts + String(" A: ") + amps + String(" W: ") + watts);
//delay(1000);
}
3.07 *333 = 1022.31, 5V or greater!
But I also tried a battery and it is still 3,07V
What was the battery voltage?
JCA34F:
3.07 *333 = 1022.31, 5V or greater!
What was the battery voltage?
The battery was 9V
If the analog input was not already destroyed, applying voltage > 5V, or an AC voltage will finish the job.
Try a different input, using a 1.5V battery instead.
Do ask the teacher for the details about the generator.
1,5 works perfectly.
Is there a way to get more voltage?
Maybe with a resistor and then multiplying or something?
FOCUS on the problem at hand. Come back when you have asked the teacher for the details about the generator.
Have you heard of a "voltage divider"? Ask Google or your teacher.
jremington:
FOCUS on the problem at hand. Come back when you have asked the teacher for the details about the generator.
He doesn't know as well.
He found it in his shaft...