Skip to content

philipzellweger/SmartFactory_SorticRoboter_CommunicationHub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SmartFactory_SorticRoboter_CommunicationHub

The SmartFactory_SorticRoboter_CommunicationHub is the communication module for the SmartFactory_SorticRoboter. It enables communication via Wifi based on the MQTT protocol amongts all participants in the SmartFactory project, for example with the SmartFactory_Box-Sortic. The connection to the SmartFactory_SorticRoboter is via i2c data bus. The received messages are serialized for simple and dynamic message management.

The programmed algorithm is based on the finite state machine design pattern. The design pattern allows to give the roboter a state and to change its state to another state by events. The robot is built by different nested state machines and thus executes its tasks.

Table of contents

Tools and technologies

The source code is implemented in the programming language C++. In the following, the tools for editing the project are listed.

Visual Studio Code

The development environment used is Visual Studio Code with the PlatformIO extension. The development environment can be downloaded open sourced. For an installation guide look here.

Doxygen

Doxygen was used for documenting the source code. For using Doxygen in Visual Studio code, the Doxygen Documentation Generator extension is available.

Fritzing

For the creation of the electrical shema the software Fritzing was used. A link to the software can be found here.

I2C

The connection to the hub is via i2c. For an explanation of the technology and the library look here.

MQTT

The communication protocol used to communicate via Wifi is MQTT. For an explanation of the technology look here.

Deque

The messages received via MQTT are stored in a Deque of shared pointers after serialization. A Deque is a Queue, which can be accessed from both sides. Here you can find an explanation about Deque.

Shared pointer

Shared pointers are used to handke dynamically created objects. The advantage of shared pointers is that direct control over deleting dynamically created objects is not needed. As soon as no pointer points to the created object, the object is automatically deleted. This concept makes the factory design pattern very powerful. An explanation of shared pointer can be found here.

Hardware

For the i2c connection between the Arduino Uno and the ESP32-DevKitC a Logic Level converter is required. This is necessary due to the different voltage levels of the microcontrollers, otherwise damage can occur or communication cannot be stable guaranteed.

SorticRoboter CommunicationHub

The communication hub is structured with the following elements.

  • ESP32-DevKitC
  • Logic Level converter

Electrical shematic

The following illustrations show the electro shema of the SmartFactory_SorticRoboter. The connection to the SmartFactory_SorticRoboter_CommunicationHub is shown on it.

Breadbord

[Image: Breadboard SmartFactory_SorticRoboter with SmartFactory_SorticRoboter_CommunicationHub]

Electrical shematic

[Image: Electrical shematic SmartFactory_SorticRoboter with SmartFactory_SorticRoboter_CommunicationHub]

ESP32-DevKitC

The microcontroller used for the communication hub is an Esp32-DevKitC. The microcontroller is very powerful and has a large memory and is very cheap compared to other microcontrollers. In addition, it has a Wifi chip which enables communication via MQTT.

esp32

[Image: SOS electronic: Esp32 DevKitC]

Logic Level converter

A Logic Level converter is required for the i2c connection. The Logic Level converter transforms the signal voltage of the Arduino Uno from 5V to the signal voltage of the Esp32-DevKitC from 3.3V.

levelconverter [Image: Distrelec: Logic Level converter]

Software

Finite State Machine

The design pattern used to implement the software is the Finite State Machine. The robot always has a state. The states are transformed into other states by events. The figure below shows the finite state machine of the SmartFactory_SorticRoboter_CommunicationHub seen in the read area. The SmartFactory_SorticRoboter_CommunicationHub has only one Finite State Machine

FSM

[Image: Finite State Machine SorticRoboter with SorticRoboter CommunicationHub]

Communication

Communication with the box via the MQTT protocol is done via the topics shown in the figure below. The messages with defined topics are sent to via the broker to to any opposite participant which subscribed to the defined topic.

TopicTree

[Image: Topic tree communication between SorticRoboter and SmartBox]

If an available package needs to be sorted in a SmartFactory_Box-Sortic a handshake with an available SmartFactory_Box-Sortic is performed. The process flow is shown in the graph below.

Communicationflow

[Image: Process flow communication between SorticRoboter and SmartBox]

UML

The figure below shows the data model in UML notation. The core of the communication hub is the serialization of the received messages. A library has been implemented for this purpose, which performs this serialization.

Click on the image to open doxygen-documentation.

Dependency Graph

The figure below shows the dependency tree of the main file of the CommunicationCtrl. The used extern libraries for the project:

Click on the image to open doxygen-documentation.

ToDo's

All the ToDo's are documented in the source code with Doxygen.

Contributors

Changelog

V 1.0 - Release SA HS20 - Philip Zellweger

License

MIT License

Links to SmartFactory

Releases

No releases published

Packages

No packages published