Integrating physical devices with IOTA — Car-IOTA Part 1

The 12th part in a series of beginner tutorials on integrating physical devices with the IOTA protocol

Hugo Gregersen
Dec 1, 2019 · 8 min read

Introduction

This is the 12th part in a series of beginner tutorials where we explore integrating physical devices with the IOTA protocol. This time we will look at simplifying and automating payments for typical car related services such as parking, toll-road, washing etc. using the IOTA protocol.


The Use Case

In the back of our hotel there is a parking facility available for hotel guests and staff. Lately there have been problems with both authorized and unauthorized people using the parking facility without paying the required parking fees. Our hotel owner believes that this is related to the current manual and complicated process for handling parking fees. If only there was an automated system that could take care of collecting parking fees without bothering his guests or staff. After all, the current situation is loosing him money together with making his guests and staff frustrated. Something must be done.


The components

Before we start looking at the coding for this project, we should take a step back and look at the overall concept and the various components used.


How it works

Before looking at the Python code for this project, lets take a step-by-step look at the events as they unfold when a new car enters the hotel parking lot.

  1. A picture of the license plate area of the car is taken by the camera.
  2. The picture is uploaded to the OpenALPR Cloud service that returns the identified license plate number in the form of a json object.
  3. We convert the license plate number from the json object to a string before searching the Plate/SEED DB for a match.
  4. If a match was found, we return the related IOTA SEED before issuing a value transaction to the tangle, using the returned SEED as sender for the transaction.

Required Software and libraries

Before we start writing our Python code for this project we need to make sure we have all the required software and libraries installed on our Raspberry PI. For this tutorial, besides PyOTA itself, the following libraries are required:
* The PiCamera library (already installed with Raspbian)
* Requests (pip install requests)


The Python Code

And here is the python code for this project..


About the Plate/SEED DB

The python script is looking for the “Plate/SEED DB” in a text file called plates.csv located in the home directory on your PI. Make sure you update this file with your plate numbers and SEED’s before running the project. You will find an example of how the plates.csv file should be structured here.


Running the project

To run the the project, you first need to save the scrip from the previous section as text files on your computer.


Whats next?

While the solution proposed in this tutorial might work for some local use-cases. For other use-cases, the concept of a centralized entity (in this case the hotel owner) controlling the SEEDS would not be practical or acceptable. For a truly global and decentralized solution we probably need to take a different approach. More about that next time.


Contributions

If you would like to make any contributions to this tutorial you will find a Github repository here.


Donations

If you like this tutorial and want me to continue making others, feel free to make a small donation to the IOTA address shown below.

Coinmonks

Coinmonks is a non-profit Crypto educational publication. Follow us on Twitter @coinmonks Our other project — https://coincodecap.com

Hugo Gregersen

Written by

Coinmonks

Coinmonks

Coinmonks is a non-profit Crypto educational publication. Follow us on Twitter @coinmonks Our other project — https://coincodecap.com

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade