{"id":81,"date":"2017-02-15T23:45:17","date_gmt":"2017-02-16T07:45:17","guid":{"rendered":"http:\/\/eequalspi.com\/?p=81"},"modified":"2020-01-01T15:29:09","modified_gmt":"2020-01-01T23:29:09","slug":"the-sidereal-clock","status":"publish","type":"post","link":"https:\/\/eequalspi.com\/index.php\/2017\/02\/15\/the-sidereal-clock\/","title":{"rendered":"The &#8216;Sidereal&#8217; Clock"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-86\" src=\"http:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/10-finished.jpg\" alt=\"\" width=\"544\" height=\"360\" srcset=\"https:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/10-finished.jpg 992w, https:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/10-finished-300x198.jpg 300w, https:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/10-finished-768x508.jpg 768w\" sizes=\"auto, (max-width: 544px) 85vw, 544px\" \/><\/p>\n<p>Note: This post is based on a word document I wrote and archived back when I finished this project in April of 2014.<\/p>\n<h2>Background<\/h2>\n<p>The Sidereal Clock is a simple thing. It tells you exactly how much daylight you have left. Once the sun sets, it goes negative and tells you how much nighttime remains. I realize it\u2019s a misnomer, \u2018sidereal time\u2019 (<a href=\"http:\/\/en.wikipedia.org\/wiki\/Sidereal_time\">http:\/\/en.wikipedia.org\/wiki\/Sidereal_time<\/a>) would really describe a clock based around the movement of the fixed stars, but \u2018daylight clock\u2019 is a rather ambiguous and forgettable name.<\/p>\n<p>The Sidereal Clock started from an idea. Well, someone else\u2019s idea. My academic advisor saw a clock at an art installation (supposedly by James Campbell \u2013 <a href=\"http:\/\/www.jimcampbell.tv\/portfolio\/objects\/untitled_for_the_sun\/\">http:\/\/www.jimcampbell.tv\/portfolio\/objects\/untitled_for_the_sun\/<\/a>, although I haven\u2019t seen it with my own eyes) that measured the percent of daylight remaining using a photo detector to determine when the last sunrise and sunset were. My advisor thought this was a really novel way of showing time, and I agreed. The implementation, however elegant, is rather impractical. It requires some reliable uninterrupted access to outdoor light, which suggests a ruggedized installation of a photo detector outdoors with a line leading inside to the display unit. Certainly impractical for many people, but really cool nonetheless.<\/p>\n<h3>Generation 1: Wired<\/h3>\n<p>My advisor, had an upcoming freshman class and some old 2.4\u201d seven segment displays scrapped from a bowling alley.\u00a0 He&#8217;d suggested a clock that would provide the same information, but which would show his freshman the cool stuff you could do with an Arduino. This meant the following requirements:<\/p>\n<figure id=\"attachment_87\" aria-describedby=\"caption-attachment-87\" style=\"width: 333px\" class=\"wp-caption alignright\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-87\" src=\"http:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/1-wired-clock.png\" alt=\"\" width=\"333\" height=\"182\" srcset=\"https:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/1-wired-clock.png 720w, https:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/1-wired-clock-300x164.png 300w\" sizes=\"auto, (max-width: 333px) 85vw, 333px\" \/><figcaption id=\"caption-attachment-87\" class=\"wp-caption-text\">Figure 1: Wired Clock<\/figcaption><\/figure>\n<ol>\n<li>Automatic network time setting.<\/li>\n<li>Those bright displays, each with three 2.4\u201d digits.<\/li>\n<li>A way to calculate sunrise and sunset.<\/li>\n<\/ol>\n<p>What I came up with wasn\u2019t much of a leap. I basically ganged together the displays, which were on boards with handy shift registers, grabbed and Ethernet Shield, and off I went!<\/p>\n<p>I could of course get the time from NTP servers (there\u2019s even an example that comes with the Ethernet Shield), and I found that the Navy offers a web page that would calculate the Sunrise and Sunset time for me. It\u2019s actually pretty neat! All I had to do was scrape it for that data (check it out <a href=\"http:\/\/aa.usno.navy.mil\/cgi-bin\/aa_pap.pl\">http:\/\/aa.usno.navy.mil\/cgi-bin\/aa_pap.pl<\/a>). I wrote a tiny PHP script which I hosted on my own domain to act as an intermediary and then had my Arduino parse the text output and use it to set my clock. Bam!<\/p>\n<p>I laser cut a relatively crude acrylic case in our campus shop and brought it to show the students. Overall, a decent outcome for a few evenings work, if I do say so myself.<\/p>\n<h3>Generation 2: Wireless<\/h3>\n<p>Unfortunately, my advisor didn\u2019t particularly like the fact that it required an Ethernet cable (neither did I, to be honest), but I let it sit for a season, because it was providing good service on his wall and occasionally inspiring students. After about six months, the glue holding the front of the hastily assembled acrylic case gave out. I decided to use that as an excuse to improve the design. I managed to get a hold of the then brand new Adafruit CC3000 breakout (<a href=\"https:\/\/www.adafruit.com\/products\/1469\">https:\/\/www.adafruit.com\/products\/1469<\/a>) and see if it would do the trick for NTP. It worked like a charm (that CC3000 chip is really cool in my opinion, although I must disclaim having been a TI intern in the past \u2013 but not involved with the CC3000). The next trick was to free myself from web page parsing. After some more web spelunking, I found someone who had solved exactly this problem in C, and all that was required was to port it to my Arduino sketch. That original code can be found here (<a href=\"http:\/\/souptonuts.sourceforge.net\/code\/sunrise.c.html\">http:\/\/souptonuts.sourceforge.net\/code\/sunrise.c.html<\/a>).<\/p>\n<figure id=\"attachment_88\" aria-describedby=\"caption-attachment-88\" style=\"width: 572px\" class=\"wp-caption alignleft\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-88\" src=\"http:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/2-guts.jpg\" alt=\"\" width=\"572\" height=\"262\" srcset=\"https:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/2-guts.jpg 619w, https:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/2-guts-300x138.jpg 300w\" sizes=\"auto, (max-width: 572px) 85vw, 572px\" \/><figcaption id=\"caption-attachment-88\" class=\"wp-caption-text\">Figure 2: Wireless Clock Guts<\/figcaption><\/figure>\n<p>Finally, I added a real time clock module based on the DS1307, which allowed me to virtually never synchronize with the internet. At this point, I modified the firmware so that it would only check NTP when the user<\/p>\n<figure id=\"attachment_89\" aria-describedby=\"caption-attachment-89\" style=\"width: 369px\" class=\"wp-caption alignright\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-89\" src=\"http:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/3-wireless-clock.jpg\" alt=\"\" width=\"369\" height=\"207\" srcset=\"https:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/3-wireless-clock.jpg 487w, https:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/3-wireless-clock-300x168.jpg 300w\" sizes=\"auto, (max-width: 369px) 85vw, 369px\" \/><figcaption id=\"caption-attachment-89\" class=\"wp-caption-text\">Figure 3: Wireless Clock<\/figcaption><\/figure>\n<p>pressed a button on the top of the clock. The downside to all this was that the addition of the CC3000 libraries, combined with the DS1307, various time libraries, and lots of text in the serial interface used for setting parameters (like GPS coordinates) meant that there simply wasn\u2019t enough program memory (EEPROM) on the 32k of an Arduino Uno, and I had to switch to a Mega2560. Still, all in all, a successful result, even if it is rather ugly on the inside.<\/p>\n<p>I dutifully returned my Wi-Fi friendly clock to my advisor and it found a home on his wall, once again occasionally coming down to show students just how much cool stuff you could pack onto a measly Arduino.<\/p>\n<h2>Generation 3: Single Board<\/h2>\n<p>Thinking I was done with the project I nearly moved on, but the cool factor of the design kept bugging me. I wanted one for my own wall. After some searching, I actually found that Jameco (our beloved local bay-area parts supplier) carried the exact same, beautiful 2.4\u201d tall seven segment LEDs (<a href=\"http:\/\/www.jameco.com\/webapp\/wcs\/stores\/servlet\/Product_10001_10001_97199_-1\">http:\/\/www.jameco.com\/webapp\/wcs\/stores\/servlet\/Product_10001_10001_97199_-1<\/a>) this opened the possibility of building a single board version of the clock. I started down the road of a full replication of my previous effort, including an integrated Mega2560, CC3000 and RTC. After getting said board half laid out, I came to a realization\u2026<em>wireless is a luxury, and I have no need for it in a design for me.<\/em> Stripping out the wireless removed a lot of fat from the code. I could pull most of the serial interface as I didn\u2019t need to set things like SSID and password, I could pull several large libraries, etc. It made it trivial to fall back to an Atmega328P (of Arduino Uno fame) as opposed to the more complex and expensive surface mount microcontroller used in the Mega2560.<\/p>\n<p>The final result consisted of 6 LED Digits, three \u00a0TLC5925I\u2019s (LED driver ICs), five buttons for input, a regulator, a DS1307 with a watch battery, an atmega328P and a handful of resistors and capacitors.<\/p>\n<p>I pretty quickly stripped down the board to a much smaller (and less costly) bill of materials and produced a final version, containing an Atmega, with ICSP, a Real Time Clock, and LED drivers. Everything was easy, or so I thought. It turned out that I had foolishly rounded down in my measurement of the LED\u2019s width when creating a footprint for Eagle CAD.\u00a0 Unfortunately, this meant that while I could squeeze the LEDs into their footprint, the rounding errors added up across all six LEDs to a 0.1\u201d overhang. Of course, this stress meant that the entire board ended up curved! It worked, but that\u2019s not okay.<\/p>\n<figure id=\"attachment_90\" aria-describedby=\"caption-attachment-90\" style=\"width: 818px\" class=\"wp-caption alignleft\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-90\" src=\"http:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/4-bent-board.jpg\" alt=\"\" width=\"818\" height=\"140\" srcset=\"https:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/4-bent-board.jpg 818w, https:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/4-bent-board-300x51.jpg 300w, https:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/4-bent-board-768x131.jpg 768w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><figcaption id=\"caption-attachment-90\" class=\"wp-caption-text\">Figure 4: Bent Board<\/figcaption><\/figure>\n<p>A quick fix revision (and $50 and several weeks of waiting) later and all was well!<\/p>\n<figure id=\"attachment_91\" aria-describedby=\"caption-attachment-91\" style=\"width: 812px\" class=\"wp-caption alignleft\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-91\" src=\"http:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/5-fixed-board.jpg\" alt=\"\" width=\"812\" height=\"332\" srcset=\"https:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/5-fixed-board.jpg 812w, https:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/5-fixed-board-300x123.jpg 300w, https:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/5-fixed-board-768x314.jpg 768w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><figcaption id=\"caption-attachment-91\" class=\"wp-caption-text\">Figure 5: Fixed board.<\/figcaption><\/figure>\n<h2>The Enclosure<\/h2>\n<p>Finally, the design needed a better enclosure.<\/p>\n<figure id=\"attachment_92\" aria-describedby=\"caption-attachment-92\" style=\"width: 305px\" class=\"wp-caption alignright\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-92\" src=\"http:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/6-side-enclosure.jpg\" alt=\"\" width=\"305\" height=\"125\" srcset=\"https:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/6-side-enclosure.jpg 400w, https:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/6-side-enclosure-300x123.jpg 300w\" sizes=\"auto, (max-width: 305px) 85vw, 305px\" \/><figcaption id=\"caption-attachment-92\" class=\"wp-caption-text\">Figure 6: Side View Of Enclosure<\/figcaption><\/figure>\n<p>I\u2019m going out of order here because I came up with this design as I laid out the board, but it fits better as its own section. As I mentioned, I had originally built an acrylic enclosure in the campus shop, designing the entire apparatus to hang from the back plate using either double stick tape or standoffs. This was a haphazard arrangement, and designing my own board opened up an opportunity to simplify things.<\/p>\n<figure id=\"attachment_83\" aria-describedby=\"caption-attachment-83\" style=\"width: 264px\" class=\"wp-caption alignright\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-83\" src=\"http:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/7-back.jpg\" alt=\"\" width=\"264\" height=\"162\" srcset=\"https:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/7-back.jpg 400w, https:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/7-back-300x184.jpg 300w\" sizes=\"auto, (max-width: 264px) 85vw, 264px\" \/><figcaption id=\"caption-attachment-83\" class=\"wp-caption-text\">Figure 7: Back Of Enclosure<\/figcaption><\/figure>\n<p>I discovered Ponoko (<a href=\"http:\/\/www.ponoko.com\">ponoko.com<\/a>), which will laser cut from an SVG and mail directly to your door. Given that I had spent most of a day in the shop simply waiting for an opportunity to use the laser cutter (behind a long line of students who had never used it before and had come essentially unprepared to cut anything), I decided to give them a try. Despite the fact that they are listed as a New Zealand company, it turns out that their Acrylic shipped from a shop east of the San Francisco Bay, meaning that I would get my parts 24 hours after they shipped, even with the cheapest<\/p>\n<figure id=\"attachment_84\" aria-describedby=\"caption-attachment-84\" style=\"width: 377px\" class=\"wp-caption alignright\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-84\" src=\"http:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/8-no-diffuser.jpg\" alt=\"\" width=\"377\" height=\"147\" srcset=\"https:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/8-no-diffuser.jpg 513w, https:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/8-no-diffuser-300x117.jpg 300w\" sizes=\"auto, (max-width: 377px) 85vw, 377px\" \/><figcaption id=\"caption-attachment-84\" class=\"wp-caption-text\">Figure 8: Contrast issues without a diffuser<\/figcaption><\/figure>\n<p>shipping rates. Combine that with the $50 annual fee to use the campus shop and the long delay, I decided to give them a try. I got a discounted rate and my first piece ended up being on the order of $20, which was stunning. I ended up cutting two pieces of acrylic and using #4 screws to create a PCB sandwich, with a hanging hole in the back of the clock.<\/p>\n<p>Unfortunately, there was a downside to clear<\/p>\n<figure id=\"attachment_85\" aria-describedby=\"caption-attachment-85\" style=\"width: 327px\" class=\"wp-caption alignright\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-85\" src=\"http:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/9-paper-diffuser.jpg\" alt=\"\" width=\"327\" height=\"153\" srcset=\"https:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/9-paper-diffuser.jpg 488w, https:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/9-paper-diffuser-300x140.jpg 300w\" sizes=\"auto, (max-width: 327px) 85vw, 327px\" \/><figcaption id=\"caption-attachment-85\" class=\"wp-caption-text\">Figure 7: Paper Diffuser<\/figcaption><\/figure>\n<p>acrylic. Unlike the first LEDs, the new LEDs from Jameco have a black background (this is visible in the picture of the assembled board, to the right). This means that even the unlit LED segments have a fairly high contrast with their background. That lack of contrast makes the clock extremely difficult to read despite the display being absolutely huge. The first obvious solution was to use some thin paper as a diffuser, which works reasonably well, but it\u2019s still not particularly pretty.<\/p>\n<figure id=\"attachment_86\" aria-describedby=\"caption-attachment-86\" style=\"width: 544px\" class=\"wp-caption alignright\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-86\" src=\"http:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/10-finished.jpg\" alt=\"\" width=\"544\" height=\"360\" srcset=\"https:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/10-finished.jpg 992w, https:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/10-finished-300x198.jpg 300w, https:\/\/eequalspi.com\/wp-content\/uploads\/2017\/02\/10-finished-768x508.jpg 768w\" sizes=\"auto, (max-width: 544px) 85vw, 544px\" \/><figcaption id=\"caption-attachment-86\" class=\"wp-caption-text\">Figure 8: Finished Design<\/figcaption><\/figure>\n<p>I decided to place a second order from Ponoko, of the same design, but in smoked gray acrylic. This design, diffuser omitted, came back absolutely beautiful and represents a nearly final design. The one last tiny change came from the realization that I could fit three clock enclosures on two sheets of acrylic if I shrank the height of the face by 0.1\u201d.<\/p>\n<p>The final BOM in quantity one is a little over $100, mostly due to the PCB, LEDs, and Acrylic, although I suspect in large quantities, it would be reduced to less than half that.<\/p>\n<p>All in all, I\u2019m really happy with how the entire clock came out and who knows, maybe at some point I\u2019ll make a kit out of it or something, but for now, I intend to pass them out to friends and family as the occasional unique gift.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Note: This post is based on a word document I wrote and archived back when I finished this project in April of 2014. Background The Sidereal Clock is a simple thing. It tells you exactly how much daylight you have left. Once the sun sets, it goes negative and tells you how much nighttime remains. &hellip; <a href=\"https:\/\/eequalspi.com\/index.php\/2017\/02\/15\/the-sidereal-clock\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;The &#8216;Sidereal&#8217; Clock&#8221;<\/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":[6],"tags":[],"class_list":["post-81","post","type-post","status-publish","format-standard","hentry","category-clocks"],"_links":{"self":[{"href":"https:\/\/eequalspi.com\/index.php\/wp-json\/wp\/v2\/posts\/81","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/eequalspi.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/eequalspi.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/eequalspi.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/eequalspi.com\/index.php\/wp-json\/wp\/v2\/comments?post=81"}],"version-history":[{"count":14,"href":"https:\/\/eequalspi.com\/index.php\/wp-json\/wp\/v2\/posts\/81\/revisions"}],"predecessor-version":[{"id":216,"href":"https:\/\/eequalspi.com\/index.php\/wp-json\/wp\/v2\/posts\/81\/revisions\/216"}],"wp:attachment":[{"href":"https:\/\/eequalspi.com\/index.php\/wp-json\/wp\/v2\/media?parent=81"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eequalspi.com\/index.php\/wp-json\/wp\/v2\/categories?post=81"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eequalspi.com\/index.php\/wp-json\/wp\/v2\/tags?post=81"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}