Ok, so the short of it I made an array of IR transistor sensors but readings across them isn't equal, each sensor reading corresponds to a color of an LED in a strip. Making each LED different color in the default state, making each LED slightly or completely different color, when they supposed to be the same Is there a way to calibrate the array in the program,
The code works well and each LED changes color with an appropriate LED
but the min and max values for each sensor are different messing up the aesthetic of it.
Edit:
accidentally clicked post instead of preview heres what it looks like and yes 3 sensors dont work properly but it was just a test anyway, Led Matrix Test GIF | Gfycat
Why do want to measure the IR output of various visible light LEDS? Are your IR sensors all from the same manufacturer and lot number? IF not there is no way they could give the same value for the same light.
I'm measuring the voltage between the resistor that is connected to the IR transistor, depending on the intensity of light it gets from an IR LED it has a different potential difference. Hence voltage changes with the distance of the object above the sensor, the idea is the same as with a LDR voltage divider. I just need a way of calibrating it so when nothing is near I get an even color.
The accuracy isn't my goal, it's just for the coffee table or something similar. I just have no idea how to calibrate the array, there should be little light from the led strip anyway most should come from a separate IR LED.
If i understand corectly, your problem is that your sensors dont output the same values according to light intensity from distance, eg sensor 1 gives say 1023 and sensor 2 gives 578 and sensor 3 gives 897 ... under the same conditions.
And you ould like them to give the same values under the same conditions.
If that is the case , just off-hand i can see 2 solutions:
One would be to determine the max and min value of each sensor and map the value according to those. Basically this gives you relative values rather then absolute.
The other solution is , i presume you use a voltage divider to read the phototransistors. You could adjust the resistor values so they output the same value . You could use pots instead of resistors, at least temporary until you find the sweet spot value
Yes, that's exactly it. I'd rather do it in the software since the amount of sensors can get overwhelming, I want something like 15x15 at least, working with 3x3 for testing tho. Calibrating individual sensors isnt much of an issue but I just cant figure out how to do it in the array
void calibrate(){
for(int i=0; i<=2; i++){
digitalWrite(digitalPin[i], HIGH);
for(int j=0; j<=2; j++){
// save values for each sensors default and max state, the bit I cant figure out
digitalWrite(digitalPin[i], LOW);
}
}
it's just a test rig but works for trouble shooting
Edit:
here's what i get back from the serial monitor
LED 0 Value : 52
LED 1 Value : 96
LED 2 Value : 5
LED 3 Value : 51
LED 4 Value : 165
LED 5 Value : 7
LED 6 Value : 7
LED 7 Value : 180
LED 8 Value : 219
alexs_tech:
The other solution is , i presume you use a voltage divider to read the phototransistors. You could adjust the resistor values so they output the same value . You could use pots instead of resistors, at least temporary until you find the sweet spot value
It should be sufficient to adjust the load resistor for setting the amplification.
Do you already have a plan how to scan 15x15=225 or more analog signals in acceptable time?
Your test results suggest that the transistors are not aligned to the light source as required or catch random ambient light. Use a pulsed light source and determine the ripple on the signal to learn more about your real problems.
If need be I can use multiple arduinos, each resistor and IR transisntor aren't perrfect so values differ slightly, and setting 200 odd pots each time it needs calibrating isn't practical it's still a problem when they aren't that close to one another, for the actual build i will test each LED and IR tranisitor to get most similar ones but it still wont be perfect, and i want to calibrate it to the ambient light regardless.
I just wrote this but it doesn't let me use the values in the rest of the code and I can't figure out hot to assign a each LedMin value to a corresponding LED hue value
thanks, but ive seen it ages ago but this one uses the premade sensors and they work as buttons essentially,what im doing is analog, with the way its made id the video you cant get a gradual change of color also id have to spend a small fortune on the sensors given the size i want