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

        /* 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...



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.'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.'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 - 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,'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 -

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 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.

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 :)

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.


본 사이트의 모든 컨텐츠와 자료는 "있는 그대로" 제공됩니다. CYPRESS SEMICONDUCTOR와 해당 공급자는 그 목적에 관계 없이 이러한 자료의 적합성에 대한 표현을 하지 않으며 상업성, 특정 목적에의 적합성, 권리 및 제3자 지적 재산권의 비침해에 대한 모든 묵시적 보증과 조건을 포함하여(이에 제한되지 않음) 이러한 자료와 관련한 모든 보증과 조건을 부인합니다. CYPRESS SEMICONDUCTOR에서는 명시적 또는 묵시적으로 금반언이나 여타의 다른 방법으로 라이센스를 부여하지 않습니다. 이 사이트의 정보를 사용하려면 제3자의 라이센스 또는 CYPRESS SEMICONDUCTOR에서 제공하는 라이센스가 필요할 수 있습니다.

이 사이트의 컨텐츠에는 특정 사용 지침이나 제한이 포함되거나 그러한 제한이 적용될 수 있습니다. 모든 게시물과 이 사이트 컨텐츠 사용에는 사이트 약관이 적용됩니다. 이 컨텐츠를 사용하는 제3자는 제한 또는 지침을 따르고 이 사이트의 약관을 준수할 것이라는 데 동의합니다. Cypress Semiconductor와 그 공급자는 컨텐츠와 자료, 그 제품, 프로그램 및 서비스를 언제든 수정, 삭제, 개조, 개선, 향상 및 기타 변경하거나 예고 없이 컨텐츠, 제품, 프로그램 또는 서비스를 이동 또는 중단할 수 있는 권리를 보유합니다.