element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • STEM Academy
    • Webinars, Training and Events
    • More
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • More
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • More
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • More
  • 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
Cypress Kits
  • Products
  • Dev Tools
  • Cypress Kits
  • More
  • Cancel
Cypress Kits
Forum PSoC 4 Pioneer Kit Community Project#046 – “Paint The Night” Accelerometer Example
  • Blog
  • Forum
  • Documents
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Cypress Kits requires membership for participation - click to join
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 9 replies
  • Subscribers 12 subscribers
  • Views 332 views
  • Users 0 members are here
  • 100projects
Related

PSoC 4 Pioneer Kit Community Project#046 – “Paint The Night” Accelerometer Example

cy.wbz
cy.wbz over 8 years ago

Hello!


We took yesterday off due to the US holiday. The 4th of July US holiday is typically characterized by fireworks in the night sky. Today our example will show you how to create your own fireworks in the night’s sky using the RGB LED. In this example uses a sparkfun 3 axis accelerometer and the PSoC 4 Pioneer kit. We use the accelerometer and the movement of the Pioneer kit to change the colors on the RGB LED.

 

 

 

This project uses our new Component Pack 6 release of PSoC Creator 2.2 SP1. Please take a look at our earlier post on this new release:


http://www.element14.com/community/message/82153

 

Forum Post Attachments:

 

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

  • Example Project Zip File
  • Zip File of Images
    • Project Schematic
    • Component Configurations

 

Components Used:

 

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

  • PWM
  • UART
  • I2C
  • CyClock
  • CyPin

 

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.

 

Firmware Description:

 

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

 

In the example we are communicating to the accelerometer via an I2C interface. This interface will report the positioning on the three axis. This value is then translated into color values on the RGB LED. We use the LED RGB source files used in some of our earlier examples, like example #019. These files give us easy API access to the RGB LED. Make sure you copy those files into your example.

 

We then report the 3 axis positioning over the UART bridge so it can be reported up to the Bridge Control Panel. We are able to chart our positioning in real time using the chart features. You can use the following Bridge Control Panel command to read out the values from the PSoC 5LP USB-UART bridge:

 

RX8 [h=43] @STATUS @1X @0X @1Y @0Y @1Z @0Z

 


 

Hardware Connections:

 

You will need to solder on a male connector to the sparkfun 3 axis accelerometer. The header will be connected into the Pioneer board Arduino headers. Connect the accelerometer into header J3 using Pins 1-6. Ground should be pin 1. Please be very careful when plugging this in as you might reverse the polarity on the power and ground connections and hurt your accelerometer. Please see the below image for the correct orientation.

 


 

Test Your Project:

 

Connect the 3 axis accelerometer board to the Pioneer kit. Program the kit and begin waving the kit around to see the RGB LED change. If you are interested in creating similar long exposure photos using a DSLR camera, take a look at the following video.

 

 

I hope this example can help you in your design.

 

Best,

Matt

Attachments:
6813.Project Images.zip
KIT042_Accelerometer_LightPaint.cyprj.Archive01.zip
  • Reply
  • Cancel
  • Cancel

Top Replies

  • jesusantoniocar
    jesusantoniocar over 8 years ago +1

    Hello Matt.

    Thanks for this project. Another application for our psoc 4 pioneer kit.

     

    amazing....

     

    best regards,

     

    Jesus Antonio.

  • Former Member
    Former Member over 8 years ago +1

    All,

     

    Thanks for expressing your enthusiasm! This was a very fun project to work on. I'm working on another with the accelerometer that should be a little more application focused. For now, enjoy these additional…

  • DAB
    DAB over 8 years ago

    Hi Matt,

     

    Has anyone done a comparison between the 3-axis accelerometer verses a capacitive change sensor array?

    Given the sensitivity of the Capacitive inputs to movement in the Theramin example, a combined project to look at the position information with both sensor types could lead to some interesting implementation options for the Psoc4 board.

     

    Just a thought,

    DAB

    • Cancel
    • Up 0 Down
    • Reply
    • Cancel
  • Former Member
    Former Member over 8 years ago

    Awesome example, Max.

     

    Really. The creativity to take something simple and make it beautiful... Wow.

     

    Matt, we really need to put out the example with the efficient 8-bit PWM for RGB LED control... This using of 3 TCPWMs is ouchy :| (It could be a word, you know)

     

    Good job,

    Antonio

    • Cancel
    • Up 0 Down
    • Reply
    • Cancel
  • jesusantoniocar
    jesusantoniocar over 8 years ago

    Hello Matt.

    Thanks for this project. Another application for our psoc 4 pioneer kit.

     

    amazing....

     

    best regards,

     

    Jesus Antonio.

    • Cancel
    • Up +1 Down
    • Reply
    • Cancel
  • Former Member
    Former Member over 8 years ago

    All,

     

    Thanks for expressing your enthusiasm! This was a very fun project to work on. I'm working on another with the accelerometer that should be a little more application focused. For now, enjoy these additional pictures I created with the help of my wife: http://imgur.com/a/YwXX2

     

    Regards,

    Max

    • Cancel
    • Up +1 Down
    • Reply
    • Cancel
  • Former Member
    Former Member over 8 years ago

    Hi Max,

     

    many thanks for this example...

     

    I've 'pruned' your code to work as a uart to accelerometer device.

     

    All works well, but I'm having no luck when I try to speed up the comms.

     

    The I2C seems to fail at 400 kbps, OK at 100 kbps. (extra pull-ups?)

     

    The uart is fine at 115200 baud but timing seems to be an issue at 230400 baud.

     

    Any thoughts on these issues?

     

    Best regards Michael

    • Cancel
    • Up 0 Down
    • Reply
    • Cancel
  • Former Member
    Former Member over 8 years ago in reply to Former Member

    Michael,

     

    I posted another example running the I2C at 1000 kbps. It is here: http://www.element14.com/community/thread/25961?tstart=0

     

    I also added some code to detect and correct communication failures. I think the accelerometer might be getting hung up somehow.

     

    If that example doesn't work for you, let me know.

     

    -Max

    • Cancel
    • Up 0 Down
    • Reply
    • Cancel
  • Former Member
    Former Member over 8 years ago

    Hi Matt and team.

     

    Great job.

     

    I would like to implement in PSOc5 LP.

     

    But SCB can't put inside the PSOC5 project.Any idea??

    • Cancel
    • Up 0 Down
    • Reply
    • Cancel
  • Former Member
    Former Member over 8 years ago in reply to Former Member

    PSoC 5 has two options for I2C: Fixed function I2C blocks, and UDB implementations of I2C. There might be some slight code changes required, but the architecture remains the same.

     

    Glad you enjoy the project!

    • Cancel
    • Up 0 Down
    • Reply
    • Cancel
  • Former Member
    Former Member over 8 years ago in reply to Former Member

    Dear Max,

     

    Good morning !

     

    Appreciate a lot . I will try to implement it.

     

    Thanks MAN.

    • Cancel
    • Up 0 Down
    • Reply
    • Cancel
Element14

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 © 2022 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

  • Facebook
  • Twitter
  • linkedin
  • YouTube