element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • 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
Sensors
  • Technologies
  • More
Sensors
Sensor Forum Struggling to get a digital sensor to see my indoor ambient light
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Sensors to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Suggested Answer
  • Replies 8 replies
  • Answers 5 answers
  • Subscribers 342 subscribers
  • Views 1582 views
  • Users 0 members are here
  • light sensor
  • photodiode
  • ambient light sensor
  • photoresistor
Related

Struggling to get a digital sensor to see my indoor ambient light

suitcase
suitcase over 5 years ago

I wanted to use a Raspberry Pi to check whether my room's ceiling light was on. I’m an electronics amateur and do not want to solder anything, so I am using a Pi Zero W with presoldered pins, and using female-to-female Dupont cables I bought to connect the GPIO pins to the sensor board.

 

I bought this cheap little photoresistor board: https://www.aliexpress.com/item/32806322505.html

 

I set it up successfully (using the digital out, since a regular Pi can't see analog signals). I can easily set it up so that flashing my phone flashlight at it will make it return something different over the digital out.

 

But with all the adjusting I'm doing of the potentiometer, I just can't get it to reliably trigger when the ambient room light changes. If I am REALLY careful with it, tweaking the potentiometer to the point the “DO-LED” starts flickering on and off, barely turning on, I can get it to work for a few minutes to return 1 or 0 over the digital output based on the room’s light, but it’s very flaky. Right now I just thought I got it right, but after five minutes, find it’s flickering between 0 and 1 again.

 

What would be a better, more reliable room sensor I could purchase? I bought a similar board that used a photodiode instead, and it's just as bad. Maybe worse, because photodiodes are more directional, I guess. It just seems like these little potentiometer-adjustable sensors have a microscopic “sweet spot” for detecting ambient room light, which doesn’t make sense to me.

 

One critical thing is that I don’t want to solder anything, or use a breadboard, or anything that seems complicated. I really liked my little setup with the dupont cables and this board, and I’d like something that is just as doable with my hands alone. What should I get?

  • Sign in to reply
  • Cancel

Top Replies

  • jw0752
    jw0752 over 5 years ago +7 suggested
    Hi, You might want to check to see if you can find a module that has a hysteresis adjustment as well as a sensitivity control. The hysteresis will allow you to adjust the turn on and turn off points to…
  • dougw
    dougw over 5 years ago +6 suggested
    You could try putting a little cup reflector around the sensor to collect more light onto the sensor surface. something like aluminum foil should work, but be careful not to short out the sensor leads…
  • fmilburn
    fmilburn over 5 years ago +5 suggested
    There are more precise sensors like the one by Rohm that is included in the RoadTest here . Adafruit also sells one that I have used. They should be relatively easy to set up over I2C on the Pi although…
Parents
  • fmilburn
    0 fmilburn over 5 years ago

    There are more precise sensors like the one by Rohm that is included in the RoadTest here.  Adafruit also sells one that I have used. They should be relatively easy to set up over I2C on the Pi although I haven’t done that.  The measurements are reasonably accurate without calibration and stable. It would be easy to set up hysteresis in software as John describes above. 

    Frank

    • Cancel
    • Vote Up +5 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • suitcase
    0 suitcase over 5 years ago in reply to fmilburn

    Thank you! These two sensors seem to require soldering, which I am hoping to avoid. However, this one seems to have a similar model number to the Adafruit one  (VEML7700), and looks to have a socket I could plug my little individual Dupont cables into. Would you say this seems about right, or is it not going to be readable over the Pi’s GPIO in the same fashion as the Adafruit model?

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • shabaz
    0 shabaz over 5 years ago in reply to suitcase

    You'll need to use some adaptor cable, because the connector is JST 'PH' which is 2mm pitch, not 2.54mm pitch. Ordinary jumper cables will be too tight, although perhaps you may be able to remove the plastic shells and use thinner heatshrink to fit them but it would be an experiment. Possibly some JST PH to 0.1" header pins cable exists, or you could crimp your own (JST shells and pre-crimped wires exist on ebay etc, so you may only need to crimp the other end yourself).

    The board uses I2C, so it needs to go to specific pins on the 'Pi, and it won't be readable in the same fashion, since the board you're replacing only has an on/off output.

    This board  provides light level readings, and I2C code is used to read the digital register containing the light level. So, your code needs to be adapted for that (it's not difficult, there are plenty of examples if you google 'pi i2c'+the language of your choice,  it may require you to either find existing code for that board or chip, or check the datasheet and write your own).

    Also, although you may not need to solder with this board, you may need to desolder. There's some pull-up resistors on the board that the Pi doesn't need. It may work fine, but if it doesn't, you'll need to remove the resistors (could be clipped off with wire cutters maybe, if you really don't want to touch a soldering iron, but at some point difficulties could be far more easily resolved using a soldering iron (even a cheap $15 one would do)).

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
Reply
  • shabaz
    0 shabaz over 5 years ago in reply to suitcase

    You'll need to use some adaptor cable, because the connector is JST 'PH' which is 2mm pitch, not 2.54mm pitch. Ordinary jumper cables will be too tight, although perhaps you may be able to remove the plastic shells and use thinner heatshrink to fit them but it would be an experiment. Possibly some JST PH to 0.1" header pins cable exists, or you could crimp your own (JST shells and pre-crimped wires exist on ebay etc, so you may only need to crimp the other end yourself).

    The board uses I2C, so it needs to go to specific pins on the 'Pi, and it won't be readable in the same fashion, since the board you're replacing only has an on/off output.

    This board  provides light level readings, and I2C code is used to read the digital register containing the light level. So, your code needs to be adapted for that (it's not difficult, there are plenty of examples if you google 'pi i2c'+the language of your choice,  it may require you to either find existing code for that board or chip, or check the datasheet and write your own).

    Also, although you may not need to solder with this board, you may need to desolder. There's some pull-up resistors on the board that the Pi doesn't need. It may work fine, but if it doesn't, you'll need to remove the resistors (could be clipped off with wire cutters maybe, if you really don't want to touch a soldering iron, but at some point difficulties could be far more easily resolved using a soldering iron (even a cheap $15 one would do)).

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
Children
No Data
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