Skip to main content

Ardui-No Thank You

A screenshot of the Arduino IDE


This post requires a bit of background before I jump in.

I'm in a club here at Penn State called the Student Space Program Laboratory (SSPL for short). It's pretty much what it sounds like: a space program for students at Penn State. It's most heavily targeted at aerospace engineering students, but students from other disciplines like mechanical or electrical engineering are more than welcome.

Now, I should make it clear that the club isn't launching Penn State students, or cars, or anything terribly exciting into space; it's mostly just small satellites. But, still, it's pretty darn cool to have anything in space.

But I digress. I'm not actually working on anything this semester that will be shot into space, or even attached to a rocket of an appreciable size. Instead, I'm doing the Student Training Program, or STP. New members of the club are split into groups, and each group designs a payload for a small model rocket. This payload has to measure, record, and transmit various types of data, from acceleration to UV radiation.

It's a pretty simple task, but the point of the STP is less to test ourselves and more to familiarize ourselves with the design process, workflow, and some of the hardware and software used in SSPL. This is also the stage where students determine what skills they can contribute most to SSPL with. The groups (which are usually around six people) split into three or four subgroups each, with each subgroup tackling one component of the problem: software, electronics, housing design, etc.

As it turns out, the skill of mine that is most useful to my group is my programming experience. This came as something of a surprise to me; I'm no CS major, and heck, the C++ class I'm taking this semester is the first formal programming course I've ever taken. But I used an Arduino for a high school engineering project, and that gave me more experience related to programming a flight computer than anybody else in the group.

So, that's what I did this past Sunday: program an Arduino (well, technically a SAMD 21). How was it?

Terrible.

The actual program part wasn't bad at all. All we needed to do was collect, store, and transmit the data at predetermined intervals, and that's almost trivially easy to do with the Arduino IDE. The hard part was the setup code.

See, for most of the dozen or so sensors we plan to use for our payload, some setup code is required: to turn the sensor on, to set the data collection settings, to calibrate the sensor, and so on. Usually, this is as simple as importing a library and copying and pasting some sample code. In this case, not so much.

The most frustrating problem I ran into was an issue between the SPI library (SPI is a communications interface) and the Adafruit Sensor library (Adafruit is an electronics supplier, and this library is a general-purpose library used by most of their sensors). Trying to compile the code gave an error stating that a certain function, SPI, was defined twice, once in each of these libraries.

This seemed like an easy fix: just delete the function from the Adafruit Sensor library, and the problem should be solved. But the function wasn't actually in that library, despite the compiler saying it was. It took me at least a solid half hour of frantic Googling before I realized my mistake: in another section of the code, I initialized a SERCOM (a general-purpose communications port) to use SPI communication, and I called that instance "SPI."

The day was full of little hiccups like this. And my eyes hurt aftwerwards. And, jeez, the coding was just downright boring most of the time. I definitely would not recommend doing this

Comments

  1. Ha, I am not a big fan of messing around with code and programming anything either. I built a 3D printer this semester (like way back before Christmas break) and it just now starting printing anything useful. The code was all messed up and I ran into so many hiccups. However, I'm just grateful that it's working now. As a fellow engineering, I feel your pain. It's about time to pass this part of our projects onto our fellow Comp Sci peers.

    ReplyDelete

Post a Comment

Popular posts from this blog

The Stories We Tell Ourselves

Image Source: Senor Velasco After last week's excursion, I decided to do something a little more mundane this past Sunday: watching TV. I don't exactly have access to cable television, so I decided to rewatch an old favorite of mine, Battlestar Galactica (the new series, not the one from the 1970s). Imagine my surprise when I found out that Netflix didn't have Battlestar Galactica anymore. Or Doctor Who. Or The Addams Family. Dang it. Eventually I settled on BoJack Horseman. It's a Netflix original, and my favorite TV show, and I figured I was due for a rewatch. So that's what I did all Sunday. I suppose I should explain what BoJack Horseman is. Basically, it's an animated show that exists in an alternate Hollywood where humans and anthropomorphic animals coexist (no explanation is given for this). The story follows the life of BoJack Horseman, a washed-up sitcom actor desperately clamoring for the glory days. It starts out seeming like any other subp...

My Eyes!

This past Sunday, I got out of my bed, slid myself between my chair and my desk, picked up the Gamecube controller I keep next to my laptop, and played video games for about 8 hours. Looking back, I was surprised to realize that this actually wasn't something I'd done before; I considered myself quite the avid gamer in high school (I've since scaled back for time and productivity reasons), but the only time I can remember playing video games anywhere near this much was way back in 7th grade, when my brother first introduced me to his Nintendo DS. And at that point in my life, video games were a rare treat, imbued with a magical wonder they've since lost. So, suffice it to say, I expected to be almost as bored at the end of this as I was after 10 hours of homework. In an attempt to stave off the boredom, I chose one of my personal favorites: Donkey Kong Country Returns. It's a 2D platformer, similar to Super Mario Bros, originally for the Wii; I played it on ...

Words, Words, Words

There's nothing quite like cozying up with a good book and a mug of coffee, turning on a reading lamp, and disappearing into a story. That's what I did the Sunday before last, for eight hours. It was decidedly uncozy. It should be said that there were a few circumstances that conspired to make the day a miserable experience. I was rather sleep-deprived; I'd had trouble sleeping the previous night, and I hadn't really slept well for the whole week before that, either. On top of that, I was in the middle of a nasty cold. But these things aren't usually huge problems if I'm doing what I like. And the book I chose was Foundation and Empire by Isaac Asimov, the second book in the Foundation series. I enjoyed the first one quite a bit, so I anticipated that I would like this one, as well. And, at least from the parts I can remember, it was even more enjoyable than the first book (more on that pesky "remembering" thing later). For the first few hou...