Commit ed9c50e5 authored by Jake Read's avatar Jake Read

controller notes

parent 015de3ad
......@@ -2,24 +2,26 @@
I've decided to roll a standalone controller for DEX. I've made a little ad-hoc breadboard circuit to connect one stepper driver, one load cell amp, to an Adafruit Feather M4 - an arduino variant.
So, this should just be a short project - I mostly have the codes I need to run the thing in cuttlefish implementations, here will just be wrapping those up in a standalone system. I can also experiment with 'no handcuffs' programming models, not having to manage this all through various homebrew dataflow environments.
The controller is fairly simple. The embedded code (which can be built with Arduino) reads command codes from the usb-serial port. These commands tell the machine to:
- move a number of steps
- tare the loadcell
- read the loadcell
So, first task is getting the embedded code up to competency. Compexity will live in JS, so the embedded just needs to do two things:
- `step <int32 steps>`
- accelstepper's this count, replies when complete
- microsteps are baked in: calculate transmission ratio as well?
- `read <uint32 averaging samples>`
- does read, replies with int32 (or whatever width is HX711) back, simple
Instructions to the machine are done in low-level appropriate data types: steps are steps, not mm. Readings are returned as raw ADC readings. Conversions between machine-units and real-world units are done in JavaScript.
Then, steps / mm land, zeroing, etc, will live in JS. As will load cell calibration, and plotting, etc. I can bottle each of those low level commands in JS promises, making 'running' the machine big async codes. This should be easy-ish, let's see.
One javascript launches a webserver: that's `js/dexs.js` - you should be able to run it (after installing node) by navigating to the `js` directory here and doing `node dexs.js`. It will announce an IP address and port, point your browser at that. Important! Launch the tool when the DEX machine is already plugged into USB.
Have this all together, now just need to re-calibrate the load cell and debug some loadcell-not-ready errors that the embedded code occasionally throws.
The client javascript can jog the machine, tare the loadcell, and perform tests. Tests are saved as .csv files.
Hopefully enough of the code is self-explanatory, more documentation can come if it's requested.
## Install
``npm install express``
``npm install ws``
``npm install serialport``
``npm install esm``
\ No newline at end of file
``Install Node.JS``
``npm install express``
``npm install ws``
``npm install serialport``
``npm install esm``
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment