You are here

Cypress Maker Lab - Barc is Finally Tamed | Cypress Semiconductor

Cypress Maker Lab - Barc is Finally Tamed

Well, I finally finished my Barc project. The design is attached to this blog. I think I learned a lot. Mostly that I should never pick up another soldering iron, always use battery packs with on/off switches, and that blogging takes a lot longer than programming. More usefully I got quite efficient at tuning CapSense and have a very tidy and reliable motor control circuit to use in new designs.

Barc works pretty well now but he tends to be a little excitable. He is quite obedient most of the time and faithfully follows my hand even though I am not holding any treats at all. But I did build a little bit of "personality" into him by breaking all the rules of good CapSense sensor design. To name a few of my engineering crimes:

  • My sensors are just roughly looped wires taped to ABS plastic (this reduces the range a lot)
  • My proximity threshold settings are just a few counts above the noise
  • The SNR was tuned in perfect conditions with no unshielded motors running nearby! Not exactly reality…

It is hardly surprising, then, that after following me for a while he has a habit of running off into the distance or chasing his tail like it has been wrapped with bacon. It is all good fun but I could never take him for a walk in San Jose traffic.

To train him a little bit I built a little thinking time into his main loop. According to the CapSense component each scan takes 512 microseconds. You can see this in the dialog. Each scan slot takes 171us for a total of 512us.

CapSense customizer dialog showing the order and duration of three proximity scans

That means I am detecting just less than 2000 times per second. I can give Barc some rest time by counting the number

of times my main loop executes and forcing a delay, with CapSense and the motors both turned off, if he does the same thing for more than a second. It's just a simple loop counter that increments if the motors are running (compare value not equal to zero) and resets otherwise. If the counter gets to 2000 then Barc stops for a quarter of a second. That seems to be long enough for the noise to die down enough for much improved behavior.

I feel the need to point out, one last time, that this is deliberately doing very naughty things with CapSense. I am ignoring the excellent guidelines set out in our best practices document so that Barc will behave badly, and then using extremely crude measures to limit the "error" rate. If you are making a serious CapSense design please don’t use this project as an example of robust sensing! But, that said, he's my dog and I'll train him however I like!

Attached is a short video of Barc chasing me around the floor.

 

And here is the snippet of code that senses my hand, adjusts the motor speeds, and, if necessary, takes a short breather to let the noise dissipate.

    CapSense_Start();               // Turn on CapSense   

   

    for(;;)

    {

        /* Start a scan and wait for it to complete */

        CapSense_ScanAllWidgets();

        while( CapSense_IsBusy() )

        {

            /* Busy loop */

        }

       

        CapSense_ProcessAllWidgets();   // Read all sensors and determine widget status

       

        if( CapSense_IsWidgetActive( CapSense_LEFT_WDGT_ID ) )

        {

            /* Hand to the left, follow it */

            PWM_Speed_WriteCompare1( 40 );

            PWM_Speed_WriteCompare2( 0 );

            loopcount++;

        }

        else if( CapSense_IsWidgetActive( CapSense_RIGHT_WDGT_ID ) )

        {

            /* Hand to the right, follow it */

            PWM_Speed_WriteCompare1( 0 );

            PWM_Speed_WriteCompare2( 40 );

            loopcount++;

        }

        else if( CapSense_IsWidgetActive( CapSense_FRONT_WDGT_ID ) )

        {

            /* Run toward the hand in front of your nose */

            PWM_Speed_WriteCompare1( 60 );

            PWM_Speed_WriteCompare2( 60 );

            loopcount++;

        }

        else

        {

            /* No hand close so stop */

            PWM_Speed_WriteCompare1( 0 );

            PWM_Speed_WriteCompare2( 0 );

            loopcount = 0;

        }

       

        /* Each loop takes ~500ns so check for 1s of unchanged state */

        if( loopcount > 2000 )

        {

            /* Turn off the motors */

            PWM_Speed_WriteCompare1( 0 );

            PWM_Speed_WriteCompare2( 0 );

            loopcount = 0;

           

            /* Turn off CapSense and wait 250ms for noise to settle */

            CapSense_Stop();

            CyDelay( 250 );

            CapSense_Start();

        }

       

        #ifdef TUNING

        CapSense_RunTuner();            // Send data to tuner (I2C)

        #endif

    }

I have attached my final Barc project to this blog. Feel free to try it out, fix it, add to it, whatever. But do let me know if you do something interesting!

It took me longer than I expected to finish this project - just ask my wife/videographer who got really bored of the whirring motors and runaway dog in the living room - but now I think it is time to move onto the next one. I feel like I actually know what I am doing at last. Next time I am going to use Sparkfun robot/motor parts and see if I can make a Bluetooth-enabled dog…

 

Comments

portmanminta_2569126's picture

This embedded machines are very critical to program and well defined and pre-defined functions. I always wanted to become robotics developer and engineer now I started my business and hire Complete SEO Services Online - SEOServicesLand.com from USA based top leading and top rank firm who is completely satisfied me by excellent performance.

lazynetpreneur_2917916's picture
jordanss123 jordanss123's picture

Thanks for you share great topic with us. fake yeezy boost 350

 

sumitsmith050_2593806's picture

It took me longer than I expected to finish this project - just ask my wife/videographer who got really bored of the whirring motors and runaway dog in the living room - but now I think it is time to move onto the next one. I feel like 

rohitmtf31_2607741's picture

Super website with a great sharing and amazing stories is ur web.. please keep doing what u do now.. thanks to you, It's a great sharing and really informative.. will keep following ur web. thanks to you and ur great website. august 2017 calendar

 

happywheelsgame102_2613186's picture

The game is best known for its dark sense of humor and its graphic violence. Expect to see a lot of blood and guts. Your goal is to go far across each level without letting your character get hurt. The game is over even the smallest body part injuries. It takes much patience to finish the goal. Is this much challenging? Make your best efforts to survive in this glory and funny game. We can find a way to break through Even if we can't find heaven, I'll walk through hell with you. =>happy wheels =>geometry dash

Anna Marsh's picture

I videographer is best a photographer with a machine which information sequential photographs... With a video digicam. Stills are splendid, (im a photographer) you could choose what is and what isnt in awareness and you may control the light. Video has none of those refinements until youre conserving a panaflex, or similar like a 35mm bolex. Video is press on, and record. You should use a tripod, you should realize a way to music and follow movement, zoom in and pull returned, and preserve the eye in your topics. And accept as true with me, youll spend many many hours editing it, splicing, and including al lthe bells and whistles...Like fades, wipes and diffusers. In the end though, youll fly via the method, and analyze a chunk alongside the way. Anybody can shoot UK Essays video...However capturing appropriate video, nicely thats like locating gold at the give up of a rainbow..And now not such a lot of folks can do that. Being caught in a lab, or at a table for hours on cease isnt glamorous, and its tedious dull repetitive paintings, but its all part and parcel of doing a great process. (except you get very rich and famous like david bailey, and tehn you pay someone else to do the uninteresting stuff)

kanaksoni1994_2684361's picture

all gadget lover are waiting for Samsung Galaxy S9..

josejonatha962_2689956's picture

Best Shower Curtains Collection from everywher

viveksud6_2692871's picture

Galaxy S9 launch a new smartphone with new technology Galaxy S9.

 

viveksud6_2692871's picture

Galaxy S9 launch a new smartphone with new technology Galaxy S9.

devnathmtf_2700216's picture

<a href="http://mycaty.com/september-2017-calendar/">September 2017 Calendar</a>
<a href="http://mycaty.com/september-2017-calendar-printable/">September 2017 Calendar Printable </a>
<a href="http://mycaty.com/september-2017-calendar-template/">September 2017 Calendar Template</a>
<a href="http://mycaty.com/september-2017-calendar-with-holidays/">September 2017 Calendar With Holidays</a>
<a href="http://mycaty.com/september-2017-kalnirnay-calendar/">Kalnirnay September 2017</a>

Thanks for providing great information dude. we appreciate your efforts towards this article.As your are providing the best article.

l371467_2687626's picture

It looks like you have completed the work pretty wonderfully. It is all exciting to design and deal with such projects. Since the resources are extensively available across the web related to the topics, the projects seem to be a lot simpler than earlier.  

https://woodpeckerscrafts.com/wooden-dowels-furniture-parts.html
 

 

taylorshaw151_2687531's picture

The site has been providing a lot of such interesting topics regarding PSOC 6 early adopter program. The codes offered here are very helpful in making the project all by myself. The detailed instructions along with the codes come pretty handy to clear any doubts while doing it. Big Apple Medical Furniture

Rashmi Sharma's picture

It is nice calendar template .Video is press on, and record. You should use a tripod, you should realize a way to music and follow movement, zoom in and pull returned, and preserve the eye in your topics. And accept as true with me, youll spend many many hours editing it, splicing, and including al lthe bells and whistles...Like fades, wipes and diffusers. 

casusbubble_2806561's picture

mSpy est une application conçue pour surveiller une cible téléphone, tablette ou PC/Mac. Une fois installé, il vous permet de voir le périphérique cible le journal d'appels, les SMS, l'historique de navigation internet, de la localisation GPS, e-mails, médias (photos et vidéos), des messages instantanés et de plusieurs applications de médias sociaux.

Full Essay Help's picture

Cypress is the platform where students learn from Full Essay Help regarding their subjects like in this post we can see they're talking about Barc Project and for what purpose of this project, i think this should be related to I.T field project.

lincyrose90_2704921's picture

Thank you so much for attaching the design of your Barc project in this blog. I have gone through this video and happy to see that Barc is working pretty well. I didn’t understand the code you have specified here? What’s the purpose of it? Can you specify it in detail?https://meritotreatment.com/treatment-programs/alcohol-rehab-treatment/

alinachopra906_2890676's picture
alinachopra906_2890676's picture

I appreciated over read your blog entry. Your blog have pleasant data, I got smart thoughts from this stunning site.
http://www.royalgoamodels.com/
http://www.royalgoaescort.com/
http://www.eshadutta.com/
http://www.visitgoaescorts.com/

alinachopra906_2890676's picture

Here I got the superb blog to peruse and I am truly enchanted to see this magnificent article that is pleasant. Much appreciated sir.
http://www.alinachopra.com/airhostess-call-girls-aerocity-whatsapp-numbe...
http://www.shikharoy.in/air-hostess-call-girls-aerocity.html

alinachopra906_2890676's picture

I appreciated over read your blog entry. Your blog have pleasant data, I got smart thoughts from this astounding web journal.
http://www.riyadelhiescorts.com/

Hitman Apk's picture

Thanks for posting this, i really appreciate it.

http://<a href='http://www.paidapps4free.com/'>My Boy Emulator</a>

Hitman Apk's picture

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.