{"id":203,"date":"2018-04-17T09:00:37","date_gmt":"2018-04-17T09:00:37","guid":{"rendered":"http:\/\/www.hardwarehacker.co.uk\/blog\/?p=203"},"modified":"2021-04-07T08:33:06","modified_gmt":"2021-04-07T08:33:06","slug":"more-peripherals","status":"publish","type":"post","link":"https:\/\/www.hardwarehacker.co.uk\/blog\/more-peripherals\/","title":{"rendered":"More Peripherals"},"content":{"rendered":"<p>Following the posts on servos and distance sensors, I thought I&#8217;d talk about the other peripherals we&#8217;re adding to Tigerbot.<\/p>\n<p>A screen is an under-rated part of a PiWars robot.\u00a0 Its really handy not to have to cart a laptop around with you between events and have a way to check that the robot is in the mode you think it is (ask me how we know!).\u00a0 We found this little 128&#215;64 pixel screen on ebay based on the SSD1306. And<a href=\"https:\/\/learn.adafruit.com\/ssd1306-oled-displays-with-raspberry-pi-and-beaglebone-black\/overview\"> Adafruit has a lovely tutorial<\/a> on how to use it.<a href=\"http:\/\/www.hardwarehacker.co.uk\/blog\/wp-content\/uploads\/2018\/03\/IMG_20180325_145811-1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-179\" src=\"http:\/\/www.hardwarehacker.co.uk\/blog\/wp-content\/uploads\/2018\/03\/IMG_20180325_145811-1-225x300.jpg\" alt=\"\" width=\"225\" height=\"300\" srcset=\"https:\/\/www.hardwarehacker.co.uk\/blog\/wp-content\/uploads\/2018\/03\/IMG_20180325_145811-1-225x300.jpg 225w, https:\/\/www.hardwarehacker.co.uk\/blog\/wp-content\/uploads\/2018\/03\/IMG_20180325_145811-1-768x1024.jpg 768w\" sizes=\"(max-width: 225px) 100vw, 225px\" \/><\/a><\/p>\n<p>It can be controlled over either I2C or SPI (just set the pattern of resistors on the back).\u00a0 With this, you can write your code to have a menu of &#8220;modes&#8221; (one for each event) switch between them using buttons on your controller and display the mode the robot thinks you&#8217;re in on the screen.\u00a0 No more laptop on the day!<\/p>\n<ul>\n<li>Another handy peripheral is an IMU.\u00a0 This is a combination Gyro, Accelerometer, Barometer and Thermometer all in one.\u00a0 Of most interest to us is the Gyro.\u00a0 This is a rate gyro &#8211; it tells you how fast the rate of rotation is changing (and NOT the absolute rate of rotation).\u00a0 This is a 3-axis device &#8211; it tells you about rotation around the X, Y, Z axes.\u00a0 To use it you generally have to calibrate it first &#8211; with the robot still and stationary, you take readings from each of the gyros for a while and record the output.\u00a0 These are your zero readings.\u00a0 All future readings from the gyro need to subtract the zero readings.\u00a0 The zero reading can vary with battery voltage and temperature, so be sure to re-calibrate it just before you use it!\u00a0 Now you can turn the rate into absolute rotation by taking lots of readings and integrating them.<a href=\"http:\/\/www.hardwarehacker.co.uk\/blog\/wp-content\/uploads\/2018\/03\/IMG_20180320_203543.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-178\" src=\"http:\/\/www.hardwarehacker.co.uk\/blog\/wp-content\/uploads\/2018\/03\/IMG_20180320_203543-300x225.jpg\" alt=\"\" width=\"300\" height=\"225\" srcset=\"https:\/\/www.hardwarehacker.co.uk\/blog\/wp-content\/uploads\/2018\/03\/IMG_20180320_203543-300x225.jpg 300w, https:\/\/www.hardwarehacker.co.uk\/blog\/wp-content\/uploads\/2018\/03\/IMG_20180320_203543-768x576.jpg 768w, https:\/\/www.hardwarehacker.co.uk\/blog\/wp-content\/uploads\/2018\/03\/IMG_20180320_203543-1024x768.jpg 1024w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>What use is a gyro?\u00a0 There are a couple of obvious events that could use a gyro:<\/li>\n<li>Straight line speed test\n<ul>\n<li>here you&#8217;re trying to keep the robot pointed in the same direction all the way to the end<\/li>\n<\/ul>\n<\/li>\n<li>Minimal maze\n<ul>\n<li>for checking that your turns are exactly 90 degrees (if you&#8217;re using wheel rotations for this, how do you know if the wheel has slipped on the surface?)<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Following the posts on servos and distance sensors, I thought I&#8217;d talk about the other peripherals we&#8217;re adding to Tigerbot. A screen is an under-rated part of a PiWars robot.\u00a0 Its really handy not to have to cart a laptop around with you between events and have a way to check that the robot is &hellip; <a href=\"https:\/\/www.hardwarehacker.co.uk\/blog\/more-peripherals\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">More Peripherals<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,5,11],"tags":[2],"_links":{"self":[{"href":"https:\/\/www.hardwarehacker.co.uk\/blog\/wp-json\/wp\/v2\/posts\/203"}],"collection":[{"href":"https:\/\/www.hardwarehacker.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hardwarehacker.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hardwarehacker.co.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hardwarehacker.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=203"}],"version-history":[{"count":1,"href":"https:\/\/www.hardwarehacker.co.uk\/blog\/wp-json\/wp\/v2\/posts\/203\/revisions"}],"predecessor-version":[{"id":204,"href":"https:\/\/www.hardwarehacker.co.uk\/blog\/wp-json\/wp\/v2\/posts\/203\/revisions\/204"}],"wp:attachment":[{"href":"https:\/\/www.hardwarehacker.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hardwarehacker.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hardwarehacker.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}