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 ...

Yawn

Source: Catriona Ward I made a point last week of getting a decent amount of sleep each night. I didn't quite get eight hours a night, but I came pretty close. This was partly because I wanted to improve my sleep schedule, but it was also partly because, over the weekend, I decided that I was going to stay awake for 40 hours straight. Now, I'd pulled all-nighters before. I knew what it meant to stay up into the wee hours of the morning. But every time I did that, I would get to sleep pretty quickly the day after. Before this past weekend, I don't think I'd ever stayed up for more than maybe 20 hours at a time. Oh, before I really begin, I should tell you: please don't do this. It's not good for you. Get some sleep! So, I woke up at around 8 AM on Saturday, and I spent the day doing, well, not much of anything. Most of my friends had gone home over the weekend, so I spent the day mostly just hanging out. I'd read a book, play some video games, check...