December 15, 2016

DIY Smart Mirror ft. Alexa



Materials

  1. Computer Monitor. Buy used and look for cable inputs that point down or sideways instead of straight out. 22" recommended (I used Acer AL2216 )
  2. Video cable. Whatever fits your monitor (I used HDMI to DVI adapter)
  3. Raspberry Pi 3, 16GB Micro SD Card, 5V Micro USB power supply, any RPi case
  4. Wood. I bought four 3ft lengths of 3"x1"
  5. 8 Angle brackets
  6. Short wood screws.
  7. Gorilla glue.
  8. Electrical tape.
  9. Extension Cord with multiple plugs.
  10. 50cm x 70cm Ikea STROMBY frame.
  11. Gila Mirrored Window Film 
  12. USB Sound CardLapel Micany USB powered speaker *
*Bonus Alexa Materials

Additional required tools/supplies are: scotch tape, a squirt bottle, dish soap, a drill or screwdriver, exacto knife, scissors, and a saw.

March 10, 2018 update: I'm currently in the process of trying out an actual two way mirror as well instead of the window film. If you're interested in this I can recommend this mirror which comes in several sizes. I'll have a post coming soon with instructions for how to mount it.

Creating the Two Way Mirror


The two way mirror is the most essential part of this build. To create this component, you just apply Gila Mirrored Window Film to any piece of glass or acrylic. This works equally well for glass and acrylic, and only takes about 15 minutes.

December 09, 2016

Raspberry Pi Bot Server



My trusty RPi3 twitter bot server "starkiller".

So let's say you've got a twitter bot that you want running 24/7, but you don't want it running on your personal system. What you need here is a server, which is really just a dedicated system. Note, if you're looking for a web server, you'd be better off with Amazon's AWS .

If you're running automated tasks and answering tweets however, a Raspberry Pi is an excellent choice. 

The steps are pretty straightforward:

1. Setup a computer (raspberry pi) to run your program.
2. Write a script to launch your program.

3. Run the script automatically at startup.

Setup your computer


The starting point here is simply to buy a Raspberry Pi. RPi3 is great because it has build in wifi, and it's very affordable, any generation will work though. Once you've got the hardware, you need to install an OS. I strongly recommend Raspbian Jessie with Pixel (download and install guide can be found here).

December 08, 2016

From the Vault: PICHEC Raspberry Pi Cluster

I want to document this project, as it is one of my favourite projects to date. This took place about 4 years ago while I was working at the Irish Centre for High End Computing (ICHEC).

One of ICHEC's projects at the time was creating demonstration for the BT Young Scientist Exhibition to explain the use of parallel computing. I volunteered to build a Raspberry Pi cluster for this, along with a parallel demo application called Conway's Game of Life. The (very old) code can be found here, and more details about the simulation can be found in the official handout.

The best part of the project was building the cluster. My design placed the 8 Raspberry Pi's into the legs of a plexiglass enclosure shaped like the pi symbol. I also wrapped ethernet cables in colour electrical tape to give them distinct colours, and added several strands of EL Wire to make it glow.

Here are a couple of photos of the cluster and build process.


Glorious PICHEC


November 30, 2016

DIY Alexa Raspberry Pi Voice Assistant

Amazon did something really cool. They made their Alexa voice assistant code open source and cross platform. That means instead of buying their Amazon Echo to get a home assistant, you can simply install it on any system you want.

It's actually a fairly straightforward project, especially if you've setup a Raspberry Pi before (or eight #fromthevault)! Basically you're just installing an application, and setting up a microphone and speaker. Nothing fancy.

There are already some great guides for getting started too for both Raspberry Pi and Alexa. I'm just going to direct you to these, give a rough overview, and add some additional tips.

Here it is in action:



Shopping List


For equipment, you'll need:

1. A Raspberry Pi 3 with SD card and USB micro power source:

November 24, 2016

Intro to Python: Hello World! (Part 1 /2)

Many of the projects on this site use a programming language called python. Python is a great language for beginners, because it is designed to be very readable, but it's also very powerful. It is powerful because there are a lot of powerful libraries and APIs that are easy to use made for python, which allows you to write some pretty exciting programs without much code. 

In this post, I walk you through installing python, and running your first program. In the next post I will introduce containers and functions used to make code readable and re-usable. 

Once you have completed both parts, you should have a good understand of the language features I use in the programs on this blog. There is a lot you can do with only a few concepts!

Here are a couple projects to check out once you have completed these tutorials:

Making a simple Twitter Bot
Reddit word counting
Writing an orbit simulator

Now let's get down to business.

Intro to Python: Containers, Functions, and Loops (Part 2 /2)

This is the second post in a series. If you're just getting started, see Part 1.

In the previous post, you got python installed, and ran a simple program. In this section we will use some language features to store data, and re-use code. These are important concepts for all programming languages.


Before we get started, let me warn you to pay attention to your indentation / white space here. Python doesn't care if you use tabs or spaces for white space, but does require that indented blocks are consistent. 

Lists


The first container we will look at is a list. A list is rather unsurprisingly just a series of items in a single object. To create a list, you just assign values inside square brackets separated by commas. After it is created you can add values using your_list_name.append(value). 

November 16, 2016

Python N-body Orbit Simulation

Do you ever find yourself thinking "I wish I could do more recreational physics"? If so, today is your lucky day! We're going simulate our very own solar system.

At the end of this tutorial, you should be able to define a hypothetical gravitational system, and graph the paths of the bodies involved over a custom time frame.

This sounds complicated, because usually physics relating to space is considered hard. But it's not that hard! If someone has already broken down the algorithm (which I will do), you just have to understand the rough theory. Then it's no harder than writing a bot. If you've ever studied kinematics, you should also be able to follow along with the physics.

This is also the first in a series of posts. I will be solving this problem again using C++ instead of python, and introducing some High Performance Computing techniques.

If you don't care about theory, you can also skip straight to the program. An intro to python can be found here.

ELI15 Gravitational Theory


We'll start with the difference between weight and mass. Mass is a measure of the matter that makes up an object, and weight is how much force it feels from gravity. So your weight on the Moon and on Earth are different, but your mass is the same. That's because the Moon has less gravity dragging you down man.

November 11, 2016

From the Vault: Arduino Night Writer.

Night Writer


About four years ago, I invited some friends over to try to turn a remote control car into something programmable. We had some trouble finding supplies though, so they just brought beer instead. But we were determined to build something.

I had recently seen this video, and thought we might be able to reproduce it with just a column of LEDs and a long exposure photo.

This project uses the "Persistence of Vision" concept, where the LEDs flash vertical slices of a letter or symbol, and you provide the horizontal movement. Using a long exposure camera allows you to slowly "paint" the light into your image.

First I'll show you some photos from the project. If you want to build your own, keep scrolling for rough build details. As it's "from the vault", it's not a complete walkthrough. It does give you the code you need though, and a photo of the circuit. This would be a good 2nd or 3rd Arduino project.

Results


HPC 4 Life

November 07, 2016

Reddit Data Mining with Python: Are Canadians Really Sorry?

Internationally, Canadians have a reputation for being a sorry lot. In fact, we've even passed a law called "The Apology Act" stating that saying "sorry" does not count as an admission of guilt. A very sensible law indeed.

Is this stereotype true?

We're going to test it in this tutorial, by counting the frequency of apologies in a number of Canadian subreddits. We will do this using python, and a module called praw which provides an interface to the Reddit API.

Then we will generalize the python program to allow us to search any subreddit for any set of words using command line arguments.

The final program can be found here, and an intro to python can be found here.

Setup


The first step is to make sure you have python 3 or higher, and the praw module. If you have python 3, praw can be installed simply by running the following command your shell or command prompt:

$>python -m pip install praw

November 05, 2016

Turbo Press - The Aeropress Pour Over

Most of the projects on this site are created with a cup of coffee immediately in reach, and my favourite way to make coffee is with an Aeropress. This device is sort of a hybrid between French Press, and Espresso. It was also created by Aerobie, inventor of the world famous SuperDisc Frisbee!

There are already hundreds of recipes online, many with a cult like following. Checkout some of the winning recipes from the World Aeropress Competitions, featuring advanced techniques like "the turbulent wiggle". 

After hundreds of experiments of my own, I've abandoned the inverted method for what I call the Turbo Press. This is my favourite way to extract a large cup of coffee with a full bold flavour. 

The Turbo Press

  1. Get a medium to large cup, with a volume of roughly 1.5 Aeropress chambers. 

  2. Fire up the kettle, and freshly grind your beans for a paper filter. In step 8, you should have to push down with the force of an enraged child. If it's too easy, grind finer.

  3. Wet a paper filter and place it in the Aeropress over your cup. Fill with one heaping Aeropress scoop, and  turbulently wiggle your Aeropress so the grinds are flat.

  4. Heaping scoop, fine-ish grind.

November 02, 2016

Simple Python Twitter Bot

Twitter Bots


Twitter has some amazing bot personalities; from celebrity impersonators, to genuinely useful automated announcements. It is also probably the first place anyone was exposed to bots and interacted with them. Some of my favourites are BIGBEN and CaptainMarkov. It is also very easy to make a simple bot, especially if you're familiar with python.

In this post, I'm going to walk you through the creation of Mirror_Bot_1000. Mirror_bot_1000 reads tweets when its username is mentioned, and then makes its own tweet with the mirror image.

It's a great example for the simple interactions with Twitter's API because it requires you to read a message, post a message, and keep track of where you left off. If you want to make your bot more complicated, you just have to modify the decision-making behind the tweets.

The entirety of the code in this example can be found on github here. An intro to python can be found here.

Account Setup


October 30, 2016

Astrophotography Manual Barn Door Tracker

Motivation

After seeing some beautiful photos of the milky way, I wanted to step up my astrophotography game a little bit. In astrophotography, you are limited to shutter speed = 500 / (focal length) before your stars get blurry from the earth's rotation. To get better photos of the night sky, you can use what is called a tracker which allows you to take much longer exposures.

They are also quite expensive, and not particularly complicated. So I decided to try making one myself. The goal was to make it simple, and cheap. In the end, the total was less than $50, and the results have been quite successful.

It was so simple to build in fact, you probably don't even need a guide once you understand the key concepts. So I'll start with the basics of how and why it works, followed by a breakdown of how I built it.

Here is the final product:



and some results:


2.5 minute Milky Way exposure

October 29, 2016

Vice City: Python Automated Sports Betting

Automated Sports Betting


Everyone knows gambling is a great way to make money (/s). I myself formed this conclusion after hearing bookies will sometimes pay out before an event even happens, which planted a betting strategy in my mind that required a bot. This very successfully and slowly lost me my $50 investment, but I had a lot of fun making it, so I thought I would share the project.

If you use this guide, please don't be stupid. Basically nobody comes out on top in the sports betting world. It's not going to be you! So maybe have some fun testing out theories, or let a robot lose money on your favourite sports team, but be prepared to lose any money you deposit in your Pinnacle account.

This is my first tutorial, so if you use this project I'd love to hear how it goes. If you manage to make a lot of money, a donation to Wikipedia would be appreciated.

Now let's get down to the coding. Taking a look at the official API documentation  at this point would be wise as well. All the source code referenced can be found at my github here, along with any future bug fixes. An intro to python can be found here.

In my bot, there are three essential stages.

1. Gather information. (Balance, Odds)
2. Check Criteria. (Find desirable bets)
3. Place bet.