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 & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • 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#06 – Danger Shield with Light Sensor Control
  • 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 1 reply
  • Subscribers 25 subscribers
  • Views 791 views
  • Users 0 members are here
  • 100projects
Related

PSoC 4 Pioneer Kit Community Project#06 – Danger Shield with Light Sensor Control

cy.wbz
cy.wbz over 12 years ago

Hello!

 

Today’s community project is our first project targeting Arduino shield boards. The CY8CKit-042 Pioneer Kit is hardware compatible with numerous Arduino shield boards. In the coming weeks we will showcase various shield boards that are available to Arduino users.

 

Today’s example project uses the “Danger Shield” which includes a list of hardware features such as three large sliding potentiometers, LEDs, LDR light sensor, push buttons, buzzer, and a small 7 segment LED display. The example and descriptions are included in this post.

 

This example project uses the LEDs, LDR light sensor, a switch and our USB-UART bridge to report debug data to the PC. The project demonstrations the use of the LDR light sensor on the Danger shield, integrates the digital switch to run a calibration routine and then uses the LED outputs to indicate the light intensity measured (high or low). The UART interface communicates the status and debug messages across the USB-UART bridge available on the PSoC 4 Pioneer Kit.

 

 

Project Schematic:

 

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

  • ADC SAR (LDR sensor)
  • UART (Debugging)
  • Debouncer (Clean up switch signal)
  • Status Register (Button State)
  • CyPins (LEDs)

 

image

 

(PSoC Creator Schematic)

 

The components are configured by right clicking on the component in your Top Design schematic view and selecting Configure. Please enable the following selections in the Configuration windows for the listed components above.

 

image

 

(Configure menu for ADC SAR)

 

image

 

(Configure menu for UART)

 

image

 

(Configure menu for Debouncer)

 

image

 

(Status Register)

 

image

 

(CyPins)

 

The main.c firmware is included in the example project. Please review the commented sections for more details. The code first initializes a number of project variables and arrays. Once the user enters into the main loop a number of variables and arrays are initialized and the components are started. The code then enters into two separate calibration routines. These routines cover both the Low and High light calibration of the light sensor. The calibrations are controlled and initiated by the digital button presses by the user. Once the calibration is complete the UART initializes the debug messaging and then enters into the main loop. In the application loop the ADC is measuring the LDR sensor output and then calculating whether or not a threshold has been met. Depending on the LDR sensor value the application will toggle between two LEDs.

 

Hardware Connections:

 

For this example project the user will need to connect one piece of hardware and connect two wires. First the user will need to connect the two wires to the J8 header from the PSoC 5LP. Please refer to the USB-UART example project (#04) for images.  Connect the wire to the PSoC 5LP P12  [7] (on J8) and a second wire to P12 [6] (on J8).

 

You will then need to connect the Danger Shield to the PSoC 4 Pioneer Kit. Once the shield board is connected then take the two wires and connect them to the headers on the Shield board. Connect the wires to the following PSoC 4 pins on the shield board header.

 

PSoC 4 UART RX P0[4] --> PSoC 5LP P12  [7] (on J8)

PSoC 4 UART TX P0[5] --> PSoC 5LP P12  [6] (on J8)

 

  In the previous example we connected the UART pins to the header of the Pioneer Kit. Since we have the Shield board connected to the Pioneer kit in this example we needed to connect the UART wires to the header on the Shield board.

 

 

Test Your Project:

 

Once programmed with this project, your PSoC 4 Pioneer Kit is setup to begin the example.

 

Next launch a serial interface tool like PuTTy. We dicussed this in example #04 when we were discussing the USB-UART functionality. Once your PuTTy settings are enabled click open to launch the serial window.


imageimageimage

 

(PuTTy Settings)

 

First press the reset button on the Pioneer kit to ensure the example project starts from the beginning.

 

After resetting you will need to press the D12 digital button. The LED will toggle during the calibration. Press the D12 digital button again and the calibration will be complete. Then wave your hand over the LDR sensor and you will see the LED's toggle between D6 and D5.

 

Next view the PuTTy output window. The example will continuously output data to the PuTTy window. You will see the data change as you wave your hand over the LDR sensor.

image

 

(PuTTY Output)

 

I hope this example can help you out in your design.

 

Best,

Matt


Attachments:
DangerShield-LDR Sensor.zip
  • Sign in to reply
  • Cancel
Parents
  • cy.gul
    cy.gul over 12 years ago

    neat project, Matt!

     

    In case any one is curious about the sheild used in this project - Sparkfun Danger Shield

     

    I ran this project om my PSoC 4 Pioneer Kit with the Danger Shield and made a quick demo video -

     

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

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • cy.gul
    cy.gul over 12 years ago

    neat project, Matt!

     

    In case any one is curious about the sheild used in this project - Sparkfun Danger Shield

     

    I ran this project om my PSoC 4 Pioneer Kit with the Danger Shield and made a quick demo video -

     

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

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