How a blinky light helped me like coding


-Alison aka The reluctant coder

I know I should spend more time learning to code. It is an excellent way to solve problems, and if anything I see myself as a problem solver. I’ve had enough interactions with Matlab and Python (and good old Matplotlib) that I know firsthand how a little bit of coding knowledge goes a long way. I find that when I discover a problem where I know a solution involving code will ultimately save time and look more elegant, I find that because the time it would take me to set up said code, debug it, swear at it, and stubborn my way to a solution, could also be used to just solve it some more analog way. Now, if I only want to do something once, making a clunky excel spreadsheet is fine. However, if I want to process multiple datasets the same way, really I know I should just make the code and save future me lots of time. I know I am not alone when I choose to be mean to my future self and choose the more immediate results that come from sticking with what I know.
But I want to share with my fellow reluctant coders, the teachers of code to reluctant students, and the ‘don’t want to touch it with a ten foot pole’ coders. I think we can help reluctant coders be excited about coding with a single-board computer. Raspberry Pi, Arduino and many, many more of these programmable computers are on the market making makers, artists and scientists squee with the possibilities. They come in a range of prices and level of sophistication.


My current love affair with these programmable circuit boards started this semester when one of University at Buffalo’s resident Hydrologists, Chris Lowry, decided to run a course for graduate students (and postdocs who don’t mind spending time as a student still) using Arduino. Our goal is that by the end of the semester we will have all built a working sensor for our own research. As someone who studies destructive processes at volcanoes, and uses dynamite for my experiments, the idea of a sensor that can be lost and replaced without draining our research budget is very appealing. The sensors built on these platforms do not have the precision of high cost sensors with parts from professional tech companies, but they can make up for that in number. Want to know when the local stream level is high? Want to know if a debris flow is moving through a channel? Want to know if the ground is tilted over a specific threshold? All of these things I am promised I can make an Arduino do.
These resistors and wires will help me transform that piece of metal and plastic into a sensor that can be sent out to do dangerous jobs.
So the big picture motivation is one thing. The real reason I am so excited about my programmable sensor-to-be is the instant gratification of programming a responsive three-dimensional object. The very first tutorial that we did is the equivalent of ‘Hello World’ of classic coding tutorials where we make a tiny LED already built into the Arduino light up. Every student in the room exclaimed with satisfaction (and sometimes downright glee) when the board behaved the way they had told it to. Nothing against “Hello World,” but I was never that excited about a screen output. Then we added our own LED to the board and moved from programming to circuitry. Which, for me, is far more approachable. Its physical, rather than a string of characters. My brain is happy to follow wires and resistors, but it is likely to make text on a screen blur. I’ve known for years that I am a lazy typist. I grew up with spell check and a desire to move on to the next cool thing, not proofread my typed text. Now, I do work very hard to proofread what I write, but the best way for me to proofread is to physically print out my text and read it aloud. This is not very efficient when coding. Plus it would annoy all my fellow classmates…
Blink my little Arduino, Blink!
Regardless of your affinity for circuitry, the tangible and rapid response of a blinking light was inspiring. As we made more and more complicated circuits I finally found the motivation to make a more elegant code. The reason was again the circuit board. The little breadboard that comes in Arduino kits is tiny. If you want to have more than one LED or button on the board it gets messy fast. Then, because I wanted a less messy circuit I started wanting a tidy code. Our computer science TA can sleep better knowing that we won’t stop whining when he gives us advice on more elegant codes, but we might listen to him. These single-board computers are mostly open source with lots of tutorial codes and instructions available online so we can start adding complexity to our computers without having to be told to do it. Want your lights to blink out GEOLOGY in Morse code? Of course you can, and its not hard to find out how to do it either.
Buttons and LEDs bring inspiration to those less impressed by a string a text on a string. Use what works, right?
I still have a way to go until this little green piece of plastic and metal becomes something to use in my experiments. But I now know it is possible and reasonable to assume it will be more than just a well-behaved blinking light by November. These boards are a great confidence builder that helps even reluctant coders stick through the troubleshooting and error messages.
Three buttons and three LEDs doing my bidding. As the Kiwis taught me to say, I was chuffed. Though this mess of a breadboard made me want to make both my code and my circuit more organized!
What surprised me the most, is after a class in Arduino making buttons and LEDs do my bidding I started to think about that abandoned Python code. This really isn’t so bad, and I do like the results, maybe I can make that code help me more efficiently analyze crater shapes. I think sneaking programmable single-board computers into classes (at lots of levels) is a great way to move into the coding world, or break down the walls of reluctance that prohibit a lot of scientists from taking advantage of awesome technology and add one more tool to our problem solving kits.

 Now to use my renewed excitement and go see if I can get python to help me work on my craters.
Updated 11:51 am to reduce typos. I promise the typos were not an intentional way to show my point about my inability to see errors in text.

Popular Posts

It's all for you, girl! A message to girls everywhere from the women in volcanology

Agung Volcano Unrest Information

Communicating Volcanoes: Resources for Media

Back in time to Mount St. Helens: News coverage of the 1980 eruption

Volcanic ash is not fluffy & volcanoes don't smoke! Setting the story straight & how to protect yourself.