Search code examples
node.jslinuxvue.jsweb-applicationsembedded

Web-application design on embedded linux


I am working for a lighting automation company and we will design and develop a product which will implement Yocto/ Buildroot embedded linux operating system. We will use a Linux SoM inside the product and the specs of the SoM is ~:

  • 1.2/1.5GHz MPU
  • 128/256MB RAM
  • 4/8/16GB eMMC/SD
  • various peripherals UART, SPI...

At this point, Linux side must implement a Web-Based App, which monitors luminaires and control them etc. In general, project intends to control the lighting of a building/home using the web-app running on the device. Front-end shall show each luminary on the page and relevant buttons and icons help client control and monitor the luminaries. The front-end may have a couple of different pages. Overall there can be max of 250 luminaries and 10-bytes of data for each luminary.

I will have an MCU running beside which does real-time stuff and connected to Linux SoM using UART. The real-time MCU communicates to the luminaries and sends their data to Linux through UART or vice versa. The web-app should start a web-server I guess so that client can connect to the app from his/her PC/Smartphone browser. I also think I will need a database, because device should retain the data once restarted or in case of a power failure.

At this point I am not sure what kind of design should I do. I do not want to create a complex application. I do not want to do over-engineering. We are currently 2 embedded guys and 2 software guys will join us soon. I am an embedded C/C++ guy and although I know how stuff works in a very general sense for Vui.js, React.js etc. I am not really sure how well they will do on embedded linux with restricted sources such as RAM.

I have 3 different designs in my head:

1st ->

  1. Receive data through UART directly using a high-level language inside web-app backend (Node.js, Flask or ??? if possible)
  2. Web-app backend (Node.js, Flask etc. or ???) either writes received data to a database (SQLite ??) or executes it directly in a proper way
  3. Front-end communicates to backend through REST APIs (Vue.js, React or ???)

2nd ->

  1. Receive data through UART with a plain C executable file (circular buffer etc.)
  2. Web-app backend (Node.js, Flask or ???) receives data through a local socket from the C file and does database operations etc.
  3. Front-end communicates to backend through REST APIs (Vue.js, React or ???)

3rd -> If flask, vue.js etc. complicates the Linux applications

  1. Receive data through UART with a plain C executable file (circular buffer etc.)
  2. Use lighttpd or similar to start a web-server and use fast-cgi ?

As far as I learnt from the web, with the specs of the SoM I will use, technologies such as Node.js Vue.js can be handled easily and there should be no problem at all. If so, even though it is a quite general question, how to do it in a simple & modern way?


Solution

  • I think the best way is the first. In this way you build all the system with module so in the future will be easyer to change something. All the framework you will use is maintained by big company so will live for longer