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
Cypress Kits
  • Products
  • Dev Tools
  • Cypress Kits
  • More
  • Cancel
Cypress Kits
Forum PSoC 4 Pioneer Kit Community Project#096 – Light Sensor Project
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Cypress Kits to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 4 replies
  • Subscribers 27 subscribers
  • Views 1395 views
  • Users 0 members are here
Related

PSoC 4 Pioneer Kit Community Project#096 – Light Sensor Project

cy.wbz
cy.wbz over 12 years ago

Hello!

 

In today’s example project we will create a light sensor project that interfaces with the DFRobot Ambient Light Sensor (DFR0026). This example project uses an opamp interfaces to an ADC SAR to read in the value from the light sensor. The value from the light sensor is then transmitted over UART over the PSoC 5LP USB-UART bridge and displayed on the PC.

 

image

 

The key point of this example is that the PSoC 4 is put into a deep sleep mode and uses the Watch Dog Timer (WDT) to trigger an interrupt to sample the ADC and then move back into deep sleep mode. This is a common solution needed for devices that are power conscience or power limited.

 

image

 

Forum Post Attachments:

 

At the bottom of this post we are including the following items:

  • Example Project Zip File
  • Project Images

 

Components Used: 

 

The user can download the example project at the bottom of this post. The project uses the following list of Creator Components:

  • OpAmp
  • ADC SAR Seq
  • UART
  • WDT
  • CyPins

 

Firmware Description:

 

The main.c firmware is included in the example project. Please review the commented sections for more details.

 

image

 

In this project the PSoC 4 device enters deepsleep mode after processing and transmitting the light sensor data. To reduce the power usage of the example we control the ground of the light sensor with a pin on the PSoC 4. Before entering deepsleep, the light sensor ground pin is set to high to disable the sensor. After wakeup, the pin is set to low, to enable the light sensor for ADC conversion. Once the device has powered the light sensor the SAR ADC samples and coverts the output voltage of the light sensor. The PSoC 4 then transmits the result to Hyperterminal via the UART and the PSoC 5LP bridge. The PSoC 4 then identifies if it is night or day through a range detection. The device then enters deepsleep to be awoken by the WDT on the next interrupt.

 

image

 

Hardware Connections:

 

This example project utilizes a number of external components that are details in the PSoC 4 schematic design. Additionally users will need to connect the light sensor to the specified connections.

 

The UART lines from the PSoC 4 must be connected to the PSoC 5LP UART bridge (P12.6 and P12.7).

 


image

 

Test Your Project:

 

Connect the hardware and then program this example project into the Pioneer board. Connect the Pioneer board to the PC and then launch the hyperterminal to view the output from the example.

 


image

 

I hope this example can help you in your design.

 

Best,

Matt

Attachments:
LightSensor_22SP1.cywrk.Archive02.zip
5226.Project Images.zip
  • Sign in to reply
  • Cancel
  • jesusantoniocar
    jesusantoniocar over 12 years ago

    Hello Matt.

    Thanks for this project.

    A light sensor, as its name suggests, is a device that is used to detect light. There are many different types of light sensors, each of which works in a slightly different way. A photocell or photoresistor, for example, is a small sensor that changes its resistance when light shines on it; they are used in many consumer products to determine the intensity of light. A charged coupled device (CCD) transports electrically charged signals, and is used as a light sensor in digital cameras and night-vision devices. Photomultipliers detect light and multiply it.

     

    great project.

     

    Regards,

     

    Jesus Antonio.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to jesusantoniocar

    It seems, the DFRobot Ambient Light Sensor board, DFR0026 hasnot too much components:

    - the CDS Photoresistor

    - two resistors

    - and one capacitor.

    It seems, easy to substitute with another light detector, for experiments.

    Maybe the used CDS component has special specification, why they call it ambient light sensor. Do you know what is the ID of this component?

    If I know well, there arenot too popular nowewadays the  cadmium sulphid based photoresistor devices. Here is an interesting application of it: detect the moonlight with it. There is another note, that this devices have signiphicant variability in its parameters:

    " I am informed that the industry standard for specification tolerances of CDS photocells is typically 30% .... this amounts to a very wide latitude of variability in photo-conductive cells..."

    http://home.earthlink.net/~nevadabat/Moonlight/MoonLight.html

    Another interesting field of the light sensors to trigger photo-camera, for example take pictures of lightening strikes. Usually this sensors need another stage, to produce a "well-formed" impuse for the camera trigger.

    t.janos

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • DAB
    DAB over 12 years ago

    Hi Matt,

     

    A nice little project to show how you can control a process based upon day or night determination.

     

    You could also use the circuit in a dark room to determine if someone has entered and is using a flash light (or torch for the UK) to set off an intruder alarm.

     

    Thanks

    DAB

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 11 years ago

    Please could someone explain to me how the gain of the op amp works?

     

    It has no programmable gain so how do I know what voltage I am expecting at the output for a specific input? it doesn't make any sense to me..

     

    Like if I know my input signal is 10mV pk/pk what am I going to get at the output of the opamp component.. I know the 5LP has a PGA which makes more sense to me.

     

    Also what is the point of the voltage divider at the input of the ADC?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • 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