Bits of Geekery

Building awesome hardware/software projects. Becoming a better alchemist day by day.

Read this first

ElixirConf 2018 was amazing

The cramped 6.5-hour flight to Seattle was worth being uncomfortable for the remainder of the night as ElixirConf 2018 was a truly great event. I experienced two major firsts: speaking and the hallway track. Chris McCord dropped Phoenix.LiveView, Boyd Multerer released Scenic and I am already drinking the kool-aid.

I mention a few talks below but I wanted to point out there are many more. Please visit the ElixirConf Youtube Channel to view more.

 Speaking

Due to my obsession interest with weather (particularly wind speed) I built a weather station using Elixir/Nerves/Phoenix. The blog posts were well received and after a lightning talk at Lonestar Elixir 2018, I felt a full talk to be warranted. I went ahead and submitted “Did you hear that wind?” for ElixirConf 2018 and it was accepted. Many stressful nights resulted in the talk you see below. It was very fun to present my project in...

Continue reading →


ElixirConf 2018 crunch time

Crunch time is here, ElixirConf is in 36 days! I started my presentation which is going to require a lot more time than previously imagined. My goal is to have the audience laugh a bit while learning how to build their own weather station. Once again I will go with TenderLove’s approach, laugh at your own jokes and others will join you.

It’s challenging to try to forget what you know in order to better teach others. I don’t want to make any assumptions about the audiences knowledge, or forget to mention some important details. There was a bit about the Elm front-end that may get cut due to time. I have a branch for Lake Effect with some basic, but broken channel support, not enough to talk about at the moment.

If you are going to be attending ElixirConf I would love to meet everyone! I am throwing around the idea of bringing my Elixir Card set. Contact me on twitter (@frigidcode) or...

Continue reading →


Building a Raspberry Pi weather station with Elixir/Nerves – Part 5

 Speaking at ElixirConf 2018

If you want to learn how to build a weather station, laugh, cry when its over; then come to ElixirConf 2018! You can talk to me in person and I’ll make sure to tell you the wind speed.

 It’s ALIVE

To see weather results visit https://weather.frankkumro.com. Refresh the page every 30 seconds to see the latest weather report.
wind-speed-sensor-mounted.jpg

 Setting up wireless

Capturing weather data is useless without saving / displaying it. Lake Effect will send the data it captures to a Phoenix application over HTTPS in JSON format. I did not want to dig a trench to run power/ethernet to the shed, it is around 100 feet from the house. Life is too short to dig holes for fun! Wireless will be used for connectivity and solar for power (future project). Setting up the wireless connection within Nerves is easy.

Nerves Network provides wired and wireless network setup for Nerves projects...

Continue reading →


Building a Raspberry Pi weather station with Elixir/Nerves – Part 4

Part 3 demonstrated how to communicate with the wind speed sensor. The next step is to create modules for reading from both sensors, and automatically repeating this task at a set interval.

You will notice two project names in the details below, Lake Effect and Thunder Snow. These are the project names for the code running on the weather station (Lake Effect) and the code that will be running the API/UI for display (Thunder Snow). Currently Thunder Snow is empty, that will change after Part 4.

 You down with OTP? Yea you know me!

I am going to utilize OTP to implement the processes for reading data and printing to the screen. There will be a total of 4 servers, all supervised by the default Application supervisor:

Name Description
LakeEffect.Sensors.Temperature.Server Read temperature
LakeEffect.Sensors.WindSpeed.Server Read wind speed
LakeEffect.Clients.ThunderSnow.Server
...

Continue reading →


Building a Raspberry Pi weather station with Elixir/Nerves – Part 3

Part 2 ended without us being able to read the wind speed, let’s fix that!

wind-speed-hacking-large.jpeg

 Communicating via SPI bus

To communicate with the wind speed sensor, a binary payload must be sent to the MCP3008 chip over the SPI bus. The elixir_ale library will be used, as it supports SPI. The first step was to determine what channel the wind speed sensor is wired to. For my setup, that is channel 0, indicated by the top left most pin being used on the chip. Now that the channel is known, the binary payload can be constructed.

mcp3008-layout.png

 Binary to send to the SPI bus

Microchip provides the documentation necessary to figure out what should be sent to the MCP3008. The figure I needed was 6-2, it’s copied below for reference. Follow along when I explain how I came to my results.

figure-6-2.png

For the correct binary payload, I needed to reference the MCU Transmitted Data section. There are 3 sections of bits, 8 bits per...

Continue reading →


Building a Raspberry Pi weather station with Elixir/Nerves – Part 2

oneeternitylater.jpg

Life happens but I am back with a part 2 update for the Raspberry Pi weather station powered by Elixir/Nerves!

 An analog mistake

After the parts arrived, I began to pour over the schematics for each device. Only then did I realized the wind sensor was analog, but the Raspberry Pi did not support analog inputs. Digital vs analog is a topic I never thought of, being niave in the hardware world, but it was an easy fix. The MCP3008 analog to digital converter is only $3.75 from Adafruit and shipping will most likely cost more than the part. Make sure to pick one up if you are following along with your initial order.

Now that all the correct parts were here, I could begin mocking them up. The process was fairly easy, thanks to adafruit and a friend who will likely forget more about this topic than I might ever know. I’ve seen some nice graphical representations of the connections, but I...

Continue reading →


Deploying git tags on Nanobox

I’ve been using Nanobox for months now on my side projects, it is an amazing tool for dev(s)/teams that are solo or want to avoid devops work. One item that I miss from my devops days, was the ability to deploy based on a git tag. Being able to checkout the code that currently lives on production, at any time, saves a lot of headaches when it hits the fan.

 Using a git tag for deployment

There are multiple steps that need to be executed to deploy a git tag:

  • Save the current branch name, not required, but a nice touch
  • Checkout the git tag into a detached state
  • Deploy via nanobox deploy -m ‘’
  • Checkout the original branch

 Obtaining the current branch

Using git branch will not have the desired results, as it lists all local branches. We need to only grab the starred item, and then trim off the star and spaces. The resulting string can be interpolated into a git checkout command for...

Continue reading →


Building a Raspberry Pi weather station with Elixir/Nerves – Part 1

My house is at the top of a hill, and no weather stations are close enough to accurately determine the wind speeds. Being the nerd that I am, knowing the current and historical wind speeds is something I would love to play with. I am most interested in the wind speeds during storms. Being able to use Elixir to build this project makes it even more fun!

 Parts List

I sourced parts from Adafruit and Amazon. The smoke case and power supply that I planned on purchasing were out of stock. Begrudgingly I had to order a different case and use Amazon for the SD card/power supply. Adafruits pricing for SD cards couldn’t compete with Amazon.
Adafruit

  • High Temp Waterproof DS18B20 Digital temperature sensor + extras
  • Anemometer Wind Speed Sensor w/Analog Voltage Output
  • Premium Female/Female Jumper Wires – 20 x 6” (150mm)
  • Aluminum Heat Sink for Raspberry Pi 3 – 14 x 14 x 8mm
  • Raspberry Pi 3 – Model...

Continue reading →


Learning Elixir – August 2017 Update

Learning a new programming language is an investment in time and money (if you purchase learning material). Sometimes a job forces you to learn a new language in order to be productive and to do your job. My personal preference is to learn a new language without the pressures of instant productivity, this is the route I took when I wanted to learn Elixir.

 Attempt #1

I first attempted to learn Elixir in Q4 of 2015, but my schedule (lack there of) didn’t allow me the time I needed for deep learning. About two months ago I decided to go all in and start learning Elixir again. This time I would learn the language first, and then any frameworks I deemed necessary. Previously I opened up Programming Phoenix and tried to pick up the language as I went. I feel this approach does a disservice to Elixir, as it is such a powerful language even without frameworks. I briefly tried to read through...

Continue reading →


Install Rescuetime on Solus Linux

If you use a linux distribution which cannot install .deb or .rpm packages, Rescuetime appears to be unusable. Solus Linux cannot install either of those packages, and the developer I reached out to at Rescuetime didn’t quite know why I wanted a .tar.gz (or insert your fav compression algo here). I decided to find out if the binaries contained within the .deb file could run on a Solus Linux system. It was a success, and here is how you can do it.

 Prerequisites

Two packages are needed to support running the rescuetime binary, qt4 and xprop. Both are available for install via eopkg.

$ sudo eopkg install qt4 xprop

You also need to download the 64 bit version of the debian package from Rescuetime’s website.

$ wget https://www.rescuetime.com/installers/rescuetime_current_amd64.deb

 Extract and copy contents of .deb

Debian files (.deb) are ar archives, and can be extracted using ar.

$
...

Continue reading →