{"componentChunkName":"component---src-pages-index-js","path":"/","result":{"data":{"allMarkdownRemark":{"edges":[{"node":{"id":"f48ddd34-6fe4-55d8-b2f2-241a5c648a52","html":"<p>After a few months on the back burner (thanks to a few reminders from my daughter), I'm back to focusing on the PyClock 2. Now's as good a time as ever to delve into what makes the clock <em>tick</em>.</p>\n<p>The original PyClock source code is little more than a script that is always running. I want the PyClock 2 to be configurable through a web-based interface. In keeping with the spirit of doing this project in Python, I chose to use Flask as the framework for my clock's user interface. Flask's lightweight nature was attractive, considering the target hardware for this project is a Raspberry Pi Zero W.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 395px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/b114f3373c9cf1cd0747e70a4b323d00/2cb6c/2020-05-05-myapp.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 87.16216216216216%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAARCAIAAABSJhvpAAAACXBIWXMAAA7EAAAOxAGVKw4bAAACRElEQVQ4y42S+27bIBTG8zBLMAbjC5ibwYDvrtOmSSvtj73/ewwnrbZp0jrp0xE2+s75+MGhZG6Yr4KGjDV4cWTxpl8xliCtk5T/WwfKw+X2w4YZdlZd1roJuNApEl86d3OCOEQiCiCOM4WQPCXsf5y7GTWmfO+RadDYFksvlJPKxy4A1gnkv5RyAD/0y8wLv6otMyZ/7c15a8wEiUgzAbGAmUjuNcV3IYGyXfDzUIcUydhYFmES566eibHZ5rO+xc6Q54Bnx5ZBaTc9dT443/sw+FqEzzPfU4GUQyj2RVKD++dOG/EPxd0dzd/AiAD5PUZkhkWWq7xSpFCYqAR+BQxrw7/PWWez2YnLIoQblzBMHRcBfGkWuZ+LFU02u3Z2ecplC5EEYM+ffOp0V+T/qH/c8xHQomnraaBjV1x7s50JbZJcpExBqlClS6orpkmpSqpiTbH8jTbicf5An3w5IKHzp0jb7rS3gMe2GvvWhXHtTGv7OcjG5YV9zD/swU71CdbHhMYIMdjxGzsdGQAsATEzf8Q+glhjxvoBAj4mQyqTRqeFRExjYYpKU6GpbEjZnCCLTzXeWZwDILvXxyL+p3HeoZCtu55Rb9PVkkunp3Hu/DYFJ8ey8FIMed6U1NWir6irmI8qSsfEUNL2wPPgyMj7oQ2rdiN7WewyDFOvzKC3l/7tNl5vL5fbdrku6/Pt/W1aLkqur9v19fx2QESDXMUWga22GjNuydhh57FpyRyQs3yelQ5N6yIq631VW5I3Xpmgh58P1dC6WmvfPgAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"Screenshot of Flask app code\"\n        title=\"Flask App\"\n        src=\"/static/b114f3373c9cf1cd0747e70a4b323d00/2cb6c/2020-05-05-myapp.png\"\n        srcset=\"/static/b114f3373c9cf1cd0747e70a4b323d00/12f09/2020-05-05-myapp.png 148w,\n/static/b114f3373c9cf1cd0747e70a4b323d00/e4a3f/2020-05-05-myapp.png 295w,\n/static/b114f3373c9cf1cd0747e70a4b323d00/2cb6c/2020-05-05-myapp.png 395w\"\n        sizes=\"(max-width: 395px) 100vw, 395px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n  </a>\n    </span></p>\n<p>So far, the Flask app is a series of mostly experimental endpoints, and some setup code to get the clock running. The <code>/flash</code> endpoint was key to establishing that I could manipulate the lightboard with HTTP requests.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 448px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/53908b207ebec32db82d1ad53a0f2d5a/33b38/2020-05-05-chrono.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 116.89189189189189%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAXCAIAAACEf/j0AAAACXBIWXMAAA7EAAAOxAGVKw4bAAADlklEQVQ4y0VUiZakKBCsj5kub1SUUwHF+66q7t6e3f3//9i0eqvnvRBBSJKMCLwkUZkhxcmm5MPaW99/Gr3Zdqe0zrCu7RpL5Rjhahm3VYr1r2v25pxwfXpxfeL4lJNd8tW2az89bLtN6yfnluDOlI9Cz3Y+qnGthn0c76Uemu5QZvYCeoHHC5hgh+Br0+3j/GGbrR/veaok2Ut+q5ttXb+G4d62xzi/98N9WT9xbhyPvILpUcqjG45+fNR20XphWUuyiWSdVIMyU6nG8tkp1KDNFET8TzDUXIh9P76m5VOrESd1VX5mWRfF8rvCq0uuHrm6+RPE8ehZM0T6AZfsBpnvj3/W46sQrSoWyRajbigpIQOscQPqPtNAzA8uzvMVRSpCBSYmI1UY8jiGYRnFxdU9WXW9F56Lf7a4sLjWWedpSdteAOdiCpGACUgIqaA2N6QOIKJeyCDs5/BnsB+w4Dz2UcgdNJiWj6qegDZV9DS3Xf+eaZvONu0tXXqlxyASKCkAsNHlWQyT9AaEtf0+TI8GdF4+OLUMT6W4m2ob5ve228E5I7igOWeVGcEgJ2FPttdCbNZuXQ967tBJUSlBP3EzdgVtu/7WdqDl2Q7TPUTy+iMVsM3FypdezBPpGnM7GKlRpFGsMakob3JSA5eEni3l9kdn5vksQjpA0sXMwcxNWUgKoO3q5d/MveT9g//ZPqd9Yqq1a4+he8hy8GqZN12KK5rPgi+FGatqTaoqHIysBoSKb6kg5QWFEqPSSZmLuYd5QCUojGLjh+zNycFbTzOBpc6E36d4g44PhssvJDYiqfk88LFPtWH9XJfvTX0HVXCuedFGsYiRSZMahkw0Oa0ZtyE4Kmku5x4+FXKmtCd5T8mS4l6opdBbYVZjb1SMlK6EzlItur6VZpNqRInK0+6sGXSX5YSQYuxgYmqGW9M9COscDywtAqT8SLoh98LCBQT8vBgnbdkZDMSC9BgpSe+q3I/738vykWIFi2D25PYsG0gi3svbXsBPhz115lnWJJnlxZ6zMU4NJg1hc4wtpj0vliRrELZ+VMRZm9IBpXWM4UvzfSVZjnTfHH3zl8jaspi342uefuepqc02Df/mpIFDAuHOqTwwT579lz2dgIY+S5AR9F5V9/34PcyPSo0ZarT4JPkYoCJKTBirJ3SINLSX50Vn3gs47TJsK7vC74ayOggFyeAmFX4oUzoiXEVpBeVAJOz1H53SMQaVr0dqAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"Screenshot of clock code\"\n        title=\"The Clock\"\n        src=\"/static/53908b207ebec32db82d1ad53a0f2d5a/33b38/2020-05-05-chrono.png\"\n        srcset=\"/static/53908b207ebec32db82d1ad53a0f2d5a/12f09/2020-05-05-chrono.png 148w,\n/static/53908b207ebec32db82d1ad53a0f2d5a/e4a3f/2020-05-05-chrono.png 295w,\n/static/53908b207ebec32db82d1ad53a0f2d5a/33b38/2020-05-05-chrono.png 448w\"\n        sizes=\"(max-width: 448px) 100vw, 448px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n  </a>\n    </span></p>\n<p>The Clock class is the most important piece of this puzzle, and I wanted it to be a marked improvement over <a href=\"https://github.com/jdorety/picture.clock/blob/master/WakeUp/main.py\">the original</a>. One of my main goals for this upgrade is to allow displays for holidays that aren't necessarily on the same calendar date every year (e.g. Thanksgiving, Easter, etc.). I'm hoping to leverage Python's calendar modules (and possibly others that I might find) to achieve this goal.</p>\n<p>As for the basic clock mechanism, it's straight from the Pimoroni example code included in the <a href=\"https://github.com/pimoroni/unicorn-hat/blob/master/examples/hat/clock.py\">Unicorn HAT GitHub repo</a>. It is much nicer on the CPU than my original code from two years ago.</p>\n<p>Next up, I plan on creating a Display class, in keeping with my object oriented approach. My hope is that keeping hardware-specific functionality confined to well-designed class methods will aid in the overall organization of my codebase.</p>","frontmatter":{"author":"Jonathan Dorety","date":"05/05/2020","path":"/content/02-software","title":"Digging into the Software"}}},{"node":{"id":"0a21b1df-5e9d-5b9f-a75d-0fedf03c7f20","html":"<p>The PyClock is a hardware and software project. Today, I want to focus on the hardware.</p>\n<h3>The Brain</h3>\n<p>The first, and arguably, most important piece of hardware used for the PyClock2 is the Raspberry Pi. For development purposes, I'm currently using a Pi 3 Model B. The final piece of hardware will be running on a Pi Zero-W. I'll delve into the reasons I'm using a higher spec board for development in a later post. The Raspberry Pi is the brains of the machine, and allows for easy prototyping. A Raspberry Pi packs a <strong>lot</strong> of features onto a tiny circuit board, but it doesn't have <em>everything</em> you might expect from a full-sized computer.</p>\n<h3>The Heart</h3>\n<p>One of those things is a real-time clock. The Raspberry Pi relies on pinging a Network Time Protocol on boot to figure out what time it is. This might prove to be a problem if I go travelling with my clock, and don't have wi-fi available to connect to. After much research, I chose to go with the Adafruit PiRTC, a preassembled add-on based on the PCF8523 RTC.</p>\n<h3>The Face</h3>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 590px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/c0de47daa515acd6bf81ee3043d20985/a3429/unicorn-hat.jpg\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 75%; position: relative; bottom: 0; left: 0; background-image: url('data:image/jpeg;base64,/9j/2wBDABALDA4MChAODQ4SERATGCgaGBYWGDEjJR0oOjM9PDkzODdASFxOQERXRTc4UG1RV19iZ2hnPk1xeXBkeFxlZ2P/2wBDARESEhgVGC8aGi9jQjhCY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2P/wgARCAAPABQDASIAAhEBAxEB/8QAFwAAAwEAAAAAAAAAAAAAAAAAAAMEBf/EABUBAQEAAAAAAAAAAAAAAAAAAAEA/9oADAMBAAIQAxAAAAGBuisYTbC//8QAGRAAAgMBAAAAAAAAAAAAAAAAAQIAAxIR/9oACAEBAAEFAlQF8hZhnj0HRosnJ//EABQRAQAAAAAAAAAAAAAAAAAAABD/2gAIAQMBAT8BP//EABQRAQAAAAAAAAAAAAAAAAAAABD/2gAIAQIBAT8BP//EABwQAAIBBQEAAAAAAAAAAAAAAAARIgECEBIhQf/aAAgBAQAGPwK5kR6ohTiR5j//xAAbEAEBAQACAwAAAAAAAAAAAAABEQAhMVFhcf/aAAgBAQABPyHkB6yRau73EaU9zoGAfuIAeXzv/9oADAMBAAIAAwAAABCnP//EABURAQEAAAAAAAAAAAAAAAAAAAAR/9oACAEDAQE/EIj/xAAVEQEBAAAAAAAAAAAAAAAAAAAAEf/aAAgBAgEBPxCq/8QAHBAAAgIDAQEAAAAAAAAAAAAAAREAIUFhoTGB/9oACAEBAAE/EHhWylZX2JKiKdxINDSUOLsotkvs0ihPnkEcKCJZn//Z'); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"The Pimoroni Unicorn Hat\"\n        title=\"The Pimoroni Unicorn Hat\"\n        src=\"/static/c0de47daa515acd6bf81ee3043d20985/1c72d/unicorn-hat.jpg\"\n        srcset=\"/static/c0de47daa515acd6bf81ee3043d20985/a80bd/unicorn-hat.jpg 148w,\n/static/c0de47daa515acd6bf81ee3043d20985/1c91a/unicorn-hat.jpg 295w,\n/static/c0de47daa515acd6bf81ee3043d20985/1c72d/unicorn-hat.jpg 590w,\n/static/c0de47daa515acd6bf81ee3043d20985/a8a14/unicorn-hat.jpg 885w,\n/static/c0de47daa515acd6bf81ee3043d20985/fbd2c/unicorn-hat.jpg 1180w,\n/static/c0de47daa515acd6bf81ee3043d20985/a3429/unicorn-hat.jpg 4160w\"\n        sizes=\"(max-width: 590px) 100vw, 590px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n  </a>\n    </span></p>\n<p>The last piece of the puzzle was the Pimoroni Unicorn HAT. One can't very well have a picture clock without pictures, and the device needed to be releatively self-contained. The 8x8 RGB light grid provided by the Unicorn seemed to be just enough to be able to render simple pictures that a toddler could understand.</p>\n<p>With that, I had the three components needed to build the PyClock.  Next time, I'll discuss the original PyClock.</p>","frontmatter":{"author":"Jonathan Dorety","date":"01/21/2020","path":"/content/01-hardware","title":"Let's Talk Hardware"}}},{"node":{"id":"353b3a27-397d-53cf-9976-634803594ca2","html":"<p>On my daughter's second birthday, she got to start sleeping in a regular bed. Soon after this, it became apparent that she had no concept of time beyond \"the sun is up\", and \"the moon is up\". This wasn't much of a problem during bedtime, as I was fully awake and capable of enforcing compliance. Wakeup time was trickier, my wife and I discovered.</p>\n<p>Every other morning, my daughter would wake us up a full hour or two before our usual routine. Now that she wasn't in her crib, she was free to come and get us whenever it felt appropriate to her. I thought briefly about trying to teach her to read a digital clock, and then remembered that she was two.</p>\n<p>At this time, I was teaching myself Python during my free time. I was also tinkering around with hardware projects centered around the Raspberry Pi single-board computer. One day, something clicked, and I thought \"I will build a clock that a two-year-old can understand!\" I looked online to see what kinds of things people had come up with, and most of them were very simple, generally involving a light that would change colors based on the time of day.</p>\n<p>I don't know why, but that sounded boring. My mind started going wild with the possiblities. Instead of colors, I would use actual pictures for my clock, and on holidays, a special picture would appear for the day! Finally, I had found a project to work on that involved more than following the steps in a tutorial.</p>\n<p><a href=\"https://github.com/jdorety/picture.clock\">This</a> is the GitHub repo for that original clock project. It's pretty hacky for sure, but it was also the first time I successfully solved a problem using code!</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 590px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/92dbf36e01d4329c64f0b4446bfee298/df02d/pyclock2.jpg\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 96.62162162162163%; position: relative; bottom: 0; left: 0; background-image: url('data:image/jpeg;base64,/9j/2wBDABALDA4MChAODQ4SERATGCgaGBYWGDEjJR0oOjM9PDkzODdASFxOQERXRTc4UG1RV19iZ2hnPk1xeXBkeFxlZ2P/2wBDARESEhgVGC8aGi9jQjhCY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2P/wgARCAATABQDASIAAhEBAxEB/8QAGQABAAMBAQAAAAAAAAAAAAAAAAIDBAEF/8QAFwEBAQEBAAAAAAAAAAAAAAAAAgMBBP/aAAwDAQACEAMQAAAB8S2rRUY00n3SdRiBv//EABoQAQADAAMAAAAAAAAAAAAAAAEAAhARITH/2gAIAQEAAQUCrGoZT3kid1gGf//EABURAQEAAAAAAAAAAAAAAAAAAAEQ/9oACAEDAQE/AWM//8QAGBEAAgMAAAAAAAAAAAAAAAAAAhADMTL/2gAIAQIBAT8BGlHlf//EABYQAQEBAAAAAAAAAAAAAAAAACABIf/aAAgBAQAGPwKjT//EABkQAQEBAQEBAAAAAAAAAAAAAAEAETEhUf/aAAgBAQABPyE/G2YZPbobg25fZkBYhwnt/9oADAMBAAIAAwAAABAH4Dz/xAAXEQADAQAAAAAAAAAAAAAAAAAAATEQ/9oACAEDAQE/EKEi8//EABgRAQEBAQEAAAAAAAAAAAAAAAEAESEx/9oACAECAQE/EAYUnNgdz7f/xAAdEAEBAAMAAgMAAAAAAAAAAAABEQAhMUFxYaGx/9oACAEBAAE/ECRJk8lC3HVN6pfU7zWCI+c31QLedyXIJNgF/Mq4JWTmbSfeXAT6xqlz/9k='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"A picture of the Pyclock\"\n        title=\"PyClock2\"\n        src=\"/static/92dbf36e01d4329c64f0b4446bfee298/1c72d/pyclock2.jpg\"\n        srcset=\"/static/92dbf36e01d4329c64f0b4446bfee298/a80bd/pyclock2.jpg 148w,\n/static/92dbf36e01d4329c64f0b4446bfee298/1c91a/pyclock2.jpg 295w,\n/static/92dbf36e01d4329c64f0b4446bfee298/1c72d/pyclock2.jpg 590w,\n/static/92dbf36e01d4329c64f0b4446bfee298/a8a14/pyclock2.jpg 885w,\n/static/92dbf36e01d4329c64f0b4446bfee298/fbd2c/pyclock2.jpg 1180w,\n/static/92dbf36e01d4329c64f0b4446bfee298/df02d/pyclock2.jpg 2328w\"\n        sizes=\"(max-width: 590px) 100vw, 590px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n  </a>\n    </span></p>\n<p>Now I'm looking to make a better, more improved version, using all of the web development skills I've learned in the past 1-2 years. The rest of posts in this blog will deal with that project...</p>","frontmatter":{"author":"Jonathan Dorety","date":"01/03/2020","path":"/content/00-introduction","title":"The Beginning"}}}]}},"pageContext":{}}}