Toolkit for urban data collection

Toolkit for decision makers and specialists to gain experience with data collection.


A smart city starts with high-quality data with a continous in-stream of more measurements which represent the current situation. This is the basis for every data analysis or machine learning model and needs to be built up first. For a city that is at this first stepping stone, it is not always easy to tell which data matters. To avoid a huge inital investment for the city's step into IoT, it would be great when a set of sensors together with an easy to use software would exist, so that desicion makers as well as specialists of the city administration can gather experience with data collection and its analysis before they decide about a bigger investment.

Aside of deployment in a testing phase, this toolkit could also be used for temporary use in a location, e.g. in advance of opening a construction site to gain some traffic data to estimate how many cars must be rerouted during the construction.

Most of the implementation can be done with a handful of open source projects, while for the sensors already existing solutions can be used. Those sensors are cheap and easily integrated into a system with a clean interface.

The project needs Python and web developers for creating the backend and user interface, microcontroller developers for the sensors and people that find use cases for such a toolkit, preferably directly with employees of the municipality.


We wanted to build a toolkit that enables to collect data in the real world in a device agnostic way.

For this we built on already existing open source solutions. We chose the test case of car traffic monitoring, around which we built our prototype. During the Lenzburg Hackathon we built a prototype with consisting of following modules: - Pub/Sub Broker - Data Management and Rule Engine - Database to save the data in a persistent way - Dashboard to visualize the data - IOT ToF sensor based on a development board

To keep the interface as open as possibile, we decided to use the MQTT Protocol as the basis to communicate between the different software modules and the IOT devices. We used Apache Mosquitto as our MQTT broker. Since there is already a containerized version of it in the Docker repository, we didn't have to invest any time to set it up and could directly launch it on a cloud service (AWS in our case). As a next step we needed a controller implement the data flow to different services that don't support MQTT, i.e. the SQL database or the dashboard. For this we used the open source software Node-RED. Node-RED offers a simple but nonetheless powerful graphical interface to implement a flow chart based rule set. Since Node-RED does not have a native SQL interface, we had to implement a plugin to enable this action. We containerized our modified Node-RED version and also lauched it on a cloud service. Afterwards we implemented our rule set which subscribed to the desired topics on the MQTT broker (the topics on which the IOT devices publish) and filled the received data in the right format into the database.

The SQL database setup was straightforward, since AWS offers databases as SaaS. We programmed a small Python script, which filled the database with dummy data so the team members working on the dash board were able to output something before the sensor implementation was finished to deliver the real data. The dashboard was implemented as a reactive web app, which was taking its data from the SQL database. Aside of a list with showed the most recent measurments of the sensors distributed in the city, it also showed the positions of the sensors on a map. Another figure was showing the development of an observed metric, in our case the number of cars passed per time unit.

As our sensor we used a development board from STM (part-nr.: B-L475E-IOT01A). We programmed it to observe whether something is passing in front of it and in the case that it detects a car, it shall publish a message on the given topic on the MQTT broker.


At the end we were able to build a functioning prototype from the hardware in the streets to the dashboard where the refurbished data is shown in a easily readable way.

Next steps:

The next step would be to find a town that would be interested to start measuring data to improve their decision processes and tune the product to their needs to develop a real product prototype. Ausblenden

Team members:





👋 Slack chat, Email

Edited content

14.01.2021 11:35 ~ Maud

Event finished

14.11.2020 14:00

Joined the team

13.11.2020 12:48 ~ timur_erdag

Event started

13.11.2020 10:00

Edited content

12.11.2020 22:21 ~ michel

Joined the team

12.11.2020 22:09 ~ michel

Challenge posted

12.11.2020 22:09 ~ michel
Contributed 3 years ago by michel for Smart City Lab - Lenzburg
Alle Teilnehmer*innen, Sponsor, Partner, Freiwilligen und Mitarbeiter*innen unseres Hackathons sind verpflichtet, dem Hack Code of Conduct zuzustimmen. Die Organisatoren werden diesen Kodex während der gesamten Veranstaltung durchsetzen. Wir erwarten die Zusammenarbeit aller Teilnehmer*innen, um eine sichere Umgebung für alle zu gewährleisten. Weitere Einzelheiten zum Ablauf der Veranstaltung finden Sie unter Richtlinien in unserem Wiki.
All attendees, sponsors, partners, volunteers and staff at our hackathon are required to agree with the Hack Code of Conduct. Organisers will enforce this code throughout the event. We expect cooperation from all participants to ensure a safe environment for everybody. For more details on how the event is run, see the Guidelines on our wiki.

Creative Commons LicenceThe contents of this website, unless otherwise stated, are licensed under a Creative Commons Attribution 4.0 International License.

Smart City Lab - Lenzburg