.
Overview.
Here in Malaysia, a road user can pay the toll system with cash, Touch n Go card, Touch n Go e-wallet and Smart Tag. With IOTA, there is a new possible way to pay for the toll fare. In this project, I am implementing a proof-of-concept (PoC) for the IOTA based payment channel for toll system. It will be a simple and rough implementation.
Getting Started.
First I have created two IOTA accounts for this project. One account for vehicle wallet and the other one for the toll system. I follow the instructions detailed here to create these accounts. Later I visited the Devnet Faucet to request some tokens for these accounts.
.
Build the vehicle wallet.
I build a hardware button wallet for the vehicle using a Raspberry Pi Zero together with a button switch. Whenever the button is pressed, there is Javascript code which will send some tokens to the toll wallet account.
There is another piece of code which will command the toll booth barrier (see the section Build the toll booth barrier
below) to open thru the Azure IoT hub device twin feature.
.
Build the toll booth barrier.
Implementation #1
This is a simple implementation using a LED to indicate if a gate barrier is open or closed. Follow this tutorial to setup the Azure Sphere for this implementation.
.
Implementation #2
To be implemented (if there is time) with a proper motor to open and close the gate, this is for the purpose of simulating a toll gate like the picture below.
.
Create an IoT Hub and IoT Device.
I am using Azure Sphere to light up a LED (implementation #1) as an indicator for opening the toll barrier. As for implementation #2 (if there is time), Azure Sphere will control the barrier thru a power relay and motor. Follow this link to create an IoT Hub and IoT Device for the Azure Sphere, which can receive commands thru Device Twins.
.
Codes.
I use a few scripts to help in building this project. Full content of the scripts is shown in the code section below.
get-account-data.js
This shows the account data of the toll or vehicle accounts.
.
.
get-available-balance.js
This shows the available balance of the toll or vehicle accounts.
.
get-total-balance.js
This shows the total balance of the toll or vehicle accounts.
.
generate-magnet-link.js
This generate the toll account's magnet link.
.
button_led_http.js
This runs on Raspberry Pi Zero which turn on/off led and call paytoll() rest API when button is pressed
.
pay-toll.js
This performs the action of paying toll from vehicle wallet to toll wallet via IOTA network.
.
turn-led.js
This turns on the LED on Azure Sphere via IoT Hub's device twins.
.
hello-iota.js
This serves the paytoll()
rest API by calling the module pay-toll.js
above.
.
Pictures and Video..
The following video shows a simple demo. When the button is pressed, the vehicle wallet will make a payment to the toll wallet. If the transaction is a success, a command is issued to open the toll barrier (here indicated by the red LED light on the Azure Sphere board) via IoT Hub device twin.
.
.
.
Summary.
Though this project is a simple and primitive implementation of a blockchain based toll system, it does show it is a possible channel to make toll payment. Possible future enhancements include (1) proper handling of seeds and addresses, (2) more advanced hardware capability of toll booth barrier, and (3) build a management console for toll operator.
.
Useful Links.
.
Comments