{"id":20696871,"url":"https://github.com/araobp/parking","last_synced_at":"2025-10-30T08:47:08.075Z","repository":{"id":145719257,"uuid":"58454995","full_name":"araobp/parking","owner":"araobp","description":"Internet of Parking Garages -- where is my car?","archived":false,"fork":false,"pushed_at":"2017-07-22T08:48:47.000Z","size":8259,"stargazers_count":28,"open_issues_count":4,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-07T03:05:26.458Z","etag":null,"topics":["aws-iot","car","iot-gateway","nodejs","openalpr","opencv","raspberry-pi"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/araobp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-05-10T11:16:24.000Z","updated_at":"2024-10-05T19:17:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"f289439d-7aa6-4c3a-84bf-d4dc863a1cdc","html_url":"https://github.com/araobp/parking","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/araobp/parking","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/araobp%2Fparking","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/araobp%2Fparking/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/araobp%2Fparking/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/araobp%2Fparking/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/araobp","download_url":"https://codeload.github.com/araobp/parking/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/araobp%2Fparking/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264608149,"owners_count":23636685,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws-iot","car","iot-gateway","nodejs","openalpr","opencv","raspberry-pi"],"created_at":"2024-11-17T00:15:42.891Z","updated_at":"2025-10-30T08:47:07.965Z","avatar_url":"https://github.com/araobp.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Use case: where is my car?\n\n## The IoT toy I develop is Automatic License Plate Recognition\n![pi-alpr2](./doc/PI-ALPR2.png)\n\n## Background and motivation\n\n#### Why I am interested in the use case\n\nI go shopping at these malls on weekends. The problem is that sometimes I do not remember where I parked my car...\n\n- [Northport Mall, Yokohama](https://www.google.co.jp/maps/@35.5507775,139.5792885,3a,75y,2h,101.12t/data=!3m6!1e1!3m4!1sr2XS6qJGnbIkwTT953SWPA!2e0!7i13312!8i6656)\n- [Sogo, Kashiwa](https://www.google.co.jp/maps/@35.8644843,139.9731393,3a,75y,144.06h,112.16t/data=!3m6!1e1!3m4!1sHc9UH1NphEztWjDAM0G-Bg!2e0!7i13312!8i6656)\n- [AEON mall, Makuhari](https://www.google.co.jp/maps/@35.6573085,140.0245396,3a,75y,154.86h,91.46t/data=!3m6!1e1!3m4!1sQEXUIVr33EV5ebIr5tE0rA!2e0!7i13312!8i6656)\n\n[OpenALPR](https://github.com/openalpr/openalpr) is a very interesting open source software to tackle the problem. I just want to try out the software with my Raspberry Pi 3. That is the motivation.\n\n## The toy I develop\n\nI have made the toy with LEGO and my Raspberry Pi 3:\n\n![pi-alpr](./doc/PI-ALPR.png)\n\n## Architecture\n\n#### Overall architecture\n\n![Goal](https://docs.google.com/drawings/d/18lDoqUTxcNn5_Y5HM9rxr1AuS1mzCkMjpiCr9U_PMrE/pub?w=640\u0026h=480)\n\nWhy is beacon(Eddystone) required for this system? Get rid of an expensive special-purpose Kiosk, just use your smart phone that detects beacon, extracts an URL of a car search page from the beacon, and opens up Chrome browser.\n\nWhy is Cassandra or DynamoDB used for storing data? Cassandra/DynamoDB is suitable for this use case, because they are good at storing time-series data with write-intensive usage, whereas MongoDB is good at read-intensive usage. \n\n#### Thing management via AWS IoT\n\nI use AWS IoT Shadow to manage my things: [Thing management](./thing/README.md).\n\n#### Minimum setup\n\nEverything runs on my Raspberry Pi 3 except for the device management.\n\n![WhereIsMyCar](https://docs.google.com/drawings/d/1_GiS80Nem-KqX6v-HBjz98eovvMlLeTybwrgqH_1kmg/pub?w=640\u0026h=480)\n\n#### Working with AWS services\n\n- Cassandra is replaced with DynamoDB (I need to add TTL feature somewhere).\n- app.js runs on an EC2 instance.\n\n![WhereIsMyCar2](https://docs.google.com/drawings/d/1UWIcfvBbUBZEOQgkGEzRN_vnKfkEmdFDAgtx6saGaF0/pub?w=640\u0026h=480)\n\n#### Physical configuration (Internet of Things)\n\nI use WiFi and 4G (e.g., NTT DoCoMo or SORACOM) to connect my devices to the Internet.\n\nNote that \"Internet of Things\" is about a network of things, not about a network of micro services: IoT is one of networking technologies.\n\n![InternetOfThings](https://docs.google.com/drawings/d/1cZ3vfNn52rYJ7BJ9UhJnlSxFU-wls6IeM_7cZnppOFg/pub?w=960\u0026h=600)\n\n#### Sensors\n\nTwo types of time-series data is published to MQTT broker on AWS IoT:\n- Licence plate numbers recognized by OpenALPR (alprd) -- topic name \"alprd\"\n- Temperature and luminousity -- topic name \"sensor\"\n\n![PCB](https://docs.google.com/drawings/d/1RWnvtRF_2oyBpaMBb_fe2pwgplGz5MFdtaD25IStJPQ/pub?w=640\u0026h=480)\n\nAnd the wirling on the solderless breadboard:\n\n![solderless_breadboard](./doc/solderless_breadboard.png)\n\nRegarding the technical details, refer to [this page](./doc/electronic_kit.md):\n- The electronic circuit\n- Controling the AD converter (MCP3008)\n- Temperature calculation\n\nI finally solderd all the parts onto an universal board:\n\n![universal_board](./doc/universal_board.png)\n\n#### Screenshots from AWS IoT\n\nThis is a list of my things:\n\n![aws_iot](./doc/aws_iot.png)\n\nI created a rule to forward location data from MQTT server to DynamoDB. The topic name is \"alprd\".\n\n![aws_iot_dynamodb](./doc/aws_iot_dynamodb.png)\n\nDynamoDB is cool. I assigned \"CarId\"(garage_id:plate) as a hash key and \"Timestamp\" as a seconday index:\n\n![dynamodb](./doc/dynamodb.png)\n\n## Software components used in this project\n- node.js/express/angular.js with cassandra-driver\n- [OpenALPR](https://github.com/openalpr/openalpr)\n- [beanstalkd](http://kr.github.io/beanstalkd/) and [fivebeans](https://github.com/ceejbot/fivebeans)\n- [node-eddystone-beacon](https://github.com/don/node-eddystone-beacon)\n- [Cassandra](http://cassandra.apache.org)\n- AWS: IoT (incl. its client SDK), DynamoDB and EC2\n\n## Building OpenALPR on Raspberry Pi\n\nFirst, you have to build OpenCV. Follow the instructions here: http://docs.opencv.org/3.0-last-rst/doc/tutorials/introduction/linux_install/linux_install.html\n\nDon't forget to install libv4l-dev before cmake:\n```\n$ sudo apt-get install libv4l-dev\n```\nAnd add this option to cmake: -DWITH_LIBV4L=ON\n\nIt took one hour to complete the build processes.\n\nThen, follow the instructions on this page: https://github.com/openalpr/openalpr/wiki/Compilation-instructions-%28Ubuntu-Linux%29\n\nIt took some ten minutes.\n\nCheck if ALPR works on your Raspberry Pi:\n```\npi@raspberrypi:/tmp $ wget http://plates.openalpr.com/h786poj.jpg -O lp.jpg\n--2016-05-10 20:45:51--  http://plates.openalpr.com/h786poj.jpg\nResolving plates.openalpr.com (plates.openalpr.com)... 54.231.114.105\nConnecting to plates.openalpr.com (plates.openalpr.com)|54.231.114.105|:80... connected.\nHTTP request sent, awaiting response... 200 OK\nLength: 62721 (61K) [image/jpeg]\nSaving to: ‘lp.jpg’\n\nlp.jpg              100%[=====================\u003e]  61.25K   125KB/s   in 0.5s\n\n2016-05-10 20:45:52 (125 KB/s) - ‘lp.jpg’ saved [62721/62721]\n\npi@raspberrypi:/tmp $ alpr lp.jpg\nplate0: 8 results\n    - 786P0      confidence: 90.1703\n    - 786PO      confidence: 85.579\n    - 786PQ      confidence: 85.3442\n    - 786PD      confidence: 84.4616\n    - 7B6P0      confidence: 69.4531\n    - 7B6PO      confidence: 64.8618\n    - 7B6PQ      confidence: 64.627\n    - 7B6PD      confidence: 63.7444\n```\n\nIt took something like 10 seconds to recognize a number, so it is not plactical -- you should run alprd instead.\n\n## node.js/express\n\nYou must install a middleware 'body-parser' for express POST operations:\n```\n$ sudo npm -g install body-parser\n```\n\n```\nvar bodyParser = require('body-parser');\n\napp.use(bodyParser.urlencoded({ extended: true }));\napp.use( bodyParser.json() );\n\napp.post(  ...\n```\n\n## Portal (web page) for searching your car\n\nThis is a Kiosk-like GUI I have developed with HTML5 and AngularJS. Smart phones receives URL from beacons installed in the mall (e.g., in front of elevators), then open up this web page automatically.\n\nAngularJS-based page: [index.html](./portal/www/index.html)\n\nYou enter your car's licence plate number on the GUI. If the system can find your car on the database and if it was parked in the past 24 hours, it shows the location of your car.\n\n![GUI](./doc/GUI.png)\n\n## Emitting URL of the web page from your Raspberry Pi\n\nNote: Eddystone cannot advertise URL longer than 18 bytes. Use the following URL shortner service: https://goo.gl/\n\nInclude the following lines in your Java script:\n```\nvar beacon = require('eddystone-beacon/index');\nbeacon.advertiseUrl(url);\n```\n\n![Eddystone](./doc/Eddystone.png)\n\n## OpenALPR training for Japanese car licence plates (calibration/tuning)\n\nIn case of the default setting (country = us),  \"2\" can be recognized as \"Z\", and \"0\" as \"O\" or \"D\". For the time being, you may use country = us and use a matching pattern \"####(4 digits)\" by modifying the following file:\nhttps://github.com/openalpr/openalpr/blob/master/runtime_data/postprocess/us.patterns\n\n```\n$ cd /usr/share/openalpr/runtime_data/postprocess\n\nOpen the file \"us.patterns\" and append \"jp              ####\" to it.\n\n$ cd /etc/openalpr\n\nOpen the file \"alprd.conf\" and edit it as follows:\n\n  [daemon]\n  \n  ; country determines the training dataset used for recognizing plates.\n  ; Valid values are: us, eu, au, auwide, gb, kr, mx, sg\n  country = us\n- ;pattern = ca\n+ pattern = jp \n\n```\n\n\nTo get most out of OpenALPR, you must train it. Take pictures of Japanese license plates, then use the following utilites to train it:\n- https://github.com/openalpr/train-ocr\n- https://github.com/openalpr/train-detector\n\n## Issues\n\n- My USB webcam stops working just after I have started Cassandra. I disabled wlan0, but it does not solve the problem.\n- My powered USB 3.0 hub does not work with Raspberry Pi. See this page: https://www.raspberrypi.org/documentation/hardware/raspberrypi/usb/README.md\n\nSo I have bought a camera module for RPi:\n- https://www.raspberrypi.org/products/camera-module/\n- https://www.raspberrypi.org/documentation/usage/camera/\n\nDon't forget to load the following kernel module for V4L2: \n```\n$ sudo modprobe bcm2835-v4l2\n```\n![pi-alpr3](./doc/PI-ALPR3.png)\n\n## Wish list\n\n#### Docker-based software management for IoT gateways (i.e., Raspberry Pi 3)\n\nAWS Shadow is OK, but AWS does not support software life cycle management (such as software upgrade) for IoT gateways. I use neither Chef, Puppet nor Ansible, since those tools make things complicated. I want something like [Resin.io](https://resin.io/) that is based on Docker.\n\nAWS recommends us to use Shadow and S3 for OTA: https://forums.aws.amazon.com/thread.jspa?messageID=706302\n\nI should also check out [Google Brillo](https://developers.google.com/brillo/).\n\n#### Data analysis\n\nUse [Apache Spark](http://spark.apache.org/) to analyze the data on AWS DynamoDB:\n- the throughput of ALPR processing\n- correlation between the temperature and the number of cars entering into the garage\n\nReference: https://blogs.aws.amazon.com/bigdata/post/Tx1G4SQRV049UL0/Analyze-Your-Data-on-Amazon-DynamoDB-with-Apache-Spark\n\n## What I have learned so far from this project\n\n#### System integration processes for IoT\n\nTHINK OF IOT AS A WHOLE SYSTEM!\n\nVery critical:\n\n- Security (incl. authentication/authorization)\n- System performance guarantee and SLA\n- Remote device management (incl. software update and certificate installation)\n- Stable power suply for the things\n- Stable network connectivity for the things\n\nEdge computing:\n\n- Stream processing at IoT gateways\n\nSystem integration test:\n\n- You cannot automate the test: you need to run cars in front of the camera.\n\n#### Enterprise integration patterns\n\nWhen it comes to messaging such as MQTT (e.g., pubsub, event-driven and asynchronous messaging), you had better read this: http://www.enterpriseintegrationpatterns.com/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faraobp%2Fparking","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faraobp%2Fparking","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faraobp%2Fparking/lists"}