Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

mabartos/smart-street-lights

Repository files navigation

Smart Street Lighting Microservices Concept

General

Nowadays, it's a great problem with light pollution in cities. Smart street lights could improve the situation by decreasing the intensity of the emitted light. The lights in cities are usually inefficient and are still turned on with the maximum intensity. It could also save a lot of resources provided by these cities and especially save environment, which is affected by that.

These street lamps would contain some basic set I/O devices, because we need to sense the surroundings of that. We need to detect people, measure ambient light and change intensity of these lights (PIR sensor, photoresistor, PWM). Basic specification of the street lamp:

  • transmit data to the server, where are processing, and some response is sent back.
  • has neighbours, which are affected by the lamp, so there should be defined some association among the adjacent lamps. (the neighbours will be turned on too with lower intensity)
  • define time quantum after the lamps are turned off, if there's no traffic.
  • lamps on more frequent places could have greater time quantum
  • (optional) maybe somehow measure speed of people (trigger objects) and react to that.

Services

It's necessary to create some hierarchy of these street lamps, in order to locate them. It should be possible to get lights from specific cities, streets and get particular lights. Lately, it should be possible to add external sensors, so the lamps could be some kind of device composed of another devices, so I'd prefer mark that as devices too.

I'd suggest deploy these services:

  • User service - admins, maintainers,...
  • Auth service - AuthN and AuthZ
  • City service
  • Street service
  • Device service - device management
  • Device Data service - data management
  • (optional) Data Simulation service - create simulated data from sensors

Implementation

Here's a proposal for tools/services used for implementing the components of the system.

  • Server - Quarkus
  • ORM - Hibernate with Panache
  • DB - arbitrary (default H2)
  • REST - Mutiny (async)
  • Metrics - Prometheus
  • API visualize - Swagger UI
  • Istio

For bulk operations, there should be used pagination. f.e. getAll(int firstResult, int maxResults), which takes the maxResults items from firstResult index.

Basic Structure of microservices

  • /entity - DTO
  • /resources - REST
  • /services - Business logic
  • /health - Health check
  • ...

Basic metrics

Collected metrics about device values, where the data are simulated.

Data values

Device-Metrics

Create device

Create-Device-Metrics

Prometheus service

Prometheus-Metrics