Control Systems Club Web Controlled Servo Instructions                 1-24-2019

Ok everyone, we'r going to start a web controlled servo project.

What we want, is a webpage where you click "move servo" and a servo moves.

It will work like this, with 4 components we have to write:

The Front End
The Backend
The Servo Controller
The Arduino Firmware

+---Digital Ocean VPS--+                    +--Control Computer--+
|HTML/CSS/JS Front End |   HTTPS POST       |C Servo Controller  |
|Golang Backend        |====================|                    |
+----------------------+                    +--------------------+
         ||                                          ||
         ||H                                         ||U
         ||T                                         ||S
         ||T                                         ||B
         ||P                                         ||
         ||S                                         ||S
         ||                                          ||e
 +-Client Computer-+                                 ||r
 |  Some sort of   |                                 ||i
 |  Browser        |                                 ||a
 |                 |                                 ||l
 |                 |                                 ||
 |                 |                        +----------------------+
 +-----------------+                        |C/C++ Arduino Firmware|
                                            |                      |
                                                 |       |    

The Frontend will consist of html templates, as well as supporting css and js
files, that will implement a simple UI that allows the user to click on a button
that sends a POST request to the backend to move the servo.
W3 Forms Tutorial
Inline CSS Tutorial
CSS Display Property Tutorial

The Backend will be a Golang executable that will be listening for HTTPS
connections, and serves the frontend, as well as listen for POST requests from
both the Frontend and the Control Computer. A POST request from the frontend
updates the desired state of the servo, and a POST request from the Control
Computer will update the actual state. Both the Actual state and the desired
state should also be served as well.
Go net/http and html/template Libraries Tutorial

The Servo Controller will poll the Backend for the desired state, communicate
this to the Arduinoi via the RS-232 Library, and return this desired state via
POST to the backend so as to update the actual state.
RS-232 Library
RS-232 Example
cURL Code Examples

The Arduino Firmware will commands over the USB Serial Wire, and output that to
the servo.
Arduino Serial Tutorial
Arduino Servo Tutorial

Devops should refer to the workflow page as well as read this page about systemd
unit files.
Systemd Services