I am trying to build the amplifier circuit with the photodiode. I am referencing the circuit below. Note I only built the photodiode amplifier circuit around the LM358. I do not have a boost converter (U3) or linear regulator (U5) connected. My code also measures A1 and I have switched R1 with a 6.6M ohm resistor (I have a 2.2M ohm resistor though).
The problem is that my serial output gives a constant value (~400 counts). I dont understand why. If I disconnect the analogpin, I get the same output. Without changing anything else, I DO get a light-dependent response when I power the circuit with the 5V and GND pins of the Arduino board itself. However, there is NO response when I connect to the DC Power supply.
int sensorPin = A1;
int sensorValue = 0;
int read1;
int read2;
int read3;
int read4;
int read5;
int val;
void setup(void) {
Serial.begin(9600);
pinMode(13, OUTPUT);
pinMode(sensorPin, INPUT);
}
void loop(void) {
val = 0;
digitalWrite(13, HIGH);
delay(100); // how long the light is on before measuring fluorescence
for (int x = 0; x < 10; x++) { // collect ten measurements
read1 = analogRead(sensorPin);
delay(10);
val = val + read1;
}
Serial.println(val/10); // average of sum of 10 readings
digitalWrite(13, LOW);
delay(100);
}
Please post a hand drawn schematic of the actual circuit you have constructed, showing the Arduino connections as well.
As an aside, the LM358 is a very poor choice for a transimpedance amplifier, especially operating at 5V. It has very limited range of input currents and output voltages. Excellent circuit construction is required, and a breadboard may not even work due to conductive paths. Finally, you should be using a FET-based amplifier. Don't even try to use the 6.6 Meg resistor.
Yeah... I've never built a transconductance amplifier (or really studied them) but I'm pretty sure you need high gain for a photodiode and high gain usually means "trouble". You generally need low noise components, and good PCB layout in a shielded case, etc. (Most of my experience with high-gain and noise-sensitive circuits is with audio, but thermocouple amplifiers can and amplifiers for strain gauges can be finicky too.)
Depending on what you're doing and your optical requirement a phototransistor might work better, or even a light dependent resistor (LDR).
And 'just for kicks" try reversing the photodiode in case you have it backwards.
Do you have a common ground? You need a common ground.
Do you have a multimeter?
Unconnected, the analog input will float to an undefined voltage so a reading of 400 (or almost anything) is perfectly normal.
But it's quite a coincidence that the op-amp would be putting-out the exact same voltage.
Without the photodiode and ignoring any "imperfections" from the high-value feedback resistor, you basically have a buffer amplifier (a gain of 1.0) with an input of 1/3 x 12V = 4V, so that would give you a 4V output for a raw ADC reading of about 820.
What do you anticipate, higher AD counts with increasing light on the sensor? Are you attempting to linearly map counts to light levels?
Other than transimpedance and amplification, I am unsure what the goal is you want to achieve. From the photos, is a common Gnd established via the power supply? Establish a common ground directly to the Arduino analog ground and digital ground planes.