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.
- Teensy 3.2
- ESP8266
- ESP32 (including C and S series)
- Arduino Uno
#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:
The system loops at once per 5000 µs (5 ms), and data is reported once per 50000 µs (50 ms).
-
Download this repo and extract the contents to an unzipped folder.
-
Copy the inner
6302view/
folder that contains the C/C++ library to your Arduino libraries folder. -
Install the Python dependencies
websockets
andpyserial
usingpip
.
To run the local server, run local_server.py
, located in gui/
, with a Python version of at least 3.8. Finally, open gui.html
in your favorite web browser.
Only required if using local_server.py
for communication over Serial.
websockets
pyserial
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.