The SmartFactory_Box-Sortic is an implementation from the SmartFactory project for Sortic.
SmartFactory_Box-Sortic is a SmartBox which can detect its fill level. It knows if it must be emptied or filled and communicates this information wirelessly to its environment using the SmartFactory_MQTTCommunication-component.
Multiple nested Finite State Machines (FSM) based on the pattern of the ArdFSM are used to control these processes.
- The SmartFactory project - Sortic
- Tools and technologies
- Documentation
- FAQ's
- ToDo's
- Contributors
- Changelog
- License
The implementation of the SmartFactory project for Sortic looks like this:
The associated repositorys are:
SmartFactory-Sortic
SmartFactory_Box-Sortic
SmartFactory_Vehicle-Sortic
SmartFactory_Vehicle-Basis
SmartFactory_MQTTCommunication
The source code is written in C++. To achieve this project, the following listed tools and technologies were used.
Doxygen is used for the documentation of the source-code.
An intorduction to Doxygen and how to install it can be found in the ArdFSM-Repo.
The used IDE is VSCode with the PlatformIO-extension.
For a description of the MQTT-Technologie take a look at the MQTTCommunication-ReadMe.
To build a SmartBox the following hardware is needed:
- 1x Adafruit Feather M0 WiFi - ATSAMD21 + ATWINC1500 from Adafruit.
- 1x LED + 560 Ohm Resistor
- 3x Grove - Digital Distance Interrupter
- 1x Battery with an JST 2.0 Connection
- 1x Box (85 x 105 x 45 mm) with platform
For detailed building instructions please contact Felix Nyffenegger.
All functions and files are documented on the GitHub-Page with Doxygen.
The documentation includes also the MQTTCommunication-Files.
It is important to mention that all functions are non-blocking and as short as possible so no other process starves. This way a degree of parallelism can be achieved.
Click on the image to open doxygen-documentation.
Extern Libraries:
Click on image to open doxygen-documentation.
In MainConfiguration.h are all important settings for the box defined:
- How long the SmartBox for vehicle-responses waits (SMARTBOX_WAITFOR_VEHICLES_SECONDS)
- How long the SmartBox for vehicle-acknolegemnt waits (SMARTBOX_ITERATION_VACKS_SECONDS)
- Time between the MQTT Publishs (TIME_BETWEEN_PUBLISH)
- The hostname number (DEFAUL_HOSTNAME_NUMBER)
- The hostname "SB"+ hostname-number (DEFAULT_HOSTNAME)
- The maximum number of vehicles that will be evaluated (NUM_OF_MAXVALUES_VEHICLES_STORE)
In SensorConfiguration.h are all settings for the Sensors defined:
- Pin-number of the Distance-Interrupter
- Pin-number of the Load-Indicator LED
The SmartBox communicates via the SmartFactory_MQTTCommunication to an MQTT-Broker that distributes the messages. The communication works by subscribing to various topics. The subscribed topics change depending on action and position of the box. The topic-tree looks like this:
The box is constantly subscribed to the topics: error, Box/error, Box/box.id/error and also always publishes its status to Box/box.id/status.
More information about the communication process and the complete procedure is documented in SmartFactroy-Sortic-ReadMe.
For an handshake with a vehicle the topic Box/box.id/handshake is used. The confirmation of the new position is sent from the vehicle to the Box/box.id/position.
So that the box knows what it has loaded, it subscribes itself to the topic Sortic/Handover.
It updated its loading information if a valid message is received.
This repository is designed specifically for Sortic. You can still use it, if you follow the rules below:
- Use the same Handshake and Communication-Sequence for your carrier as documented in SmartFactory-Sortic and Communication.
- Only if a package is loaded or not is detected. It cannot be detected how full the box is, therefore the sensor concept has to be reworked.
- The battery of the box must be recharged by hand. Inductive charging while waiting would be desirable.
- Cable routing and mounting must be revised.
All open ToDo's can be found in the Documentation on the GitHub-Page
- Split the Code in 2 Repos: Box-Sortic and Box-Basis in order to increase reusability.
- Write a separate test-class
- Luca Mazzoleni
- Luciano Bettinaglio
V 1.0 - Release BA FS19 - Luca Mazzoleni
MIT License