Instead of playing Halo, I've been having fun with 343's public Halo 5 API. There's a remarkable amount of information that you are able to pull from them; I'm quite surprised.
This is my first time doing anything like this so, since I'm already familiar with it, I used R and Shiny to throw together a little dashboard to let you view basic arena statistics. I might add more functionality but probably nothing serious unless it gets crazy popular for some reason. More importantly, to go along with the Shiny app, I'm working on a nice R package to allow others easy access to 343's generous amount of game data. Hopefully I'll be able to finish it up with a couple weeks and get it uploaded to CRAN or github at the very least.
I was really hoping I could do a heatmap of where most deaths occur in each level. Kind of like was Bungie did for Halo 2. Unfortunately I didn't see any of that data available through the API but maybe in the future.
R package to access the API is now up on my github!
I2C and the ADXL345 on Raspberry Pi
2015-04-06 05:43:10
Still mucking around with the Raspberry Pi, I wanted to dip my toes into using the I2C bus to interface with sensors. The sensor I'm going to use to demonstrate here is the ADXL345 accelerometer from Analog Devices. It actually supports I2C or SPI but the RPi only allows 1 SPI device so I wanted to use I2C instead.
To enable I2C on the Raspberry Pi I followed this tutorial.
Hooking up the sensor is simple enough. Power (3.3v), ground, and the two I2C connections: SDA (data) and SCL (clock). However in addition to these 4 connections the sensor needs 2 additional connections. The pin labeled CS goes to power (3.3v) and the pin labeled SDO goes to ground. This is needed to put the sensor into I2C mode instead of SPI.
Now comes the fun part, interfacing with the sensor. For this we will refer to data sheet available here. Looking at the register chart, there are a few things we need to set up before we can actually get data from the sensor.
First we enable i2c; set the address of the sensor, the ADXL345 has address 0x53; and set the clock divider, 2500 gives use a clock frequency of 100kHz which is standard for I2C.
Next we need to write to the POWER_CTL register located at 0x2D. We write 0x08 to it which enables the measurment mode on the ADXL345. Disabling the measurment bit would put the sensor into standby mode. Standby mode powers up the sensor but won't take measurements. This would be useful in a situation where power conservation was an issue.
Finally we must tell the sensor what type of data we want. Writing 0x0B to the DATA_FORMAT register located at 0x31 means we want to use the full resolution of 13-bits with a g range of +/-16g. There are several different ranges to choose from (2, 4, 8, 16) but choosing anything else limits the number of bits to 10 instead of 13. And more bits is always better.
Check out the register descriptions in the data sheet and you will get a much better understanding of what I just described above.
Now that all the initialization is out of the way it's time to actually get from readings from the sensor. The readings are stored in 6 bytes starting at 0x32. There are 2 bytes for each axis. It looks something like this: DATAX0 - DATAX1 - DATAY0 - DATAY1 - DATAZ0 - DATAZ1 Where DATAx0 has the least significant bits and DATAx1 has the most significant bits. It's important to do a single read of all the registers to minimize any change in the data that might happen between reads.
So combine the bytes and we've got a result from the sensor. Since we're using full resolution mode we will get a range of -4096 to 4095 for each axis and dividing the result by 256 gives the G value. If the sensor is lying flat on a table it should read 1G in the z-axis due to gravity.
And that's pretty much it. Now you can interface with I2C devices from your Raspberry Pi! I wrote a simple program with will flash an LED whenever there is more than a G in either X-axis direction that I hope illustrates what I've explained here.
http://notez.ca/downloads/accel.c (I've since stopped paying for a server so the file is no longer available. Email me if you are interested to see the code)
Raspberry Pi Online Weather Station
2015-03-29 08:20:10
I've recently been given a Raspberry Pi and have been trying to come up with a good idea about what to do with it. I eventually decided on a Raspberry Pi powered weather station.
The idea is use the experience building the weather station to expand my knowledge in programming, electronics, meteorology, and data collection.
So far all I have is a small temperature sensor set up that takes a reading every 5 minutes. I'm looking to soon add an anemometer (wind speed sensor), and precipitation sensor. The readings from the Raspberry Pi are uploaded to my database where I use R Shiny to pull the data and present it on a webpage. With more data shiny makes it super easy to come up with interesting statistics and graphs.
Raspberry Pi Code:
http://notez.ca/downloads/temperature.zip (I've since stopped paying for my own server so both links will no longer work. If you interested in the code for either please email me)
Notez - A Dumb Notes App
2014-09-22 15:01:10
I decided to brush up on my SQL so I've started a simple little notes app that I call 'Notez'. Once I get the web version running the way I want my idea is to make a native iPhone app to access the same database. This way you'll be able to do neat things like add alarms and notifications to notes to remind you about things.
It's very simple right now and I have no way for users to create accounts so you can login with email 'public' and no password to try it and see what others have written.
http://notez.ca (I've since stopped paying for my own server so the link is now dead.)
Dreamcast Collection Spreadsheet
2013-10-11 12:08:10
This is a simple spreadsheet to keep track of your collection of Dreamcast games. It contain a list of every North American release, independent release, and a few European releases that never made it to North America. You can set whether you own each game or not, leave a note regarding its quality, and it will automatically count them to let you know how many games you have in your collection and how many you are missing. There is even a second spreadsheet to keep track of official hardware that you own, in case you are trying to collect all the hardware as well.
This blog is intended as written documentation of my ongoing side-projects. Most everything here is likely to be programming or data related, although something else may creep in every now and then.
This blog itself is an example of a personal project of mine. It was written entirely from scratch in C with SQLite3. It's also hosted on a Raspberry Pi.