MIR Raport by Bo Wolters

From MDD wiki
Jump to navigation Jump to search


Pecha Kucha Slides: https://docs.google.com/presentation/d/1gUh7OetOVi5qY7y509KAMme1DvZcO-K8RDMcJ1uN0t0/edit?usp=sharing

When given the chance to freely explore new technologies, this is always something you should definitely go for. Before starting this Master I already had certain goals in my mind which I wanted to achieve. One of which is getting a bit more into tech related products and see how they work, instead of just designing for them and seeing someone else do all the magic. This is why I had chosen to start exploring the use of a Raspberry Pi as there is plenty of information around to get me started.

In summary, the 1st project during the master we had been working on required us to get coffee drinkers to reuse their coffee cups for a more sustainable approach of using these cups. During this project we tried introducing a mobile application that would motivate people to reuse their cup while the app keeps track of their cup(a QR-Code was printed on the cup itself) and rewards them for reuses.

This is where the problem lied, introducing an app. We noticed that in order to make this work, we shouldn't mess around too much with the current habit/sequence of coffee drinkers while they're getting coffee. So we came up with a different strategy: hands free coffee cup scanning that used a Raspberry Pi to do all the work for us and send and store data in a web application that runs on the side.

Now that you know what, why, and how, check out this simple overview of how the set-up functions:


Getting started with the Pi

Funny fact, as soon as I got the Raspberry Pi to boot I was shocked. My understanding was that this was something external that would be linked to your own laptop, and then from your own laptop you were able to work with and push to the Raspberry Pi. This wasn't true. The Pi is a whole computer on it's own that runs it's own operating software: Raspian (linux based).

Installing the necessary packages

The first task when the Pi was up and running was to install all the needed Python and OpenCV packages to run the QR-Code scanner and import them within the script. OpenCV is a code package that's used to fire up the attached camera Pi camera and makes it useable in your own script. I had used a boilerplate script from [www.hackster.io](http://www.hackster.io) that was already able to recognize and read the data from QR-Codes. ***By the way; installing this while having 0 to some knowledge about it was hell and as of yet, I do not have any advice on how to make this easier. Basically just trial and error and hoping stuff works at some point.

Modifying the QR-Scanner script

The boilerplate script I was using was very limited. I needed it to do much more than just print out data that it was able to find inside of a QR-Code. So I wrote a little code that made the scanner only accept and print data from QR-Codes that had a certain #ID attached to it, and ignore the others.

After having the scanner ready to only scan certain QR-Codes I needed to add more. The data had to go somewhere, but how???

Enter: Integromat Webhooks

By installing the Requests package I was able to push data in a JSON-format over wi-fi connection to a web application called Integromat that was hooked up to the script. I modified the script to wrap the content that was read from the QR-Code in a JSON-format which was then pushed into Integromat.

Integromat has some amazing automation features and let's you link and set-up many different every day applications that you use. Such as Google Spreadsheets.


Enter: Google Spreadsheets

I needed a database, to hold the data that was read from the QR-Codes. Google Spreadsheets had a very nice integration in Integromat so it was easy to set-up. The idea was that after saving the data somewhere I would be able to then retrieve the data again with an API connection through my Bubble.io web application that was designed and made to run on the side next to the coffee machine.


Enter: Bubble.io Web Application

So to all my fellow no-coders out there: Bubble is tha bomb. Everything has it's limits, but being able to produce working applications that can actually do stuff??? It's a nice feeling.

Bubble.io let's you make apps pretty much without any coding experience, although you NEED to have a good understanding of how stuff works in a technical way. You are still moving data around, pushing and pulling, updating, reading, sorting, and all that kind off stuff. Luckily I did have an understanding in this, so it was ok for me to figure out how to make something in Bubble.io.

Basically my Bubble.io app was also linked through Integromat to the Google Spreadsheets database and every time a QR-Code was scanned, this was added to the spreadsheet. My Bubble.io app had great senses so it sensed every time a row was added to the spreadsheet and would grab the data from that row and save it in it's own database inside of the app.

Every time the web app retrieved and added a new scanned cup to the database, the app would start rolling. The user is taken through a couple of screens in which they eventually come up to the central idea of the app: a Wheel of Fortune. It was at this point that the user would have a chance to win a prize each time they reused their cup. After they had either received a prize or not, the app would reset itself. Ready for the next cup.


Notes from the author

Achieving all this took a lot of effort as it was a first time for most of the whole process. Nevertheless, every TINY step forward during this process felt like the biggest win in the world. Until the point where the entire prototype, on the Raspberry Pi end only (luckily), died. The SD card that was running the Raspberry Pi had gone to a better place, but took all of my data and scripts with it.

So I had to start over, two days before the deadline! I managed to do everything in one day, the first time this took me an entire week so I was quite happy. Eventually I got everything running again and the most important insight for me was: create backups.