{
"type": "entry",
"author": {
"name": null,
"url": "http://tinysubversions.com/",
"photo": null
},
"url": "https://twitter.com/BarsBot",
"published": "2017-12-05T00:00:00+00:00",
"content": {
"html": "<p>A corny stream-of-consciousness rap bot. (<a href=\"https://twitter.com/BarsBot\">full item here</a>)</p>",
"text": "A corny stream-of-consciousness rap bot. (full item here)"
},
"name": "[Project] Bars Bot",
"post-type": "article",
"_id": "3903031",
"_source": "2776"
}
{
"type": "entry",
"author": {
"name": null,
"url": "http://tinysubversions.com/",
"photo": null
},
"url": "https://twitter.com/EatenBot",
"published": "2017-12-02T00:00:00+00:00",
"content": {
"html": "<p>I have eaten the memes that were in the tweets... (<a href=\"https://twitter.com/EatenBot\">full item here</a>)</p>",
"text": "I have eaten the memes that were in the tweets... (full item here)"
},
"name": "[Project] Eaten Bot",
"post-type": "article",
"_id": "3903032",
"_source": "2776"
}
{
"type": "entry",
"author": {
"name": null,
"url": "http://tinysubversions.com/",
"photo": null
},
"url": "https://twitter.com/RapNameBot",
"published": "2017-11-20T00:00:00+00:00",
"content": {
"html": "<p>An attempt to programmatically assassinate the \"your rap name is...\" joke meme. (<a href=\"https://twitter.com/RapNameBot\">full item here</a>)</p>",
"text": "An attempt to programmatically assassinate the \"your rap name is...\" joke meme. (full item here)"
},
"name": "[Project] Rap Name Bot",
"post-type": "article",
"_id": "3903033",
"_source": "2776"
}
{
"type": "entry",
"author": {
"name": null,
"url": "http://tinysubversions.com/",
"photo": null
},
"url": "https://botsin.space/@ombra/",
"published": "2017-10-25T00:00:00+00:00",
"content": {
"html": "<p>A poetry bot that liberally remixes the words of 19th century Scottish novelist Margaret Oliphant. (<a href=\"https://botsin.space/@ombra/\">full item here</a>)</p>",
"text": "A poetry bot that liberally remixes the words of 19th century Scottish novelist Margaret Oliphant. (full item here)"
},
"name": "[Project] Ombra",
"post-type": "article",
"_id": "3903034",
"_source": "2776"
}
{
"type": "entry",
"author": {
"name": null,
"url": "http://benjaminturner.me/blog/",
"photo": null
},
"url": "http://benjaminturner.me/blog/electronics-recycling/",
"published": "2017-07-26T03:00:00+00:00",
"content": {
"html": "<p>This morning I discovered a partially disassembled iMac abandoned in my building's dumpster. <a href=\"https://www.theatlantic.com/technology/archive/2016/09/the-global-cost-of-electronic-waste/502019/\">It should come as no surprise that E-waste is an increasingly important issue, and is terrible for the environment</a>. The individual who left this computer for trash acted extremely irresponsibly. What's even more frustrating is that Apple makes it trivially simple to recycle their products.</p>\n<p>You can drop off your old product at any Apple store, or if that's inconvenient, they will ship you a box for free that you can then ship back to them. If you have a newer product, they'll give you a gift card for the current value of your old product. Details are here: <a href=\"https://www.apple.com/recycling/\">https://www.apple.com/recycling/</a></p>\n<p>{{ photo:small 38 align=right }}</p>\n<p>It pains me to think of all the components of a computer leaching into a landfill, not to mention the parts that can be recycled, so I took it upon myself to remove the iMac from the garbage (thankfully it wasn't full). The nearest Apple store is only a 15 minute drive, so I gathered the disassembled pieces and carried it into the store. When I was greeted by the Apple Genius at the front of the store, I coyly asked whether they thought they could fix my computer. After a brief pause, he smiled. Several employees came over to inspect the mangled specimen I had retrieved. We posed theories as to why the owner may have bent and torn into the case when the only missing components were the RAM sticks which are easily accessible. I was thanked for rescuing the computer from the trash and we made a few jokes at the unknown owner's expense.</p>\n<p>My good deed done for the day was done, and at least one less computer went to a landfill.</p>",
"text": "This morning I discovered a partially disassembled iMac abandoned in my building's dumpster. It should come as no surprise that E-waste is an increasingly important issue, and is terrible for the environment. The individual who left this computer for trash acted extremely irresponsibly. What's even more frustrating is that Apple makes it trivially simple to recycle their products.\nYou can drop off your old product at any Apple store, or if that's inconvenient, they will ship you a box for free that you can then ship back to them. If you have a newer product, they'll give you a gift card for the current value of your old product. Details are here: https://www.apple.com/recycling/\n{{ photo:small 38 align=right }}\nIt pains me to think of all the components of a computer leaching into a landfill, not to mention the parts that can be recycled, so I took it upon myself to remove the iMac from the garbage (thankfully it wasn't full). The nearest Apple store is only a 15 minute drive, so I gathered the disassembled pieces and carried it into the store. When I was greeted by the Apple Genius at the front of the store, I coyly asked whether they thought they could fix my computer. After a brief pause, he smiled. Several employees came over to inspect the mangled specimen I had retrieved. We posed theories as to why the owner may have bent and torn into the case when the only missing components were the RAM sticks which are easily accessible. I was thanked for rescuing the computer from the trash and we made a few jokes at the unknown owner's expense.\nMy good deed done for the day was done, and at least one less computer went to a landfill."
},
"name": "Electronics Recycling",
"post-type": "article",
"_id": "3903132",
"_source": "2780"
}
{
"type": "entry",
"author": {
"name": null,
"url": "http://benjaminturner.me/blog/",
"photo": null
},
"url": "http://benjaminturner.me/blog/upgrading-postgres-using-pg_dumpall-on-macos/",
"published": "2017-05-28T18:29:00+00:00",
"content": {
"html": "<p>Recently, I decided to update the dependencies in my local development environment. I develop on macOS and use homebrew for package management. One of the packages I tend to neglect keeping up to date is postgresql because of the data juggling required to make the upgrade (It's actually not too difficult of a process). I've been using 9.4 and the current major version is 9.6 so it seemed like a good time to upgrade before falling even further behind. I followed the instructions on this <a href=\"https://keita.blog/2016/01/09/homebrew-and-postgresql-9-5/\">helpful blog post</a> to upgrade from 9.4 to 9.5, and everything worked exactly as outlined. However, when I tried to follow the procedure for upgrading from 9.5 to 9.6, I was met with this error:</p>\n<pre><code>$ FATAL: could not open directory \"/usr/local/share/postgresql95/timezonesets\": No such file or directory\nHINT: This may indicate an incomplete PostgreSQL installation, or that the file \"/usr/local/Cellar/postgresql95/9.5.5/bin/postgres\" has been moved away from its proper location.\n</code></pre>\n<p>The issue appears to be related to having upgraded to a newer version of postgresql before running the <code>pg_upgrade</code> command which attempts to start up the previous version of the server and fails. I tried lots of different methods switching back to the previous version of postgresql and following the procedure, but that just broke the process in a different place.</p>\n<p><a href=\"https://www.postgresql.org/docs/9.6/static/upgrading.html\">After a fair amount of googling I found a different method of upgrading using <code>pg_dumpall</code></a> which did the trick, allowing me to bypass having to start up the older version of the server. Using this process you simply create a dump file of your data, upgrade postgres and initialize a new database, then import your dump file into the new database.</p>\n<p>Create the dump file:</p>\n<pre><code>$ pg_dumpall > /path/to/file\nC&#35;when performing this step it's recommended to use the latest version of the `pg_dumpall` binary. If you haven't switched versions using `brew link` yet, you can use the absolute path:\nC&#35;$ /usr/local/Cellar/postgresql/9.6.1/bin/pg_dumpall > /path/to/file\n</code></pre>\n<p>Shut down the current server:</p>\n<pre><code>$ brew services stop postgresql95\n</code></pre>\n<p>Move the current data directory:</p>\n<pre><code>$ mv /usr/local/var/postgres /usr/local/var/postgresql95\n</code></pre>\n<p>Make a new data directory using the upgraded binary and start the server:</p>\n<pre><code>$ initdb /usr/local/var/postgres -E utf8\n$ brew services start postgresql\n</code></pre>\n<p>Restore from the dump file:</p>\n<pre><code>$ psql -d postgres -f /path/to/file\n</code></pre>",
"text": "Recently, I decided to update the dependencies in my local development environment. I develop on macOS and use homebrew for package management. One of the packages I tend to neglect keeping up to date is postgresql because of the data juggling required to make the upgrade (It's actually not too difficult of a process). I've been using 9.4 and the current major version is 9.6 so it seemed like a good time to upgrade before falling even further behind. I followed the instructions on this helpful blog post to upgrade from 9.4 to 9.5, and everything worked exactly as outlined. However, when I tried to follow the procedure for upgrading from 9.5 to 9.6, I was met with this error:\n$ FATAL: could not open directory \"/usr/local/share/postgresql95/timezonesets\": No such file or directory\nHINT: This may indicate an incomplete PostgreSQL installation, or that the file \"/usr/local/Cellar/postgresql95/9.5.5/bin/postgres\" has been moved away from its proper location.\n\nThe issue appears to be related to having upgraded to a newer version of postgresql before running the pg_upgrade command which attempts to start up the previous version of the server and fails. I tried lots of different methods switching back to the previous version of postgresql and following the procedure, but that just broke the process in a different place.\nAfter a fair amount of googling I found a different method of upgrading using pg_dumpall which did the trick, allowing me to bypass having to start up the older version of the server. Using this process you simply create a dump file of your data, upgrade postgres and initialize a new database, then import your dump file into the new database.\nCreate the dump file:\n$ pg_dumpall > /path/to/file\nC#when performing this step it's recommended to use the latest version of the `pg_dumpall` binary. If you haven't switched versions using `brew link` yet, you can use the absolute path:\nC#$ /usr/local/Cellar/postgresql/9.6.1/bin/pg_dumpall > /path/to/file\n\nShut down the current server:\n$ brew services stop postgresql95\n\nMove the current data directory:\n$ mv /usr/local/var/postgres /usr/local/var/postgresql95\n\nMake a new data directory using the upgraded binary and start the server:\n$ initdb /usr/local/var/postgres -E utf8\n$ brew services start postgresql\n\nRestore from the dump file:\n$ psql -d postgres -f /path/to/file"
},
"name": "Upgrading postgres using pg_dumpall on macOS",
"post-type": "article",
"_id": "3903133",
"_source": "2780"
}
{
"type": "entry",
"author": {
"name": null,
"url": "http://benjaminturner.me/blog/",
"photo": null
},
"url": "http://benjaminturner.me/blog/quickly-add-a-ssl-certificate-using-cloudflare/",
"published": "2016-06-23T07:16:00+00:00",
"content": {
"html": "<p>In the past adding a SSL certificate to a website has been an expensive and complicated operation, but there are many good services available today making it cheap and easy to secure a website.</p>\n<p>Using a SSL certificate with a domain allows users to access a website using an encrypted connection between the browser and a server. If you access a website from a public wifi hotspot that does not require a password, the data between your device and the wifi router can be compromised by being intercepted by someone else on the network. Accessing websites using https greatly reduces this vulneribility.</p>\n<p>A major drawback to implementing better security has unfortunately been cost. Previously on Heroku, using a certificate required the addition of a $20/mo add-on. This doesn't make a lot of sense for smaller projects or primarily static sites. In May, <a href=\"https://blog.heroku.com/archives/2016/5/18/announcing_heroku_free_ssl_beta_and_flexible_dyno_hours\">Heroku annouced a new SSL Beta</a> which makes using a certificate free. This is great news and what got me interested in figuring out how to setup a certificate on my site.</p>\n<p>Another interesting project is <a href=\"https://letsencrypt.org/\">Let's Encrypt</a> which has significantly reduced the complexity around acquiring a certificate. A command line tool is provided which distills creating a certificate down to a series of prompts asking for a little bit of information about your website. The certificate is saved to your device and you then can move it to your server or service where you're hosting your website.</p>\n<p>I set down the path of creating my own certificate using Let's Encrypt and wiring it up to my Heroku project using their SSL add-on. I hit two roadblocks, one was that while it's better than the $20/mo add-on, using the SSL Beta requires at the minimum a $7/mo Hobby account. Since I'm using this for my blog, which I try to run using free services, it felt like overkill. The other problem was that in it's current state, Let's Encrypt certificates must be renewed every three months. This means keeping everything up and running requires some vigilance or investment in automation.</p>\n<p>At this point I happend to learn about <a href=\"https://www.cloudflare.com/\">CloudFlare</a>, a free, hosted solution for SSL. Setting up your site with CloudFlare is simple, quick and easy. I was able to configure CloudFlare in several minutes without having to touch my Heroku configuration. After waiting for the DNS changes to propagate, I had a safer and more secure website.</p>\n<p>Here's what I did:</p>\n<ol><li>\n<p><a href=\"https://www.cloudflare.com/a/sign-up\">Create a free CloudFlare account</a></p>\n</li>\n<li>\n<p>Add a site. Here you'll enter a root domain, e.g., foo.com. CloudFlare will scan DNS records for the domain and find relevant information, in my case, I had A and CNAME records, benjaminturner.me and www.benjaminturner.me.</p>\n</li>\n<li>\n<p>When the scan is complete, CloudFlare will provide new Nameservers. These must be updated with your domain registrar, in my case I was using NameCheap. Log in to the registrars interface and update existing Nameservers to point to CloudFlare's.</p>\n</li>\n</ol><p>That's it. At this point, you'll just need to wait for all the DNS changes to propagate. For free accounts this can take up to 24 hours.</p>\n<h5>Troubleshooting</h5>\n<p>At this point, you'll have CloudFlare configured correctly, but your website may not be. One problem I had was an externally hosted image I was linking to on every page of my site. It was hosted on http, not https. All links on a site should use the https scheme, otherwise you won't see the nice \"lock\" icon in the browser's URL bar.</p>",
"text": "In the past adding a SSL certificate to a website has been an expensive and complicated operation, but there are many good services available today making it cheap and easy to secure a website.\nUsing a SSL certificate with a domain allows users to access a website using an encrypted connection between the browser and a server. If you access a website from a public wifi hotspot that does not require a password, the data between your device and the wifi router can be compromised by being intercepted by someone else on the network. Accessing websites using https greatly reduces this vulneribility.\nA major drawback to implementing better security has unfortunately been cost. Previously on Heroku, using a certificate required the addition of a $20/mo add-on. This doesn't make a lot of sense for smaller projects or primarily static sites. In May, Heroku annouced a new SSL Beta which makes using a certificate free. This is great news and what got me interested in figuring out how to setup a certificate on my site.\nAnother interesting project is Let's Encrypt which has significantly reduced the complexity around acquiring a certificate. A command line tool is provided which distills creating a certificate down to a series of prompts asking for a little bit of information about your website. The certificate is saved to your device and you then can move it to your server or service where you're hosting your website.\nI set down the path of creating my own certificate using Let's Encrypt and wiring it up to my Heroku project using their SSL add-on. I hit two roadblocks, one was that while it's better than the $20/mo add-on, using the SSL Beta requires at the minimum a $7/mo Hobby account. Since I'm using this for my blog, which I try to run using free services, it felt like overkill. The other problem was that in it's current state, Let's Encrypt certificates must be renewed every three months. This means keeping everything up and running requires some vigilance or investment in automation.\nAt this point I happend to learn about CloudFlare, a free, hosted solution for SSL. Setting up your site with CloudFlare is simple, quick and easy. I was able to configure CloudFlare in several minutes without having to touch my Heroku configuration. After waiting for the DNS changes to propagate, I had a safer and more secure website.\nHere's what I did:\n\nCreate a free CloudFlare account\n\n\nAdd a site. Here you'll enter a root domain, e.g., foo.com. CloudFlare will scan DNS records for the domain and find relevant information, in my case, I had A and CNAME records, benjaminturner.me and www.benjaminturner.me.\n\n\nWhen the scan is complete, CloudFlare will provide new Nameservers. These must be updated with your domain registrar, in my case I was using NameCheap. Log in to the registrars interface and update existing Nameservers to point to CloudFlare's.\n\nThat's it. At this point, you'll just need to wait for all the DNS changes to propagate. For free accounts this can take up to 24 hours.\nTroubleshooting\nAt this point, you'll have CloudFlare configured correctly, but your website may not be. One problem I had was an externally hosted image I was linking to on every page of my site. It was hosted on http, not https. All links on a site should use the https scheme, otherwise you won't see the nice \"lock\" icon in the browser's URL bar."
},
"name": "Quickly add a SSL certificate using CloudFlare",
"post-type": "article",
"_id": "3903134",
"_source": "2780"
}
{
"type": "entry",
"author": {
"name": "David Bryant",
"url": "https://www.orangemoose.com/blog",
"photo": null
},
"url": "https://www.orangemoose.com/blog/?p=79",
"published": "2014-09-21T16:41:59-07:00",
"content": {
"html": "<p>I\u2019ve been wanting to add wind & rain sensors to my home-built Arduino-powered weather station and thanks to a recent sale at Sparkfun have acquired their nicely-built <a href=\"https://www.sparkfun.com/products/8942\">set</a>. As a result, though, I have two interesting problems to solve in getting those sensors integrated to the temperature and barometric pressure ones I have deployed today. First, I need to work out where and how to install the wind/rain sensors as placement is critical in getting good readings Of more immediate concern, however, is that I need to rethink my weather station application in order to properly integrate the new sensors, especially the anemometer and rain gauge.</p>\n<p>At the moment my weather station code uses basic clock timing to read temperature and barometric pressure sensors periodically, average their values, and display the readings on a small attached OLED. Temperature and pressure sensors are continuous so their values are always available and can be read whenever desired just based on the Arduino\u2019s internal clock. While my new wind vane sensor also provides a continuous reading, the new anemometer and rain gauge don\u2019t work that way. Instead they report data discontinuously whenever they have something to share.</p>\n<p>In the case of the anemometer it closes an internal switch every time the cups rotate through one revolution. Deriving wind speed from the anemometer means counting the number of revolutions over some specific period of time and calculating the number of revolutions per second. Multiplying revolutions-per-second by a fixed factor based on the size and geometry of the anemometer lets you determine average wind speed over that period of time. You can\u2019t simply poll the anemometer and ask it to tell you what it is observing as you can with temperature, pressure, or wind direction sensors.</p>\n<p>Similarly the rain gauge can\u2019t provide a continuously-available reading, but instead closes a switch every time its internal self-emptying bucket fills and dumps. The volume of the tiny bucket is known, so keeping track of how many times it has emptied over a specific period of time lets you figure out how much rain has fallen.</p>\n<p>Therefore a different approach is needed to read sporadic sensors like the anemometer and rain gauge and keep track of every time their internal switches close, whenever that turns out to be and no matter how often. The asynchronous, switch-closing nature of those sensors is a perfect case for interrupt-driven data gathering.</p>\n<p>A good overview on interrupts and how they work on Arduino is available over at <a href=\"http://www.engblaze.com/we-interrupt-this-program-to-bring-you-a-tutorial-on-arduino-interrupts/\">EngBlaze</a>. In my case I need to modify my weather station code to add logic to handle the calculations to be done whenever either the anemometer or rain gauge closes their internal switch. Just as with reading my other sensors, I need to devote an Arduino pin to each of the anemometer and rain gauge so I can detect their respective switch closures. This turns out to be pretty easy as Arduino has already set aside pins to handle two external interrupts: interrupt number 0 (or INT0) on digital pin 2 and interrupt number 1 (or INT1) on digital pin 3. All you need to do is connect the interrupt-generating device to one of those two pins, write a simple handler function you want to be called every time an interrupt occurs, and use the special built-in <a href=\"http://arduino.cc/en/Reference/attachInterrupt\">attachInterrupt</a> function to associate your handler with the chosen pin.</p>\n<p>A simple example is provided in the Arduino reference for <a href=\"http://arduino.cc/en/Reference/attachInterrupt\">attachInterrupt()</a>. Here\u2019s another one aligned with my intent to use interrupts to read my anemometer and calculate wind speed:</p>\n<pre>\n/*\n * Example program for Arduino external interrupts, in this case to read\n * an anemometer connected to digital pin 2 (which is INT0).\n *\n * Author: David Bryant (david@orangemoose.com)\n */\n\nvolatile int interruptCnt = 0; // Counts anemometer interrupts\n\nunsigned long sampleDelayMs = 30*1000; // Sample interval, milliseconds\nunsigned long prevSampleMs = 0; // Timestamp for previous sample\n\nvoid setup()\n{\n Serial.begin(9600);\n Serial.println(\"Gathering data...\");\n\n // Attach our interrupt service routine to INT0\n attachInterrupt(0,anemom_cnt,RISING);\n}\n\nvoid loop()\n{\n unsigned long currentMillis = millis(); // Get current timer value\n /* See if it is time to calculate wind speed */\n if( (currentMillis - prevSampleMs) >= sampleDelayMs) {\n Serial.print(\"Anemometer count: \");\n Serial.println(interruptCnt);\n\n prevSampleMs = currentMillis; // Remember clock time\n interruptCnt = 0; // Reset counter\n }\n}\n\n/*\n * Interrupt service routine called when the anemometer switch closes.\n * All it needs to do is increment the interrupt counter.\n */\nvoid anemom_cnt()\n{\n interruptCnt++;\n}\n</pre>\n<p>This works well enough and is quite straightforward, but I\u2019m not completely happy with it. To add my anemometer and rain gauge I need two interrupts, but I\u2019d like to make broader use of interrupts in my weather station code. For example, I\u2019m currently using a push button to step through a series of screens on an attached OLED so a user can browse a variety of information from the sensor including maximum and minimum readings, system statistics, etc. At the moment that push button is read periodically as part of the sensor timing loop but it\u2019d make more sense to have it generate an interrupt to trigger stepping to the next screen. It may also make sense to use interrupts to handle other sensors I could add, or support other system functions. Using all the available external interrupts just for the anemometer and rain gauge seems short sighted.</p>\n<p>Happily the Arduino supports handling interrupts on every pin, both analog and digital, through a different mechanism than INT0/INT1 and their attachInterrupt function. That means there\u2019s lots of room for expansion, but it requires a bit more low-level knowledge and coding. That\u2019s a good subject for another blog post\u2026</p>",
"text": "I\u2019ve been wanting to add wind & rain sensors to my home-built Arduino-powered weather station and thanks to a recent sale at Sparkfun have acquired their nicely-built set. As a result, though, I have two interesting problems to solve in getting those sensors integrated to the temperature and barometric pressure ones I have deployed today. First, I need to work out where and how to install the wind/rain sensors as placement is critical in getting good readings Of more immediate concern, however, is that I need to rethink my weather station application in order to properly integrate the new sensors, especially the anemometer and rain gauge.\nAt the moment my weather station code uses basic clock timing to read temperature and barometric pressure sensors periodically, average their values, and display the readings on a small attached OLED. Temperature and pressure sensors are continuous so their values are always available and can be read whenever desired just based on the Arduino\u2019s internal clock. While my new wind vane sensor also provides a continuous reading, the new anemometer and rain gauge don\u2019t work that way. Instead they report data discontinuously whenever they have something to share.\nIn the case of the anemometer it closes an internal switch every time the cups rotate through one revolution. Deriving wind speed from the anemometer means counting the number of revolutions over some specific period of time and calculating the number of revolutions per second. Multiplying revolutions-per-second by a fixed factor based on the size and geometry of the anemometer lets you determine average wind speed over that period of time. You can\u2019t simply poll the anemometer and ask it to tell you what it is observing as you can with temperature, pressure, or wind direction sensors.\nSimilarly the rain gauge can\u2019t provide a continuously-available reading, but instead closes a switch every time its internal self-emptying bucket fills and dumps. The volume of the tiny bucket is known, so keeping track of how many times it has emptied over a specific period of time lets you figure out how much rain has fallen.\nTherefore a different approach is needed to read sporadic sensors like the anemometer and rain gauge and keep track of every time their internal switches close, whenever that turns out to be and no matter how often. The asynchronous, switch-closing nature of those sensors is a perfect case for interrupt-driven data gathering.\nA good overview on interrupts and how they work on Arduino is available over at EngBlaze. In my case I need to modify my weather station code to add logic to handle the calculations to be done whenever either the anemometer or rain gauge closes their internal switch. Just as with reading my other sensors, I need to devote an Arduino pin to each of the anemometer and rain gauge so I can detect their respective switch closures. This turns out to be pretty easy as Arduino has already set aside pins to handle two external interrupts: interrupt number 0 (or INT0) on digital pin 2 and interrupt number 1 (or INT1) on digital pin 3. All you need to do is connect the interrupt-generating device to one of those two pins, write a simple handler function you want to be called every time an interrupt occurs, and use the special built-in attachInterrupt function to associate your handler with the chosen pin.\nA simple example is provided in the Arduino reference for attachInterrupt(). Here\u2019s another one aligned with my intent to use interrupts to read my anemometer and calculate wind speed:\n\n/*\n * Example program for Arduino external interrupts, in this case to read\n * an anemometer connected to digital pin 2 (which is INT0).\n *\n * Author: David Bryant (david@orangemoose.com)\n */\n\nvolatile int interruptCnt = 0; // Counts anemometer interrupts\n\nunsigned long sampleDelayMs = 30*1000; // Sample interval, milliseconds\nunsigned long prevSampleMs = 0; // Timestamp for previous sample\n\nvoid setup()\n{\n Serial.begin(9600);\n Serial.println(\"Gathering data...\");\n\n // Attach our interrupt service routine to INT0\n attachInterrupt(0,anemom_cnt,RISING);\n}\n\nvoid loop()\n{\n unsigned long currentMillis = millis(); // Get current timer value\n /* See if it is time to calculate wind speed */\n if( (currentMillis - prevSampleMs) >= sampleDelayMs) {\n Serial.print(\"Anemometer count: \");\n Serial.println(interruptCnt);\n\n prevSampleMs = currentMillis; // Remember clock time\n interruptCnt = 0; // Reset counter\n }\n}\n\n/*\n * Interrupt service routine called when the anemometer switch closes.\n * All it needs to do is increment the interrupt counter.\n */\nvoid anemom_cnt()\n{\n interruptCnt++;\n}\n\nThis works well enough and is quite straightforward, but I\u2019m not completely happy with it. To add my anemometer and rain gauge I need two interrupts, but I\u2019d like to make broader use of interrupts in my weather station code. For example, I\u2019m currently using a push button to step through a series of screens on an attached OLED so a user can browse a variety of information from the sensor including maximum and minimum readings, system statistics, etc. At the moment that push button is read periodically as part of the sensor timing loop but it\u2019d make more sense to have it generate an interrupt to trigger stepping to the next screen. It may also make sense to use interrupts to handle other sensors I could add, or support other system functions. Using all the available external interrupts just for the anemometer and rain gauge seems short sighted.\nHappily the Arduino supports handling interrupts on every pin, both analog and digital, through a different mechanism than INT0/INT1 and their attachInterrupt function. That means there\u2019s lots of room for expansion, but it requires a bit more low-level knowledge and coding. That\u2019s a good subject for another blog post\u2026"
},
"name": "Exploring Arduino Interrupts",
"post-type": "article",
"_id": "4159234",
"_source": "2934"
}
{
"type": "entry",
"author": {
"name": "David Bryant",
"url": "https://www.orangemoose.com/blog",
"photo": null
},
"url": "https://www.orangemoose.com/blog/?p=30",
"published": "2013-08-24T22:26:18-07:00",
"content": {
"html": "<p>One of the things that attracted me to the Raspberry Pi from the beginning was their announced intention to make an add-on camera module available. It took a while but I finally received notification that they were in stock so quickly jumped on-line and placed an order.</p>\n<p>While waiting for the camera to arrive I prepared by reading through all the <a href=\"http://www.raspberrypi.org/archives/tag/camera-board\">camera-board postings</a> on RaspberryPi.org, studying the <a href=\"http://www.raspberrypi.org/wp-content/uploads/2013/07/RaspiCam-Documentation.pdf\">official documentation</a>, and watching the<a href=\"http://www.youtube.com/watch?v=GImeVqHQzsE\"> installation video</a>. By the time the box arrived I was sure I was ready.</p>\n<p>Installation of the hardware was not particularly difficult though does require care to make sure the ribbon cable is oriented properly with the exposed contacts facing away from the Ethernet connector. (The video spells this out very clearly.) Once installed the camera looks like this:</p>\n<p><a href=\"http://www.orangemoose.com/blog/wp-content/uploads/2013/08/IMGP0208a.jpg\"><img alt=\"Raspberry Pi & camera\" src=\"https://aperture-proxy.p3k.io/6a87235403efbc586b3df9f258fc5130688ed2dd/687474703a2f2f7777772e6f72616e67656d6f6f73652e636f6d2f626c6f672f77702d636f6e74656e742f75706c6f6164732f323031332f30382f494d475030323038612d333030783139392e6a7067\" /></a></p>\n<p>Setting up the camera software is also straightforward. First, update to the latest Linux kernel and system software:</p><pre>% sudo apt-get update\n% sudo apt-get upgrade</pre><p>Then enable camera support by using the <code>raspi-config</code> utility:</p><pre>% sudo raspi-config</pre><p>You\u2019ll need to use the cursor keys to select the \u2018enable camera\u2019 command and confirm that\u2019s what you want to do. Exiting <code>raspi-config</code> prompts for a reboot, which is required to alter GPU operations so the camera works properly. Eagerly I waited for the reboot, logged back in, and tried to take a picture using the command line utility:</p><pre>% raspistill -v -o test.jpg</pre><p>Instead I received a cryptic error message:</p><pre>* failed to open vchiq instance</pre><p>This wasn\u2019t covered in the camera documentation and I had no idea what \u2018<code>vchiq</code>\u2018 was. Naturally I did what you always do in situations like this \u2013 google the text of the error message and see if you can find anything to help explain what to do. Happily I came across a <a href=\"http://www.modern-industry.com/articles/10-raspberry-pi-camera-first-look\">blog post</a> describing exactly the same situation and with a fix, namely that the user must be a member of the \u2018<code>video</code>\u2018 group. This can be accomplished as follows:</p><pre>% usermod -a -G video {userid}</pre><p>Eagerly I logged out and back in and tried the <code>raspistill</code> command again. Voil\u00e0, the view out the window near my workbench as my first test image:</p>\n<p><a href=\"http://www.orangemoose.com/blog/wp-content/uploads/2013/08/test5a.png\"><img alt=\"Test image\" src=\"https://aperture-proxy.p3k.io/f1f1b120a96b29122f7b82ffabc31f35bcf2caac/687474703a2f2f7777772e6f72616e67656d6f6f73652e636f6d2f626c6f672f77702d636f6e74656e742f75706c6f6164732f323031332f30382f7465737435612d333030783232352e706e67\" /></a></p>\n<p>More to come\u2026</p>",
"text": "One of the things that attracted me to the Raspberry Pi from the beginning was their announced intention to make an add-on camera module available. It took a while but I finally received notification that they were in stock so quickly jumped on-line and placed an order.\nWhile waiting for the camera to arrive I prepared by reading through all the camera-board postings on RaspberryPi.org, studying the official documentation, and watching the installation video. By the time the box arrived I was sure I was ready.\nInstallation of the hardware was not particularly difficult though does require care to make sure the ribbon cable is oriented properly with the exposed contacts facing away from the Ethernet connector. (The video spells this out very clearly.) Once installed the camera looks like this:\n\nSetting up the camera software is also straightforward. First, update to the latest Linux kernel and system software:% sudo apt-get update\n% sudo apt-get upgradeThen enable camera support by using the raspi-config utility:% sudo raspi-configYou\u2019ll need to use the cursor keys to select the \u2018enable camera\u2019 command and confirm that\u2019s what you want to do. Exiting raspi-config prompts for a reboot, which is required to alter GPU operations so the camera works properly. Eagerly I waited for the reboot, logged back in, and tried to take a picture using the command line utility:% raspistill -v -o test.jpgInstead I received a cryptic error message:* failed to open vchiq instanceThis wasn\u2019t covered in the camera documentation and I had no idea what \u2018vchiq\u2018 was. Naturally I did what you always do in situations like this \u2013 google the text of the error message and see if you can find anything to help explain what to do. Happily I came across a blog post describing exactly the same situation and with a fix, namely that the user must be a member of the \u2018video\u2018 group. This can be accomplished as follows:% usermod -a -G video {userid}Eagerly I logged out and back in and tried the raspistill command again. Voil\u00e0, the view out the window near my workbench as my first test image:\n\nMore to come\u2026"
},
"name": "Raspberry Pi Camera Installation",
"post-type": "article",
"_id": "4159235",
"_source": "2934"
}
{
"type": "entry",
"author": {
"name": "David Bryant",
"url": "https://www.orangemoose.com/blog",
"photo": null
},
"url": "https://www.orangemoose.com/blog/?p=17",
"published": "2013-08-24T14:37:03-07:00",
"content": {
"html": "<p>Welcome to my \u201cnew\u201d blog. Part of the overall reason for <a href=\"http://orangemoose.com/\">orangemoose.com</a> is to provide a place for me to capture and share what I\u2019m up to, both just generally as part of my work, home and hobby life, and for any of the steady stream of projects I can\u2019t seem but help to undertake. I\u2019ve made attempts at blogging before, first on Tumblr and then on WordPress.com, but failed to develop the regular habit of posting. That struck me as odd as I post to Twitter quite frequently and often struggle to fit my answer to Twitter\u2019s \u201cWhat are you doing?\u201d question in 140 characters. Meanwhile my blog had never gotten beyond a very small number of longer, carefully constructed magazine article-style posts and so failed in its intended role as a diary shared via the web.</p>\n<p>So, the blog idea is reborn with two key tweaks. First, I\u2019m going to lean towards more frequent, shorter posts that complement (and probably extend) my Twitter utterances. Second, it\u2019s part of orangemoose.com where I\u2019ll be more regularly tending a variety of posting efforts including software, web applications, and shared media, and therefore where I can work separately on detailed expositions as articles outside the flow of my blog.</p>\n<p>Let\u2019s see if it works\u2026</p>",
"text": "Welcome to my \u201cnew\u201d blog. Part of the overall reason for orangemoose.com is to provide a place for me to capture and share what I\u2019m up to, both just generally as part of my work, home and hobby life, and for any of the steady stream of projects I can\u2019t seem but help to undertake. I\u2019ve made attempts at blogging before, first on Tumblr and then on WordPress.com, but failed to develop the regular habit of posting. That struck me as odd as I post to Twitter quite frequently and often struggle to fit my answer to Twitter\u2019s \u201cWhat are you doing?\u201d question in 140 characters. Meanwhile my blog had never gotten beyond a very small number of longer, carefully constructed magazine article-style posts and so failed in its intended role as a diary shared via the web.\nSo, the blog idea is reborn with two key tweaks. First, I\u2019m going to lean towards more frequent, shorter posts that complement (and probably extend) my Twitter utterances. Second, it\u2019s part of orangemoose.com where I\u2019ll be more regularly tending a variety of posting efforts including software, web applications, and shared media, and therefore where I can work separately on detailed expositions as articles outside the flow of my blog.\nLet\u2019s see if it works\u2026"
},
"name": "Hello World!",
"post-type": "article",
"_id": "4159236",
"_source": "2934"
}
{
"type": "entry",
"author": {
"name": "David Bryant",
"url": "https://www.orangemoose.com/blog",
"photo": null
},
"url": "https://www.orangemoose.com/blog/?p=1",
"published": "2013-08-08T03:13:32-07:00",
"content": {
"html": "<p>Welcome to WordPress. This is a test post just to see how content, fonts and formatting all come together based on some ongoing tinkering with the \u2018Admired\u2019 theme I\u2019ve selected for use with WordPress. Here comes a couple of cut/pasted paragraphs to give this a feel of a normal post. Don\u2019t get too attached to it as it\u2019ll eventually go away.</p>\n<p>I\u2019m an engineer and tinkerer and needed a place where I could use the Internet to publish results of some of my projects. Facebook, Tumblr and blogs like WordPress are great for some things but they don\u2019t give you complete freedom to combine information and images with active web content like Javascript. They also have limited ability to provide content for tablets, mobile devices, and the coming connectivity revolution associated with the Internet of Things. While I was able to avoid it for quite a few years, eventually I knew I\u2019d need my own hosted web presence. So here we are\u2026</p>\n<p>Now some test code. First the full SyntaxHighlighter Extended plugin:</p>\n<pre>\n#body {\n background-color: #a0a0a0;\n font-family: MountainsofChristmas;\n}\n</pre>\n<p>and then the \u2018light\u2019 rendering option of SyntaxHighlighter Extended:</p>\n<pre>\n% scp dbryant@10.1.10.202:test18.jpg .\n</pre>\n<p>and finally use of the <pre> tag:</p><pre>% ls -l /home/dbryant</pre><p><a href=\"http://www.orangemoose.com/blog/wp-content/uploads/2013/08/IMGP0208a.jpg\"><img alt=\"Raspberry Pi & camera\" src=\"https://aperture-proxy.p3k.io/6a87235403efbc586b3df9f258fc5130688ed2dd/687474703a2f2f7777772e6f72616e67656d6f6f73652e636f6d2f626c6f672f77702d636f6e74656e742f75706c6f6164732f323031332f30382f494d475030323038612d333030783139392e6a7067\" /></a>And a paragraph with a picture. This is a photo of my Raspberry Pi with the camera attached. Installation is not hard, but you do need to be careful with the connector.</p>",
"text": "Welcome to WordPress. This is a test post just to see how content, fonts and formatting all come together based on some ongoing tinkering with the \u2018Admired\u2019 theme I\u2019ve selected for use with WordPress. Here comes a couple of cut/pasted paragraphs to give this a feel of a normal post. Don\u2019t get too attached to it as it\u2019ll eventually go away.\nI\u2019m an engineer and tinkerer and needed a place where I could use the Internet to publish results of some of my projects. Facebook, Tumblr and blogs like WordPress are great for some things but they don\u2019t give you complete freedom to combine information and images with active web content like Javascript. They also have limited ability to provide content for tablets, mobile devices, and the coming connectivity revolution associated with the Internet of Things. While I was able to avoid it for quite a few years, eventually I knew I\u2019d need my own hosted web presence. So here we are\u2026\nNow some test code. First the full SyntaxHighlighter Extended plugin:\n\n#body {\n background-color: #a0a0a0;\n font-family: MountainsofChristmas;\n}\n\nand then the \u2018light\u2019 rendering option of SyntaxHighlighter Extended:\n\n% scp dbryant@10.1.10.202:test18.jpg .\n\nand finally use of the <pre> tag:% ls -l /home/dbryantAnd a paragraph with a picture. This is a photo of my Raspberry Pi with the camera attached. Installation is not hard, but you do need to be careful with the connector."
},
"name": "Testing, testing\u2026",
"post-type": "article",
"_id": "4159237",
"_source": "2934"
}