I have a wire connecting the "+" pin on the sensor to the "5V" pin on the Arduino, a wire connecting the "-" pin on the sensor to the "GND" pin on the Arduino, and a third wire connected to the "Out" pin on the sensor. I don't have this wire attached to the Arduino, instead I've been touching it manually to the board to test the different analog outputs, from 0-7.
When I hook it up to my PC and run the program, the code functions, but what it does is confusing. All 8 values fluctuate at around 60-90, but if I touch the wire connected to "Out" to any of the analog pins on my Arduino board, the value for that pin almost immediately drops to 0.
Additionally, the serial plotter is a bit odd.
This is a screenshot of what it looks like when I run the program.
For some reason, there isn't a "value 0" or "value 1" for some reason, and only one of the values is actually plotted. In this case, it's value 5. I've checked, too, and none of the other values are being shown on the plotter. Also, when I went to take a screenshot of the plotter, the values were all mixed up. This hasn't happened for me before, and I don't know if that's an issue or not.
I have an Adafruit GUVA-S12SD ultraviolet sensor that I've connected to my Arduino nano board. The "GND" pin on the board is connected to the "-" pin on the sensor, the "5V" pin on the board is connected to the "+" pin on the sensor, and the "A0" pin on the board is connected to the "Out" pin on the sensor. I'm also using the basic "ReadAnalogVoltage" program. Here it is, in case you'd like a reference:
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
float voltage = sensorValue * (5.0 / 1023.0);
// print out the value you read:
Serial.println(voltage);
}
The problem is, the code seems to do the opposite of what it's supposed to! I've run some tests with and without the UV sensor connected to the A0 pin. When I'm inside (with no UV light) and it's not connected, I get numbers around 0.45. When I'm outside (with UV light), and it's not connected, I get about 2.5. However, in both cases (inside and outside), when I attach the wire to A0, the number immediately drops to 0. Why is that?
The solder on the ground pin was from older tests. A bit ago, I had the suspicion that the different ground pins might correspond to the analog and digital sides of the board (I'm pretty new to Arduino so I have no idea). The blue wire was originally soldered to A3, but I removed it so that I could easily move the wire to different analog pins between tests.
I have merged your topics due to them having too much overlap on the same subject matter @l_t.
In the future, please only create one topic for each distinct subject matter and be careful not to cause them to converge into parallel discussions.
The reason is that generating multiple threads on the same subject matter can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.
I've already tried it soldered, as that was why there is leftover solder on A3. I also tried using a breadboard, and even connecting to 3.3V instead of 5V. After all that, nothing. Could there maybe be some sort of file that I need to install to the IDE?
I've also checked the Adafruit page, but couldn't find much help there.
Use your multimeter to measure the output voltage of the UV sensor module, in the dark and when illuminating the sensor with full sunlight, outdoors. The sensor needs to be powered, of course, and solder joints to the module must be clean and not touching each other.
Ok, when I tried directly measuring the output voltage of the 5V pin with the multimeter, I wasn't getting any power. However, when I tried the VIN pin, I was getting some power. So, I tried hooking it up to the UV sensor with the VIN pin instead of the 5V pin, and it worked. But, I'm skeptical that it may not work when I try to hook it up when it's not connected to my computer.
What does the VIN pin actually do, and will it work if I use it?
To use, power the sensor and op-amp by connecting V+ to 2.7-5.5VDC and GND to power ground. Then read the analog signal from the OUT pin. The output voltage is: Vo = 4.3 * Diode-Current-in-uA. So if the photocurrent is 1uA (9 mW/cm^2), the output voltage is 4.3V. You can also convert the voltage to UV Index by dividing the output voltage by 0.1V. So if the output voltage is 0.5V, the UV Index is about 5.