Introducing Struts4Embedded: MVC Framework for Embedded Systems

This forum is about you. Feel free to discuss anything is related to embedded and electronics, your awesome projects, your ideas, your announcements, not necessarily related to ChibiOS but to embedded in general. This forum is NOT for support.
User avatar
Abusous2000
Posts: 12
Joined: Fri Jul 05, 2019 1:26 am
Has thanked: 5 times
Been thanked: 1 time

Introducing Struts4Embedded: MVC Framework for Embedded Systems

Postby Abusous2000 » Tue Jul 21, 2020 10:46 pm

Struts4Embedded (S4E) is a MVC framework designed for embedded systems; it mimics Java's Struts 1.0 that was popular 18+ years ago. Basically it's a pattern that decouples the model (data structure) from your view (UI); and all are decoupled from the controller (business logic), which often results in projects that are faster to market, easy to manage, maintain & scale. For now, S4E is coupled to ChibiOS RTOS only; therefore if it is of independent any 3rd party libraries (i.e LWIP, MQTT, FATFS, ..etc).
https://youtu.be/VAiZSbqR4mY
Proof of Concepts (Tested Use Cases)
In this release, three IOT use cases were provided as a proof of concepts to help developers get started:-

  1. The 1st use case reads POT values and sends them as JSON messages (via MQTT broker) to a Node-Red instance where the data is displayed on the UI Dashboard. Once messages reaches Node-Red, they could be rerouted to AWS IOT, or persisted to data stores (i.e. ElasticSearch, DynamoDB, & SQLLite3 were demonstrated). Commands to the embedded application could be sent from UI Dashboard (or AWS IOT) via JSON messages routed via MQTT broker.
  2. the 2nd use case demonstrates controlling and monitoring the state of a MP3 Player from a Node-Red's UI Dashboard; and if ESP8266 (WiFi Module) is attached to STM32F769i, it could be controlled as well via RESTful Web Service (web server) hosted on ESP8266. Also a GUI was built to control the player using uGFX library (based on V2.7 with slight modification) with ST32F746 & STM32F769i boards. CLICK HERE to view a demo.
  3. the 3rd use case demonstrates reading MPU6050 accelerometer & gyro values and plotting them onto a Node-Red UI Dashboard.

It should be noted; that all three use case:
  • were demonstrated using FATFS (w/ SDIO and SPI), ADC; GPT, 5-Button JoyStick, SSD1306 OLED (via I2C), I2S, SAI in a reusable helper modules; that you can include/exclude as you see fit. See ./source folder for details
  • could be easily modified/extended to fit other embedded projects.

Architectural Overview
Image
Click here for High Resolution Diagram in PDF

This architectural diagram for the MP3 Player use case with STM32F769i board. Please pay attention to the sequenced steps; and from there you should be able to trace the system & have a good overview.

Struts4Embedded framework is based on actions & events that are statically predefined for each use case (or project). Those actions & events could be triggered/invoked by sending events to a queue (mailbox), and worker thread(s) consume and execute those predefined actions. This is very similar to the command pattern where the senders and the consumers are decoupled. For more details, pay attention in ./source/ActionEvents folder per each project use case. The core of the architecture is very ease to follow in this file ./source/Struts4Embedded/Threads/ActionEventsThd.c which is under 250 lines of code


Supported Boards
The framework was tested using the following development boards: STM32F407 Discovery, STM32F407VET6 Blackboard, Seeed Arch Max 1.1, ST32F746 & STM32F769i discovery boards, STM32F446re-Nucleo, STM32F429zi-Nucleo, & STM32F746zg-Nucleo.

Licencing
Basically Apache 2.0 has been adopted, therefore please be free to use as you see fit and I shall welcome your critical feedback. I hope this framework will help others in speeding up the development process using a tested & well designed framework. Therefore please be free to use and upgrade as you see fit.

CLICK HERE for Projects Setup
Wiki Page

Jacon
Posts: 139
Joined: Wed Dec 08, 2010 7:52 am
Has thanked: 34 times
Been thanked: 3 times

Re: Introducing Struts4Embedded: MVC Framework for Embedded Systems

Postby Jacon » Wed Jul 22, 2020 9:57 am

Hi,

Interesting, but would you pay attention to this line from your text::

[url]Click here[/url] for High Resolution Diagram in PDF.

'Cause all I get after clicking on this link (https://github.com/abusous2000/MP3Playe ... Player.pdf)
is this: "Not Found" text on blank page... :oops:

User avatar
Abusous2000
Posts: 12
Joined: Fri Jul 05, 2019 1:26 am
Has thanked: 5 times
Been thanked: 1 time

Re: Introducing Struts4Embedded: MVC Framework for Embedded Systems

Postby Abusous2000 » Wed Jul 22, 2020 3:47 pm

I'm bad Jacon, innocent type..here it is.. I missed a slash

https://github.com/abusous2000/MP3Playe ... Player.pdf


Return to “User Projects”

Who is online

Users browsing this forum: No registered users and 2 guests