Next to my hackathon series, the most read series on Our Code was #MarchIsForMakers, where I offered an introduction to microcontrollers and wearable projects for newbies. Due to the success of that series, I made a mental note to do more posts about computer hardware, specifically microcontrollers such as the Arduino and Raspberry Pi. What I love about microcontrollers is that they are essentially micro PCs that can be programmed using Ruby (with Artoo or the SerialPort gem) and Python. Things you can make with microcontrollers, such as heart monitors, small robots, drones, and casual wearables have caused an uptick in Internet of Things (#IoT) programmers and tinkerers.
Fellow coder and Our Code reader, Andrea, has been using RaspPi to create a video tracking project. I thought it would be great to showcase her project for others who want to follow along and learn more about RaspPi’s capabilities. She politely agreed. Here’s Part I in Andrea’s Raspberry Pi Adventures.
I’ve been really excited about one of my personal projects for the past couple of weeks, but haven’t wanted to say too much in case it wasn’t going to be feasible for whatever reason.
My project: I’m a bit of a windowsill gardener, and I thought it would be pretty cool to create a time lapse video tracking the growth of a couple of my plants. A combination of confidence in my green thumb (courtesy of one of my friends) and too much time spent on Pinterest has resulted in a pineapple plant growing in my living room. We go through a lot of pineapples at my day job (working in a hotel), so sourcing one wasn’t hard. I just cut off the top of the pineapple, cut away all of the flesh from the stem, peeled away some leaves and trimmed away until I could see some of the roots. At that point the pineapple stem was placed in a jar of water. The remaining leaves stick out and sit on the edge of the jar, keeping the stem from going too far into the glass. The stem sits in the water for a few weeks while the roots grow, and once they’ve reached a few inches in length I moved the stem to a plant pot with soil. Slowly new leaves start to grow, and I’m at this point with my pineapple now.
The logistics: I decided to use a Raspberry Pi for this project. It’s an extremely cool, adaptable microcomputer, and you can learn more about it from their official site. I’ve been wanting to play around with one of these for a while, and this was the perfect opportunity! I was originally planning on using a wifi adapter to send the images (taken two or three times each day) directly to cloud storage, but in the interest of power consumption I’m just going to be saving the images to the Pi, and harvesting them weekly. Looking at power- power supply is cited as an source in a lot of online posts about Raspberry Pi issues, so I was happy to see that my power supply and cable did supply adequate power. The Pi makes this obvious by displaying a rainbow-coloured square in the upper right corner of the display if it isn’t receiving what it deems to be enough power.
Since I’m planning on having the Pi on a window sill, and would like it to still be fairly discreet, I’m actually going to try using a power bank to power the Pi. Ideally, I would like the Pi to send me a notification (perhaps via Bluetooth, or over the internet) when the power drops below a certain level, but that may be slightly beyond me for the time being. I’m currently testing my power bank to see how long it can supply power for before it needs recharging.
A few weeks ago I ordered a Raspberry Pi B+, along with the camera module, and last week ordered a micro SD card, mount for the camera, and a case for the Pi itself.
Initially, I had hoped to set up the Pi using SSH, but I got a bit frustrated after a few failed connection messages, so picked up an HDMI cable this week, and set up the Pi using a television for a monitor, and a controller that we have for one of our other devices. Suddenly I was making great headway! It took a few tries, but I set up the camera and wrote the command to take a photo and save the file to a certain directory, and then edited the crontab file so that the script runs three times each day.
This is the point that I’m at, so tonight when I get home from work I’ll see if the Pi is still running and on my next day off, or when I next have time, I’ll connect it back up to the telly so I can see how many photos were taken, also helping me figure out exactly how long the power pack will last.
It’s also worth noting that everything here was bought separately- you can buy kits, but I wanted these specific cases: the one for the Pi itself, and that particular one for the camera.
I’d love to hear from anyone who has used a Raspberry Pi before! They seem really versatile, and I’ve been reading about some of the really creative things people have been doing with them!
Stay tuned to read more about Andrea’s RaspPi project. I will be posting any followups here in the future.
A Kulbaba: When she’s not playing with sugar or getting covered in chocolate in my day job as a pastry chef, she’s busy with all sorts of geekery! Andrea blogs mainly about learning to be a front-end web developer, and her tinkerings with a raspberry pi. Follow her on Twitter @AKulbaba and read her blog Part Timer here.