Integrating physical devices with IOTA — Car-IOTA Part 2

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

Hugo Gregersen
Jan 1 · 8 min read

Introduction

This is the 13th part in a series of beginner tutorials where we explore integrating physical devices with the IOTA protocol. If you have been following the IOTA project for some time you may have heard about strange ideas such as “cars having their own wallets” or “cars paying for their own services”. While this may sound intangible and futuristic, it’s basically the idea we will be taking on in this tutorial.


The use case

As you may remember, we ended the previous tutorial by pointing out some problems related to the centralized nature of the ALPR approach, where a centralized entity (aka, the hotel-owner) would have to have control over the seeds used when performing the payment transactions. The great thing about this approach is that the car itself does not require any new electronics, (as the infrastructure (parking facility) takes care of all the payment transactions). While this might be acceptable for some local use-cases, it would not be very practical if we wanted to implement our parking payment system on a truly decentralized and global scale.


Data exchange

The first thing we need to deal with when taking on this problem is that we need some type of data exchange between the infrastructure (parking facility) and the car so that the car knows what payment address to use when sending the payment transaction. I’m guessing there are multiple wireless data protocols and technologies that could be used for this purpose (radio, blue-tooth, RFID, etc.) but I felt they all had some disadvantages that were not optimal for this particular use-case. After puzzling over this problem for a while I decided to go with a simple, yet familiar technology that you probably use every day when sitting in front of your television, namely Infrared communication, or IR for short.


About IR and IR communication

IR communication is based on light pulses being sent from an IR transmitter to an IR receiver. To prevent interference from “normal” light, IR uses light in the infrared light spectrum, hens the name Infrared. As the technology suggests, IR is a binary communication protocol where the length in time between each individual light-pulse determines if the data being sent is a 0 or 1. Different implementations of IR communication use different logic with respect to pulse length, the time between pulses, the number of pulses in a data packet, etc. In this tutorial, we will be using a particular IR protocol called NEC. The NEC protocol is a 32-bit protocol that allows us to send 32 bits of data (0 and 1) in one data packet. As it takes 8 bits to define a byte, the NEC protocol allows us to transfer 4 bytes of data in each data packet. As the typical IOTA address consists of 90 bytes (including the checksum), it would then take 23 NEC data packets to transfer the complete IOTA address.


The components

The main components used in this tutorial is the IR transmitter and the IR receiver. For my project, I’m using the popular NE555 IR modules. They often come in a pair and you should be able to get them both of eBay for a couple of bucks.


Wiring

Now, let’s take a look at how each module is connected to its respective controller.


How it works

Before moving on to the code used for this project, let's take a step back and look at the general idea behind the concept proposed in this tutorial and how it works.


The Code

Next, let’s have a look at the code used for this project.

Running the project

To run the project you should start by connecting your IR transmitter module to your Arduino UNO. Then upload the Arduino sketch from the previous section to the board using the Arduino IDE.


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