Skip to content

The SmartFactory_Box-Sortic is an implementation from the SmartFactory Project for Sortic. It's a SmartBox which can detect its fill level and communicate.

License

Notifications You must be signed in to change notification settings

LMazzole/SmartFactory_Box-Sortic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SmartFactory_Box-Sortic

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.

Table of contents

The SmartFactory project - Sortic

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

Tools and technologies

The source code is written in C++. To achieve this project, the following listed tools and technologies were used.

Doxygen

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.

VSCode PlatformIO

The used IDE is VSCode with the PlatformIO-extension.

MQTT

For a description of the MQTT-Technologie take a look at the MQTTCommunication-ReadMe.

Documentation

Hardware

To build a SmartBox the following hardware is needed:

For detailed building instructions please contact Felix Nyffenegger.

Software

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.

Dependency Graph

Click on the image to open doxygen-documentation.

Extern Libraries:

Collaboration Diagram

Click on image to open doxygen-documentation.

Important Functions and Files

MainConfiguration.h

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)

SensorConfiguration.h

In SensorConfiguration.h are all settings for the Sensors defined:

  • Pin-number of the Distance-Interrupter
  • Pin-number of the Load-Indicator LED

Communication

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.

Handshake with vehicle

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.

Sortic to box

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.

FAQ's

I'd like to use this code in my project. What do I need to know?

This repository is designed specifically for Sortic. You can still use it, if you follow the rules below:

ToDo's

Hardware

  • 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.

Software

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

Contributors

Changelog

V 1.0 - Release BA FS19 - Luca Mazzoleni

License

MIT License

About

The SmartFactory_Box-Sortic is an implementation from the SmartFactory Project for Sortic. It's a SmartBox which can detect its fill level and communicate.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published