SRS - Tachymètre

=  Introduction=

Goal of the project

 * The aim of the project is to learn how to use the Cohorte platform to develop a web application which displays an historic of measures made by a sensor and stored on a remote server.
 * The main point of the project is to be able to transmit and process the information from the measures given by the sensor to the processed data on the user interface. Moreover, there is a more mathematical step, that consist in calculating the speed with the frequency, and filtering the signal to eliminate noise.

Scope of the product

 * The implementation of the sensor on the Raspberry and the process of measures can be added on any other application that needs movement detection in front of the sensor. The steps of calculation and storage on the server have to be autonomous so that any number of sensors are connected to the application.
 * The storage on the server and the interface have to be scalable. During the project, we only have one sensor, but the application we want to develop should be able to displays data form several sensors, which are characterised by a unique identifier, a name, an owner, GPS coordinates, … Besides, an interface has to be implemented on the Raspberry so that the owner can define all these attributes on the sensor in a way that it can be clearly identified by the Cohorte application.

Definitions, acronyms and abbreviations

 * Raspberry Pi : Reduced size computer (ARM processor), compatible with devices like keyboards, mouses, … The Raspberry Pi can host a program, providing many opportunities of use. In our project, the Raspberry is linked to the Arduino, and host the python modules that process the data and send it to the server.


 * Arduino : Programmable microcontroller able to generate and analyse electric signals. For our project, the Arduino get the measures from the HB100 sensor. Once the voltage and frequency values are available, they are transformed into distance and speed values, and send to the Raspberry by serial link.


 * ARM processor : Low consumption processor, equipped with a simpler architecture than other families of processors. ARM processors are mainly used on embedded computing like smartphones.


 * HB100 : Proximity sensor that provide a voltage and frequency measure. The voltage gives an information about the distance between the sensor and the object, whereas the frequency allows to calculate the speed of the object thanks to the Doppler effect (see below). The distance variation corresponds to the direction of movement.


 * Cohorte : Development platform created by Isandlatech that provides tools to program distributed applications on different independent devices, including the programming languages. Cohorte allows to do component oriented programming, which means that the application is flexible, and the different components are autonomous.


 * SQLite : Database engine in a C library that allows table interrogation with SQL requests. In our server, the database contains only one table, so SQLite is quite enough for the management of the server.


 * Doppler effect : Physical phenomenon that consist in a frequency shift between the transmitter and the receiver when the distance between them is changing. With this phenomenon, we can calculate the speed of an object thanks to the relation between the measured frequency and the speed of the object.


 * Raw data : Data returned by the sensor and send to the Arduino (voltage, frequency, timestamp).


 * Processed data : Data returned by the process of raw data on the Raspberry (average speed, maximum speed, direction, date).


 * Synthetic data : Analysis of processed data. For example, it could be a distribution of the flow during a month, or at a precise moment of the day, or also an historic of speed.


 * Timestamp : date, hour, minute and second when the measure is done.

=  Description of the project=

Product perspective

 * The product is meant to be a presence detector whose measurements are saved to interrogate them in the user interface. We could imagine many use like domestic surveillance (a detector with a bell), or also a road traffic detector.
 * In a fuller version of the product, we should integrate an authentication system that allows groups of users with different access permissions.

Product functions

 * The sensor is able to measure speed and distance. Therefore, the aim is to detect the speed of objects in front of the sensor (pedestrians, cyclists, cars, …) and date this detection. The web interface gets the data from the server and displays it with the possibility to restrict to a certain time of day, or a date range, or to make graphs.

General constraints

 * The constraints of the project are the use of Cohorte and the Raspberry Pi with the sensor.
 * There is no constraint about the programming language, because thanks to Cohorte, the different components can be developed in different languages : Python or Java for the Raspberry, Java and SQLite for the server, and HTML/CSS/Javascript for the web interface.

=  Specific requirements, covering functional, non-functional and interface requirements=

Functional requirements
Data acquisition function
 * Getting of physical values : speed and distance
 * Sending of processed data by consuming a service provided by a remote component.

Aggregation function
 * Storage of the data in a server.

User interface function
 * Data presentation components.

Non-functional requirements
Quality of the network
 * Store the data on the device allows to avoid losing data in the event of link loss.

Sensor environment
 * The measurements have to be filtred to eliminate the noise generate by the environment (street, wind, …).

Interface requirements

 * Compatibility multi-platform (different browser, mobile version of the software).
 * Interactivity (date range selection, creation of graphs, …).

= Use case =

Interaction between user and web interface

 * - The user connects to the website and authenticate with his loin and password
 * - The user can choose to click on “all” to display all the data from every sensors (sorted in descending order of date)
 * Data displayed : date, average speed, maximum speed, direction, sensor


 * - The user choose a sensor in the sensor list (green : connected, red : disconnected)
 * - Processed data tab :
 * - The system displays the processed data in a table (sorted in descending order of date)
 * Data displayed : date, average speed, maximum speed, direction, sensor
 * - The user can click on pagination links to browse the data.
 * - The user can filtrate the data with two types of parameters :
 * - Between two dates
 * - A minimum / maximum speed value
 * - Synthetic data tab :
 * - The user can make parameterized analyses choosing the option “historic”, or a distribution choosing the option “distribution. The parameters are :
 * - Selection of the type of data :
 * - Number of moves
 * - Average speed
 * - Maximum speed
 * - Selection of a date range :
 * - Start date (DD/MM/YYYY)
 * - End date (DD/MM/YYYY)
 * - Selection of time slot :
 * - Start hour (HH/MM)
 * - End hour (HH/MM)
 * - Administration tab :
 * - The system displays events related to the selected sensor in a table (sorted in descending order of date) :
 * - Selection of a date range :
 * - Start date (DD/MM/YYYY)
 * - End date (DD/MM/YYYY)
 * - Selection of time slot :
 * - Start hour (HH/MM)
 * - End hour (HH/MM)
 * - Date of event (HH/MM/DD/MM/YYYY)
 * - State of the sensor (connected / disconnected)
 * - The user can disconnect

Interaction du technicien avec le capteur

 * - Le technicien branche le capteur au réseau internet du client
 * - Le technicien démarre le capteur

Interaction between the technician and the sensor

 * - The technician connects the sensor to the client’s internet network
 * - The technician fill a form on the Raspberry :
 * - Identifier of the sensor
 * - GPS coordinates of the sensor (latitude, longitude, altitude)

= Appendicies = Read first:
 * http://www.cs.st-andrews.ac.uk/~ifs/Books/SE9/Presentations/PPTX/Ch4.pptx
 * http://en.wikipedia.org/wiki/Software_requirements_specification
 * IEEE Recommended Practice for Software Requirements Specifications IEEE Std 830-1998

Cohorte
 * cohorte.github.io

Microwave Motion Sensor
 * https://www.openimpulse.com/blog/wp-content/uploads/wpsc/downloadables/HB100_Microwave_Sensor_Module_Datasheet.pdf
 * https://www.openimpulse.com/blog/wp-content/uploads/wpsc/downloadables/HB100_Microwave_Sensor_Application_Note.pdf

Making the electronics for $7 USD doppler motion sensor
 * http://ch.linkedin.com/in/mathieustephan
 * http://www.limpkin.fr/index.php?post/2013/08/09/Making-the-electronics-for-a-%247-USD-doppler-motion-sensor
 * https://docs.google.com/document/d/1CVdH3UVTROaJ4_Bgsx_-hyg5_LvoNxYiB13pPRN9gzU/edit

Raspberry Frequency measurment
 * http://raspberrypi.stackexchange.com/questions/26166/count-rpm-frequency-pulses-on-gpio-ports-maximum
 * http://blog.durablescope.com/2015/03/build-speed-camera-and-traffic-logger.html
 * http://abyz.co.uk/rpi/pigpio/examples.html#C_code
 * https://www.raspberrypi.org/forums/viewtopic.php?f=37&t=97795
 * http://raspberrypi.stackexchange.com/questions/24812/measuring-frequency-via-gpio
 * http://hacker.instanet.net/forums/viewtopic.php?f=4&t=104