Categories
TUTORIALS

Use Grove Inductive Sensors to Calculate the Number of Parking Spaces remaining

Overview

This is an overview of the first tutorial for Smart Parking Philadelphia(SPP), detection using Grove inductive sensors. The project is about the data collection part of the smart parking project. In this project, we will use Grove inductive sensors to count the number of vehicles and calculate the number of parking spaces remaining, and then transmit the data using a wireless transmitter.

Reference Link

This is a project that detects vehicles passing through by using electromagnetic induction coils, and we are using it as a template for writing and improving.

https://www.seeedstudio.com/Counting-Cars-with-Induction-Loops-using-Seeeduino-p-5219.html

The document provides a more detailed explanation of the principles, hardware, and code used to count vehicles. https://files.seeedstudio.com/products/E21011104/Grove%20Inductive%20Sensor_Published%20Version(3).pdf

Parts

Arduino Uno: You will need an Arduino Uno board to control the motor and other components.

Grove Base Shield V2.0 for Arduino: Connect Arduino to each module through Grove Base Shield to make the connection more orderly.

Grove Inductive Sensor: Use two inductive sensors to count vehicles. The Grove Inductive Sensor consists of three parts: the 2-Channel Inductive Sensor, coil-0, and coil-1.

433MHz Transmitter: Transmit the calculated remaining parking spaces to the receiver, and the receiver displays the corresponding remaining parking spaces after receiving the signal.

Universal 4-Pin Buckled Cable: Connect the inductive sensors and the base shield.

Jumper Wires(Male To Female & Male To Male): Connect inductive sensors to inductive sensors and Arduino to transmitter.

Step-by-Step Tutorial

1. Building the Hardware

1.1 Connect the Grove Base Shield to the Arduino Uno board

Using the base shield can make the connections more organized and orderly.

1.2 Connect the Grove Inductive Module

Connect the 2-Channel Inductive Sensor using a Universal 4-Pin Buckled Cable. Connect one end of the cable to the I2C port on the base shield and the other end to the 2-Channel Inductive Sensor. You can refer to the diagram below for the pin layout of the Grove Inductive Sensor.

Connect the coil-1 pin to the CH1 pin on the 2-Channel Inductive Sensor using a male-to-male jumper wire.

1.3 Connect the Transmit Module

To connect the transmitter according to the circuit diagram below.

The transmitter module should be connected to the corresponding interface on the base shield installed on the Arduino using jumper wires.

2. Wrote code of the Grove Inductive Module & Transmit Module

2.1 Install the libraries

Install the libraries required for the code.

2.2 Coding

In this step, relevant variable names are set in the code and the setup function is also configured.

Set up two void functions to control the Arduino to count when the inductive loop detects a vehicle.

Complete the code for the loop, which shows how to calculate Remaining Parking Space (RPS) and includes the code for the transmitter. The obtained RPS value will be transmitted to the visualization module mentioned in the next tutorial.

3. Upload and Test

Upload the code to the Arduino. In the following test, I used a coin instead of a vehicle.

This video demonstrates the Grove inductive sensors detecting the coin passing through and counting it, while also calculating the RPS.

Congratulations, you have completed the construction of the Grove inductive sensors!

Leave a Reply

Your email address will not be published. Required fields are marked *