Home

Aaron Tan's Blog

09 Dec 2017

December status report

Wow. It’s been a month since I last posted to this blog. It feels like an eternity. A month of classes has happened since the last time I posted, which means it’s been almost a third of the semester’s worth of experiences that I haven’t written about. So let’s go!


Forget it, Paul Ward. It’s ECE150.

ECE150 has been a sort of large train wreck, and that comes in two parts: Marmoset and the project.

Marmoset

Marmoset is the automatic grader - you submit your code to the server, and it gets run through tests that the TAs wrote then tells you what tests you passed or failed. There are public tests, which are unlimited submissions, but there are also release tests, two which you can submit three times over the course of twelve hours, and secret tests, that the TAs don’t tell you about. Assignments are worth 25% of the final grade, so it makes sense to want to get most, if not all, of the marks on them.

My issues with ECE150 stem not from the public tests: those are, for the most part, fine. However, I would really like to see what inputs they put in when the test fails, so that I can actually fix the problems. (For example, sometimes it just tells you “Expected value: 2.12222455. Your value: 20.4224.” I can’t really fix it because I don’t know what they’re entering as input values to get that in the first place!)

What really grinds my gears are the release tests. During the later assignments in particular, the release tests began to become murderous to a point where most of my weekends went to feeding the Marmoset and subsequently becoming marmo-upset. The issues with release tests are twofold: a) most of them test edge cases that aren’t specified in the original assignment, so it becomes a game of whack-a-mole and Piazza hunting, and b) there are so many of them (on assignment 7, there were 9 public tests but 19 (!) release tests). Compounding this is that you can only see the first two release tests that you failed - so if you failed 9 of the 19 release tests of Assignment 7, too bad! You only get to see the names of the first two. The rest are left as exercises to the reader.

I wonder how anybody still has their sanity after working on these assignments.

alt marmo-upset.png

The Project

For us, this was mostly self-inflicted, I will give that. But it shouldn’t have been this hard to do. We were given an Onion Omega2 and told to “impress the TAs”. Our idea for the project was to line the spokes of an umbrella with some Neopixel LEDs and set their colour and intensity based on accelerometer readings. Sounds basic, right? It ended up taking literally over 100 hours to work.

A series of unfortunate events starts from here: the first accelerometer we bought ended up being just the chip itself, without a breakout board. We thought we were getting something like this - reasonably sized, actually useable. What we ended up receiving was this thing:

alt

Yep. That black square. One-tenth the size of my fingernail. It has nine pins on it that we need to connect to in order to get any data.

We thought, “OK it can’t be that bad maybe we can get a breakout board for it.” We went to Digikey. Breakout board cost $8. Not bad. Shipping cost $44. Very bad. We can’t afford that.

So fine. We can’t use that accelerometer. At this point, we basically don’t have any hardware, so I try to work on the software. Setting up the virtual machine and cross-compiler was a nightmare. A Doctor Strange-Dormammu “I’ve come to install Ubuntu” type of time loop. First, the make menuconfig would fail. Then, the entire virtual machine would get irrecoverably corrupted and have to be set up again. Then, the cross-compiler wouldn’t locate python.h. Then the libraries got misplaced by the compiler. I couldn’t get the example code, provided by Onion themselves, to compile.

I spent 12 hours getting that thing to work. Then I gave up and got a TA to help. He got it working on my MacBook and I didn’t turn it off for the next two weeks out of fear of having the virtual machine die on me again.

Also, the process for putting software on the Omega2 makes me want to bash my head into the wall. First, I upload my code to Google Drive. Then, I download the code on the virtual machine. I drag it into the right folder, organize and fix it up a bit. I modify the makefile provided to us by the TA to get it to compile. Once it compiles (which it doesn’t always do!), I get an executable. I upload that executable to Google Drive again. Then I download it using my actual computer, load it on a USB 2.0 stick (because all the USB 3.0 sticks don’t work on the Omega2!), plug it in to the Omega dock. Once it’s snug and tight, I fire up PuTTY and SSH into root, mount the USB drive, and run the code.

That entire workflow, every time I make a change in the code that I need to test.

Hello wall, this is my forehead. It would like to meet you at high velocities.

Now back to hardware: thankfully, Austin Jiang had a car (bless that guy honestly) and was in Toronto. So we made him buy us a gyroscope and an accelerometer (We paid him back, of course. We’re not animals.). The Omega2 is hair-tearingly difficult to work with, and Lily had an Arduino lying around, so we test the accelerometer using some sample code that was confirmed working by somebody else.

The accelerometer is dead on arrival. We set up the circuit correctly (as verified by the hardware deity Kash Pirani), we tried different wires and a different breadboard (maybe it’s just a broken resistor?), and we even bought a multimeter to verify that there was current flowing through the circuit.

It’s just dead.

Great. So we turn to the gyroscope. The gyroscope also doesn’t work… at first. We’re using SPI to try to communicate with the gyroscope. Because the gyroscope is also compatible with I2C, we try using that.

IT WORKS.

SPI is a lie. SPI doesn’t exist. It is most certainly not moist and delicious.

Now we hook it up to the Omega2. AND MY CODE WORKS. FIRST TIME.

HALLELUJAH PRAISE BE.

We are so excited! One half of the project is basically done - we can read x, y, and z tilt and have the Omega communicate with it. Awesome. So we decide to solder some header pins onto it, so that we can better mount it on the breadboard and securely connect it to the Arduino Dock that our Omega is sitting in.

Some of the molten solder flies up and lands directly on one of the chips. This kills the gyroscope.

alt That little shiny part above the IC-265 isn’t supposed to be there

Throughout all of this, Hengcheng has been a champ and soldering a lot of stuff (Lily too actually.) We now have a a few strands of Neopixels that we’ve verified are working with Strandtest on the Arduino, so we want to see whether we can control them from the Omega2. There’s a C++ Neopixel library for the Omega2, so we thought it would be easy.

It was not easy. Compilation with the C++ library failed because the neopixel.h required module.h, which in turn required five other header files, which in turn required more… It was exponential growth with dependencies. So we can’t use the Neopixel library. Fine. There’s a version that should work with C - conveniently called neopixel_Cwrapper.h. So I write some more code! And it compiles (with a warning that some files couldn’t be found)! And it doesn’t work either. Next, we try implementing the functions directly. Maybe if we do the I2C communication it’ll be better…? Nope. Doesn’t work. None of it works. The Neopixels, we assume, can’t actually be controlled directly by the Omega2. And remember - every time we compile something, we have to go through that entire process of uploading through Google Drive, compiling, getting it on the USB stick, SSH’ing into the Omega…

60+ hours in, all nighters pulled, and we’re back to square one. That’s not even including the gas that we made Austin use up. At this point, there is less than a week before we need to present this project to the TAs. And like all of the assignments, this project is worth 25% of our final grade. We have nothing. There is no software. The hardware doesn’t work.

This is basically when I hit the lowest point. I woke up on the 29th of November at 8:30, thinking I was going to work on the ECE150 project. Then I thought about it and went back to sleep. Woke up at 11:00 again, watched the Infinity War trailer, and tried to clean up my room but then dropped a glove and started ugly crying because I thought that nothing was going to work. That was a bad day.

This also happens to be why I haven’t written for this blog for a long time. Because for a while, all of my free time was being taken up by ECE150. Anyway, back to the story.

Saturday rolls around, and it’s T-minus 2 days. Austin drives Lily to Kitchener and we buy a new accelerometer. This time, we buy two, because we no longer trust Hengcheng’s soldering skills. We test it with the Arduino over SPI. It doesn’t work. Remembering the gyroscope, we try using I2C. It works. SPI is a lie. I2C forever.

I write some code for it. And it works.

Now, we don’t try to solder it again. We wait until we can use some better soldering irons that are available in the E5 building. Variable temperatures! Tips that aren’t completely wrecked! Amazing! Meanwhile, Hengcheng is dutifully working hard on making more strands so we can cover the umbrella.

The Neopixels still refuse to be connected over via the Omega2, so we post on Piazza to see if some other groups got them working. Nobody uses the same lights. The responses are unhelpful because they suggest things that we’ve already tried. We call it a day.

Sunday. T-minus 1 day. A nice new day. We stumble upon a post hidden away in the confines of the Onion forums that tells us how somebody figured out how to turn on and off the light on the Arduino dock using I2C. We extrapolate. We write some garbage code. We succeed in sending data from the Omega2 to the Arduino dock, and have the Arduino dock read it. The code is a horrible hack that abuses the I2C library on the Omega2, but it works. The function we call is supposed to be ([device number] [device address] [data register] [data] [number bytes to read]) but we end up calling it like this: ([device number] [device address] [data] [0x01] [0]); instead of writing data to the data register, we write nothing and the data register itself is the data.

Whatever. It works.

It all works.

We’re done.

It’s been more than a hundred hours.

We’re all done.

alt Happy parents after birth of child, 2017, colourized


Other school stuff

I’m really enjoying linear algebra. I can’t really explain it. I like grids of numbers, I guess?

Physics has been a lot more intuitive after the midterm. I hope that the final is easier than some of the quizzes that we’ve had!

Chemistry has gotten harder, since we’ve started covering things that weren’t covered in high school. Also, the final exam being 25 multiple choice questions is a little bit killer :(

Calculus has been a struggle, but the final was made up of a lot of past final questions, so I hope I did well. It’s never really been a strong suit of mine.

Most of the people I know in Stream 4 have a job now too! Andrew is going to Health Canada, Ryan is doing some fun C# robot stuff, and Clement has this thing with Tucows. Also, Stephen is going off to SAP, which sounds very interesting!

On the less good side, I’ve literally done nothing in Watsat this term. The CDH team has been waiting for the PCB so that we can work on the software, but it still hasn’t arrived. Might consider joining another design team so I can actually develop skills a little bit more.


Non-school things

On Black Friday, I bought a Google Home Mini and some Hue Lights. It’s super cool! I can say things like “OK Google, tamise les lumières” and the lights will dim. Plus, I have three assistants to talk to in my room now: Google Assistant, Siri, and Cortana! (Alexa will never pollute this beautiful Google-Apple-Microsoft trinity). I can also control the lights from the phone (Homekit) and my Pebble (using Snowy and IFTTT), and sync them up with what’s playing on Spotify using iLightShow. Pretty neat stuff! Home automation is so cool, but it needs a better name. Like French. Where it’s just called “la domotique”.

I started playing Twilight Struggle on Steam. It’s really well done for a PC port of a board game! I recommend this if you enjoy history, board games, and turn-based strategy, in reverse order.


Anyway, that about it for now. Still got a bunch of finals to write before the winter holidays, then it’s off to starting a job. My first real developer job! I’m really looking forward to it.

aaron at 23:39

footer