Feb 28, 2023 09:26
Feb 28, 2023 09:11
If you only want to measure the solar panel, not the 5v, you can separate it using a diode and connect the voltage divider to the solar panel.
Feb 28, 2023 09:05
hardware/electronics is neither hardware nor arduino specific, it is a question belong to electronics.stackexchange.com
Feb 28, 2023 09:04
I have no idea what you are trying to accomplish, so can't comment on that...
Feb 28, 2023 08:58
but since your 5V is always connected, it always give you the 5V reading
Feb 28, 2023 08:58
your current circuit can't really measure the solar panel out unless 5V is disconnected.
Feb 28, 2023 08:54
as far as reading the value of your existing diagram, the code works as expected.
Feb 28, 2023 08:53
this is probably a question too much for you if you don't have an electronic background, you need to have a load sharing circuit so that when solar panel is not sufficient, it switch to the 5V or vice versa.
Feb 28, 2023 08:49
so your Arduino supply 5V whether your solar panel work or not working, you already get 5V, isn't it?
Feb 28, 2023 08:49
I'm not asking you voltage divider, read my question
Feb 28, 2023 08:48
You connect the solar panel to the 5V from Arduino too?
Feb 28, 2023 08:38
void loop() {
analogReference (INTERNAL);
float voltage = 1.1/1023*analogRead(A0);
Serial.print (“voltage at A0:”);
Serial.println(voltage);
Serial.print (“Solar panel voltage:”);
Serial.println(voltage*5.7);
delay(1000);
}
Feb 28, 2023 08:36
Sorry, wrong formula, refer to my answer on arduino.stackexchange.com/a/92331/40646 for the correct formula.
Feb 28, 2023 08:33
void loop() {
analogReference (INTERNAL);
float voltage = (analogRead(A0)/1.1)*1024;
Serial.print (“voltage at A0:”);
Serial.println(voltage);
Serial.print (“Solar panel voltage:”);
Serial.print(voltage*5.7);
delay(1000);
}
Feb 28, 2023 08:31
this will give you the reading at the input of A0, to get the value of the solar panel, multiply it by 5.7.
Feb 28, 2023 08:31
PLEASE, PLEASE, PLEASE, try this:
void loop() {
analogReference (INTERNAL);
float voltage = (analogRead(A0)/1.1)*1024;
Serial.println (voltage);
delay(1000);
}
Feb 28, 2023 08:28
Please, please, please, try this:
Feb 28, 2023 08:27
Why are you keep repeating those code? this can be replaced by one line of analogRead(A0). and the output is not the "voltage"!
Feb 28, 2023 08:26
"ADMUX |= B11000000;
int sensor = analogRead(A0);
ADCSRA |= B11000000;
while(bit_is_set(ADCSRA, ADSC));
float voltage = ADCL | (ADCH << 8); "
Feb 28, 2023 08:22
okay, so you want to measure the voltage of the solar panel. As I said, Vref is the VOTLAGE value, you need to change your internalReference value to 1.1, not the reading from the analogRead().
Feb 28, 2023 08:12
internalReference should be '1.1` or the voltage you actually measured with a volt meter at Vref. What is the resistance of the LDR?
Feb 28, 2023 08:12
Whether you want to measure and calibrate the Vref, it is +/-10% differences according to datasheet (I mentioned this already on my prefer answer, please read them). so that means the Vref could be in the range of 0.99 - 1.21v.
Feb 28, 2023 08:12
Looking at your past posts, you are repeatedly using the wrong code and then asking why it doesn't work. Maybe you should search how the ADC work. The reading from sensorValue = analogRead(A0) is a value ranging from 0 to 1023, to convert it to a voltage, the formula is voltage = (sensorValue/Vref) * 1023, where Vref is the reference Voltage you are using, in this case, it is 1.1v. Furthermore, you can't get a correct sensorValue if your input at A0 is HIGHER than the Vref, you will get the wrong value!
 
Feb 23, 2023 12:38
Sorry my bad on the max current part. You can't measure voltage higher than your Vref which is 1.1V when you using analogReference(INTERNAL). If you want to keep the Vref with INTERNAL, you need a voltage divider same as you used in the battery setup.
Feb 23, 2023 12:38
1) The absolute max current an ATMega328 GPIO can take is 40mA, your Solar Panel is capable of deliver 5V with 45mA, it is over the limit. 2) Instead of using a Solar panel as a light sensor, would it be better to use it to charge the battery? 3) You should consider to put your Arduino to deep sleep whenever it is ideal instead of only by night.
 
Mar 3, 2020 14:56
What working by connecting to Arduino is because the FDTI chip on the Arduino generate a DTR signal trough a capacity that temporarily pull down the RESET pin for USB boatload.
Mar 3, 2020 14:56
Are you sure you connect the button correctly? the button switch should be normal-open (and only close when press it). Are you happened to connect it as normal-close?
 
Feb 12, 2020 02:11
Many of the Nano compatible boards with CH340 chip uses ATmega328P(old bootloader), what is your setting on Board configuration (Tools --> Processor on Arduino IDE)?