Hackathon on autonomous IoT transactions
With the Hackatrain 2019 coming up, we saw a nice opportunity to get prepared by hosting our own software/IoT hackathon. Since this years’ Hackatrain is all about autonomous and mobility, we wanted to already investigate one of these topics more into detail: autonomous.
Autonomous to us means: automation. With many connected devices on the market nowadays, many opportunities for automation arise. One of these opportunities is allowing devices to autonomously make transactions on behalf of you. In short: enabling autonomous transactions by IoT. To give a practical example, you could think of authorizing your electric car to pay for charging or even allowing your car to make its own parking transactions. There are plenty of interesting scenarios to think of, so enough reason to start exploring.
Let’s get to the challenge
This brought us to our challenge for this hackathon: authorize and configure an IoT device to make autonomous transactions by means of the FINN ‘banking of things’ platform. As inspiration, we used a coffee machine example: let your coffee machine order new coffee beans when it notices that you are almost out. Here, there is a clear trigger (detecting a low amount of beans) and a resulting action (ordering new beans). For this hackathon we wanted participants to scan a QR code with their IoT device (as the trigger) and send a notification to the FINN mobile application (as the action).
What do we need to start hacking?
The main requirement for exploring this challenge is of course a device to perform autonomous transactions. Participants in this case could use our Raspberry Pi as their own programmable IoT device. Combining this with the FINN platform, which served as a transaction tool, we got the key ingredients set. Connecting the Raspberry Pi to a screen, mouse, keyboard and camera, the hackers were ready to go.
The Raspberry Pi serving as programmable IoT device
Let’s get going!
Looking at the challenge and the given resources, the following steps had to be performed: register the IoT device on the FINN platform (connect your IoT device), create actionable triggers for the device (determine when the transaction takes place) and authenticate to act on these triggers (autonomously make the transaction). A 15-minute task? Of course not; we’re in a hackathon and software challenges are never as easy as they seem at first.
After registration to the FINN platform and downloading their mobile application, the IoT device had to be connected to FINN. Read: set up a local server on the Raspberry Pi, serving as a pass-through gate for requests towards the FINN server. With the connection established, the participants started working on scanning the QR code with the final goal of triggering the FINN notification in mind.
Scanning the QR code with the Raspberry Pi camera
Participants had to construct a Python script to scan the QR code. While we expected teams to do real-time image processing by means of Open CV tracking, they came up with a much easier alternative: taking a picture of the QR code and scanning it afterwards using the PyZBar package. A simple, effective, and fast solution. At this point the only thing left to do was implementing this into a Python script; a piece of cake for our competing teams. A few minutes later they made the request: the QR code got scanned, the trigger was sent, and notification was received; challenge solved!
Challenged solved! Or…
Nevertheless, the competing teams were in the hacking flow and continued hacking beyond the initial goal of the challenge. They started working together and tried to connect two IoT devices so that when one’s action is triggered the other device’s server is contacted to also trigger an action. This could help in a scenario where the coffee machine notices that cappuccino milk is consumed faster than usual and decides to notify the fridge to order extra milk.
Although the participants ran out of time eventually to get this additional IoT-chain working, we were glad to see that they enjoyed it and kept on hacking even though they already reached their initial goal. Curious about the challenge and like to try it yourself? Get yourself a Raspberry Pi and start hacking with the FINN platform. Good luck!