element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Vision Thing
  • Challenges & Projects
  • Project14
  • Vision Thing
  • More
  • Cancel
Vision Thing
Blog Light Dependant Resistor Camera LDRCam)
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Vision Thing to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: dubbie
  • Date Created: 23 Sep 2019 7:35 PM Date Created
  • Views 5560 views
  • Likes 11 likes
  • Comments 7 comments
  • visionthingch
  • ann
  • artificial neural network
  • ai
  • ai project
  • ldr camera
Related
Recommended

Light Dependant Resistor Camera LDRCam)

dubbie
dubbie
23 Sep 2019
image

Vision Thing

Enter Your Project for a chance to win an Oscilloscope Grand Prize Package for the Most Creative Vision Thing Project!

Back to The Project14 homepage image

Project14 Home
Monthly Themes
Monthly Theme Poll

 

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

void setup()
{
    Serial.begin(9600);
    Serial.println("LDR Camera ");
} /* setup */

void loop()
{
  while (1)
    {
      LDRvalue = analogRead(LDR0pin);
      Serial.print(LDRvalue);
      Serial.print(" ");
      LDRvalue = analogRead(LDR1pin);
      Serial.print(LDRvalue);
      Serial.print(" ");
      LDRvalue = analogRead(LDR2pin);
      Serial.print(LDRvalue);
      Serial.print(" ");
      LDRvalue = analogRead(LDR3pin);
      Serial.print(LDRvalue);
      Serial.print(" ");
      LDRvalue = analogRead(LDR4pin);
      Serial.print(LDRvalue);
      Serial.print(" ");
      LDRvalue = analogRead(LDR5pin);
      Serial.print(LDRvalue);
      Serial.print(" ");
      LDRvalue = analogRead(LDR6pin);
      Serial.print(LDRvalue);
      Serial.print(" ");
      LDRvalue = analogRead(LDR7pin);
      Serial.println(LDRvalue);
      delay(500);
    } /* 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.

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

 

Dubbie

  • Sign in to reply

Top Comments

  • jw0752
    jw0752 over 5 years ago +3
    Hi dubbie This looks like a really neat idea. I look forward to seeing how you develop it. It seems to be a lot more complicated than what I could do so I hope to have an opportunity to learn something…
  • dubbie
    dubbie over 5 years ago in reply to clem57 +3
    Yes, I was greatly encouraged by the response of the 1x8 array so it does look like an 8x8 array might work well. The drawback is that I want it to be greyscale so I will need either 64 ADC inputs, or…
  • dubbie
    dubbie over 5 years ago in reply to jw0752 +3
    John, Thanks for the encouragement. I hope to learn something as well. I don't think it is a technically complicated approach, but I do think it will be a complicated construction and I can see that getting…
  • acetylcoa
    acetylcoa over 5 years ago in reply to dubbie

    I see... from your description, if indeed they are from the GL55XX series, it is likely to be a GL5506. The ones I got were GL5516 -- much higher resistance values for the same amount of light.

     

    I'm not sure if could be calibrated via software, since the range of readings from the ADC is determined by the LDR response and reference resistors, and if the LDRs do not respond well to light the change in ADC readings will be limited...

     

    Maybe I'm overthinking it, though, as like you mentioned the NN could have taken care of it, albeit with more layers/nodes.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • dubbie
    dubbie over 5 years ago in reply to acetylcoa

    I'm not entirely sure what type of LDRs these are. I just bought a bag of 20 some time ago to make darkness activated Christmas decorations - although so far I haven't used them for that project. I too was surprised by how consistent the LDRs seemed to be, however, these readings were taken almost directly under a small halogen desk lamp which is pretty bright so all the LDRs are driven down into the 80 - 90

    Ohm range. Then when they have a shadow they increase to about 2 kOhm which produces satisfactory values.

     

    I was (and probably still am) expecting to have to at least roughly calibrate each LDR, which I can do in the software if necessary, although I am hoping that they will be sufficiently similar that they will work with the artificial neural network. It should be possible to train the ANN even with quite widely varying LDR characteristics, as that is the nature of this type of ANN, they learn from the data provided.

     

    Dubbie

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • acetylcoa
    acetylcoa over 5 years ago

    Are you using the GL55XX LDRs? They seem to give very consistent readings across the resistors in your setup!

     

    Did you have any tips to get them to be so consistent?

     

    I tried the LDR set up of "DIY-Miniature-Solar-Tracker" by Great Scott (GreatScottLab on instructables) and GL55XX LDRs and found that they varied widely in response. In the same lighting, some would give 3kOhm, while others gave as high as 11kOhm. I measured them one by one under similar conditions until I got the number of resistors I needed to get readings that are consistent across like yours.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • dubbie
    dubbie over 5 years ago in reply to jw0752

    John,

     

    Thanks for the encouragement. I hope to learn something as well. I don't think it is a technically complicated approach, but I do think it will be a complicated construction and I can see that getting all 64 LDRs to work properly might be a challenge. However, I did want a challenge, so this looks like it.

     

    Dubbie

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • dubbie
    dubbie over 5 years ago in reply to clem57

    Yes, I was greatly encouraged by the response of the 1x8 array so it does look like an 8x8 array might work well. The drawback is that I want it to be greyscale so I will need either 64 ADC inputs, or some kind of analogue multiplexing. There does seem to be a common 16-to-1 analogue multipler but I would still need four of these, as well as wiring up 64 resistors, 64 LDRs and at least 64 wires! That's a lot of soldering to get right.

     

    Dubbie

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube