This project shows how Spresense could be used to visually monitor a parking lot and do image analysis on the edge to determine the status of each space.
Lora modules RFM95 are used to transfer the parking state from Spresense to a Raspberry Pi. The data could equally well be sent using LoraWAN to a service like ThingsSpeak but for now we just use raw LoRa to communicate with a simple Rapsberry Pi with a RFM95.
Why would anybody make a parking "Smart" and connected?Imagine going into a crowded city to watch a movie, go to a meeting or basically any reason. You enter the address of your destination in your phone and not only would you get directions of how to get there, you would automatically have a parking space allocated for you. Accumulating this over all cars, this would probably save thousands and thousands of miles of unnecessary city driving while searching for a free space. The environmental benefits and reduction in traffic jams would be enormous.
Basic overview of the systemDirectly after boot, Spresense starts by taking a series of pictures of the parking lot which should be empty. Then, each parking space have been defined as a rectangle and the initial image for each space is stored and kept as a baseline image. No neural network have been used to determine the state of each space. Just a fairly basic approach where the current image of each space is compared with a baseline image of a free space. A state machine handles the state transitions of each space. This is to get good, reliant results and to be able to tell if a car is entering or leaving a space. Not until the state of a parking space is considered as stable, the information will be sent out over radio. This sort of filtering is used to limit the amount of data and have some sort of quality control of the data being transferred.
The receiving end of the data, in this case the Raspberry, has a Python script that shows an artificial copy of the parking lot with a red car over each space that is occupied.
It is not necessary to use the RFM9x modules for this project. Using a straight wire between Spresense UART2_TX and Raspberry PI RXD0 (Pin 10 on the header) and of course ground should work too. Please be aware that only simplex communication (Spresense TX -> Raspberry Pi RX) is possible if you are not using external components to handle the level shifting. Connecting Raspberry Pi TX to Spresense RX will most likely destroy the Spresense board so be careful!
The TFT display is being driven by hardware SPI and most of this is already taken care of in the software in regards to drivers and pins.
The RFM9x board is also using SPI. Instead of using shared SPI bus with the display a software, SPI driver is used.
This project is written in the Spresense SDK and not the Arduino IDE. It will be distributed as a folder that have to be manually installed into a Spresense SDK tree spresense/examples/smart_parking
.
This project should be considered as a demonstrator only. The algorithm used is very basic and is for conceptual purposes only. To use it in a real-world environment outdoors, further optimizations would most likely be required.
Comments