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
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • 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
Smarter Life
  • Challenges & Projects
  • Design Challenges
  • Smarter Life
  • More
  • Cancel
Smarter Life
Blog Smart Life Challenge: geoCar PSoC meets Android sample
  • Blog
  • Forum
  • Documents
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: camuyano
  • Date Created: 20 Nov 2013 2:27 AM Date Created
  • Views 668 views
  • Likes 1 like
  • Comments 3 comments
  • android
  • bluetooth
  • psoc4
  • smarter_life_challenge
  • gecar
  • smarter_life
  • psoc
Related
Recommended

Smart Life Challenge: geoCar PSoC meets Android sample

camuyano
camuyano
20 Nov 2013

A few posts ago I posted about the bluetooth and the PSoC and was asked to post some code for it. So here it is some sample code to write from Android via Bluetooth to the PSoC. This is nothing close to what my project be but it is a test of the different components and others might found it useful so why not share it.

 

Hardware

PSoC Pioneer Kit

Bluetooth to Serial TTL adapter (cheap adapter close to $10 ebay/amazon .... )

 

Software

PWM

UART

Android application (https://github.com/soynerdito/AndroidPSoCBluetooth)

 

Overview

I copied the PWM from the PSoC capacitance sample. Then added an UART control with 9600 baud rate. Wrote a simple Android app to send a character via Bluetooth.

The bluetooth device is called "linvor" with passcode 1234. If you use a different one, may need to change the code to use the one you needed. Before using the app the bluetooth device should be paired with the phone (the same way you pair a headset) with it's corresponding pin code. The app will try to connect to an already paired device named linvor, please note that this is a simple sample code without any error checking. Original code gotten from the android developer site sample and modified a little bit.

On the PSoC when receiving a character (integer value) I did the exact same thing as the demo (shift the bits) and write to the PWM control. I control the range of the values like the example, from 1 to 127 (I skipped the 0).

image

image

It is pretty straight forward. On the demo the PWM is written when an interrupt is generated, here is when a character from 1 to 127 arrives.

image

 

Testing the app with the PSoC

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

Attachments:
BlueSoc.zip
  • Sign in to reply
Parents
  • DAB
    DAB over 12 years ago

    Good demo.

     

    It looks like the Bluetooth HW and SW worked well.

    Did you encounter any unexpected issues when you put the two together?

     

    DAB


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

    Good demo.

     

    It looks like the Bluetooth HW and SW worked well.

    Did you encounter any unexpected issues when you put the two together?

     

    DAB


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

    Actually no. It is scary easy on how to use the UART on the PSoC. The code of the PWM is not something that I understand very well, but it was just as easy as taking the code from the interrupt of the Cap demo out and then set it up on the receiving of the character that comes from the UART interface. On the android it was just getting the correct documentation from the Android site.

    I hope somebody sees this and help'em achieve what ever he/she wants.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • vsluiter
    vsluiter over 12 years ago in reply to camuyano

    Nice demo. Simple and effective.

    It's always impressive when paired with a smart phone. Just like a few years ago when the first 'tinkerer' devices started to feature USB. Makes you feel grown up image

    • Cancel
    • Vote Up 0 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