Ruby on Rails

Summarized using AI

Saving the World (Literally) with Ruby

Sean Marcia • February 04, 2015 • Earth

In his talk at RubyConf AU 2015, Sean Marcia discusses a unique project aimed at monitoring honeybee hives to understand the causes of their decline. With the alarming statistic that two thirds of honeybee hives have died out in Virginia, Sean presents a solution utilizing Raspberry Pi and Rails technology to track and provide real-time data about hive conditions.

Key Points Discussed:

- Personal Anecdote and Community: Sean shares his childhood experience with bees and highlights the supportive nature of the Ruby community. He credits open-source contributors for enabling developers to pursue their passions.

- Bee Population Decline: He presents data indicating that about 67% of bees have died in Virginia, facing threats from pesticides, mites, and other factors. The global implications of bee population declines affect food production, with 65% of food relying on bee pollination.

- Project Goals: Inspired by Hermann Priya's wish to monitor beehives for temperature and weight, Sean aims to explore simple and cost-effective technology solutions to contribute to bee conservation efforts.

- Technical Implementation: The project employs Raspberry Pi computers powered by solar panels to gather environmental data from the beehives. Sean discusses his creative problem-solving when faced with technical challenges, including a humorous moment involving unconventional materials for probe protection.

- Community Engagement and Fundraising: The project's social media success led to community interest, raising over $12,000 via an Indiegogo campaign. This financial support facilitated expanded research and educational outreach, including teaching sustainable beekeeping practices.

- Technology Overview: Sean details the technical aspects of the setup, using Raspberry Pi with Ruby and Sinatra for data processing and dashboard creation. He emphasizes the accessibility and ease of implementing similar projects for those interested in tech for social good.

- Encouragement to Get Involved: He concludes by urging audience members to participate in projects that address community needs, promoting initiatives like Ruby for Good that connect technology with civic engagement.

In summary, Sean's presentation emphasizes the importance of technology in environmental conservation, encouraging the Ruby community to leverage their skills to make a positive impact. He fosters the message that small projects can lead to significant societal benefits, and encourages attendees to explore engagement opportunities within their local communities.

Saving the World (Literally) with Ruby
Sean Marcia • February 04, 2015 • Earth

RubyConf AU 2015: http://www.rubyconf.org.au

Two thirds of honeybee hives have died out in Virginia. Is it possible for us to devise a way of monitoring beehives in remote locations to find the cause? Enter a raspberry pi + rails. Using a combination of this robust hardware and software solution, we were able to successfully track, monitor and provide real time reporting on the well-being of hives from across the county. Find out how we used ruby, rails, solar panels and other libraries to provide insight into this problem.

RubyConf AU 2015

00:00:00.160 I'm really excited to be here. I love Australia and Melbourne; it is a completely fantastic city. I guess if I had one complaint, it's that I haven't been able to find any truly Australian beer yet. I've been looking for Fosters everywhere but haven't found any. If you can help me out, I would greatly appreciate it. Okay, so yeah, I'm Sean, and I'm going to talk about how I'm saving the world with Ruby. But before I get started, I just want to give a shout-out to the Ruby community, which is probably the best community out there. We all have the jobs we do because of the free work done by open-source contributors who help us find jobs that we love, which is fantastic.
00:00:19.439 If I can just give a shout-out to Sandy Metz, I was talking to her at RubyConf USA in November, and I told Sandy I was coming here to speak. She said, "Sean, you're going to do great," and that’s just Sandy because Sandy is the nicest person in the world. About two hours later, Sandy came running up to me with some stickers that say, "What Would Sean Marcia Do?" I was just blown away that she found the time to make those. It made me realize how much I love this community.
00:00:44.640 In my talk, I'm going to give you a bit of a history of the project, share some information about the technology, and tell you how you can get involved in similar projects. But mostly, I'm going to tell you a story about bees. My story with bees began when I was six years old, back when I loved this sweater. My best friend and I were wandering one day and found a wild beehive. If you know six-year-old boys, you can probably guess what we did: we started throwing rocks at it. For whatever reason, my friend got stung a few dozen times while the bees left me alone. I feel like I owe them a karmic debt for not stinging me.
00:01:27.920 Jumping to today, I work at a university and one day I saw a gentleman named Hermann Priya giving a talk about Amazonian stingerless honey bees. Like all of you, I became a software developer because I like free swag. Since he was giving out honey samples, I thought, 'Oh perfect!' After his talk, I sat down with him because it was really interesting. He told me a lot of fascinating things about bees. One key takeaway is that bees are incredible; they are hard workers. A bee will only live three to six weeks during the honey-gathering stages.
00:02:16.080 However, if it’s not during the honey-gathering season, they can live three to six months. One bee can visit 50,000 flowers in its lifetime and will only gather about 1/12 of a teaspoon of honey. In North America, there are over 4,000 species of bees, and more than 90% of all wildflowers and plants are pollinated by bees. Approximately 65% of our food depends on bees, either because they pollinate the food we eat or the food our food eats.
00:02:48.480 Unfortunately, the bees are dying, which is a serious issue. In North America, about 35% of managed bees have died out, and for wild bees, the situation is even more severe—in some areas, it's 90% dead. In the state where I work, around 67% of the bees have died, but this is not just a North American problem. In the United Kingdom, they predict there will be no bees left by 2018. The situation is particularly alarming in India since their pollination relies heavily on wild honey bees.
00:03:40.000 This brings me back to Hermann. He studies colony collapse, a significant problem, and there are various possible causes: pesticides, mites, genetic factors, but they just don't know for sure. I conducted a little research, and it seems Australian honey bees are facing similar challenges. Although I don’t feel bad anymore about my previous joke about Fosters, I realized I wanted to contribute somehow. After talking to Hermann, he shared that he had a wish list; the first item was money, but I didn’t know any billionaires, so I focused on the second item: monitoring beehives.
00:04:32.000 Afterward, I learned that Hermann had several beehives at George Mason University, located on top of a parking garage. He wanted insights into the temperature and weight both inside and outside the hives. Monitoring the weight of each beehive should yield an increase over the course of the year, and it's fascinating to note that bees maintain a constant internal temperature regardless of the outside conditions.
00:05:03.040 Our first hurdle was that the beehives were open to the elements, and there was no power source. With a very low budget—about $175 to start—we needed something simple to maintain, repair, and cheap to implement. I decided to use solar panels and a deep-cycle battery for power. For the data processing, I opted for Raspberry Pi computers. Many people have Raspberry Pis at home because they buy them with plans for projects and then never use them. I asked friends for their unused Raspberry Pis, and many were excited to contribute since it was all about saving the bees.
00:05:58.000 My value to the project came through my ability to think creatively to solve problems. During the probe installation, I found our initial probe was poorly made, so we had to protect it. After some brainstorming, I approached campus health services for some condoms, thinking I could wrap the probe in one for protection when putting it in the hive. I realized afterward how peculiar it must have looked, entering the health center with rope and duct tape while asking for condoms.
00:07:21.120 For those unfamiliar with MacGyver, he’s a character known for solving problems in unique ways. Although I didn't have a perfect solution, I had a start. Since I had a little server running on a Raspberry Pi, I thought, why not throw in Twitter? Our initial results were humorous, with the bees tweeting images, but we experienced a temperature sensor malfunction.
00:07:54.720 Interestingly, when we tweeted about it, we received inquiries from the public on how to prevent their dogs from eating bees. It turns out many dogs enjoy snacking on bees, regardless of size. If you're familiar with Ruby, you might recognize the acronym that originated in our community, which stands for 'test all the things,' although to be honest, I don't recall what it really stands for. No offense to Brian Lyles, but I believe the real meaning should be 'try awesome things and forget testing.' Forgetting testing can lead to hilarious, yet problematic, situations.
00:08:38.720 One particularly funny mishap involved our beehive tweeting about a temperature spike of 500 degrees. Although it was originally a mistake, it resulted in an explosion of social media attention. It created a buzz, with even the City of Virginia retweeting us. This made people more aware of the Sweet Virginia Foundation—a non-profit dedicated to educating about honey bees.
00:09:39.040 They reached out to assist us. While they did not have funds, they had land throughout Virginia to offer us access. With a little fundraising, we started an Indiegogo campaign, raising more than $12,000, allowing us to fill a class of twelve students in under an hour, with 168 people on the waiting list eager to help.
00:10:39.600 This event also caused another social media explosion. Fraternities and campus magazines featured stories about us, and interest grew. Hermann, who was previously working on the project, leveraged this attention, receiving budget approval. With the newfound resources, Hermann began traveling across Central and South America, teaching beekeeping sustainability to indigenous communities.
00:11:36.400 Now, onto the interesting part: the technology. We utilized Raspberry Pis—not pies—because when you mention pies in the office, people get the wrong idea. Just for scale, here's a Raspberry Pi next to a banana to illustrate its size. Raspberry Pis come equipped with GPIO pins that can connect sensors. If you're considering a similar project, I recommend starting with recommended sensors.
00:12:19.200 The Raspberry Pi is powered by Ruby and Sinatra, as I wanted to keep it simple. I avoided Rails' complexity. Additionally, I ultimately opted for the Dashing gem to create dashboards simply. Using this, we could wirelessly connect to the beehives and monitor various statistics. Overall, we operated with only three cron jobs to manage tasks, such as retrieving temperature and humidity readings.
00:13:01.600 Writing this code simply involved grabbing temperature and humidity data, saving them into CSV files, making them accessible for researchers visiting the hives. The overall code is minimal yet effective. If any of you are interested in diving deeper into the python side, I can share that too.
00:14:41.600 Aside from that, I also utilized Passenger as a web server and various Linux packages to set up a wireless access point. Overall, the system we’ve developed is quite straightforward that I believe anyone here could implement it. I encourage all of you to get involved in similar projects. We sometimes become consumed in the tech bubble, focusing on speed or structure, but the truth is that the rest of the world does not live in that mindset.
00:16:21.120 At my university, I witness daily how many people solve problems by exchanging text files and spreadsheets, especially in the educational sector. They require our help. Entering into projects aligning with your interests, like working with professors in research involving areas you are passionate about, like wine or beer, is easy. Every university has schedules for talks, and professors will generally be eager to discuss their work.
00:17:59.120 In a way, it’s similar to the Ruby community where new Rubyists often want to contribute to open-source projects but don’t know how. Getting involved through these initiatives can be a gateway to open source contribution—a way to connect and learn new things and perhaps to take part in projects that interest you. I'd like to invite you to participate in Ruby for Good this year, where we hack on civic good projects in a university dorm setting.
00:19:07.280 This conference is all about making a difference while learning together. The projects we work on are generally simple, but they serve essential needs like supporting animal shelters and community services that lack funding. Our logo represents a world full of love as it embraces Ruby, and our initials paying homage to Jim Warwick, someone who greatly influenced our community. This is all part of our mission to give back, and I encourage you to connect with me afterward if you’d like to receive one of our stickers.
00:20:18.000 Thank you so much for your time.
Explore all talks recorded at RubyConf AU 2015
+13