{"id":14065,"date":"2016-01-20T20:21:11","date_gmt":"2016-01-20T19:21:11","guid":{"rendered":"http:\/\/www.recantha.co.uk\/blog\/?p=14065"},"modified":"2016-01-20T20:21:11","modified_gmt":"2016-01-20T19:21:11","slug":"fading-leds-using-pwm-with-gpio-zero-on-the-raspberry-pi","status":"publish","type":"post","link":"https:\/\/www.recantha.co.uk\/blog\/?p=14065","title":{"rendered":"Fading LEDs using PWM with GPIO Zero on the Raspberry Pi"},"content":{"rendered":"<p><a href=\"https:\/\/www.recantha.co.uk\/blog\/?attachment_id=14067\" rel=\"attachment wp-att-14067\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-14067\" src=\"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2016\/01\/fading_leds.jpg?resize=560%2C288&#038;ssl=1\" alt=\"fading_leds\" width=\"560\" height=\"288\" srcset=\"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2016\/01\/fading_leds.jpg?w=1816&amp;ssl=1 1816w, https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2016\/01\/fading_leds.jpg?resize=300%2C154&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2016\/01\/fading_leds.jpg?resize=768%2C395&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2016\/01\/fading_leds.jpg?resize=1024%2C526&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2016\/01\/fading_leds.jpg?resize=560%2C288&amp;ssl=1 560w, https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2016\/01\/fading_leds.jpg?resize=260%2C134&amp;ssl=1 260w, https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2016\/01\/fading_leds.jpg?resize=160%2C82&amp;ssl=1 160w, https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2016\/01\/fading_leds.jpg?w=1120&amp;ssl=1 1120w, https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2016\/01\/fading_leds.jpg?w=1680&amp;ssl=1 1680w\" sizes=\"auto, (max-width: 560px) 100vw, 560px\" \/><\/a><\/p>\n<h2>The project<\/h2>\n<p><a href=\"http:\/\/pythonhosted.org\/gpiozero\/\" target=\"_blank\">GPIO Zero<\/a>, the new GPIO library from the Raspberry Pi Foundation, is becoming my go-to method for doing simple things with the Pi&#8217;s GPIO pins. Over the past couple of weeks, I&#8217;ve been having fun preparing for the Bett exhibition, and more specifically the Raspberry Jam that is being held there on the 23rd January.<\/p>\n<p>Part of my exhibit is a Raspberry Pi Zero with a Scroll pHAT attached. Getting that working was a story in and of itself, but I want to focus today on the 4 LEDs I soldered onto some prototyping board that is attached to the Zero. You can see them in the picture above.<\/p>\n<p>Back to GPIO Zero. It contains a class called PWMLED which allows you to do software <a href=\"https:\/\/en.wikipedia.org\/wiki\/Pulse-width_modulation\" target=\"_blank\">PWM<\/a>\u00a0with LEDs. What this means is that instead of just blinking them on and off you can fade them in and out. This takes a little bit of doing (unless I&#8217;ve missed something) so I thought I&#8217;d share with you my method. One thing to understand is that I&#8217;ve done it in a &#8216;thread&#8217;, which means that while the Scroll pHAT is doing it&#8217;s job of displaying messages, I can have the LEDs doing something disconnected from that process. The individual functions, however, could be removed from inside the threading &#8216;object&#8217; if you don&#8217;t need to do anything else except pulse the LEDs.<\/p>\n<p>Here&#8217;s a video to prove that it works!<\/p>\n<p><iframe loading=\"lazy\" title=\"Fading LEDs using GPIO Zero on a Raspberry Pi\" width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/RmpLctBNGkc?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<h2>The code<\/h2>\n<p>Anyhoo. Here&#8217;s the code. (I&#8217;ve removed anything to do with the Scroll pHAT) (You can skip this bit and go straight to the\u00a0<strong>bold<\/strong> bit to <a href=\"https:\/\/github.com\/recantha\/scroller\" target=\"_blank\">download the code from Github<\/a>.<\/p>\n<p>First of all, let&#8217;s import the libraries:<\/p>\n<pre>import time, threading, random\r\nfrom gpiozero import LED, PWMLED<\/pre>\n<p>Now, let&#8217;s define the LEDs:<\/p>\n<pre># Set-up LEDs\r\nled_red = PWMLED(17)\r\nled_yellow = PWMLED(27)\r\nled_green = PWMLED(22)\r\nled_blue = PWMLED(10)<\/pre>\n<p>Now, in order to get a smooth fading action, we&#8217;re going to want to loop from 0 to 1 using\u00a0a &#8216;float&#8217; (decimal) value. (0.1&#8230; 0.2&#8230; 0.3&#8230; 0.4&#8230; etc). We can&#8217;t do that without a helper function. Note, Python doesn&#8217;t seem to do float subtraction very well, so I found I had to round the floats to one decimal place just to make it play nice! If I&#8217;m missing something, please leave a comment!<\/p>\n<pre># Helper function to iterate over a float\r\ndef frange(start, stop, step):\r\n  i = start\r\n \r\n  if (start &lt; stop):\r\n    while i &lt;= stop:\r\n      yield i\r\n      i += step\r\n      # For some reason, += doesn't always add an exact decimal, so we have to round the value\r\n      i = round(i, 1)\r\n  else:\r\n    while i &gt;= stop:\r\n      yield i\r\n      i += step\r\n      # For some reason, += doesn't always add an exact decimal, so we have to round the value\r\n      i = round(i, 1)<\/pre>\n<p>Now let&#8217;s define a class that we can start as part of a new thread:<\/p>\n<pre>class RandomLEDs(threading.Thread):\r\n  def __init__(self, threadID, name):\r\n    threading.Thread.__init__(self)\r\n    self.threadID = threadID\r\n    self.name = name\r\n\r\n  def run(self):\r\n    while True:\r\n      led_list = [led_blue,led_yellow,led_green,led_red]\r\n      the_led = random.choice(led_list)\r\n      self.fade_in_led(the_led, 0.03)\r\n      time.sleep(0.3)\r\n      self.fade_out_led(the_led, 0.02)\r\n      time.sleep(0.3)\r\n\r\n  # PWM the LED value from 0 to 1 (or from 1 to 0) with a 0.1 step\r\n  def fade_in_led(self, led, speed):\r\n    for i in frange(0.0, 1.0, 0.1):\r\n      led.value = i\r\n      time.sleep(speed)\r\n\r\n  def fade_out_led(self, led, speed):\r\n    for i in frange(1.0, 0.0, -0.1):\r\n      led.value = i\r\n      time.sleep(speed)<\/pre>\n<p>Now, let&#8217;s kick the whole thing off:<\/p>\n<pre># Start independent threads\r\n# This one lights up random LEDs\r\nthread1 = RandomLEDs(1, \"Thread-1\")\r\nthread1.start()<\/pre>\n<p>I&#8217;m hoping that all the indents have come through okay (I just spent the last 10 minutes putting spaces in, so hopefully so).<\/p>\n<h2>TL;DR<\/h2>\n<p><strong>If you want to download the code, do the following:<\/strong><\/p>\n<pre>git clone https:\/\/github.com\/recantha\/scroller<\/pre>\n<p>And the file you want is pwm_leds.py<\/p>\n<p>You can run it by doing:<\/p>\n<pre>python3 pwm_leds.py<\/pre>\n<h2>Feedback<\/h2>\n<p>I&#8217;d be very happy to get any feedback you might want to give about my code, and my approach. I\u00a0<em>expect<\/em> that there is a much easier way to do this &#8211; the float looping deserves a bit of consideration, for instance &#8211; but this is what I got working! In any case, I hope you found the post interesting! \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The project GPIO Zero, the new GPIO library from the Raspberry Pi Foundation, is becoming my go-to method for doing simple things with the Pi&#8217;s GPIO pins. Over the past couple of weeks, I&#8217;ve been having fun preparing for the&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"https:\/\/www.recantha.co.uk\/blog\/?p=14065\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[50,39,51],"tags":[],"class_list":["post-14065","post","type-post","status-publish","format-standard","hentry","category-making","category-programming","category-tutorials"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Fading LEDs using PWM with GPIO Zero on the Raspberry Pi - Raspberry Pi Pod<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.recantha.co.uk\/blog\/?p=14065\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Fading LEDs using PWM with GPIO Zero on the Raspberry Pi - Raspberry Pi Pod\" \/>\n<meta property=\"og:description\" content=\"The project GPIO Zero, the new GPIO library from the Raspberry Pi Foundation, is becoming my go-to method for doing simple things with the Pi&#8217;s GPIO pins. Over the past couple of weeks, I&#8217;ve been having fun preparing for the&hellip;Read more &rarr;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.recantha.co.uk\/blog\/?p=14065\" \/>\n<meta property=\"og:site_name\" content=\"Raspberry Pi Pod\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/recantha\/\" \/>\n<meta property=\"article:published_time\" content=\"2016-01-20T19:21:11+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2016\/01\/fading_leds.jpg\" \/>\n<meta name=\"author\" content=\"Michael Horne\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@recantha\" \/>\n<meta name=\"twitter:site\" content=\"@recantha\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Michael Horne\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/?p=14065#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/?p=14065\"},\"author\":{\"name\":\"Michael Horne\",\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/#\/schema\/person\/c27c4ef2ee1c18b130f1fcd5dcdbb263\"},\"headline\":\"Fading LEDs using PWM with GPIO Zero on the Raspberry Pi\",\"datePublished\":\"2016-01-20T19:21:11+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/?p=14065\"},\"wordCount\":522,\"commentCount\":6,\"publisher\":{\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/?p=14065#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2016\/01\/fading_leds.jpg\",\"articleSection\":[\"Making\",\"Programming\",\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.recantha.co.uk\/blog\/?p=14065#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/?p=14065\",\"url\":\"https:\/\/www.recantha.co.uk\/blog\/?p=14065\",\"name\":\"Fading LEDs using PWM with GPIO Zero on the Raspberry Pi - Raspberry Pi Pod\",\"isPartOf\":{\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/?p=14065#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/?p=14065#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2016\/01\/fading_leds.jpg\",\"datePublished\":\"2016-01-20T19:21:11+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/?p=14065#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.recantha.co.uk\/blog\/?p=14065\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/?p=14065#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2016\/01\/fading_leds.jpg?fit=1816%2C933&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2016\/01\/fading_leds.jpg?fit=1816%2C933&ssl=1\",\"width\":1816,\"height\":933},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/?p=14065#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.recantha.co.uk\/blog\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Fading LEDs using PWM with GPIO Zero on the Raspberry Pi\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/#website\",\"url\":\"https:\/\/www.recantha.co.uk\/blog\/\",\"name\":\"Raspberry Pi Pod\",\"description\":\"Experiences with the Raspberry Pi micro computer and microcontroller\",\"publisher\":{\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.recantha.co.uk\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/#organization\",\"name\":\"Raspberry Pi Pod\",\"url\":\"https:\/\/www.recantha.co.uk\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2016\/03\/cropped-PiPod-Logo-v3.png?fit=800%2C337&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2016\/03\/cropped-PiPod-Logo-v3.png?fit=800%2C337&ssl=1\",\"width\":800,\"height\":337,\"caption\":\"Raspberry Pi Pod\"},\"image\":{\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/recantha\/\",\"https:\/\/x.com\/recantha\",\"https:\/\/www.linkedin.com\/in\/recantha\/\",\"https:\/\/www.youtube.com\/channel\/UCK4F9blabxzmk8Inzhs8tpg\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/#\/schema\/person\/c27c4ef2ee1c18b130f1fcd5dcdbb263\",\"name\":\"Michael Horne\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/479778b0677caadde0ceb54c4129804ef674914607e3ed0998808148357d10d8?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/479778b0677caadde0ceb54c4129804ef674914607e3ed0998808148357d10d8?s=96&d=mm&r=g\",\"caption\":\"Michael Horne\"},\"url\":\"https:\/\/www.recantha.co.uk\/blog\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Fading LEDs using PWM with GPIO Zero on the Raspberry Pi - Raspberry Pi Pod","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.recantha.co.uk\/blog\/?p=14065","og_locale":"en_US","og_type":"article","og_title":"Fading LEDs using PWM with GPIO Zero on the Raspberry Pi - Raspberry Pi Pod","og_description":"The project GPIO Zero, the new GPIO library from the Raspberry Pi Foundation, is becoming my go-to method for doing simple things with the Pi&#8217;s GPIO pins. Over the past couple of weeks, I&#8217;ve been having fun preparing for the&hellip;Read more &rarr;","og_url":"https:\/\/www.recantha.co.uk\/blog\/?p=14065","og_site_name":"Raspberry Pi Pod","article_publisher":"https:\/\/www.facebook.com\/recantha\/","article_published_time":"2016-01-20T19:21:11+00:00","og_image":[{"url":"https:\/\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2016\/01\/fading_leds.jpg","type":"","width":"","height":""}],"author":"Michael Horne","twitter_card":"summary_large_image","twitter_creator":"@recantha","twitter_site":"@recantha","twitter_misc":{"Written by":"Michael Horne","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.recantha.co.uk\/blog\/?p=14065#article","isPartOf":{"@id":"https:\/\/www.recantha.co.uk\/blog\/?p=14065"},"author":{"name":"Michael Horne","@id":"https:\/\/www.recantha.co.uk\/blog\/#\/schema\/person\/c27c4ef2ee1c18b130f1fcd5dcdbb263"},"headline":"Fading LEDs using PWM with GPIO Zero on the Raspberry Pi","datePublished":"2016-01-20T19:21:11+00:00","mainEntityOfPage":{"@id":"https:\/\/www.recantha.co.uk\/blog\/?p=14065"},"wordCount":522,"commentCount":6,"publisher":{"@id":"https:\/\/www.recantha.co.uk\/blog\/#organization"},"image":{"@id":"https:\/\/www.recantha.co.uk\/blog\/?p=14065#primaryimage"},"thumbnailUrl":"https:\/\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2016\/01\/fading_leds.jpg","articleSection":["Making","Programming","Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.recantha.co.uk\/blog\/?p=14065#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.recantha.co.uk\/blog\/?p=14065","url":"https:\/\/www.recantha.co.uk\/blog\/?p=14065","name":"Fading LEDs using PWM with GPIO Zero on the Raspberry Pi - Raspberry Pi Pod","isPartOf":{"@id":"https:\/\/www.recantha.co.uk\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.recantha.co.uk\/blog\/?p=14065#primaryimage"},"image":{"@id":"https:\/\/www.recantha.co.uk\/blog\/?p=14065#primaryimage"},"thumbnailUrl":"https:\/\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2016\/01\/fading_leds.jpg","datePublished":"2016-01-20T19:21:11+00:00","breadcrumb":{"@id":"https:\/\/www.recantha.co.uk\/blog\/?p=14065#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.recantha.co.uk\/blog\/?p=14065"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.recantha.co.uk\/blog\/?p=14065#primaryimage","url":"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2016\/01\/fading_leds.jpg?fit=1816%2C933&ssl=1","contentUrl":"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2016\/01\/fading_leds.jpg?fit=1816%2C933&ssl=1","width":1816,"height":933},{"@type":"BreadcrumbList","@id":"https:\/\/www.recantha.co.uk\/blog\/?p=14065#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.recantha.co.uk\/blog"},{"@type":"ListItem","position":2,"name":"Fading LEDs using PWM with GPIO Zero on the Raspberry Pi"}]},{"@type":"WebSite","@id":"https:\/\/www.recantha.co.uk\/blog\/#website","url":"https:\/\/www.recantha.co.uk\/blog\/","name":"Raspberry Pi Pod","description":"Experiences with the Raspberry Pi micro computer and microcontroller","publisher":{"@id":"https:\/\/www.recantha.co.uk\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.recantha.co.uk\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.recantha.co.uk\/blog\/#organization","name":"Raspberry Pi Pod","url":"https:\/\/www.recantha.co.uk\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.recantha.co.uk\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2016\/03\/cropped-PiPod-Logo-v3.png?fit=800%2C337&ssl=1","contentUrl":"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2016\/03\/cropped-PiPod-Logo-v3.png?fit=800%2C337&ssl=1","width":800,"height":337,"caption":"Raspberry Pi Pod"},"image":{"@id":"https:\/\/www.recantha.co.uk\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/recantha\/","https:\/\/x.com\/recantha","https:\/\/www.linkedin.com\/in\/recantha\/","https:\/\/www.youtube.com\/channel\/UCK4F9blabxzmk8Inzhs8tpg"]},{"@type":"Person","@id":"https:\/\/www.recantha.co.uk\/blog\/#\/schema\/person\/c27c4ef2ee1c18b130f1fcd5dcdbb263","name":"Michael Horne","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.recantha.co.uk\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/479778b0677caadde0ceb54c4129804ef674914607e3ed0998808148357d10d8?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/479778b0677caadde0ceb54c4129804ef674914607e3ed0998808148357d10d8?s=96&d=mm&r=g","caption":"Michael Horne"},"url":"https:\/\/www.recantha.co.uk\/blog\/?author=1"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2RsaV-3ER","jetpack-related-posts":[{"id":17378,"url":"https:\/\/www.recantha.co.uk\/blog\/?p=17378","url_meta":{"origin":14065,"position":0},"title":"Pi Tote &#8211; a wearable Raspberry Pi Zero project","author":"Michael Horne","date":"28 July 2017","format":false,"excerpt":"Educator Amanda Haughs\u00a0wanted to use the Raspberry Pi Zero in a wearable project and incorporate the use of her grandmother's embroidery machine. She had the idea of a tote bag and, with a bit of sewing and some wiring-up, together with some GPIO Zero code, she created the Pi Tote.\u2026","rel":"","context":"In &quot;Accessories&quot;","block_context":{"text":"Accessories","link":"https:\/\/www.recantha.co.uk\/blog\/?cat=54"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2017\/07\/pi-tote.jpg?fit=1200%2C900&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2017\/07\/pi-tote.jpg?fit=1200%2C900&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2017\/07\/pi-tote.jpg?fit=1200%2C900&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2017\/07\/pi-tote.jpg?fit=1200%2C900&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2017\/07\/pi-tote.jpg?fit=1200%2C900&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":15445,"url":"https:\/\/www.recantha.co.uk\/blog\/?p=15445","url_meta":{"origin":14065,"position":1},"title":"Happy Birthday to Raspberry Pi Python library GPIO Zero as it hits v1.3","author":"Michael Horne","date":"14 September 2016","format":false,"excerpt":"One year ago, Ben Nuttall and Dave Jones began work on GPIO Zero, a Python library which sought to simplify access to the Raspberry Pi's GPIO pins. As of yesterday, it is now one year old and Ben has just announced that version 1.3 is now available. This release includes\u2026","rel":"","context":"In &quot;Camera module&quot;","block_context":{"text":"Camera module","link":"https:\/\/www.recantha.co.uk\/blog\/?cat=8"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/bennuttall.com\/wp-content\/uploads\/2016\/09\/mcp3008-2pots-led-825x510.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/bennuttall.com\/wp-content\/uploads\/2016\/09\/mcp3008-2pots-led-825x510.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/bennuttall.com\/wp-content\/uploads\/2016\/09\/mcp3008-2pots-led-825x510.png?resize=525%2C300 1.5x, https:\/\/i0.wp.com\/bennuttall.com\/wp-content\/uploads\/2016\/09\/mcp3008-2pots-led-825x510.png?resize=700%2C400 2x"},"classes":[]},{"id":16867,"url":"https:\/\/www.recantha.co.uk\/blog\/?p=16867","url_meta":{"origin":14065,"position":2},"title":"CamJam EduKit for the Raspberry Pi receives GPIO Zero \/ Python 3 worksheet update","author":"Michael Horne","date":"24 May 2017","format":false,"excerpt":"Tim Richardson and I are pleased\u00a0to announce that there are brand new\u00a0versions of the CamJam EduKit 1 worksheets now available from the CamJam website. In addition to the classic RPi.GPIO versions being revised\u00a0to feature 40-pin Pis and various small typographical changes, we now have available worksheets that use the\u00a0GPIO Zero\u2026","rel":"","context":"In &quot;Accessories&quot;","block_context":{"text":"Accessories","link":"https:\/\/www.recantha.co.uk\/blog\/?cat=54"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2017\/05\/EduKit_large.jpg?fit=480%2C360&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":16374,"url":"https:\/\/www.recantha.co.uk\/blog\/?p=16374","url_meta":{"origin":14065,"position":3},"title":"Maketronix Alarm system for the Raspberry Pi gets GPIO Zero software","author":"Michael Horne","date":"9 February 2017","format":false,"excerpt":"Recently, the Maketronix Alarm kit was fully-funded on IndieGoGo. It is an add-on board and sensor for the Raspberry Pi that allows you to put together your own movement-activated alarm system. It comes with educational material that can be used in the classroom. Finding that the material doesn't use the\u2026","rel":"","context":"In &quot;Crowdfunding&quot;","block_context":{"text":"Crowdfunding","link":"https:\/\/www.recantha.co.uk\/blog\/?cat=13"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2017\/02\/maketronix_alarm.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":17075,"url":"https:\/\/www.recantha.co.uk\/blog\/?p=17075","url_meta":{"origin":14065,"position":4},"title":"Colour-coded GPIO pin headers and new ZeroCams for the Raspberry Pi Zero from The Pi Hut","author":"Michael Horne","date":"10 July 2017","format":false,"excerpt":"Jamie from The Pi Hut\u00a0has been in touch about some new products he's launched today and I thought I'd pass the info on. Colour-coded GPIO header First up, we have a colour-coded GPIO 40-pin header for the Raspberry Pi Zero. Taking it's inspiration from the Asus Tinker Board, the header\u2026","rel":"","context":"In &quot;Accessories&quot;","block_context":{"text":"Accessories","link":"https:\/\/www.recantha.co.uk\/blog\/?cat=54"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2017\/07\/coloured_gpio_headers.jpg?fit=1024%2C683&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2017\/07\/coloured_gpio_headers.jpg?fit=1024%2C683&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2017\/07\/coloured_gpio_headers.jpg?fit=1024%2C683&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2017\/07\/coloured_gpio_headers.jpg?fit=1024%2C683&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":13539,"url":"https:\/\/www.recantha.co.uk\/blog\/?p=13539","url_meta":{"origin":14065,"position":5},"title":"GPIO Zero for the Raspberry Pi &#8211; more details","author":"Michael Horne","date":"12 October 2015","format":false,"excerpt":"Alex Eames has scored a great interview with Ben Nuttall about his new GPIO library, GPIO Zero. Zero, which is\u00a0written on top of Ben Croston's great RPi.GPIO library, aims to abstract some of the more difficult or long-winded concepts\u00a0and is aimed at education and developers who want to do their\u2026","rel":"","context":"In &quot;Interview&quot;","block_context":{"text":"Interview","link":"https:\/\/www.recantha.co.uk\/blog\/?cat=27"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/rasp.io\/wp-content\/uploads\/2015\/04\/RasPiO_portsplus_on_Pi2_7001.jpg?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rasp.io\/wp-content\/uploads\/2015\/04\/RasPiO_portsplus_on_Pi2_7001.jpg?resize=350%2C200 1x, https:\/\/i0.wp.com\/rasp.io\/wp-content\/uploads\/2015\/04\/RasPiO_portsplus_on_Pi2_7001.jpg?resize=525%2C300 1.5x, https:\/\/i0.wp.com\/rasp.io\/wp-content\/uploads\/2015\/04\/RasPiO_portsplus_on_Pi2_7001.jpg?resize=700%2C400 2x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.recantha.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/14065","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.recantha.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.recantha.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.recantha.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.recantha.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=14065"}],"version-history":[{"count":3,"href":"https:\/\/www.recantha.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/14065\/revisions"}],"predecessor-version":[{"id":14069,"href":"https:\/\/www.recantha.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/14065\/revisions\/14069"}],"wp:attachment":[{"href":"https:\/\/www.recantha.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=14065"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.recantha.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=14065"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.recantha.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=14065"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}