{"id":1274,"date":"2019-09-20T10:33:25","date_gmt":"2019-09-20T15:33:25","guid":{"rendered":"https:\/\/www.protowrxs.com\/?page_id=1274"},"modified":"2019-12-07T20:32:03","modified_gmt":"2019-12-08T02:32:03","slug":"pup","status":"publish","type":"page","link":"https:\/\/www.protowrxs.com\/index.php\/robotics\/pup\/","title":{"rendered":"PuP"},"content":{"rendered":"\n<p><a href=\"https:\/\/www.protowrxs.com\/index.php\/robotics\/\">Back to Robotics<\/a><\/p>\n\n\n\n<h2>PuP &#8211; Pretty Useless Playtoy<\/h2>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" width=\"457\" height=\"495\" src=\"https:\/\/www.protowrxs.com\/wp-content\/uploads\/2019\/09\/PuP_3-LMR.png\" alt=\"\" class=\"wp-image-1275\" srcset=\"https:\/\/www.protowrxs.com\/wp-content\/uploads\/2019\/09\/PuP_3-LMR.png 457w, https:\/\/www.protowrxs.com\/wp-content\/uploads\/2019\/09\/PuP_3-LMR-277x300.png 277w\" sizes=\"(max-width: 457px) 85vw, 457px\" \/><\/figure>\n\n\n\n<p>PuP is just a hack of an old toy that  was getting thrown away. Honestly the factory function was likely as  entertaining as he is now as it would bark, bark, and drive forward and  backwards\u2026 but only over and over again. Now he can \u201csee\u201d what\u2019s around him and  respond in a couple different manners. Still only forward and backwards but he  does move at least. <\/p>\n\n\n\n<p class=\"has-medium-font-size\">PuPdate 12\/07\/2019<\/p>\n\n\n\n<p>Pup was dead due to the five year old lipo battery so surgery was required. Unfortunately I basically built the controller around the battery so I had to go in pretty deep to fix him. I did take the opportunity to replace the nasty transistor H bridge I built with one of the tiny Polulu versions I had. Much cleaner at least. Hopefully he will last another few years before needing more attention.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" width=\"1024\" height=\"768\" src=\"https:\/\/www.protowrxs.com\/wp-content\/uploads\/2019\/12\/pup_apart-1024x768.jpg\" alt=\"\" class=\"wp-image-1403\" srcset=\"https:\/\/www.protowrxs.com\/wp-content\/uploads\/2019\/12\/pup_apart-1024x768.jpg 1024w, https:\/\/www.protowrxs.com\/wp-content\/uploads\/2019\/12\/pup_apart-300x225.jpg 300w, https:\/\/www.protowrxs.com\/wp-content\/uploads\/2019\/12\/pup_apart-768x576.jpg 768w, https:\/\/www.protowrxs.com\/wp-content\/uploads\/2019\/12\/pup_apart-1200x900.jpg 1200w, https:\/\/www.protowrxs.com\/wp-content\/uploads\/2019\/12\/pup_apart.jpg 1632w\" sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/figure>\n\n\n\n<h2>Original Plans \/ New Plans<\/h2>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" width=\"500\" height=\"421\" src=\"https:\/\/www.protowrxs.com\/wp-content\/uploads\/2019\/09\/PuP_2-LMR.jpg\" alt=\"\" class=\"wp-image-1276\" srcset=\"https:\/\/www.protowrxs.com\/wp-content\/uploads\/2019\/09\/PuP_2-LMR.jpg 500w, https:\/\/www.protowrxs.com\/wp-content\/uploads\/2019\/09\/PuP_2-LMR-300x253.jpg 300w\" sizes=\"(max-width: 500px) 85vw, 500px\" \/><\/figure>\n\n\n\n<p>Originally my thoughts were \npretty grand for such a small little thing. I wanted a Pro-Mini, LiPo battery, \nsonar, sound, IR receiver, LDRs, a wagging tail, servo head, RGB mouth, a piece \nof metal on top of his head using touch sensing for petting, and more. BUT the \nreality of getting just the CPU and battery inside the small \u00bd section of the \nbody stopped those plans. I had even thought about using a \u201cleash\u201d to power him \nto remove battery needs and make more room for CPU, etc but wasn\u2019t sure how well \nthat would have worked out.\n<br>I still really wanted PuP to move forward and \nbackwards, talk, and have a sonar for eyes though. So after some success with an \nATTiny85 on Buford and Buzz I figured that may work for PuP. So the plan was \nscaled back to ATTiny85, sonar, speaker, RGB LED, and home brew transistor \nH-Bridge.\n<\/p>\n\n\n\n<figure class=\"wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"PuP - Pretty useless Playtoy\" width=\"840\" height=\"473\" src=\"https:\/\/www.youtube.com\/embed\/PPg2BL2tXYA?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<h2>PuP Build<\/h2>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" width=\"500\" height=\"447\" src=\"https:\/\/www.protowrxs.com\/wp-content\/uploads\/2019\/09\/PuP_1-LMR.jpg\" alt=\"\" class=\"wp-image-1277\" srcset=\"https:\/\/www.protowrxs.com\/wp-content\/uploads\/2019\/09\/PuP_1-LMR.jpg 500w, https:\/\/www.protowrxs.com\/wp-content\/uploads\/2019\/09\/PuP_1-LMR-300x268.jpg 300w\" sizes=\"(max-width: 500px) 85vw, 500px\" \/><\/figure>\n\n\n\n<p>Pup was decapitated, man that sounds harsh but \nthat\u2019s what happened, and a 9g servo replaced his head after some \u201cplastic \nsurgery\u201d. &nbsp;Once mounted up a couple face options came to mine but the easiest \nroute was taken. Servo horn, 4 pin header mount, piece of metal across the top \nand some brown printer paper for ears worked for me. I found another small \nspeaker, glued it up in between the sonar \u201ceyes\u201d and then thought about what to \ndo for light output, tongue or something..\n<br>By now I was already running out of pins with the 5 pin limit for an ATTiny85.\n<br>I already had:\n<\/p>\n\n\n\n<ol><li>Forward drive, \n\t<\/li><li>Reverse drive, \n\t<\/li><li>Single Pin Sonar, \n\t<\/li><li>Speaker Output, and \n\t<\/li><li>Head servo\u2026 \n<\/li><\/ol>\n\n\n\n<p>\nActually I was already OUT of pins but I wanted PuP so have some light of \nsome sort!\n<br>So the first thing I tried was paralleling the Red of the RGB \nwith the speaker output. That works but you can barely see it as the output is \npulsed and the speaker takes most of the current. Next I hooked the green and \nblue up across the forward and backwards output pins. Since the pins go HIGH to \nmake him move and the RGB LED has a common POSITIVE lead, the Blue and Green \nstay ON while sitting still and go off depending on if PuP is moving forward or \nbackwards. Works at least and gives a little light show.\n<\/p>\n\n\n\n<h2>Making It Fit<\/h2>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" width=\"1024\" height=\"765\" src=\"https:\/\/www.protowrxs.com\/wp-content\/uploads\/2019\/09\/IMG_4400-1024x765.jpg\" alt=\"\" class=\"wp-image-1278\" srcset=\"https:\/\/www.protowrxs.com\/wp-content\/uploads\/2019\/09\/IMG_4400-1024x765.jpg 1024w, https:\/\/www.protowrxs.com\/wp-content\/uploads\/2019\/09\/IMG_4400-300x224.jpg 300w, https:\/\/www.protowrxs.com\/wp-content\/uploads\/2019\/09\/IMG_4400-768x574.jpg 768w, https:\/\/www.protowrxs.com\/wp-content\/uploads\/2019\/09\/IMG_4400-1200x896.jpg 1200w\" sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/figure>\n\n\n\n<p>Getting it all to fit was still a challenge, even with the ATTiny85. I had to \nmake sure I could get to the ATTiny85 to pull it to reprogram it the million or \nso times it takes me to get code right. Plus I had to fit the battery and the \ntiny Pololu 5v step up\/down regulator in to make sure the sonar would run at 5v \nproperly. It kind of worked, I really should have put the regulator on top of \nthe battery and the ATTiny board in the rear but too late at that point. I had \nto do some more plastic surgery to get the top half to mount properly and now \nPuP has his \u201cbrain\u201d sticking out of his back a little but hey, he\u2019s just a PuP.\n<br>Fitting things on the head wasn\u2019t quite as complicated. I needed to get signals \npower to the sonar, LED and speaker and signals back for each as well. I ended \nup tapping of the power and ground on the sonar and then added a couple more \nfemale headers for the speaker and LED. I actually have an extra wire running \nfrom head to body now but do not see anything to use it for.\n<\/p>\n\n\n\n<h2>Unique Walk<\/h2>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" width=\"1024\" height=\"765\" src=\"https:\/\/www.protowrxs.com\/wp-content\/uploads\/2019\/09\/IMG_4402-1024x765.jpg\" alt=\"\" class=\"wp-image-1279\" srcset=\"https:\/\/www.protowrxs.com\/wp-content\/uploads\/2019\/09\/IMG_4402-1024x765.jpg 1024w, https:\/\/www.protowrxs.com\/wp-content\/uploads\/2019\/09\/IMG_4402-300x224.jpg 300w, https:\/\/www.protowrxs.com\/wp-content\/uploads\/2019\/09\/IMG_4402-768x574.jpg 768w, https:\/\/www.protowrxs.com\/wp-content\/uploads\/2019\/09\/IMG_4402-1200x896.jpg 1200w\" sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/figure>\n\n\n\n<p>The unique thing about PuP is how he \u201cwalks\u201d. There is only ONE motor deep \ninside his guts. It drives some gears that then drive the balls on his feet \nwhich are splayed out. As the balls turn together one direction, he moves \nforward, the other direction, in reverse. Looks nice and functions pretty good \nactually.\n<br>One thing I did NOT realize until he was completed was the \nright front leg not turning when he backs up is apparently a \u201cfeature\u201d I was \nunaware of. I thought there was a problem or broken issues with him until I \nwatched it a couple times in action. This allows PuP to move reasonably straight \nforward but to turn by backing up to the right. Like some real cheap RC cars you \nsee that only have forward \/ reverse but turn when backing up.\n<br>This is something I really need to take advantage of when I further develop the code for \nhim to allow him to roam around a bit more.\n<\/p>\n\n\n\n<h2>PuB &#8211; Pretty useless Brain<\/h2>\n\n\n\n<p>\n\nPuPs brain is pretty simply, but has room to grow if I want it to since it\u2019s \nonly about \u00bd full at this time. Right now he starts out just sitting there \nstaring out to the world. If you get close enough he\u2019ll lock onto you hand and \ntry to follow you, if you move too close though he\u2019ll back up, and if you get \nsuper close he starts to get worried, his voice goes up in pitch, and he turns \nhis head away and continues to back up. Get even closer and he turns his head \nthe other direction like \u201cget away from me!\u201d\n<br>The next step is to add some \nmore modes to him such as roaming while looking around and just avoiding things. \nTrick here is there is no easy way to swap modes as I am out of input pins so I \nwill likely use my old tick like on Chomper and others of getting in his face as \na mode changing option.\n<br>Obviously some random features of just getting bored, \nlooking around, making some sounds etc if not stimulated for awhile need to be \nadded as well. Just makes it a bit more enjoyable to mess with.\n<\/p>\n\n\n\n<h2>Closing &#8211; Good Results from Bad Code<\/h2>\n\n\n\n<p> MaxHires and I were chatting in the shoutbox about  \u201cunintended good results of bad code\u201d. Max said he has had that happen in the  Apple coding days with graphics where code &nbsp;errors can generate some awesome  artistic results. <br>PuP has a very simple example of this in my opinion. I am  using the SoftwareServo library in PuP. It works but is a little different in  that it requires you to constantly call the SoftwareServo:Refresh routine to  keep the servo moving and in place. Since I am not using a library to read the  sonar on one pin, I have to go read sonar and wait a bit so the refresh doesn\u2019t  always happen as quickly as it needs to. <br>One result of this is that  sometimes, if PuPs head is turned away 90 degrees, he doesn\u2019t just snap it back  to front and center when he\u2019s done hiding, he kind of bumps it a couple times  when the refresh hits. Which is actually more \u201cnatural\u201d than speeding back to  center. This results without any intentional coding on my part. Heck if I TRIED  to do it, it would likely not work at all. <br>My TED robot has a similar effect  in that in some instances he seems alarmed and jerks back when he sees something  while walking. Reality is I\u2019m not handling the object detection cleanly and am  jumping to different servos positions but it still \u201cworks\u201d well. <br>So go build, go code, and sometimes, leave the bugs in\u2026 may make it a bit more fun! <br>Stephen    <\/p>\n\n\n\n<p><a href=\"https:\/\/www.protowrxs.com\/index.php\/robotics\/\">Back to Robotics<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Back to Robotics PuP &#8211; Pretty Useless Playtoy PuP is just a hack of an old toy that was getting thrown away. Honestly the factory function was likely as entertaining as he is now as it would bark, bark, and drive forward and backwards\u2026 but only over and over again. Now he can \u201csee\u201d what\u2019s &hellip; <a href=\"https:\/\/www.protowrxs.com\/index.php\/robotics\/pup\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;PuP&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":19,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"spay_email":""},"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/www.protowrxs.com\/index.php\/wp-json\/wp\/v2\/pages\/1274"}],"collection":[{"href":"https:\/\/www.protowrxs.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.protowrxs.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.protowrxs.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.protowrxs.com\/index.php\/wp-json\/wp\/v2\/comments?post=1274"}],"version-history":[{"count":3,"href":"https:\/\/www.protowrxs.com\/index.php\/wp-json\/wp\/v2\/pages\/1274\/revisions"}],"predecessor-version":[{"id":1404,"href":"https:\/\/www.protowrxs.com\/index.php\/wp-json\/wp\/v2\/pages\/1274\/revisions\/1404"}],"up":[{"embeddable":true,"href":"https:\/\/www.protowrxs.com\/index.php\/wp-json\/wp\/v2\/pages\/19"}],"wp:attachment":[{"href":"https:\/\/www.protowrxs.com\/index.php\/wp-json\/wp\/v2\/media?parent=1274"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.protowrxs.com\/index.php\/wp-json\/wp\/v2\/categories?post=1274"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.protowrxs.com\/index.php\/wp-json\/wp\/v2\/tags?post=1274"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}