Raspberry Pi 4

A few hours ago, the Raspberry Pi Foundation announced the latest version of their awesome single board computer, Raspberry Pi 4 Model B. I am stoked.

Raspberry Pi 4 Model B board

As shown in the above image, it has dual monitor support at 4K. They switched the power supply to use USB-C and has Bluetooth 5.0 connectivity.

Raspberry Pi 4
Raspberry Pi 4 with dual monitor support at 4K

The new version comes with support for 1GB, 2GB, and 4GB of RAM. That makes it a powerful desktop computer that’s smaller than my phone.

I cannot wait to try this out and work on something fun.

Building a Coffee Pot Monitor using Raspberry Pi

I love coffee and side projects. I wanted to solve a coffee related annoyance that I faced on a regular basis. This post is about how I built a Coffee Pot Monitor, to track the coffee level in a coffee pot, remotely, using a Load Cell, HX711 amplifier, and a Raspberry Pi.

The Annoyance

Imagine yourself being busy with something important. You take a quick break to grab some coffee and walk over to the break room only to find an empty coffee pot.

Oh, the horror

There’s no way for me to know the amount of coffee left in the pot, without walking over to the break room and checking it out. The coffee pots we have at work are opaque. So, it’s not possible to know the amount of coffee left in the pot by looking at it.

Initial Solution

I came up with a solution to my problem. A camera mounted near the coffee pot would stream the video data to a Raspberry Pi. Using Computer Vision on this stream, I can identify when someone uses the coffee pot. When someone pumps the coffee from the pot, my algorithm decreases the coffee level in the coffee pot by a static value (one cup). A dashboard, which can be accessed via a URL, displays this data in realtime.

There’re several drawbacks to this approach. For starters, my algorithm assumes that every person pumps exactly one cup of coffee. Now, consider the case of an empty, opaque coffee pot. A person tries to pump coffee and realizes there’s no coffee left. In this case, my algorithm still decreases the coffee level by a cup even though no coffee is pumped.

To say the least, it is a convoluted approach.

I knew it was a convoluted idea. I wanted to build it anyway.

One fine day, I shared the idea with a friend from work, Rajesh. He liked the thought behind the project and suggested an improvement.

Improved Solution

Rajesh suggested using the coffee pot’s weight to calculate the coffee level. That was it. Suddenly, it became obvious. It’s a great way to track the volume of the coffee in a coffee pot.

The potential of the project got us both excited. We submitted the idea to the quarterly Hackathon at work. Long story short, we won the first prize for our implementation of this idea.

Tools

After some research, it became clear that we needed a Load Cell along with a Hx711 load cell amplifier. I immediately ordered it from Amazon along with the Raspberry Pi 3 B+.

Setup

First, hook up the Load Cell to the HX711 as shown in the image below:

Connecting a Load Cell to a HX711 amplifier
Connecting a Load Cell to a HX711 amplifier

Next, connect the HX711 amplifier to Raspberry Pi as follows:

  • VCC to Raspberry Pi Pin 2 (5V)
  • GND to Raspberry Pi Pin 6 (GND)
  • DT to Raspberry Pi Pin 29 (GPIO 5)
  • SCK to Raspberry Pi Pin 31 (GPIO 6)
Connecting a HX711 to a Raspberry Pi

That finishes our hardware setup. Let’s move on to the software side.

We use the HX711 python library in Raspberry Pi to read the Load Cell data from the Hx711 amplifier. Every three seconds, the Raspberry Pi posts the data to Firebase. A simple static HTML page serves as the dashboard by displaying the realtime data from Firebase.

The build

We need two pieces of wood. One of the pieces, acts as a base to place the coffee pot. The other acts as a stand for the Load Cell. These are placed on either sides of the Load Cell. In my case, a colleague of mine, Vijay, helped with cutting out these two pieces of wood.

  • Top view of the equipment
  • Side view from an angle
  • Load Cell positioned between two wooden planks
  • Load Cell zoomed in
  • Load Cell connected to the HX711 amplifier and Raspberry Pi
  • Another view of the Load Cell

Architecture

Architecture
Data flow from Load Cell to the user’s browser
  1. The Load Cell reads the weight of the coffee pot
  2. HX711 module amplifies the Load Cell data and sends it to Raspberry Pi
  3. Raspberry Pi posts the data to Firebase
  4. Firebase publishes this data to all the clients
  5. The browser displays the updates

How it works

There is a one time setup process. First, weigh the empty pot on the Load Cell. Let this weight be w1 (min). Next, weigh the coffee filled pot on the Load Cell. Let this weight be w2 (max). At any given point of time, the weight of the coffee pot ranges from w1 to w2.

Every time someone pumps (or pours) coffee from the pot, the weight of the coffee pot decreases. This data is published to all the clients using Firebase. It’s as simple as that.

Here’s the final product:

Coffee Pot placed on the wooden platform
Coffee Pot placed on the wooden platform

Here’s an animation of the dashboard getting updated in realtime:

Dashboard getting updated in realtime

Conclusion

The entire cost of setting this up is approx. $45. It’d be great if we could build this at a much lower price. That way, it can be more affordable and practical. I’ll soon open source the code behind the project and provide the GitHub link to the repository.

Featured image courtesy: https://unsplash.com/photos/KixfBEdyp64

Google Fi Review (2019)

Google Fi
Google Fi

After ten years of using AT&T, I switched to Google Fi and here are my thoughts. Before I start my review, here’re some details you might be interested in. I use Google Fi on an unlocked iPhone XS. I knew very well about the limitations before I signed up for the service. So, here is my review of Google Fi on iPhone.

Application

I’ve been a Google Voice (GV) user since the past ten years. I love the service. I’ve used it for my voicemail and for making international calls to India. I liked the voicemail transcription feature too. This is a pretty common feature now, but, GV pioneered it.

Anyway, I was able to sign up for Google Fi online from this page here https://fi.google.com/signup and apply for the SIM card installation kit.

During the application process, you’re presented with the following 3 options:

Sign Up form
Sign Up form

If you select Use another number you own and use your current phone number, you’ll lose your GV number for good. I didn’t want to lose my GV number. So, I canceled the sign up process and logged in to my GV account and transferred my GV phone number to another Google account of mine. Once I did that, I restarted my Google Fi sign up process. Now, the form looked like this:

Sign Up form part 2
Sign Up form part 2

Everything else was pretty straight forward. The SIM card itself is free. It ships in a week or so. Since, I wanted the SIM card ASAP, I chose to go with the $15 expedited shipping option. I got it the very next day.

Activation

Once I got hold of the Google Fi SIM card, I installed the Google Fi app from the iOS App Store. I placed the SIM in my iPhone and opened the app. I was able to follow through the steps and have the service activated within 5 mins. Yep, it was that quick and simple. The app guides you through the process of setting up SMS/MMS/Voicemail on iPhone.

Caveats

In order to check voicemail, you need to check the Google Fi app. The native iOS Phone app doesn’t have access to the voicemails. Personally, this wasn’t a big deal. I never really used AT&T’s voicemail on my iPhone anyway. I always used the GV app to check my voicemail. The only difference now is that I need to check my voicemail in the Google Fi app.

Billing

I am all praise for Google in this section. Google nailed it with the UI. Honestly, I didn’t expect anything less from Google. It is extremely minimalistic and easy to understand your Fi plan. AT&T on the other hand, I had to watch this video to prepare myself before I opened my AT&T account.

Rocky Balboa Inspirational Speech

I had to tap through 5-7 different screens to get any information that made sense to me.

See how clean the UI is? Good job, Google.

International Calling

I absolutely love how Google Fi supports international calling from the United States. This basically renders my GV account useless. All the features of GV that I loved are baked into Google Fi. General information about international calling can be found here: https://fi.google.com/about/international-rates/

Speed Test

I performed a speed test on fast.com and here’re the results for Google Fi LTE

Google Fi LTE speed test results from Fast.com

The results are pretty good. I tried streaming videos (YouTube) and audio (Apple Music) with positive results.

Conclusion

While I’m missing out on the automatic carrier switching feature of Google Fi by using it on an iPhone, I still like the service. So far, the signal reception hasn’t been bad. The data speeds are pretty good. I just hope Google comes up with a solution to make automatic carrier switching work with the iPhones soon.

Working on Side Projects

Working on Side Projects can be really fun. But, you know what’s not fun and sucks? Not finishing the project and abandoning it (also, Global Warming). This is a very common problem and most of us struggle with it.

It gets trickier. Once you lose interest in the project and abandon it, guilt kicks in, as if we don’t have enough issues to deal with already. At this point it becomes really annoying having to fight with your conscience about the abandoned project. You don’t feel like working on it and at the same time you can’t really leave it. It’s just pure bliss at this point. 😇

One fine Sunday afternoon, you gather your thoughts and try to focus on your project and trim it from an ambitious project to a simpler project. You feel good about yourself for having found a way to deal with the problem. That’s when you notice a cool new tool. BAM! Suddenly, you notice all of your efforts and the interest you managed to build up, going down the drain. Can you stop it? No. What do you do instead? Go ahead and try out the cool new tool that’s going to make your life so much more awesome. What about your project? That can wait. You’re confident that you will be able to come back later and finish your project using the cool new tool.

Three months go by and you are finally at a point in your life where you feel confident and comfortable to say goodbye to your project and move on to a new one.

Moving Fast and Breaking Things

In the past, I’ve started a lot of projects and miserably failed to finish them. I even thought of moving fast and breaking things. In reality, that didn’t really work. It’s definitely not because the philosophy is flawed. It’s because my perception of the philosophy was flawed. I’ve realized what I was doing wrong and corrected it over the past few years. I’ve tried a lot of things and didn’t really find anything helpful.

Reasons for Abandoning Projects

After spending a lot of time thinking about why I kept abandoning my projects, I noticed a common theme and was able to compile a list of reasons that made me abandon my side projects.

Lack of Prioritization

Imagine working on a project where you have tasks that are not prioritized. You have no idea which task you’d work on after you finish the current task. It’s hard to continue working on something while not knowing what needs to be worked on next. Also, give yourself enough time. Make sure your deadlines are reasonable. Be extremely honest with yourself when setting up deadlines.

Unfamiliar Tooling/Technology

If you use tools that you’re not familiar with, you spend a lot of time learning to use them. After a few days, you find yourself working on an entirely different project – Learning to use the New Tools. Understand what’s important to you, learning the new tools, or completing the project. I know that these don’t have to be mutually exclusive, but, that’s how it is most of the time. If picking up a new tool is fairly quick, that’s absolutely fine. It’s unlikely that it’d distract you. Or, at least try to minimize introducing too much of new tooling into the project.

Not knowing the value

If you ever try to work on something that you’re not interested in and just think that it might be useful for others, chances are that you might never finish the project. If you truly understand how a project might be of value to you, it’s likely that you’ll stay interested in finishing the project. Your project doesn’t even have to be brand new. It could be something that has been implemented over a hundred times by others. When in doubt, just ask yourself, “Why am I doing this?”.

Perfection

Yep, perfection. Perfection is a major distraction. If it’s a side project and you’re the only one who’s going to be using it initially, don’t aim for perfection early on. This can work against you. Instead, make it an iterative process. This reminds me of the following quote:

If you’re not embarrassed when you ship your first version, you waited too long.

Matt Mullenweg, CEO of WordPress

Also, this is a perfect segue to the next reason for abandoning projects.

Lack of Iterations

If you think of a project as a whole, the project scope becomes too much to handle. Instead, you can build it in several iterations. Ship the Minimum Viable Product (MVP) first. Iterate on it later. Shipping the first version is very important. I do it with all of my projects and it has been very effective.

Lack of context

There have been times when I started a project, worked on it for a few days and stayed away from it for a week or two. When I came back to the project, it felt like I was missing the context from where I left off. So, I started journaling my thoughts regarding the project right after I stopped working on it. The next time I got back to the project, I’d read through my thoughts and pick up from right where I left off, with very little effort. This technique made me stay consistent with my projects.

I’ve struggled staying focused on side projects and abandoned a lot them in the past. Identifying these bottlenecks helped me optimize my process of working on side projects. Before publishing this post, I had all of these reasons as a checklist that I’d go through before starting any side project, as a reminder to be careful with these bottlenecks.

What bottlenecks do you face when working on side projects? Let me know in the comments section below.