Blog Post

Coffee Pour Over Project: Peristaltic Pump

To make a pour-over coffee maker, there are a few functions that are required, a coffee maker must:

  • Pump water from a holding tank to a shower head
  • Heat aforementioned water before it leaves the shower head
  • Hold the coffee in a filter in order that water can get at it evenly

For my brewer, I have a few goals of my own:

I want to create a home-brew (pun definitely intended) pour over machine that is cheaper than the ones that are currently on the market (can go up to $300!), completely hackable, and as consistent as possible. I want to create a coffee maker that empowers experimentation of how coffee is brewed by being able to control and fine tune all of the parameters of the brew process to see how coffee is affected by different brewing processes.

The Pump:

coffee makers use a few different methods to pump water, but I decided on a peristaltic pump as making one myself out of 3D printed parts and commonly available parts seemed relatively easy. In addition to this, it would allow for fine control of flow rate as I would be using a stepper motor to power the pump. The ability to iterate designs quickly using my personal 3D printer is really useful and lowers the barrier to entry for designing mechanical components drastically, especially when you are iterating experimentally to come up with the correct design (like figuring out the correct rotor size as I explain below). After deciding to make a peristaltic pump myself, I bought a food-safe silicone tube from McMaster-Carr and started design work.

My first few revs (titles rev 0 in the pictures) weren’t successful in the slightest, I had too much pressure squishing the tube down and I couldn’t get the NEMA 23 motor I had (spare from a 3D printer) to spin the rotor. I then changed the design so that the rotor had a smaller diameter so there was less friction preventing the rotor from spinning, and I also ordered a motor that has almost double the torque. I also added bearings that ride on the rim of one of the rotors so that there was no friction of the rotor onto the “squish plate” that is squishing the silicone tube. This time, the tube wasn’t being squished enough and I need to test another iteration to experimentally get the correct rotor size.

Revisions 0 and 1:

Blog Post, Climate Analysis, Programming

Starting Out: Climate Change Analysis

When I first started working on the climate analysis program, I knew that I would be working on a larger than memory dataset, but what I didn’t fully realize is how much more complexity is incurred when working with large datasets…

Keep it Simple!

I downloaded the daily summaries in the GHCN dataset a few weeks ago and saw that it was around 6GB compressed. I thought I would try to keep it simple, stupid, and tried to unzip it… until it filled the rest of the space on my computer’s SSD and was taking longer than 24 hours to unzip. This obviously wasn’t even close to optimal so I started Googling around.

Digging into the Details

I decided on the H5 file format as it uses compression (unlike databases) and the PyTables library added functionality that could come in useful. It took me multiple iterations to figure out how to convert the tar file that I downloaded containing CSV’s of climate data into an H5 file in a timely fashion. That is how big this dataset is (60GB compressed as an H5 file). I also found Dask, a library that can be used for larger-than-memory computing, perfect! I recently created a Github repo for my program in its current state. I am in the very early stages of development at this point, but I do have a function that takes in a tar file and produces a H5 file, which I think is a good start.

Blog Post, Climate Analysis, Programming

Where is all the Data on Climate Change?

Science and the pursuit of understanding is not something that is reserved only for scientists with advanced degrees and the resources that only a research institution can provide. Anyone can perform their own analysis on whether the Earth is warming or not, it is just a matter of knowing where to look.

I thought that it would be an interesting project to try to do a simple analysis of climate data using publicly available data (what a time to be alive!) on the subject. After looking at multiple datasets, I chose the GHCND (Global Historical Climatology Network Daily) dataset as it has many years of data from all around the globe. This blessing can be a curse as well though, The dataset downloaded is several gigs large, and uncompressed it is much, much larger than that, although, uncompressing it isn’t strictly necessary. If you want to look at other data sets though, Erika Wise has a great list to pick from.

This will be the first post in a series about a python program that I am developing to analyze climate data.

Blog Post, Programming, Tutorials

Building an Interactive Graph using Dash

Making an interactive graph is something that is very useful when performing data analysis, after all if you can’t interpret your data, what use does it have? This blog post will go over an example of a very simple interactive Dash graph for those just getting started with interactive graphing using Dash.

I have been using Excel for data analysis in my work and I was struggling with getting a pivot table to display exactly what I wanted, and how I wanted it. Is that too much to ask??? After trying a few different methods of organizing my data, I moved on to PowerBI, which I had even larger problems with. I already knew of the python library called Dash and I had been wanting to try interactive graphs with it for a while so I decided to give it a go.

It took me a good couple of hours starting from the first tutorial, but I ended up with a basic graph that finally displayed my data how I wanted it. Working with a programming language and knowing that you code the behavior of the graph was very cathartic after struggling with getting Excel and PowerBI to plot the data without summarizing it or combining separate trials into one trace on the graph.

Installing the Necessary Libraries

I will be assuming that you are using Anaconda and their package manager, conda, in this post. You will first need to install the community managed dash repo.

conda install -c conda-forge dash

And that should be it!

Code Overview

We start with the import statements and then load the Excel file containing the data into a dataframe. After this we create the layout of the Dash app and define the callback function which is called anytime the user interacts with the buttons on the user interface. The global dataframe variable is filtered in the callback function depending on what the user chooses using the interface and the subsequent result is graphed. The callback function loops over what the user has chosen in the interface and adds a trace for each to the graph. I made this app by reading the Dash tutorial on plot.ly’s website, here and modifying and creating my own logic for my data.

I decided not to use a css style sheet as my main objective was to create something that is functional for data analysis and as simple as possible.

The Code Itself

Blog Post, Programming, Tutorials

Creating Your First C Program: Quickstart

Many can relate to the challenge of learning a new coding language. I’ve found that quickly being able to make a first program to start experimenting with the language helps inspire the confidence needed to keep going. In this blog post I will be briefly going over the steps needed to create a simple first program in the C language in Ubuntu.

Setting Up Your Development Environment On Your Computer:

  1. Install your favorite text editor; mine happens to be VS Code by Microsoft.
  2. Know how to use the cd and ls commands in the terminal to access the files you will be creating.

C is a compiled language which means that once you have written the .c file you will need to “compile” it which will create another file which the computer will use to run the program.

To install the GCC C compiler on your computer run:

To Create Your First Program:

Create a File with the .c file extension in your text editor. Below is a sample first C file.

To Compile Your First Program:

Move to the directory that contains your program and type:

This code has two important effects, it runs the gcc compiler and creates and names an object file from your program file.

To Run Your First Program:

In the same directory, type:

Please let me know if this helped you to get started quickly with C on Linux.

Blog Post, Programming, Tutorials

Creating your First Clojure Program in Linux

Those who really want to start learning a language will find it easier to start learning the language by setting up a REPL as fast as possible. This makes it easy to experiment with some simple expressions. This post will covers the installation of Clojure and an editor on Ubuntu Linux to set up a REPL.

Since Clojure runs on the Java Virtual Machine, one will need to install Java on your system. This, Here, is an easy way to do exactly that.

Now that Java is installed, one can install leiningen, a helpful tool for managing Clojure projects, especially when starting with Clojure.

To Install Leiningen:

Use Ubuntu’s package manager:

Or use wget:
wget puts files in your current working directory, which is home by default.

Installing a text editor:

Many people like using slime emacs for Clojure development, but for people who haven’t used emacs before I suggest using Nightcode. It is easier not to have to learn Clojure and a complex text-based editor like emacs at the same time. For this reason, Nightcode is a good alternative.

To install Nightcode download the .deb file and double click on it to open a window with the option to install it on your system.

Creating a New Leiningen Project:

In the terminal type:

Lastly, open the project in Nightcode. A “Hello World!” console application is already generated for you.