Published On 2019-09-16

Car Wallet Pays for Parking Using IOTA (Machine to Machine)

A proof of concept for direct machine to machine micropayments w/o human interaction using distributed ledger-based technology, IOTA Tangle.

Problem Statement

In the United States alone we waste $73 billions every year to look for parking slot. In Germany on an average one driver spends 48 hours every year searching for parking. This is just the waste of gasoline and diesel in terms of money. Now think about the CO2 produced by this extra usage of fuel.

According to ABI research, 8 millions self driving cars will hit the road by 2025.

Keeping Sustainable Development Growth (SDG) in mind and changing model of how tomorrow's auto industry will evolve, we need an efficient, faster and secured way to look for parking spot as well as a mechanism for the cars to make parking transactions without any human interaction. Yes, we need machine to machine money transfer!

Solution

We have built a prototype on IOTA platform. IOTA is a distributed ledger based open source network, which is ideal fit for secured and trusted micro-payments. Unlike other blockchain networks such as Ethereum, there is no transaction fees (mining fees) in IOTA.

Parking spot will be equipped with IOTA wallet, an ultrasonic sensor and camera. Basically a Raspberry Pi with internet access. Each parking device will have a unique device ID which will configured in the code during provisioning of the device. The device will be registered by parking owner by a mobile app providing the unique device ID, desired parking fees in IOTA, geolocation and seed. This data will be stored securely in the cloud backend application. When the device is booted first time after registration process is completed, backend application will generate two IOTA addresses - receiving address and spending address. These two addresses and the seed will be sent to the device and stored.

On the other hand, cars will be equipped with wallet same as parking device. We have used a Raspberry Pi Zero for this because of smaller size. Each of this car devices will be assigned unique device ID as well. Car owner will register the device through a mobile app providing unique device ID, license plate number and seed. Same as parking device, during first boot after registration, backend application will generate two addresses and send to the car device.

Applications and Components

So the entire system has five components or applications.

  • Parking device (A Raspberry Pi with Camera, ultrasonic sensor and traffic LEDs)

  • Car device (A Raspberry Pi Zero )

  • Parking owner mobile app

  • Car owner mobile app

  • Backend service for managing device registration and users

How the Entire System Works

A car owner is looking for a parking. He will open the car owner app on his mobile, find available parking near him and drive to the parking location.

Ultrasonic sensor will sense for any object and capture an image of front of the car including license plate. Device then extract the license plate number from the image. We have used cloud based license plate recognition API https://www.openalpr.com/cloud-api.html. Once license plate is recognized, device makes payment request to the backend service passing it's unique device ID and license plate number. At the same time device will publish a message to Marked Authenticated Messaging (MAM) network in restricted mode with side key as device ID. Device also publish a message to the MQTT server indicating parking is occupied which is updated in realtime on mobile app preventing other car owners to see that as available and waste their fuel.

Backend service validates the request and send a zero value with message transaction to the receiving address of the car device. The message contains the receiving address of the parking device and parking fees. This message is encrypted and can only be decrypted by the target car device ID.

Car device listens for any incoming transaction at the receiving address. Once it receives the transaction, it gets decrypted using the device ID and sends a valued transaction to IOTA tangle for the receiving address of the parking device. At the same time it published a restricted message to MAM for any future audit purpose.

Parking device also listens for any incoming valued transaction at the receiving address. When parking device receives the payment, it updates the balance.

How to Recreate This Prototype

In addition to the hardware components we listed under "Things", you need to install NodeJS ( 8 or higher), Python3 on your Raspberry Pi.

You can run the backend service on your computer or deploy to any cloud such as AWS or Azure. If you are running your service on you local computer, you need to make sure Raspberry Pi can connect to the backend service. I have used Ngrok to tunnel local port 5000 to the internet. Setup of Ngrok is super simple. All you need to do is download the executable on your computer. Visit https://ngrok.com/ for instructions.

./ngrok http 5000

To keep it simple, you can run the mobile applications on your browser instead of deploying to your phone. You need to install latest version of IONIC framework on your computer. Installation is again super simple with one line npm command. Assuming you have nodejs and npm installed on your computer.

npm install -g ionic

For further study about ionic framework, visit https://ionicframework.com/getting-started

Here is what I have installed on my computer.

Once you have all the software installed on your computer, clone the github repository on your computer.

git clone https://github.com/just4give/smart-parking-iota.git && cd smart-parking-iota

You will see five folders as below.

Impact on Sustainable Development Goals

We believe when this prototype will roll out in the market, it will have serious impact on 9th and 13th SDGs. This innovation will open up a door for today's self-driving ( event semi self-driving, auto parking featured cars) and electronic cars industry enabling cars to pay. This concept is not simply limited to parking payments, it can be leveraged for all sort of money transactions such as tolls, vehicle services, car wash are just few use cases.

Apart from impact on industrial innovation, this will reduce waste of fuel due to parking significantly. As the available parking spots will be updated in real time, drivers can quickly find nearby available parking spot saving lot of fuel and time. Less use of fuel = less CO2 = Greener Environment!

Schematics

Checkout the full article on Hackster