You are here

Barc Assembled | Cypress Semiconductor

Barc Assembled

Barc (finally) got his nose back this week. I replaced the ugly yellow wire loops with some copper tape and added an Adafruit IR sensor that pokes out of his mouth. Subtle stuff! It is way easier to work on this guy now he is stretched out on one level. In my program I am going to detect the presence of a hand via the IR or CapSense sensors. I started with the new IR sensor, which is controlled via three wires.

Barc assembled...

 

The red wire is power and black is ground. I could just hook them directly to the power rails on the proto board but, since I may decide to turn the sensor on/off in future (and because I soldered a header to the wires), I am just connecting them to PSoC pins and will drive them from my program. The white wire is the analog input, which I am connecting to the PSoC ADC.

Comparator Diagram Barc

 

The I2C component (set to 400kbps data rate) is there so that I can send the ADC data to the PC via the kitprog (more in a while). I configured the ADC to average out noise and give me a steady stream of results. I only need one single-ended channel with a range of 0.0V to 5.5V that returns an averaged result of 256 samples.

CY3295 Kit Image

 

I then chose pins P1[2], P1[3] and P1[4] for the sensor (ADC), ground and power respectively. The I2C goes on P4[0] and P4[1]. My design was ready and I just needed to write a little code. I was not sure how sensitive the sensor would be so I decided to use our Bridge Control Panel to plot the ADC values in real time. The following code turns on the IR sensor and sets up the ADC.
 

    Pin_IR_GND_Write( 0 );                              // Make sure ground is low
    Pin_IR_Power_Write( 1 );                            // Turn on the sensor
    CyDelay( IR_SENSOR_SETTLE_TIME );                   // Allow time for sensor output to be valid
    ADC_IR_Sensor_Start();                              // Turn on the ADC
    ADC_IR_Sensor_StartConvert();                       // Start sampling (free running)

This turns on I2C and sets it up to communicate across the kitprog I2C-USB bridge to the PC.

    #define I2CBUFSIZE  (2)
    static uint8 i2cbuf[I2CBUFSIZE];
    EZI2C_Start();                                      // Turn on I2C (over kitprog bridge)
    EZI2C_EzI2CSetBuffer1( I2CBUFSIZE, 0, i2cbuf );     // Set up the buffer for communication

I then put this code into the main loop. It just samples the ADC and writes the 16-bit values into the I2C buffer. The EZI2C component does the hard part - in the background it sends the buffer up to the Bridge Control Panel (BCP) software.

    int16 range = 0;                                    // ADC value

    for(;;)
    {       
        /* Get an ADC value from the distance sensor and convert it to millivolts */
        if( ADC_IR_Sensor_IsEndConversion( ADC_IR_Sensor_RETURN_STATUS ) )
        {
            range = ADC_IR_Sensor_GetResult16( IR_SENSOR_CHANNEL );
            range = ADC_IR_Sensor_CountsTo_mVolts( IR_SENSOR_CHANNEL, range );
            
            i2cbuf[0] = ( range >> 8 ) & 0xFF;
            i2cbuf[1] = ( range >> 0 ) & 0xFF;
        }

    }

Once I had this programmed I started up the BCP, selected the kitprog connection, and configured I2C to be 400kHz so that it matches the component speed. I was almost ready to look at the signal from the IR sensor. The PSoC sends 2 bytes and I needed to pack them back into a 16-bit value. So I created a variable, gave it the name "range", and made it 16-bits wide.

CY3295 Kit Image

 

Back in the editor I write a command to read ('r') from address "08" into byte 1 "@1range" and byte 0 "@0range" of the range variable:

r 08 @1range @0range p

When I press the "Repeat" button and switch to the Chart view it shows me the ADC output in real-time.

CY3295 Kit Image

 

You can see that there is a floor of about 1800mV and that, as I moved my hand in and out of range, the value peaked at about 3300V. There are two peaks because I moved my hand from afar, all the way into Barc's nose, and then back out again. If you get too close the IR sensor goes "blind" and the voltage drops. This is really good information because I now know that I can detect the presence of a hand by simply comparing the ADC voltage with a value of about 1800V plus 100mV for safety. That's a simple piece of code that I will add in a week or so... when I re-tune the CapSense sensors and create a state machine for moving the dog around.

Unfortunately, as you may have guessed, Barc missed his flight to Shenzen for Maker Faire. There was a bit of a mix up about when he needed to be ready and after all the arguing stopped there was just a really disappointed dog. So we promised ot take him back to Germany for Embedded World next year...

Blog: 

Comments

ankurpathania53_2921056's picture

arc missed his flight to Shenzen for Maker Faire. There was a bit of a mix up about  Top Form Templates when he needed to be ready and

after all the arguing stopped Free Printable Invoice Template there was just a really BMI chart templates disappointed dog. 

ankurpathania53_2921056's picture

 That's a simple piece of code that I Employee Attendance Sheet Tracker will add in a week or so...  Letter To Verify Employment when I re-tune the CapSense sensors   resignation letter samples for teachers and create a state machine for moving the dog  URL around.

solomondaniel308_2809456's picture

This sort of package passes on an exceptional arranged assortment of movement for understudies, This is the regular hazard looked by each product design. Taking a shot pro essay at different stages is a frenzied errand and it was the significant issue looked by each designer.

stellaban.co.uk_2945901's picture

This is the ordinary danger looked at each product design.  there was a chunk of a mix up while he needed to be prepared and after all the arguing stopped. this is honestly accurate facts due to the fact I now recognize that I Pay Someone To Do my Essay can stumble on the presence of a hand by using genuinely evaluating the ADC voltage with a price of about 1800V plus 100mV for protection.

ellinoah.co.uk_2945981's picture

That pokes out of his mouth. subtle stuff! it's far way simpler to work in this guy now he's stretched out on one degree. Essay Writing Helper - EssayHelpPros.co.uk I configured the ADC to average out the noise and deliver me a regular circulate of results. I most effective need one single-ended channel with quite a number zero.0V to five.5V that returns an averaged end result. This kind of bundle passes on an extremely good organized assortment of motion for understudies,

olive.ethan101.co.uk_2945996's picture

To common out the noise and deliver me an ordinary circulate of outcomes. This type of package passes on an awesome organized assortment of movement for understudies, that is the regular threat looked by TrueEssayHelp | Essay Help Online UK means of every product layout. his is virtually excellent data due to the fact I now recognise that I can detect the presence of a hand by way of without a doubt comparing the ADC voltage

KellimWorthington091_2958006's picture

I have found a masterpiece of paper that is very beneficial for me because i am the student of engineering and I have got an assignment of physics and this article is very useful for me. Write My Assignment. Thanks. 

samwithers_3002041's picture

This is also a very good post which I really enjoyed reading. click here.

DavidRojkibins2005_3052851's picture

Good article. I will use the tips. Want to get your own essays on time. I found a good service that will help to do this essay writing service - https://essayusa.com/

merlinjohn098_2861591's picture

The component details and the layout things are well explained in this article and I am happy to find this blog with lots of informative projects. It is with the help of such blog posts we are able to learn new things happening in our technological world and thanks you!  broken foot scooter

miaboltan_3095971's picture

 I am happy to find this blog with lots of informative project. Because the component details and the layout things are well explained in this article.A splendidly composed task is the thing that an understudy need to obtain decent evaluations. We, Best Essay Writing Service are here to enable each student to ace in their studies  to improve a future and a superior living ahead in their lives

liyasmith200_3111721's picture

very helpful blog and its very nice blog THANK YOU so much for sharing with us.

visit here: MBA Assignment Help 

liyasmith200_3111721's picture

love to read this blog thank you.

we have some content related page if you need please visit this its helpful: Economics assignment help

liyasmith200_3111721's picture

nice blog thank you for sharing with us.

Read more : Humanities Assignment Help

Cathy anna's picture

Here in this blog, we can see the picture of Barc assembled with recently updated changes. Here it clearly specifies the assembly of code with screen shots and code. This helps any developer can understand it’s working. Keep up the good work.dm websolution

merlinjohn098_2861591's picture

Sensors play key role in every electronic gadget and use of them are inevitable. Thank you so much for sharing the details of this project along with some pictures too. I found them useful and I hope you people will definitely come up with more ideas.   http://www.howtofixprinterissues.com

MyAssignmentHelpAu Willor's picture
I really enjoyed reading your post. very informative blog and very exciting to know more on this topic.We also provide My Assignment Help Australia.

 

rcb_3241471's picture

If you are looking for the stadiums when it comes to both the teams, Royal Challengers Bangalore play their match in their hometown. Usually, for playing the match, Bangalore team make their way to the M.chinnaswamy stadium. 

RCB vs MI IPL Tickets

kennyong461_3251306's picture

Very Informative Blog.

To know more regarding this topic visit here: Marketing Assignment Help

earny002_3104986's picture

Thank you for this post, I will take what I have learned and Use it towards making my Blog get noticed, or least try :) driverpacksolutionoffline.com

smithdan854_3301731's picture

Thanks for sharing this blog, I really enjoyed reading your post. This is really interesting information for me. We also provide CDR Australia.

earny002_3104986's picture

Great Article it its really informative and innovative keep us posted with new updates. its was really valuable. thanks a lot.. آموزش سالیدورک

johnamber00_3316201's picture

Thanks for sharing such a nice piece of information to us. This is very knowledgeable for me.
I am John and i am offering Assignment help to students of Australia and all over the world.

 

ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.