{"id":2052,"date":"2019-07-03T15:26:41","date_gmt":"2019-07-03T15:26:41","guid":{"rendered":"https:\/\/4tronix.co.uk\/blog\/?p=2052"},"modified":"2019-07-04T10:00:15","modified_gmt":"2019-07-04T10:00:15","slug":"scooter-for-raspberry-pi-zero","status":"publish","type":"post","link":"https:\/\/4tronix.co.uk\/blog\/?p=2052","title":{"rendered":"Scooter for Raspberry Pi Zero"},"content":{"rendered":"<h2>Scooter Robot for Raspberry Pi Zero<\/h2>\n<p><a href=\"https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_2998a.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-2053 alignnone\" src=\"https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_2998a-300x242.jpg\" alt=\"\" width=\"300\" height=\"242\" srcset=\"https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_2998a-300x242.jpg 300w, https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_2998a-768x621.jpg 768w, https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_2998a.jpg 1000w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<h3><a href=\"https:\/\/shop.4tronix.co.uk\/products\/scooter-2wd-robot-for-raspberry-pi\" target=\"_blank\" rel=\"noopener\">Purchase Scooter<\/a><\/h3>\n<h3>Assembly<\/h3>\n<h4>Step 1 &#8211; Check you have all the parts<\/h4>\n<p><a href=\"https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_3122a.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-2056 alignnone\" src=\"https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_3122a-300x225.jpg\" alt=\"\" width=\"300\" height=\"225\" srcset=\"https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_3122a-300x225.jpg 300w, https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_3122a-768x576.jpg 768w, https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_3122a.jpg 1000w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<ul>\n<li>Main board with attached battery holder<\/li>\n<li>2 x wheels<\/li>\n<li>2 x 16mm pillars<\/li>\n<li>4 x screws<\/li>\n<li>Female header<\/li>\n<\/ul>\n<h4>Step 2 &#8211; Remove the Battery Holder<\/h4>\n<p><a href=\"https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_3123a.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-2057 alignnone\" src=\"https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_3123a-300x225.jpg\" alt=\"\" width=\"300\" height=\"225\" srcset=\"https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_3123a-300x225.jpg 300w, https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_3123a-768x576.jpg 768w, https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_3123a.jpg 1000w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Unscrew the battery holder, taking careful note of which way it is fitted<\/p>\n<p>&nbsp;<\/p>\n<h4>Step 3 &#8211; Fit the Raspberry Pi Zero<\/h4>\n<p>NB. You need to have a Pi Zero with the headers fitted. Model Zero WH is recommended<\/p>\n<p><a href=\"https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_3124a.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-2058 alignnone\" src=\"https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_3124a-300x225.jpg\" alt=\"\" width=\"300\" height=\"225\" srcset=\"https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_3124a-300x225.jpg 300w, https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_3124a-768x576.jpg 768w, https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_3124a.jpg 1000w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Screw the 16mm pillars onto the main board<\/p>\n<p><a href=\"https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_3125a.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-2059 alignnone\" src=\"https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_3125a-300x225.jpg\" alt=\"\" width=\"300\" height=\"225\" srcset=\"https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_3125a-300x225.jpg 300w, https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_3125a-768x576.jpg 768w, https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_3125a.jpg 1000w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Push the included female header into the low-profile header on the main board<\/p>\n<p>Fit the Pi Zero to the header, with the Pi Zero sitting over the motors as shown below<\/p>\n<p><a href=\"https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_3126a.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-2060 alignnone\" src=\"https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_3126a-300x225.jpg\" alt=\"\" width=\"300\" height=\"225\" srcset=\"https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_3126a-300x225.jpg 300w, https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_3126a-768x576.jpg 768w, https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_3126a.jpg 1000w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Screw the Pi Zero onto the headers so it doesn&#8217;t fall off in use<\/p>\n<p>&nbsp;<\/p>\n<h4>Step 4 &#8211; Complete the Assembly<\/h4>\n<p>Refit the battery holder<\/p>\n<p><a href=\"https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_3128a.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-2061 alignnone\" src=\"https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_3128a-300x225.jpg\" alt=\"\" width=\"300\" height=\"225\" srcset=\"https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_3128a-300x225.jpg 300w, https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_3128a-768x576.jpg 768w, https:\/\/4tronix.co.uk\/blog\/wp-content\/uploads\/2019\/07\/IMG_3128a.jpg 1000w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Push on the wheels<\/p>\n<p>Add batteries<\/p>\n<p>Start coding&#8230;<\/p>\n<h2>Coding for the Scooter<\/h2>\n<p>Install the software<\/p>\n<p>First you will need to prepare your Pi for the Smart RGB LEDs (fully compatible with neopixels). The best way we&#8217;ve found to do this is run Pimoroni&#8217;s curl script.<br \/>\nWith your Pi connected to the internet, run (you don&#8217;t need to install the resources and examples):<\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #993366;\">curl -sS https:\/\/get.pimoroni.com\/unicornhat <span class=\"pl-k\">|<\/span> bash<\/span><\/p>\n<p>Then install the Scooter software:<\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #993366;\">wget https:\/\/4tronix.co.uk\/scooter.sh -O scooter.sh<\/span><\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #993366;\">bash scooter.sh<\/span><\/p>\n<p>This installs the following files:<\/p>\n<ul>\n<li><span style=\"color: #993366;\">scooter.py<\/span> the main library module<\/li>\n<li><span style=\"color: #993366;\">motorTest.py<\/span> Use the arrow keys to control the motors. Use . and , to speed up and slow down after next arrow press. Press space bar to stop slowly and &#8216;b&#8217; to brake quickly<\/li>\n<li><span style=\"color: #993366;\">ledTest.py<\/span> Sets the Smart RGB LEDs to Red, Green, Blue, White in turn. Run with <span style=\"color: #993366;\">sudo python ledTest.py<\/span><\/li>\n<li><span style=\"color: #993366;\">lineTest.py<\/span> shows the states of the line follower sensors<\/li>\n<li><span style=\"color: #993366;\">sonarTest.py<\/span> gives the distance in cm to an obstacle using the optional HC-SR04P<\/li>\n<li><span style=\"color: #993366;\">avoider.py<\/span> is a simple obstacle avoider. Run with <span style=\"color: #993366;\">sudo python avoider.py<\/span><\/li>\n<li><span style=\"color: #993366;\">lineFollower.py<\/span> is a simple line follower. This runs the Scooter backwards and is best with lines printed from <a href=\"http:\/\/robotsquare.com\/2012\/11\/28\/line-following\/\" target=\"_blank\" rel=\"noopener\">RobotSquare<\/a>.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Scooter Robot for Raspberry Pi Zero Purchase Scooter Assembly Step 1 &#8211; Check you have all the parts Main board with attached battery holder 2 x wheels 2 x 16mm pillars 4 x screws Female header Step 2 &#8211; Remove the Battery Holder Unscrew the battery holder, taking careful note of which way it is &hellip; <a href=\"https:\/\/4tronix.co.uk\/blog\/?p=2052\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Scooter for Raspberry Pi Zero<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-2052","post","type-post","status-publish","format-standard","hentry","category-robotics-for-raspberry-pi"],"_links":{"self":[{"href":"https:\/\/4tronix.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2052","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/4tronix.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/4tronix.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/4tronix.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/4tronix.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2052"}],"version-history":[{"count":8,"href":"https:\/\/4tronix.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2052\/revisions"}],"predecessor-version":[{"id":2067,"href":"https:\/\/4tronix.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2052\/revisions\/2067"}],"wp:attachment":[{"href":"https:\/\/4tronix.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2052"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/4tronix.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2052"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/4tronix.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2052"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}