Introduction: ADS1115 InstESRE Pyranometer
A pyranometer measures the sun's irradiance (power/area, basically "brightness") on a surface. Despite the similar names, it is completely different from a pyrometer, so stop right here if that is what you are looking for.
This Instructable describes how to build and test a modified version of the pyranometer kit offered by Dr. David Brooks of the Institute for Earth Science Research and Education (InstESRE):
http://www.instesre.org/construction/pyranometer/pyranometer.htm
This version of the InstESRE pyranometer interfaces with an Arduino using an ADS1115 analog-to-digital converter (ADC) and also supports temperature correction using a TMP36 temperature sensor co-located with the photodiode.
The IV Swinger 2 IV curve tracer supports this pyranometer design as an optional sensor, and that was the motivation for the modifications. However, since other users of the InstESRE pyranometer may find it useful, this Instructable describes the design independently from the IV Swinger 2 project.
The following GitHub repository contains the documentation and software:
https://github.com/csatt/ADS1115_InstESRE_Pyranometer
Please download and read the document before proceeding. The document contains a text-only version of the steps in this Instructable and can be used as a checklist during construction. It also describes how to order the kit from Dr. Brooks and what additional parts to buy. Those are not repeated in this Instructable.
Step 1: Gather Tools
I used the tools shown in the photo.
Step 2: Prepare Enclosure
- Insert the grommet into the hole at the end of the case. Use a small blunt object such as a small screwdriver. Be careful not to cut the grommet. (The grommet is the soft rubber O-shaped item.)
_______ - Spread a small amount of superglue around the inside of the larger of the two holes in the top of the case. Insert the bubble level from the inside of the case. Make sure the bubble level's shoulder seats firmly against the top of the case. Set the case aside, upside down, to let the glue dry for several minutes.
[NOTE: the bubble level is not needed for the IV Swinger 2 application, and it is not shown in the photos.]
_______
Step 3: Prepare Photodiode and Diffuser
- Make sure the PDB-C139 photodiode leads are straight and parallel to each other, making adjustments if necessary.
_______ - Insert PDB-C139 photodiode into the LED holder. It should snap into place. Do NOT use any superglue.
_______ - With the PDB-C139 photodiode leads pointing up and with the longer lead to the left and the shorter to the right, VERY SLIGHTLY bend both leads away from you.
_______ - Insert the photodiode assembly into the housing tube from the top. Again, do NOT use any superglue. Make sure the top of the diode is clean and dust free.
_______ - Pick up the Teflon diffuser disk with a paper towel or tissue and rub both surfaces gently to remove any dust or debris that might be there. Snap the disk into its recess at the top of the housing tube. Do NOT use any superglue. If it is a very loose fit, you will have to use some superglue LATER, but NOT YET.
_______ - Flip the assembly upside down (leads pointing up, longer one to the left). Make sure the diffuser disk didn't fall out. Use 4 pieces of tape to hold it down on a hard, smooth work surface. The tape should be below the machined rim of the tube. Wrap one more piece of tape around the tube.
_______
Step 4: Add TMP36 (optional)
- Insert the TMP36 into the hole on the near side of the photodiode leads, with the flat side of the TMP36 toward the leads, and the rounded side towards the wall of the tube. Press it down by the ends of its leads. It should fit nicely with minimal deflection of the photodiode leads.
_______ - Remove the TMP36, apply superglue to its top, flat side, and rounded side and promptly insert it back into the hole in the same position. Use only enough glue so it should stick to the LED holder, diode leads, and inside of the tube, but don't use so much that it could possibly flow around the photodiode. Make sure to press it into the hole quickly, so the glue doesn't grab it before it is all the way in.
_______ - Adjust the two photodiode leads and the three TMP36 leads so they are all pointing as straight up as possible
_______
Step 5: Glue Sensor Tube to Case
- Apply some superglue to the machined rim of the tube and then promptly lower the case over that, so the tube is glued into the hole in the case. The long dimension of the case should be in line with the rows of leads coming through the hole and the end hole with the grommet should be to your right. Make sure the tube is fully seated in the hole.
_______ - Use some tape to hold the case in position so that it is level and the tube is perpendicular to it.
_______
Step 6: Add ADS1115 Board
- Apply a blob of superglue to the back of the ADS1115 board right in the middle. Quickly, but carefully, lower the ADS1115 board down with the longer photodiode lead coming through hole A0 and the shorter one coming through hole A1. The three TMP36 leads will be along the edge of the ADS1115 board and may deflect slightly. Adjust the position of the ADS1115 board so the A0 and A1 holes are centered over the tube hole and hold the board in place for about a minute so it sticks to the case.
_______ - Leave this untouched for a couple hours so the glue will be sure to have dried. Do not proceed with the following steps until then.
_______
Step 7: Add Load Resistor
- Cut both leads of the resistor to 1 cm. Bend 2mm on the end of each lead at a right angle and insert those 2mm ends into holes A0 and A1 of the ADS1115 board, alongside the photodiode leads. The reason for the 2mm length is so there's no possibility that the ends can touch the TMP36 leads or the other photodiode lead underneath the board.
_______ - Solder the resistor and photodiode leads to holes A0 and A1.
_______ - Trim the photodiode leads.
_______
Step 8: Solder TMP36 Middle Lead to A2 (optional)
- Gently bend the two outer TMP36 leads away from the edge of the ADS1115 board.
_______ - With long-nosed pliers, carefully bend the middle TMP36 lead toward the A2 hole and solder it to the hole. You may need a small piece of stripped hookup wire in the hole to solder to if the lead isn't quite long enough to actually go into the hole. Make sure this lead is not making contact with the A1 solder joint or photodiode lead stub.
_______
Step 9: Prepare Cable
- Untape the whole assembly from the work surface
_______ Shake it to make sure the Teflon diffuser disk doesn't fall out. If it does, set the disk aside for now.
_______
- Cut the female end off of the cable. Push the cut end through the grommet into the case and pull it through. Don't worry about pulling it too far, you will be able to pull it back out later. Use a drop of dish soap if it is difficult to push through.
_______ - Cut away the outer cable sheathing on the cut end to expose the four wires inside, being careful not to damage the insulation on the inner wires. Cut away at least 2 cm of the sheathing.
_______ - Strip 8 mm of the insulation from the inner four wires and twist the ends of each.
_______ “Tin” the twisted ends by heating with the soldering iron and applying some solder to the strands.
_______- Use a digital multimeter (DMM) to determine the connectivity between the inner wires and the four parts of the 3.5mm plug on the other end of the cable. Write down the colors:
Color:
Tip: _________________ [+5V]
Ring 1: _________________ [SCL]
Ring 2: _________________ [SDA]
Sleeve: _________________ [GND]
NOTE: these colors will almost certainly NOT match the colors in the connections diagram, so this is very important.
_______ - Pull the cable back out through the rubber grommet until the insulation of the inner wires just reaches the VDD hole of ADS1115 board.
_______
Step 10: Solder Cable Wires and Hookup Wire to ADS1115
- Cut the following lengths of hookup wire (only needed forTMP36)
- Black, 2.5cm
- Red, 2.5cm
Strip 6mm from each end of each.
_______
_______
_______
_______
_______
Step 11: Solder TMP36 Power/ground Leads (optional)
- Solder the other end of the 2.5cm black wire (from the GND hole) to the TMP36 lead on the right. Make sure it doesn't contact the middle lead.
_______ - Solder the other end of the 2.5cm red wire (from the VDD hole) to the TMP36 lead on the left. Make sure it doesn't contact the middle lead.
_______
Step 12: Cut and Solder Wires to Jack
- Cut four hookup wires. Make them long enough for whatever enclosure you'll be putting the Arduino in (9cm for IV Swinger 2):
- Black: __________
- Red: __________
- Blue: __________
- Green: __________
Strip 1cm from the end of each.
_______
_______
Twist the RED wire to that solder connection on the jack.
_______
Twist the BLACK wire to that solder connection on the jack.
_______
Twist the BLUE wire to that solder connection on the jack.
_______
Twist the GREEN wire to that solder connection on the jack.
_______
- Red to VDD: __________
- Black to GND: __________
- Blue to SCL: __________
- Green to SDA: __________
_______
Step 13: Final Assembly
- Put the cable tie around the cable and use pliers to pull it tight right next to the grommet on the inside of the case. Trim.
_______ - Screw the cover to the case.
_______ - Use the small piece of fine abrasive paper included with the kit and gently abrade the surface of the Teflon with a circular motion, just enough to remove the "shine" from the disk.
_______ - If the Teflon diffuser disk did not snap tightly into its recess, use a TINY amount of superglue around the recess to hold it in. Make sure not to get any glue on the photodetector! A toothpick can be useful to apply the superglue, but move quickly. Use a small clamp to hold it in while the glue dries.
_______ - Connect to Arduino:
Connect the four wires from the back of the 3.5mm jack to the Arduino as shown in the photos.
_______
Step 14: Running Tests and Calibrating
The document in the GitHub repository describes how to load and run the tests. It also describes what is required to calibrate the pyranometer.
12 Comments
Question 6 months ago on Step 14
Hey there,
I have been trying to make this pyranometer alongside my solar panel, however while running the arduino code I repeatedly get this error :
ERROR: wrote 8 but read 65535
Any fix for this please ?
Also instead of soldering I have used jumper wires, pins on the ADS1115 and a breadboard, hopefully that does not affect the working.
Answer 6 months ago
Hello again,
Another user (mrelyes37) sent me a PM today with a very similar problem.
Is that someone you know? Anyway, I spent some more time on it, and here
is additional information that I sent to him.
I just did an experiment myself. If I run the Test_ADS1x15.ino sketch on
an Arduino WITHOUT AN ADS1115 CONNECTED AT ALL, the result is similar to
what you are seeing:
15:17:19.534 -> ERROR: wrote 63 but read 65535
15:17:19.534 -> 0 reg tests passed, 64 reg tests failed
15:17:19.534 -> PGA=0 CH0: -187 uV CH1: -187 uV CH2: -187 uV CH3: -187 uV CH0/1: -187 uV CH2/3: -187 uV
15:17:19.572 -> PGA=1 CH0: -125 uV CH1: -125 uV CH2: -125 uV CH3: -125 uV CH0/1: -125 uV CH2/3: -125 uV
15:17:19.651 -> PGA=2 CH0: -62 uV CH1: -62 uV CH2: -62 uV CH3: -62 uV CH0/1: -62 uV CH2/3: -62 uV
15:17:19.687 -> PGA=3 CH0: -31 uV CH1: -31 uV CH2: -31 uV CH3: -31 uV CH0/1: -31 uV CH2/3: -31 uV
15:17:19.762 -> PGA=4 CH0: -15 uV CH1: -15 uV CH2: -15 uV CH3: -15 uV CH0/1: -15 uV CH2/3: -15 uV
15:17:19.799 -> PGA=5 CH0: -7 uV CH1: -7 uV CH2: -7 uV CH3: -7 uV CH0/1: -7 uV CH2/3: -7 uV
The register reads all fail with a value of 65535 (0xFFFF). The small
negative voltages are because 0xFFFF, when treated as a signed 16-bit
integer, is -1. The values above are the values in Table 3 of the ADS1115
data sheet, multiplied by -1.
It appears that your Arduino is not communicating with the
ADS1115. Check the connections. Make sure the ADS1115 ADDR pin is at
0V. The standard ADS1115 module has a 10k pulldown resistor between ADDR
and GND. This sets the i2c address to 0x48. If ADDR is connected to +5V,
the address will be 0x49. If it is connected to SDA, the address will be
0x4A. If it is connected to SCL, the address will be 0x4B. The sketch
has this hardcoded:
#define ADS1X15_ADDR 0x48 // I2C address (0x48 is the default)
It might be interesting to try the other three values to see if any of
them work (but they should not.)
- Chris
Reply 6 months ago
Hi there Chris,
Thank you very much for your replies. I don't know who the aforementioned user (mrelyes37) is but my problem seemed to be with a wrong ADS address and also faulty pins. I've also gone a step ahead and programmed an LCD screen to run with it.
Once again, thank you very much !!!
-salluboiii
Answer 6 months ago
FYI, I committed an update to the Test_ADS1x15.ino sketch that checks for the -1 value being returned from a register read and prints out a message with instructions on what to check. It skips the other tests if that fails, but it keeps looping so you can wiggle wires, etc while watching the monitor to see if anything fixes it.
Answer 6 months ago
Quoting from the document: "If this test does not run, it could be because your cable is too long or because you have made a mistake
I can't really offer any more guidance than that. Using a breadboard and jumper wires should be ok if the connections are correct. I can't remember what the symptom was when the cable is too long.in the wiring/soldering. The only signals that are needed for this test to run are: VDD, GND, SCL, and
SDA. It is also possible, but highly unlikely that the ADS1115 board is bad."
2 years ago
You are using 3 of the ADS1115 inputs (A0,A1,A2). If I wanted to do a dual pyranometer unit (specifically for looking at the instantaneous reflected solar radiation from separated but adjacent vegetated surfaces) could I couple a 2nd PDB-C129 between A0 and A3? The problem is that I would also need to install a TMP36 on each pyranometer to ensure that any difference I see is not due to sensor temperature differences. In posing this question, I probably see the solution as using 2 ADS1115 breakout boards. But I would value your input anyway - I'm guessing there are no measurable differences between 2 ADS1115 breakout boards?
Reply 2 years ago
Sorry for the delayed response.
To use a single ADS1115, you would have to make one of the following two compromises:
- Use single-ended (rather than differential) measurement of the PDB-C139's, having one connected between A0 and ground and one between A1 and ground. That would leave A2 for one TMP36 and A3 for the other. Differential is more immune to noise, but single-ended would probably be fine (Dr. Brooks uses single-ended in his ADS1115 design on his website).
- Forgo the temperature compensation (TMP36) and connect one PDB-C139 between A0 and A1 and the other between A2 and A3. These would be differential, but you lose the temperature compensation. Dr. Brooks argues that inaccuracies due to poor spectral and cosine response overshadow the temperature errors anyway, and he is probably right.
Using two ADS1115's should have neither of these "compromises" (if they are indeed compromises at all) and would work fine. The two ADS1115's should have negligible differences between their measurements.
3 years ago
Yes, a BPW34 photodiode will "work," but its packaging makes it harder to integrate into a cylindrical housing, which is desirable for measuring incoming radiation from the entire hemisphere above the detector. And, yes, you would have to experiment with the size of the resistor, which must be chosen to give a reasonable output voltage that remains linear over the expected range of incoming solar radiation (roughly a maximum value of 1000 W/m^2 around noon on a clear summer day).
Question 4 years ago on Introduction
can I use BPW34 photodiode to make this pyranometer?
Reply 4 years ago
This pyranometer is based on a kit from InstESRE (Dr David Brooks). I added the ADS1115 interface and temperature compensation. Dr Brooks would be the authority on the photodiode.
My guess is that it would work, but it would need a different physical packaging. The resistor value might also have to be different.
My recommendation is to get the kit from InstESRE which includes the PDB-C139 photodiode.
4 years ago
Perhaps you could put in a little explanation as to what a Pyranometer is and the difference between it and a Pyrometer. I'm sure that I wasn't the only person that looked at the Instructable and thought Pyrometer or remote temperature sensing detector.
Reply 4 years ago
Good point! I added two sentences at the very beginning that should help. Thanks for the comment.