Having thought for a while about what I might be able to achieve for the Vision Thing Project14 competition I have decided to try and create a system that uses Artificial Neural Networks (ANN) to recognise images or shapes from a simple grid array camera. I didn't want to use an existing camera as that seemed a bit of a cop-out (and possibly a bit too complicated for me) I decided to make my own camera. I could have used some type of semiconductor based light sensor but these are relatively expensive as I wanted to make an array of 8x8 sensors. So, instead I have chosen to use light dependant resistors (LDR) as these can be obtained for only a few pence each.
Rather than launch straight into constructing an 8x8 grid array of LDRs I decided to make a simple 1x8 array first. Mainly because the Arduino Nano I am currently using has only 8 analogue input connectors, plus I wanted to get some experience of how the construction of the array affects the amount of light falling onto each LDR pixel. I have used a pice of stripboard to hold the 8 LDRs in place which spaces the pixels at approximately 5 mm apart which seems a reasonable pixel area for what I want to do. This proved to be more difficult than I expected as the thin wires on the LDRs did not occupy much of the hole area on the stripboard holes and it was quite difficult to make good solder joins. This lack of soldering is something I will have to look into when I make the 8x8 array.
The LDRs vary from a low resistance of approximately 80 Ohm in bright light to a much large 100 kOhm+ in darkness, which is a very wide range. I wanted to obtain more sensitivity than this large variation in resistivity would tend to indicate. Fortunately, if the light levels are controlled to be between a bright light (lamp) of 80 Ohms and ambient light level which leads to the LDRs have a resistivity between 3-5 kOhms then a good sensitivity can be achieved. I have used the 3.3V output from the Arduino Nano to provide the supply voltage to the LDR camera as it should be more stable than the 5V value also available, as well as making sure the voltage stays within the input voltage range of the Nano. The 3.3V supply is connected to one end of a 10 kOhm resistor with the other end connected to one connector of the LDR. The other connector for the LDR is connected to 0V. The LDR is theoretically not a polarised device so it should not matter which way round they are connected. The voltage representing the light level is taken from the connection between the resistor and the LDR. All eight LDR pixels are exactly the same. There may be some slight differences between LDRs and their respective connections but for this initial prototype I am going to assume these differences are minimal (unless I discover otherwise). It would be possible to calibrate each LDR pixel individually within the software, but I hope to avoid having to do that.
The test programme for the Nano is simple as it just reads the value on each analogue input pin in turn and outputs the values as integers to the serial monitor. I have written the programme using explicit instructions for each analogue input pin to give me maximum access and control over each LDR pixel. For the 8x8 LDR array then a more compact C programme would be implemented. The programme is listed below.
int LDR0pin = A0; // LDR Analogue Input pins
int LDR1pin = A1;
int LDR2pin = A2;
int LDR3pin = A3;
int LDR4pin = A4;
int LDR5pin = A5;
int LDR6pin = A6;
int LDR7pin = A7;
int LDRvalue = 0; // variable to store the LDR value
Serial.println("LDR Camera ");
} /* setup */
LDRvalue = analogRead(LDR0pin);
LDRvalue = analogRead(LDR1pin);
LDRvalue = analogRead(LDR2pin);
LDRvalue = analogRead(LDR3pin);
LDRvalue = analogRead(LDR4pin);
LDRvalue = analogRead(LDR5pin);
LDRvalue = analogRead(LDR6pin);
LDRvalue = analogRead(LDR7pin);
} /* while */
The video below shows the whole test protoype in action and it does seem to indicate that the concept of an LDR camera is valid. I will now have to analyse the results more carefully to check if the LDR pixels are sufficiently similar that they will produce consistent and reliable image data.