daniel214 / 6302view

A convenient setup for researchers and learners that allows one to interact directly with their microcontroller in a web browser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

6302view

6302view is a setup that allows researchers and learners to interact directly with their microcontroller in a web browser. Used in MIT subject 6.302 (Feedback system design).

Our goal of this project is to make it elegant -- just include the library and go -- no explicit need to modify anything depending on the microcontroller, for example.

(system setup)

Supported microcontrollers

Quick example

#include <Six302.h>

// microseconds
#define STEP_TIME 5000
#define REPORT_TIME 50000

CommManager cm(STEP_TIME, REPORT_TIME);

float input;
float output;

void setup() {
   /* Add modules */
   cm.addSlider(&input, "Input", 0, 5, 0.01);
   cm.addPlot(&output, "Output", -1, 26);

   /* Ready to communicate over serial */
   cm.connect(&Serial, 115200);
}

void loop() {
   output = input * input;
   cm.step();
}

The above creates a Slider called "Input" from 0 to 5 (at a step size of 0.01) and a Plot called "Output" from -1 to 26, illustrating the square of the slider input:

(gif of resulting modules)

The system loops at once per 5000 µs (5 ms), and data is reported once per 50000 µs (50 ms).

Quick install

  1. Download this repo and extract the contents to an unzipped folder.

  2. Copy the 6302view/ folder that contains the C/C++ library to your Arduino libraries folder.

    • On Windows and Mac, the folder is usually named libraries/ and is located in Arduino/ in your Documents folder.
    • On Linux, the folder is usually named Sketchbook/ and located in /home/.
  3. Install the Python dependencies websockets and pyserial using pip.

To run the local server, run local_server.py, located in gui/, with a Python version of at least 3.5. Finally, open gui.html in your favorite web browser.

Dependencies

Python modules used

Only required for communication over Serial.

websockets
pyserial

Arduino libraries used

Only required if you want to use the WiFi modules of ESP8266 or ESP32 as opposed to communication over Serial.

Go to Manage libraries... and search for WebSockets. It's the one at the bottom by Markus Sattler.

Documentation

Documentation is in docs.md.

About

A convenient setup for researchers and learners that allows one to interact directly with their microcontroller in a web browser

License:MIT License


Languages

Language:JavaScript 78.1%Language:C++ 11.5%Language:CSS 4.6%Language:Python 4.6%Language:HTML 1.2%