Go Down

Topic: Measuring sunlight intensity with BPW34 pin diode and Arduino UNO? (Read 10702 times) previous topic - next topic


So first of all, I have limited experience with Arduino, electronics and the C++ language.

I want to be able to measure sunlight intensity with the miniature solar cellBPW34 https://www.sparkfun.com/products/9541, but I can't find any simple circuits or code to measure this with the Arduino Uno.

This is the closest we found to a circuit http://dptnt.com/wp/wp-content/uploads/2010/02/Arduino_Smart_Flash_Trigger.png, I would like to know if we can only use the part of the circuit (on the left side) connected to BPW34 (R1, R2, C1, D1).

Thanks for your help.


That circuit is more than you need and will not work for steady state situations.  Just use the diode and the 10K resistor (R1) and connect from the diode/resistor point (where C1 is now) to the Arduino ADC pin.

Edit:  I'd be tempted to replace that 10K resistor with a 20K trimpot.
Facts just don't care if you ignore them.


Here is a simple circuit that would read the voltage across the PiN.
BillO's trimpot idea has merit.  These components don't generate much power and 10k might load it down.
I added a 0.01uF capacitor to stabilize the voltage a little.  Try it with and without to see if it helps.


Thank you for all your replies.

I'm also limited in parts, I don't have a 20k trimpot but I do have a 10k trimpot and a pack with a wide range of smaller resistors. https://www.sparkfun.com/products/9806? and http://www.thesource.ca/estore/product.aspx?language=en-ca&catalog=online&category=Resistors&product=2719018. I also don't have a 0.01uF capacitor, the smallest I have is just 1uF, would these parts still work?

I can always order online, but that just means more money spent and I'm running behind on schedule.

And would this code work? http://arduino.cc/en/Tutorial/ReadAnalogVoltage, if I just don't add the potentiometer and have the GND, 5v and A0 directly connected on the board?

I don't need the results to be super precise, I'm using for a project just to know if the sun's up and it's intensity.

Thanks again


You are nearer than you think.  Use a 10k resistor in series with the trimpot.  When the trimpot is adjusted to 0 ohms, you have 10k total. When the trimpot is adjusted to 10k, you have 20k. I really don't think that the trimpot will be needed, but it might. :)

The 1uF cap is a little large, but might do. Again, the cap is probably not needed either.  Make sure that, if the capacitor is polarized, you place the negative side to ground.

The ReadAnalogVoltage reads A0 and should work.  I'll review the code to see if it needs a tweek. The PiN diode won't generate much voltage at full light.

Attached is a new schematic with the trimpot and resistor in series, and a polarized cap. Again, the trimpot and cap may not help much.


The ReadAnalogVoltage code should work out of the box, methinks.

The only caveat is that the A0 pin will read an A2D value between 0 and 1024, with 1024 being 5V.  The PiN diode with no load might go up to 350mV, so your circuit's highest possible digital value is 72.  So be prepared for low readings.

A last thought:  the PiN diode's strength is its sensitivity and fast reaction time -- neither needed in your project. A LDR is probably a better sensor for the project.

Attach a picture when you are done...


Ok everything is working now  XD. Attached is a picture of my setup if it's not clear enough: the solar cell is on (positive side) d11 and (negative side) d13, the 10k resistor is connecting the 5V to a11, the 1uf capacitor is connecting the GND to b11, and the yellow jumper wire is connecting the A0 and c11 and the white jumper wire is connecting the GND to a13.

I tried the 10k trimpot but it didn't make any difference. However if I remove the capacitor the serial monitor reads nothing. The code works fine and automatically converts the numbers to Volts. With one cell I got 0.85V from a lamp, I have 3 others and with all 4 together I got 2.00V. The 2V also dropped to 1.6V when I turned the lamp off, which is enough for my project.

Thanks again, I might get a 0.01uF cap just to try it out, If I do I'll post the results and changes.


Heres the code I use:

Code: [Select]
  Reads an analog input on pin 0, converts it to voltage, and prints the result to the serial monitor.
  Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.

This example code is in the public domain.

// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:

// 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:




Won't this circuit work,  as you siad the ADC is 0 - 0v and 1023 - 5v , but u said if we use ur circuit setup this will only generate upto no 72 in serial monitor , so if I want to get an output of 5v max for the 1000W/cm² . that mean for normal day light what is the change I should do to the circuit . I am annexing the BPW34 sensor ilght intensity vs current diagram with this , please reply me as far as you can I need to submit a project within 3 days

Go Up