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 LDR Camera #6 : Starting to Implement the Whole Camera System
  • 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: 7 Oct 2019 5:20 PM Date Created
  • Views 1616 views
  • Likes 10 likes
  • Comments 2 comments
  • nano
  • visionthingch
  • ldr camera
Related
Recommended

LDR Camera #6 : Starting to Implement the Whole Camera System

dubbie
dubbie
7 Oct 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

 

All the parts I needed for the LDR camera have now arrived, well almost - the correct Dupont connectors have not yet arrived but I think I might just about have enough existing ones to be able to connect everything together. As my 3D printer is still not working (I haven't tried to get it working so this is not a surprise) I went old-school and used a piece of wood. I had some hardwood plywood left over from making arm rests for chairs which seemed about the right size and thickness so I used that. I used a piece of stripboard (Veroboard) to obtain the correct grid and spacing for the holes, drilling every 0.3 inch. This does space out the LDRs more than I wanted but two hole spacing is only 2 x 2.54 = 5.08 mm so with a 5 mm drill for the LDR itself, this would mean the thickness between adjacent holes would only be 0.08 mm, which didn't seem viable. Still it looks OK with 0.3 inch spacing. I started with a pilot hole of 1.5 mm, then used a bradawl to increase the size of the neck of the hole and then drilled with a 5 mm drill mounted in a  pillar drill (Hooray for pillar drills). I allowed the wood to self-centre to the drill when I first started to drill each hole. This could be a bit unsafe if the drill was to catch in the surface of the wood - but I was careful and it didn't. The grid array of holes is not perfect but for manual drilling it is not bad.

 

As the drill was sharp the holes drilled were 5.0 mm diameter so the LDRs, also 5.0 mm diameter) are a tightish interference fit. It takes a bit of effort to push them in but not enough to damage the LDRs (well - so far anyway) and this means I do not have to glue the LDRs in, making replacement a possibility. Each LDR has to be in  series with a 10 kOhm resistor and I decided to use a bit of strip board to hold these resistors (64 in total) and to hold connectors for the Dupont wires. With this number of LDRs and wires I thought it wise to create a rigid structure to hold everything, as well as using connectors rather than soldering, in case I make a mistake.

 

The connection from each LDR is then connected to one input on the gang of four 16-to-1 analogue multiplexers, as described in a previous Blog. Each of the analogue output signals from the multiplexers is connected to an analogue input on the Arduino Nano, and four channel selection lines (plus an enable signal) come from the Nano to the multiplexer. It is not an especially complex circuit, it is just that there are (or will be) an awful lot of individual wires and connections. A PCB would have been a good idea and one day I'll learn how to use Eagle.

 

I pretty much used the existing programme for the 1x8 LDR version of the camera, but just set the channel before each analogue measurement is made, using a simple function. I wasn't sure what sort of delay might be needed after changing channels so I put in 20 milliseconds. Once everything is working properly I might look at this on my oscilloscope to see what a better value might be.

 

void setchannel(int chan)

{
  digitalWrite(S0, chan & 0x01);
  digitalWrite(S1, chan & 0x02);
  digitalWrite(S2, chan & 0x04);
  digitalWrite(S3, chan & 0x08);
  delay(20);  //delay to allow analogue voltage tostabilise 
} /* setchannel */

 

There still isn't anything clever or even compact about the existing programme as I just wanted to check everything was working, before sitting down to think about making a more flexible programme. I will have to do this once the complete 64 LDRs is inserted, maybe.

 

while (1)

  {

    setchannel(0);

    digitalWrite(enable, LOW);  // Enable the analogue mux

    matrix.clear();      // clear display

    LDRvalue = analogRead(LDR0pin);

    Serial.print(LDRvalue);

    Serial.print(" ");

    if (LDRvalue > threshold)

      matrix.drawPixel(0, 0, 1);

    else

      matrix.drawPixel(0, 0, 0);

    setchannel(1);   

    LDRvalue = analogRead(LDR0pin);

    Serial.print(LDRvalue);

    Serial.print(" ");

    if (LDRvalue > threshold)

      matrix.drawPixel(0, 1, 1);

    else

      matrix.drawPixel(0, 1, 0); 

    setchannel(2);

    LDRvalue = analogRead(LDR0pin);

    Serial.print(LDRvalue);

    Serial.print(" ");

    if (LDRvalue > threshold)

      matrix.drawPixel(0, 2, 1);

    else

      matrix.drawPixel(0, 2, 0); 

    setchannel(3);

    LDRvalue = analogRead(LDR0pin);

    Serial.print(LDRvalue);

    Serial.print(" ");

    if (LDRvalue > threshold)

      matrix.drawPixel(0, 3, 1);

    else

      matrix.drawPixel(0, 3, 0); 

    setchannel(4);

    LDRvalue = analogRead(LDR0pin);

    Serial.print(LDRvalue);

    Serial.print(" ");

    if (LDRvalue > threshold)

      matrix.drawPixel(0, 4, 1);

    else

      matrix.drawPixel(0, 4, 0); 

    setchannel(5);

    LDRvalue = analogRead(LDR0pin);

    Serial.print(LDRvalue);

    Serial.print(" ");

    if (LDRvalue > threshold)

      matrix.drawPixel(0, 5, 1);

    else

      matrix.drawPixel(0, 5, 0);

    setchannel(6);

    LDRvalue = analogRead(LDR0pin);

    Serial.print(LDRvalue);

    Serial.print(" ");

    if (LDRvalue > threshold)

      matrix.drawPixel(0, 6, 1);

    else

      matrix.drawPixel(0, 6, 0);   

    setchannel(7);

    LDRvalue = analogRead(LDR0pin);

    Serial.println(LDRvalue);

    if (LDRvalue > threshold)

      matrix.drawPixel(0, 7, 1);

    else

      matrix.drawPixel(0, 7, 0);   

    matrix.writeDisplay();  // write the changes we just made to the display

    delay(500);   

  } /* while */

 

The video below shows the entire working 1x8 LDR camera, reaady to be expanded to the full 64 LDR camera. Then it will be time for the ANN part.

 

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

  • genebren
    genebren over 5 years ago +3
    Dubbie, Wow that is a lot of wires yet to run. Good luck getting the rest of the wiring complete. I would have been tempted to connect the series resistor direct to the LDRs (under your super cool hardwood…
  • dubbie
    dubbie over 5 years ago in reply to genebren +3
    Gene, I did originally think I would do this but then once I started to fir the LDRs into place and realised how compact everything would be and how difficult (for me at least) to solder, I decided I need…
  • dubbie
    dubbie over 5 years ago in reply to genebren

    Gene,

     

    I did originally think I would do this but then once I started to fir the LDRs into place and realised how compact everything would be and how difficult (for me at least) to solder, I decided I need to do something else, where it would be much simpler to correct any mistakes I made. So the connectors on the stripboard idea made sense. I am a little concerned that once all 64 wires are in place that the whole contraption may become too unwieldy. If it does I might have to create some sort of base board to fix everything to.

     

    Dubbie

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

    Dubbie,

     

    Wow that is a lot of wires yet to run.  Good luck getting the rest of the wiring complete.  I would have been tempted to connect the series resistor direct to the LDRs (under your super cool hardwood panel) and skipped the protoboard, just to save on connectors and wires.

     

    Keep up the good work!

     

    Gene

    • 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