Welcome to EnviroDIY, a community for do-it-yourself environmental science and monitoring. EnviroDIY is part of WikiWatershed, an initiative of Stroud Water Research Center designed to help people advance knowledge and stewardship of fresh water. New to EnviroDIY?Start here
Hi all, I own a SP-110 Apogee sensor. I am working the sensor with DOIT ESP32 Devkit Board V1. Could anyone please check the code and see if the code is done correctly? Do I need to include any library in the code? Thanks in advance. Rgds, Storm
Arduino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* code read Apogee SP-110 Solar Radiation Sensor output to the serial terminal.
* RED wire: Data line, connect to ESP32 Devkit Board (30 Pin) ADC pin (pin 4)
* WHITE and CLEAR/BARE wire: Connected to GND
*/
constintAnalog_pin=4;
intsensorValue=0;
floatvoltage=0;
voidsetup(){
Serial.begin(115200);
}
voidloop(){
sensorValue=analogRead(Analog_pin);// change this to the correct analog pin you're using
voltage=(sensorValue*3.3)/(4095.0);//convert bits to volts (12 bits)
//ESP32 ADC bit can be (9 bits/10 bits/11 bits/12bits),
//if the ESP32 ADC bit is not been configure then usually is in 12 bits
floatShortwaveRadiation=voltage*5.0;//Apogee SP-110 has calibrated output of 5.0 W/m2 per mV