I'd need some help to modulate the raw signal given by a photodiode when light is shone onto it. i don't really know how to implement the PWM in order to convert the raw data.
The signal from the photodiode is not modulated; that is what Im trying to obtain.
Below I attach the fritzing diagram of the circuit I use, the spectrum of the photodiode as shown in its datasheet and the spectrum I read with the arduino.
Fixed it A REAL circuit diagram is so much easier to understand... Most of us are not going to decipher a Fritzing mess by looking up pinouts an stuff...
A photodiode is basically a variable resistor, yes?
You would put the diode in series with a resistor of a known value. This would be put across 5v/ground, and you'd take a tap from the center to an analog input pin. This will give you a value between 0 and 1023. You'd do a little math to work out how the sensed voltage will vary with the restistance of the diode.
You'd then stuff this value into a PWM pin:
const float R = 1000; // using a series 1k resistor between 5v and the diode
const float diodeMax = 10000; // 10K ?
void loop() {
float v = analogRead(A0);
float r = (v * R) / (1024-v); // I think
analogOut(3, r / diodeMax * 256);
}