<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.1.1">Jekyll</generator><link href="https://jgaxn.com/feed.xml" rel="self" type="application/atom+xml" /><link href="https://jgaxn.com/" rel="alternate" type="text/html" /><updated>2021-03-03T21:07:41+00:00</updated><id>https://jgaxn.com/feed.xml</id><title type="html">jgaxn</title><subtitle>When I write things, I write them here.
</subtitle><author><name>John Grubb Atkinson</name></author><entry><title type="html">Why I’m not Worried About Social Media Censorship</title><link href="https://jgaxn.com/blog/2020/11/20/why-im-not-worried-about-social-media-censorship/" rel="alternate" type="text/html" title="Why I’m not Worried About Social Media Censorship" /><published>2020-11-20T03:37:00+00:00</published><updated>2020-11-20T03:37:00+00:00</updated><id>https://jgaxn.com/blog/2020/11/20/why-im-not-worried-about-social-media-censorship</id><content type="html" xml:base="https://jgaxn.com/blog/2020/11/20/why-im-not-worried-about-social-media-censorship/">&lt;p&gt;I know a number of people concerned about censorship by private social media companies in 2020. I love constitutional freedoms and the internet. I love how the internet provides the ability to openly exchange ideas with people all over the world. I hope here to explain why I think that the recent choices of giant tech corporations are unlikely to jeopardize that in any meaningful way.&lt;/p&gt;

&lt;h2 id=&quot;censoring-the-internet-is-hard&quot;&gt;Censoring the Internet is Hard&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;The Net interprets censorship as damage and routes around it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;– &lt;cite&gt;John Gilmore in 1993&lt;/cite&gt;&lt;/p&gt;

&lt;p&gt;Over the decades, many people have tried to censor the internet and have come laughably short. In 2003, Barbra Streisand attempted to sue a photographer who had taken a photo of her cliffside Malibu mansion as part of a collection of 12,000 photos documenting the erosion of the California coast. The lawsuit itself drew attention to the photo and it was copied and disseminated widely. This has since come to be known as the &lt;a href=&quot;https://en.wikipedia.org/wiki/Streisand_effect&quot;&gt;Streisand effect&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;A similar thing happens anytime that someone reports that they have been censored. The fact that someone might not want you to see something drives interest and people will go out and find it. A good question to ask yourself when you hear about something being censored is, “How did I find out this was censored?” If censorship is effective, you won’t know it’s happening. I learned that Twitter had censored the NY Post story about Hunter Biden’s laptop… on Twitter. I probably saw more about it on Twitter than I would have if they had left it alone.&lt;/p&gt;

&lt;h2 id=&quot;effective-internet-censorship&quot;&gt;Effective Internet Censorship&lt;/h2&gt;

&lt;p&gt;It is possible for a government to censor the internet with heavy authoritarian policies. China has put into place a very effective censorship system. China has:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Developed and deployed the technology to filter all foreign internet traffic. This initiative is known as &lt;a href=&quot;https://en.wikipedia.org/wiki/Great_Firewall&quot;&gt;The Great Firewall&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;Set rules for domestic internet sites that govern what they can and cannot publish.&lt;/li&gt;
  &lt;li&gt;Blocked access to any foreign internet sites that China does not control. Google, Facebook and Twitter are all blocked in China.&lt;/li&gt;
  &lt;li&gt;Threatened those who disseminate censored information with jailtime and other punishments.&lt;/li&gt;
  &lt;li&gt;Also censored any information about how to circumvent censorship protocols.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In the United States it is against copyright law for me to publish copyrighted materials on my website. However I can publish information about how to acquire copyrighted materials if I want. When Twitter censored the NY Post article, they would have also needed to censor any mention of the NY Post or censorship in order to block it effectively.&lt;/p&gt;

&lt;h2 id=&quot;twitter-doesnt-really-want-to-censor-anyway&quot;&gt;Twitter Doesn’t Really Want to Censor Anyway&lt;/h2&gt;

&lt;p&gt;Large, publicly-traded corporations are motivated by revenue. They consistently choose to do what makes them the most money or what loses them the least money. Individual employees may be motivated by idealism and may make individual choices to more heavily moderate certain types of content. However, the impact of those employees is limited and if their idealism gets in the way of the company’s revenue, they will find themselves out of a job. So how does Twitter maximize their revenue? Twitter wants:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;To maximize the number of people using their platform.&lt;/li&gt;
  &lt;li&gt;To maximize the amount of time and attention each user spends on their platform.&lt;/li&gt;
  &lt;li&gt;To keep employees happy enough that they don’t walk out or (GULP!) unionize.&lt;/li&gt;
  &lt;li&gt;To not spend more money or do more work than they have to.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;With this in mind, it is easy to put Twitter’s decision-making into context. They want everyone across the political spectrum using their platform. They want everyone to have heightened emotions. They want us excited or angry or afraid. This leads to more engagement and more time using their app. However, if public opinion turns against Twitter too much, that could make their employees unhappy which could become expensive. They also want to avoid the appearance of leaning too far to one side of the political spectrum for fear of losing their users on the other side.&lt;/p&gt;

&lt;p&gt;Widespread censorship of right-leaning ideas would hurt Twitter in at least three of the four financial factors mentioned above. It would cause a mass exodus of right-leaning users to other platforms, it would hide controversial posts that would be good for engagement, and it would be expensive.&lt;/p&gt;

&lt;h2 id=&quot;so-why-did-twitter-block-the-ny-post&quot;&gt;So Why did Twitter Block the NY Post?&lt;/h2&gt;

&lt;p&gt;Why censor at all? This is an interesting question because Twitter’s censorship was not remotely effective at actually hiding the NY Post article or its existence from anyone who wanted to read it. I suspect this is because Twitter wanted to &lt;em&gt;appear&lt;/em&gt; to be blocking the article but did not want to actually commit the resources to wipe any trace of it from their platform.&lt;/p&gt;

&lt;p&gt;Twitter has taken a beating in the public eye over the last four years. They have been criticized for allowing Donald Trump’s account to remain in good standing while he constantly violates their terms of service in ways that would get other accounts banned. They have been criticized for allowing hordes of Russian bots to sow disinformation and distrust prior to and since the 2016 election. Both of those things are good for business but bad for optics. In this turbulent year of 2020 they’ve faced increased scrutiny from both external and internal critics.&lt;/p&gt;

&lt;p&gt;Jack Dorsey claimed that blocking the NY Post was a simple mistake. I don’t believe that for a second. If that article were to tip the balance of the election towards Trump and if it were later debunked or proven to be a non-story, Twitter would face massive outcry from the left likely resulting in loss of revenue. So I believe they pulled one small lever to block something that had the potential to damage their already-shaky reputation. This way, they could always say to their angry users, “Hey, don’t blame us! We tried!” If Twitter really wanted to censor conservative views they have many more levers they could have pulled.&lt;/p&gt;

&lt;h2 id=&quot;when-to-get-worried&quot;&gt;When to Get Worried&lt;/h2&gt;

&lt;p&gt;Big tech companies in the United States cannot effectively censor because the information will easily spread via their competitors. The information has too many paths to get to you and it is currently impossible to block them all. However, there are a few things to watch out for that could jeopardize this in the future.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;A single company monopolizing most of the information delivery systems would be bad. For example, a merger of Google, Twitter, and Facebook would concentrate too much censorship power in one organization.&lt;/li&gt;
  &lt;li&gt;Censorship at the ISP level would be much more effective due to local monopolies. Many users cannot easily switch to an ISP that won’t censor the information they want to see. This is a good reason to support strong &lt;a href=&quot;https://en.wikipedia.org/wiki/Net_neutrality&quot;&gt;net neutrality&lt;/a&gt; rules like the ones the FCC removed in 2018.&lt;/li&gt;
  &lt;li&gt;Any laws that regulate what can be said on the internet would obviously be problematic. If such a law is passed AND survives legal challenges up to the Supreme Court then I would be very concerned.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I focused this post on one specific censorship choice by one specific company but I believe the arguments here can be applied to other Big Tech companies and other censorship decisions.&lt;/p&gt;

&lt;h2 id=&quot;what-about-section-230&quot;&gt;What About Section 230&lt;/h2&gt;

&lt;p&gt;Okay this has already been a pretty long post and my readership is nonexistent. I think a couple people might read the beginning of this post but I’m not confident anyone will finish it. If five people communicate to me that they read this far and are interested in my take on how Section 230 of the Communications Decency Act fits into all of this, then I will write a post about it. Hopefully a shorter one.&lt;/p&gt;</content><author><name>John Grubb Atkinson</name></author><summary type="html">Big Tech has been accused of censorship. This is a post about why they probably aren't interested in censoring and why they would likely be unsuccessful if they tried.</summary></entry><entry><title type="html">People are People</title><link href="https://jgaxn.com/blog/2020/11/17/people-are-people/" rel="alternate" type="text/html" title="People are People" /><published>2020-11-17T05:57:00+00:00</published><updated>2020-11-17T05:57:00+00:00</updated><id>https://jgaxn.com/blog/2020/11/17/people-are-people</id><content type="html" xml:base="https://jgaxn.com/blog/2020/11/17/people-are-people/">&lt;p&gt;This is the first post in a series called “How to Talk to Strangers and Friends about Politics.” It might also be the last post in the series. As I type this right now, I’m not even sure if I’m going to finish and publish it. I’ve been thinking a lot about the division in our world; the causes of that division, the solutions to that division, and the rules governing the effective use of semicolons. I’m kind of nobody but I’m arrogant enough to think that the things I write might be of use to somebody sometime so here they are.&lt;/p&gt;

&lt;h2 id=&quot;lesson-1-people-are-people&quot;&gt;Lesson 1: People are People&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;I’m a person. Bret’s a person. You’re a person. That person over there’s a person. And each person deserves to be treated… like a person.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;– &lt;cite&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=zs_rXxi0zhM&quot;&gt;Jemaine Clement (fictional)&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;

&lt;p&gt;People are people. No exceptions. This may seem overly simplistic but it’s often overlooked and you’re probably overlooking it right now. People are poeple. They are not monsters, aliens, or “other” in any way. This includes all people, including and especially the ones you don’t like, the ones you disagree with, the ones who hurt you. This is really good news because people actually have a lot in common with other people and may I remind you that “other people” includes everyone. Republicans, Democrats, saints, sinners, psychopaths, immigrants, criminals. Donald Trump is a person. Hilary Clinton is a person. Nazis are people. The ones who don’t like being called nazis and the ones who actually do like it because they identify with that group and even the German ones from the first half of the 20th century. All still people.&lt;/p&gt;

&lt;p&gt;Understanding this and recognizing this and continually reminding yourself of this are foundational to having productive conversations with people you disagree with. Recognize that the person you are talking to is a person. Recognize that the groups of people you are talking &lt;em&gt;about&lt;/em&gt; are people. In our country we tend to put ourselves and others in boxes and agree with and defend “our team.” Recognize that the other groups you may be talking about are people. This may include people grouped by political ideals, race, religion, sexual orientation, national origin, socioeconomic class, age, or any other attribute.&lt;/p&gt;

&lt;h3 id=&quot;groups-of-people-are-people&quot;&gt;Groups of People are People&lt;/h3&gt;

&lt;p&gt;Recognizing that other groups of people are people just like you and me is the first step towards empathizing with and understanding them, but there is another very practical benefit. People are predictable. People are motivated by a small set of human motivations and you’ve probably experienced most of them. People tend to do what they are motivated to do. This removes a lot of the sting of under-considered and possibly bad-faith arguments like:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;“Democrats hate America and they will do whatever they can to destroy it.”&lt;/li&gt;
  &lt;li&gt;“Trump supporters are racist and they like Trump because he gives them permission to be racist openly.”&lt;/li&gt;
  &lt;li&gt;“Illegal immigrants just want to bring crime to make our country as bad as the ones they left.”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are two obvious problems with each of these statements. One, they each treat a group of people as a monolith instead of a collection of unique people. Two, they ascribe a single evil motivation to each group. A person can be motivated by evil but it can often be in service of an underlying human motivation that is much easier to empathize with. Criminals may motivated by greed or power or jealousy or hate, but underlying those motivations could be fear, insecurity, or a sense of fairness. Almost everyone thinks they’re the good guy in the story.&lt;/p&gt;

&lt;h3 id=&quot;good-and-bad-people&quot;&gt;Good and bad people&lt;/h3&gt;

&lt;p&gt;People are people. There are no good people and there are no bad people. First of all, concepts like “virtue” and “evil” do not have universally agreed-upon definitions and so they cannot be used to universally categorize humans as being “good” or “bad.” Even if we &lt;em&gt;did&lt;/em&gt; have universal definitions of those concepts, people are more complicated than that. Think about the best thing you’ve ever done. Think about the worst thing you’ve ever done. Both of those deeds were done by the same person. There are many more good and bad deeds that you will yet commit. Recognize that all people in all groups are in the same situation as you. “Okay but what about racist people?” you might ask. “Surely I’m a good person and they’re bad people.” To that I would say, recognize that in a racist’s mind their hatred can come from a good place. They can believe that the hatred they feel and violence they commit is necessary to protect themselves from forces that would erase their identity.&lt;/p&gt;

&lt;p&gt;Instead of categorizing groups of people as “good” or “bad,” it can be much more useful to consider what principles each individual holds that guide their decision making and motivate them. It is also &lt;em&gt;very&lt;/em&gt; important that you take time to consider what your personal guiding principles are. I plan to write a lot more about guiding principles in future posts.&lt;/p&gt;

&lt;h3 id=&quot;what-if-i-dont-want-to&quot;&gt;What if I don’t want to&lt;/h3&gt;

&lt;p&gt;Look, generalizing and othering groups of people is easy and convenient. It can be a shortcut to a dopamine rush that comes from all your internet friends agreeing with you. It is much more difficult to use empathy, tact and diplomacy to bring people together. Maybe you’re not up to it. Maybe that bit earlier about humanizing racists rubbed you the wrong way. I get that. It wasn’t easy to write. But the path of least resistance leads to fear, anger and violence. Working to spread empathy today can prevent violence tomorrow and it starts with you.&lt;/p&gt;</content><author><name>John Grubb Atkinson</name></author><category term="talk-to-strangers" /><summary type="html">How to Talk to Strangers and Friends about Politics. Lesson 1: People are People</summary></entry><entry><title type="html">Serving an API from a Static Site Host for Almost Free</title><link href="https://jgaxn.com/blog/2020/07/08/serving-an-api-from-a-static-site/" rel="alternate" type="text/html" title="Serving an API from a Static Site Host for Almost Free" /><published>2020-07-08T00:00:00+00:00</published><updated>2020-07-08T00:00:00+00:00</updated><id>https://jgaxn.com/blog/2020/07/08/serving-an-api-from-a-static-site</id><content type="html" xml:base="https://jgaxn.com/blog/2020/07/08/serving-an-api-from-a-static-site/">&lt;p&gt;This site is a static site built with &lt;a href=&quot;https://jekyllrb.com/&quot;&gt;Jekyll&lt;/a&gt; and hosted by &lt;a href=&quot;https://www.netlify.com/&quot;&gt;Netlify&lt;/a&gt; for free under their “Starter” tier. Static sites are great for blogs and websites where the information doesn’t change very often because they can be served very efficiently with very small load times. My first blog was built with Wordpress and hosted on Bluehost and the first time I had a post hit the front page of Hacker News, the MySQL database got overwhelmed and everything broke. The next time I hit the front page of Hacker News I had switched to a static site and even a shared host like Bluehost was able to deliver my blog post over 30,000 times in a single day.&lt;/p&gt;

&lt;p&gt;There are a number of limitations I considered before using a static site to serve an API:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;With a static site, you can’t provide an endpoint for any HTTP verb other than &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GET&lt;/code&gt;. This means that the API consumer cannot really interact with or manipulate the underlying data in any way.&lt;/li&gt;
  &lt;li&gt;No &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;POST&lt;/code&gt; requests mean no automatic user signup. I could probably use a different service for user sign ups but where’s the fun in that.&lt;/li&gt;
  &lt;li&gt;Netlify has made deploying a breeze, but I don’t have access to the underlying web server to set up any authentication on my pages or API.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Living within those limitations, I decided to make the Utah coronavirus data that I have been gathering available to the public. I’m not sure if anyone would have a use for it or even see this but I was interested in finding the limitations of Netlify as a static API host.&lt;/p&gt;

&lt;p&gt;Making a static API is as simple as generating a JSON response for each possible API request and storing it statically as a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.json&lt;/code&gt; file. Handling 404s is a little wonky because it serves an HTML 404 page. For a project that nobody will likely ever see, that’s good enough.&lt;/p&gt;

&lt;p&gt;The real magic is a once-daily job that I have running on a Raspberry Pi that has to:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;Collect the data&lt;/li&gt;
  &lt;li&gt;Store it in the Google Sheet that generates the graphs&lt;/li&gt;
  &lt;li&gt;Generate the new JSON file&lt;/li&gt;
  &lt;li&gt;Commit the JSON file to the Github repo attached to the Netlify instance&lt;/li&gt;
  &lt;li&gt;Push the commit to Github&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you’re interested to learn more about this setup, feel free to reach out via email or Twitter and I can go into more detail.&lt;/p&gt;</content><author><name>John Grubb Atkinson</name></author><summary type="html">Google Sheets + Netlify + Jekyll + Raspberry Pi?</summary></entry><entry><title type="html">Simple White Noise Machine with Raspberry Pi</title><link href="https://jgaxn.com/blog/2020/06/28/simple-white-noise-machine-with-raspberry-pi/" rel="alternate" type="text/html" title="Simple White Noise Machine with Raspberry Pi" /><published>2020-06-28T00:00:00+00:00</published><updated>2020-06-28T00:00:00+00:00</updated><id>https://jgaxn.com/blog/2020/06/28/simple-white-noise-machine-with-raspberry-pi</id><content type="html" xml:base="https://jgaxn.com/blog/2020/06/28/simple-white-noise-machine-with-raspberry-pi/">&lt;p&gt;When my daughter was very small we often used an iPad playing a 10 hour long YouTube video that was simply a repeating track of ocean sounds. Eventually I downloaded the mp3 of the sounds and set up an old android phone to play the track on a constant loop. I connected this mp3 player to an old set of computer speakers and put the whole system under my daughter’s bed. This worked great until I looked at the phone one day and the case was cracked open because the battery had doubled in size.&lt;/p&gt;

&lt;p&gt;My first thought was to try to buy a simple mp3 player on Amazon. I haven’t tried to buy an mp3 player in about a decade but I thought I should be able to get one for under $10. Unfortunately it seems like nobody manufactures a simple enough mp3 player. It’s easy to find a $25 player with a nice LCD screen, but not a $10 knock-off equivalent of an iPod Shuffle.&lt;/p&gt;

&lt;p&gt;Discouraged by what I didn’t find on Amazon, I decided to grab an old Raspberry Pi and see how hard it would be to turn it into a simple mp3 player that will loop one file forever. It ended up being easier than I thought and I had it done in less time than a Prime delivery.&lt;/p&gt;

&lt;h3 id=&quot;steps-to-create-a-raspberry-pi-white-noise-machine&quot;&gt;Steps to create a Raspberry Pi white noise machine&lt;/h3&gt;

&lt;p&gt;I installed Rasberry Pi OS and configured it to my liking. I installed omxplayer which has the ability to play an mp3 on a loop.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo apt-get install omxplayer
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I downloaded a 1-minute long mp3 of ocean sounds. I duplicated the ocean sound mp3 until I had a 30-minute long file. This was accomplished simply using the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cat&lt;/code&gt; command to repeatedly double the length of the file:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cat ocean_sounds_1m.mp3 ocean_sounds_1m.mp3 &amp;gt; ocean_sounds_2m.mp3
cat ocean_sounds_2m.mp3 ocean_sounds_2m.mp3 &amp;gt; ocean_sounds_4m.mp3
...
cat ocean_sounds_16m.mp3 ocean_sounds_16m.mp3 &amp;gt; ocean_sounds_32m.mp3
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I tested omxplayer’s looping functionality with the following command:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;omxplayer --adev local --loop ocean_sounds_32m.mp3
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Once that all worked, I created a systemd service to keep omxplayer running in the background. The service file is saved in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/systemd/system/ocean.service&lt;/code&gt; and looks like this:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[Unit]
Description=ocean

[Service]
ExecStart=/usr/bin/omxplayer -o local --loop /home/pi/ocean_sounds_32m.mp3

[Install]
WantedBy=multi-user.target
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Then I just enabled and started the service and I was in business.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo systemctl daemon-reload
sudo systemctl enable ocean
sudo systemctl start ocean
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now my daughter has her white noise machine back and this one doesn’t have an explodable battery.&lt;/p&gt;</content><author><name>John Grubb Atkinson</name></author><summary type="html">I built a simple white noise machine with a Raspberry Pi</summary></entry><entry><title type="html">Thermometer Readings with Raspberry Pi</title><link href="https://jgaxn.com/blog/2017/08/01/thermometer-readings-with-raspberry-pi/" rel="alternate" type="text/html" title="Thermometer Readings with Raspberry Pi" /><published>2017-08-01T00:00:00+00:00</published><updated>2017-08-01T00:00:00+00:00</updated><id>https://jgaxn.com/blog/2017/08/01/thermometer-readings-with-raspberry-pi</id><content type="html" xml:base="https://jgaxn.com/blog/2017/08/01/thermometer-readings-with-raspberry-pi/">&lt;p&gt;Okay so as part of my &lt;a href=&quot;/blog/2017/07/21/raspberry-pi-thermostat/&quot;&gt;Raspberry Pi Thermostat Project&lt;/a&gt; I now have a &lt;a href=&quot;/blog/2017/07/23/headless-raspberry-pi-with-wifi/&quot;&gt;headless Raspberry Pi&lt;/a&gt; that I can SSH into. The next small step is to wire a thermometer to it and begin logging the temperature in my bedroom to learn a thing or two about how hot it is getting up there and how much the temperature varies.&lt;/p&gt;

&lt;h3 id=&quot;hardware-involved&quot;&gt;Hardware involved:&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;The headless Raspberry Pi I set up in the previous post&lt;/li&gt;
  &lt;li&gt;A DS18B20 digital thermometer&lt;/li&gt;
  &lt;li&gt;A small breadboard&lt;/li&gt;
  &lt;li&gt;Some male-to-female jumper wires&lt;/li&gt;
  &lt;li&gt;A 10kΩ resistor&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;wiring&quot;&gt;Wiring&lt;/h3&gt;

&lt;p&gt;For this part I basically just followed &lt;a href=&quot;https://learn.adafruit.com/adafruits-raspberry-pi-lesson-11-ds18b20-temperature-sensing/overview&quot;&gt;this tutorial&lt;/a&gt; but with a couple small changes. I used a 10kΩ instead of a 4.7kΩ because it’s what I had around. I also didn’t shell out for the Pi Cobbler. I simply connected the three lines I needed (5V, ground, GPIO 4) directly to the breadboard with jumper wires. I still found the wiring diagram &lt;a href=&quot;https://learn.adafruit.com/adafruits-raspberry-pi-lesson-11-ds18b20-temperature-sensing/hardware&quot;&gt;here&lt;/a&gt; to be incredibly useful. Mine ended up looking like this:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/raspberry_pi_ds18b20.jpg&quot; alt=&quot;All wired up&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;making-a-temperature-reading&quot;&gt;Making a temperature reading&lt;/h3&gt;

&lt;p&gt;Once it’s all wired up there are a couple simple steps to reading the temperature. First I had to edit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/boot/config.txt&lt;/code&gt; and add this line and then reboot:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;dtoverlay=w1-gpio
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;This enables the Onewire interface that we use to read the thermometer. Next, run the following commands to mount the thermometer device:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo modprobe w1_gpio
sudo modprobe w1_therm
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;The thermometer is now ready to be read. All you have to do is find the right file to read from. To do this, go to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/sys/bus/w1/devices&lt;/code&gt; and look for a folder that starts with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;28-&lt;/code&gt; followed by a serial number. Copy this serial number because you will need it. If you now do &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cat /sys/bus/w1/devices/28-{SERIAL NUMBER}/w1_slave&lt;/code&gt; you will get something that looks like this:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;79 01 55 00 7f ff 0c 10 14 : crc=14 YES
79 01 55 00 7f ff 0c 10 14 t=23562
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;YES&lt;/code&gt; indicates that the temperature reading was successful. The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;t=23562&lt;/code&gt; is the temperature in Celsius multiplied by 1000. Now we’re in business.&lt;/p&gt;

&lt;h3 id=&quot;reading-the-temperature-with-ruby&quot;&gt;Reading the temperature with Ruby&lt;/h3&gt;

&lt;p&gt;I wanted to track and log the temperature in my bedroom so the easiest thing to do was write a little ruby script that I would run on a cron. I installed Ruby using RVM and wrote the following module to simply read the temperature and convert it to Fahrenheit so my American brain can understand it.&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/jgaxn/0a808191812d4e79b179bffb81c4803c.js&quot;&gt;&lt;/script&gt;

&lt;h3 id=&quot;logging-the-temperature&quot;&gt;Logging the temperature&lt;/h3&gt;

&lt;p&gt;The last step of this bit was creating a ruby script that would use that thermometer module and spit out a timestamp and the temperature. It looks a little something like this:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/jgaxn/f12120a24b6a2c4355f5adcc9bbc9ebb.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;All that was left to do was set that script up in a cron job with the output going to a file and I now I have a file that looks like this:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;2017-06-07 01:57 &amp;gt; 74.1866
2017-06-07 01:58 &amp;gt; 74.30000000000001
2017-06-07 01:59 &amp;gt; 74.525
2017-06-07 02:00 &amp;gt; 74.6366
2017-06-07 02:01 &amp;gt; 74.86160000000001
2017-06-07 02:02 &amp;gt; 74.975
2017-06-07 02:03 &amp;gt; 75.0866
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;</content><author><name>John Grubb Atkinson</name></author><summary type="html">Wire a DS18B20 digital thermometer to a Raspberry Pi and log the temperature continuously.</summary></entry><entry><title type="html">Headless Raspberry Pi with WiFi</title><link href="https://jgaxn.com/blog/2017/07/23/headless-raspberry-pi-with-wifi/" rel="alternate" type="text/html" title="Headless Raspberry Pi with WiFi" /><published>2017-07-23T00:00:00+00:00</published><updated>2017-07-23T00:00:00+00:00</updated><id>https://jgaxn.com/blog/2017/07/23/headless-raspberry-pi-with-wifi</id><content type="html" xml:base="https://jgaxn.com/blog/2017/07/23/headless-raspberry-pi-with-wifi/">&lt;p&gt;The very first thing I needed to do as part of my &lt;a href=&quot;/blog/2017/07/21/raspberry-pi-thermostat/&quot;&gt;Raspberry Pi Thermostat Project&lt;/a&gt; was get a headless Raspberry Pi working on my WiFi. There were a couple of gotchas I ran into here since it was my first time actually booting up a Raspberry Pi.&lt;/p&gt;

&lt;h3 id=&quot;hardware-involved&quot;&gt;Hardware involved:&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.amazon.com/gp/product/B01CD5VC92/ref=as_li_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=B01CD5VC92&amp;amp;linkCode=as2&amp;amp;tag=jgaxn-20&amp;amp;linkId=6b5cde383cdd4c7b7b59b114f11b5888&quot;&gt;A Raspberry Pi 3 Model B&lt;/a&gt;&lt;img src=&quot;//ir-na.amazon-adsystem.com/e/ir?t=jgaxn-20&amp;amp;l=am2&amp;amp;o=1&amp;amp;a=B01CD5VC92&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important;&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;A micro SD card with a capacity of at least 8 GB. &lt;a target=&quot;_blank&quot; href=&quot;https://www.amazon.com/gp/product/B004ZIENBA/ref=as_li_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=B004ZIENBA&amp;amp;linkCode=as2&amp;amp;tag=jgaxn-20&amp;amp;linkId=b6f540ad9f9a43a7c45767a4ac2f6026&quot;&gt;This one should work&lt;/a&gt;&lt;img src=&quot;//ir-na.amazon-adsystem.com/e/ir?t=jgaxn-20&amp;amp;l=am2&amp;amp;o=1&amp;amp;a=B004ZIENBA&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important;&quot; /&gt;.&lt;/li&gt;
  &lt;li&gt;A micro USB power adapter that serves 5V at at least 2 amps. If you try to use an old phone adapter, it likely won’t provide enough power and the Raspberry Pi will reboot itself periodically. I bought &lt;a target=&quot;_blank&quot; href=&quot;https://www.amazon.com/gp/product/B071DFTR31/ref=as_li_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=B071DFTR31&amp;amp;linkCode=as2&amp;amp;tag=jgaxn-20&amp;amp;linkId=2d76f8bb8acdb40f8aa0764da94c3d49&quot;&gt;this one&lt;/a&gt;&lt;img src=&quot;//ir-na.amazon-adsystem.com/e/ir?t=jgaxn-20&amp;amp;l=am2&amp;amp;o=1&amp;amp;a=B071DFTR31&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important;&quot; /&gt; from Amazon and it’s been working great for me.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;things-i-had-to-do&quot;&gt;Things I had to do:&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;Download the &lt;a href=&quot;https://www.raspberrypi.org/downloads/raspbian/&quot;&gt;Raspbian Linux distribution&lt;/a&gt;. Get the “Lite” version because we are not going to hook a monitor up to this.&lt;/li&gt;
  &lt;li&gt;Flash it onto the micro SD card&lt;/li&gt;
  &lt;li&gt;Create a file in the root directory of the micro SD card called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ssh&lt;/code&gt;. This tells the Raspberry Pi to enable SSH.&lt;/li&gt;
  &lt;li&gt;Create a file in the root directory of the micro SD card called wpa_supplicant.conf and make it look like this with my WiFi SSID and password:
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; network={
     ssid=&quot;SSID&quot;
     psk=&quot;PASSWORD&quot;
 }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;Put the micro SD card into the Raspberry Pi and boot it up.&lt;/li&gt;
  &lt;li&gt;Log in to my router to find the IP address of the Raspberry Pi device.&lt;/li&gt;
  &lt;li&gt;SSH into the Pi with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ssh pi@192.168.1.42&lt;/code&gt; and password &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;raspberry&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;And I’m in! Next step in the &lt;a href=&quot;/blog/2017/07/21/raspberry-pi-thermostat/&quot;&gt;Raspberry Pi Thermostat Project&lt;/a&gt;: connect a thermometer.&lt;/p&gt;</content><author><name>John Grubb Atkinson</name></author><summary type="html">How to set up and SSH into a headless Raspberry Pi over WiFi with no monitor, no keyboard and no mouse.</summary></entry><entry><title type="html">Raspberry Pi Thermostat Project</title><link href="https://jgaxn.com/blog/2017/07/21/raspberry-pi-thermostat/" rel="alternate" type="text/html" title="Raspberry Pi Thermostat Project" /><published>2017-07-21T20:00:00+00:00</published><updated>2017-07-21T20:00:00+00:00</updated><id>https://jgaxn.com/blog/2017/07/21/raspberry-pi-thermostat</id><content type="html" xml:base="https://jgaxn.com/blog/2017/07/21/raspberry-pi-thermostat/">&lt;!-- Whenever I start on a new project I need to have three thoughts:

1. A problem I want to solve.
2. An ambitious vision of the ideal solution to the problem.
3. The smallest useful thing that is a stepping stone on the way to the ideal solution. Bonus points if this &quot;smallest useful thing&quot; is something I can build in a couple hours. --&gt;

&lt;h3 id=&quot;problem&quot;&gt;Problem&lt;/h3&gt;

&lt;p&gt;My wife and I live in a big house that is expensive to cool down in the summer. I don’t sleep well when it’s too warm. Our bedroom is on the second floor and the thermostat is on the first floor which means that getting my bedroom to a good temperature is nearly impossible without cooling the entire house.&lt;/p&gt;

&lt;h3 id=&quot;ideal-solution&quot;&gt;Ideal Solution&lt;/h3&gt;

&lt;p&gt;A programmable thermostat that turns the air on and off based on the temperature in my bedroom. It has a web interface so that it can be easily configured on the fly. It gathers data about how it’s used so that I can tweak the algorith to maximize comfort and minimize energy cost.&lt;/p&gt;

&lt;h3 id=&quot;smallest-useful-thing&quot;&gt;Smallest Useful Thing&lt;/h3&gt;

&lt;p&gt;A Raspberry Pi with a thermometer attached that logs the temperature in my room at regular intervals.&lt;/p&gt;

&lt;p&gt;At this point I can imagine a number of the steps that get me to the ideal solution, but I know I need a raspberry pi thermometer in my bedroom, so that’s where I’m starting. My goal for this project will be to continually find the next small thing and iterate my way towards the ideal solution.&lt;/p&gt;

&lt;h3 id=&quot;edit-from-the-future&quot;&gt;Edit FROM THE FUTURE&lt;/h3&gt;

&lt;p&gt;Hi! This is John from 2020. First of all, I hope you’re enjoying 2017. Sorry. That’s a little 2020 inside joke. Give Stan Lee a hug from me.&lt;/p&gt;

&lt;p&gt;Second of all, I completed this project but I never completed the blog posts I intended to write. You can view the first couple posts here and then I will summarize everything else I did. Keep in mind that I was using an older OS version and so some of the steps I highlight there are outdated.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Part 1: &lt;a href=&quot;/blog/2017/07/23/headless-raspberry-pi-with-wifi/&quot;&gt;Headless Raspberry Pi with WiFi&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;Part 2: &lt;a href=&quot;/blog/2017/08/01/thermometer-readings-with-raspberry-pi/&quot;&gt;Thermometer readings with Raspberry Pi&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once I was able to get temperature readings, I set up a web server so I could easily view the temperature for my room which was the end of the easy part.&lt;/p&gt;

&lt;h3 id=&quot;final-setup-looked-like-this&quot;&gt;Final Setup Looked like this&lt;/h3&gt;

&lt;h4 id=&quot;basement&quot;&gt;Basement&lt;/h4&gt;
&lt;ul&gt;
  &lt;li&gt;Raspberry pi wired to a relay wired into the house thermostat wiring&lt;/li&gt;
  &lt;li&gt;running a webserver that would accept requests to turn on and off the A/C and fan&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;bedroom&quot;&gt;Bedroom&lt;/h4&gt;
&lt;ul&gt;
  &lt;li&gt;Raspberry pi with thermometer attached&lt;/li&gt;
  &lt;li&gt;running a simple webserver that would return the current temperature in the room&lt;/li&gt;
  &lt;li&gt;also running a cron job that would check the temperature and hit the basement API to turn on and off the A/C&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;This project accomplished its task and was in use every day until we moved at the end of the summer. It definitely made our bedroom more comfortable but I don’t believe it accomplished the original goal of running the A/C more efficiently. It turns out that even if you close vents in your house, the A/C will work just as hard and cost just as much money to run. Closing many vents doesn’t really increase the flow of air into the desired room as more air will leak out of the ductwork with the increase in pressure. Any benefits to closing certain vents in the house were probably offset by the fact that I switched the A/C on and off more rapidly than the regular thermostat did which is inefficient. When we moved, I removed my Raspberry Pi and wired up the regular thermostat.&lt;/p&gt;</content><author><name>John Grubb Atkinson</name></author><summary type="html">I built a home thermostat out of two Raspberry Pis, a thermometer, a relay module and some ruby code.</summary></entry><entry><title type="html">Why Am I So Upset About Aaron Swartz’s Suicide?</title><link href="https://jgaxn.com/blog/2013/01/13/why-am-i-so-upset-about-aaron-swartz-s-suicide/" rel="alternate" type="text/html" title="Why Am I So Upset About Aaron Swartz’s Suicide?" /><published>2013-01-13T00:00:00+00:00</published><updated>2013-01-13T00:00:00+00:00</updated><id>https://jgaxn.com/blog/2013/01/13/why-am-i-so-upset-about-aaron-swartz-s-suicide</id><content type="html" xml:base="https://jgaxn.com/blog/2013/01/13/why-am-i-so-upset-about-aaron-swartz-s-suicide/">&lt;p&gt;&lt;em&gt;&lt;strong&gt;Note from John, 11/7/2020:&lt;/strong&gt; This blog post was originally written for my old blog that I rarely published anything on called Discount Genius. That blog is now defunct so I decided to move this post to my new blog that I rarely publish anything on.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;For the last couple of days, I have been obsessively checking &lt;a href=&quot;http://news.ycombinator.com/&quot;&gt;Hacker News&lt;/a&gt; for new articles about Aaron Swartz. I did not know the man. I am not remotely connected to him in any personal way. I had not heard of him before his arrest and had not read much about him since. The last couple days have left me pondering what exactly it is about him that has affected me so profoundly.&lt;/p&gt;

&lt;p&gt;For those who are unfamiliar with his story, it has now been written many times by many different people. &lt;a href=&quot;http://online.wsj.com/article/SB10001424127887324581504578238692048200404.html&quot;&gt;The Wall Street Journal&lt;/a&gt; has covered it, as has &lt;a href=&quot;http://www.nytimes.com/2013/01/14/technology/aaron-swartz-a-data-crusader-and-now-a-cause.html?hp&amp;amp;pagewanted=all&quot;&gt;The New York Times&lt;/a&gt;. Tributes have been penned by &lt;a href=&quot;http://boingboing.net/2013/01/12/rip-aaron-swartz.html&quot;&gt;Cory Doctorow&lt;/a&gt;, &lt;a href=&quot;http://lessig.tumblr.com/post/40347463044/prosecutor-as-bully&quot;&gt;Larry Lessig&lt;/a&gt;, and the &lt;a href=&quot;http://pastebin.com/eFa8GdGp&quot;&gt;President of MIT&lt;/a&gt;. The expert witness who would have testified on his behalf explained how Aaron died &lt;a href=&quot;http://io9.com/5975592/aaron-swartz-died-innocent-++-here-is-the-evidence&quot;&gt;an innocent man&lt;/a&gt;. The most touching tribute came from those who knew him best who created &lt;a href=&quot;http://www.rememberaaronsw.com/&quot;&gt;Remember Aaron Swartz&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I find myself on the outside looking in not with morbid curiosity, but with a genuine concern and care for those most affected by this tragedy. This is atypical for me. I have lived much of my life ruled by a cold logic with regards to tragedies that do not immediately influence me. I ignore death and disease and famine and war justifying myself with the thought that there’s nothing I can do about it now anyway. Maybe someday when I’m older or stronger or richer I will care and I will contribute. The loss of Aaron Swartz has broken that pattern and it has taken me a couple of days to try to figure out why. Why am I so upset? Why am I so quick to take up my pitchfork and call for an end to the career of an attorney I have never met? Why has the suicide of one man had a greater emotional effect upon me than almost any war, natural disaster, or school shooting in my lifetime?&lt;/p&gt;

&lt;p&gt;The conclusion I have arrived at after two days of pondering is probably incomplete and may shift with time. Aaron Swartz is what I wish I was. I am a bright technologist, but I’ve never built anything of note. I have strong opinions about how to improve this world, but I’ve never acted to bring them to pass. I have thoughts every day that I would share with the world, but I allow my fears to convince me to keep them to myself. If I were able to stop being afraid of what the world would think of me, I could see myself making every decision that Aaron made that ultimately led to his untimely death. This upsets me immensely. I am upset that we have a justice system that would persecute me the way it did Aaron. I am upset that I have spent 27 years of my life having made no discernible difference to the world around me. Most of all I am upset that Aaron’s work here is done when there is so much more he could have accomplished.&lt;/p&gt;

&lt;p&gt;I took a computer systems class in college with a lab that involved solving programming challenges in the fewest number of operations. A live leaderboard was kept that showed the number of operations in which each group had accomplished each task. One task sat for days with nobody having accomplished it in fewer than the four operations needed for full credit. Once somebody accomplished it in three, it proved to the rest of the groups that three was possible and others soon solved it in three. Aaron Swartz has shown us what is possible and it is now up to us to try to match him.&lt;/p&gt;</content><author><name>John Grubb Atkinson</name></author><summary type="html">I wrote a post in 2013 about Aaron Swartz.</summary></entry></feed>