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
Smarter Life
  • Challenges & Projects
  • Design Challenges
  • Smarter Life
  • More
  • Cancel
Smarter Life
Blog Smarter Life Challenge - Brainwaves based appliance controller - Update 5
  • Blog
  • Forum
  • Documents
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: ciorga
  • Date Created: 25 Nov 2013 7:58 AM Date Created
  • Views 626 views
  • Likes 0 likes
  • Comments 5 comments
  • smarter_life_challenge
  • brainwave_controller
  • smarter_life
Related
Recommended

Smarter Life Challenge - Brainwaves based appliance controller - Update 5

ciorga
ciorga
25 Nov 2013

This was a “bumpy” weekend; it started quite good: I built an active Butterworth second order low pass filter using one of the opamps inside PsoC4.  I put together all external components and configured the PsoC opamp to route the output off-chip so I could probe it with the oscilloscope.  I then swept the input frequency (connected to a sinusoidal generator) and everything worked so good.  The cut-off frequency was just as calculated, around 50Hz.

 

Then the problems started: I realized that I need a window comparator (this was based on the measured waveforms that I showed in my previous update).  So I configured it using the two comparators inside PsoC4, but when I tried to build the project I’ve got a resource availability error.  So then I figured out that I cannot use two comparators and an opamp; only either two opamps, two comparators, or one opamp and one comparator.

 

Next I moved the filter off-chip and I built a window comparator using the two opamps/comparators inside PsoC4.  Then I realized that I could eliminate the low-pass filter for now if I use a debouncer block available in PsoC4.  I setup a 10Hz clock to the debouncer and here is the schematic:

 

image

 

I then routed the two outputs of the window comparator off-chip to two LEDs (in series with two 2.2k resistors).

 

So I could built this project and program the PsoC on the Pioneer kit.  Then while running various experiments and re-building the project, at some point my circuit stopped working.  One LED never turned ON.

 

So I started to troubleshoot this issue and after more than one hour I figured out what was happening:  PsoC Creator program was “optimizing” my project by removing one of the opamps/comparator.  During the troubleshooting pricess I found useful the diagram shown under the “Analog” tab in the pin mapping frame:

 

image

 

This one looks correct but the wrong one, which I did not screenshot, showed one opamp without one of the input connections and also was signaling a warning that one of the pins (that pin that I wanted routed to the opamap) is not connected.  Further tracing this issue I found out that the optimizer removed one of my opamps.

 

So after about 1.5-2 hours of poking around I came up with a solution: the only think that worked was to start a new project from scratch.  This fixed the problem and I’ve got both of my opamps in the built project.

 

If anyone knows a way to disable the PsoC Creator optimizer, I would greatly appreciate if he/she can share that technique with me.

 

Next, I put together the off-chip amplifier that I built before (and I showed the measured waveforms in my previous updates).  The resulted “system” contains the electrodes placed on the forehead skin, the off-chip amplifier, the window comarator inside PsoC4 (on the Pioneer kit), the debouncers used here as low pass filters, and two off-chip LEDs (one yellow and one green).

 

When I then mounted this system on my head and turned it ON, the electrodes measured the electric signals associated to moving my eyes left and right, and these signals were then amplified and processed by the window comparator.  The result could be then visualized by watching the two LEDs (I have placed them above each of my eyes – with some wires hanging there).

 

So each of the two LEDs lights up on one direction of eye movement: one LED lights up when I move the eyes towards left and the other LED lights up when I move the eyes towards right.

 

Here is a video that shows this experiment:

 

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

 

Don’t get scared by so many wires and boards hanging up from my forehead (they are various experimental circuits some active and some inactive hanging there) – the PCB board that I am designing will be quite small; enough small to make this project easy portable.

 

So this is my update for this weekend: so far I was able to measure the electric signals associated to eye movements and I was able to process them into a detectable form that I used in this experiment to light up the two LEDs.

 

That’s it for this weekend; I’ll post more updates as I get more work done.

Best Wishes,

Cosmin

  • Sign in to reply
  • ciorga
    ciorga over 11 years ago in reply to Former Member

    Hi Rahul,

    Thank you for your comments, suggestions, and useful information about how to create a window comparator using the ADC.  I will look into these options and see how I can port the analog front end into the PSoC4 chip (or at least part of it if I cannot implement all needed functions).  I was planning to try to port this analog front end into the PSoC5 that is part of the Pioneer kit; that PSoC5 has 4 operational amplifiers and 4 switch-capacitor amplifiers that I think are emough for what I need.  But I will definitely explore the ideas that you proposed.

    Best Wishes,

    Cosmin

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

    Hi Cosmin,

     

    I really liked your project idea and the by looking at your updates, I am quite certain that you will be able to get your idea working on PSoC 4.

     

    When I was going through your this post I figured out that you need comparators in your design. I think i can help you with this, PSoC 4 has two OpAmps which can also be configured as Comparators, apart from this PSoC 4 also have a pair of Low power comparators (LPComp), you can use them to create a window detector, the only problem is these comparators can only generate an interrupt and cant provide a hardware output, but this can be be easily dealt inside PSoC 4 by using the interrupt to set a Control register which can be virtually used as a comparator output.

     

    There is one more trick to get a window comparator, in this trick use the ADC, the ADC in PSoC 4 can generate an interrupt when the input is outside a window or within a window, you can use this interrupt as a virtual comparator. Moreover you can change the window levels at run time if use ADC.

     

    Let me know if you need any further information.

     

    Thanks,

    Rahul

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • ciorga
    ciorga over 11 years ago in reply to vsluiter

    Thank you for your comment Victor; yes, I am planning to contact Cypress with the optimizer disable question.  About PSoC5, yes, I am planning to try to port the analog off-chip front end into PSoC5 at some point after I am confident that it is completely stable.  PSoC 5 has op-amps with 10pA input bias current that can measure the signals directly from the electrodes.  The offset is a little high, 2mV, for which I may need to build some off-chip compensation/trimming circuit. So yes, I am planning to explore the choice of using the PSoC5, to port  the analog front end or even the entire system after I get this first version, the way it is now with external op-amps and PSoC4 data processing, fully functional.

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

    Nice post, Cosmin

     

    Glad you shared that debugging process, could save others a lot of time. Have you contacted your Cypress contact to see whether they can tell you how that happened?

     

    I really like that you're showing your 'mess' of electronics to us. Each engineer has his own style, and you already got to a very nice result!

     

    Have you thought about using the PSOC5 on the same board? I guess it has more analog peripherals!

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

    Good update.

     

    I appreciate your perserverence in tracking down the problem.  I would not have thought that the PSOC IDE had a built in optimizer.

     

    That said, I am not surprised.  Everytime I use a new software assembler and compiler I have to find out what interesting artifacts they put into the final code.

    In this instance, have them play with the hardware as well is very useful information.

     

    DAB


    • 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