Skip to content

IpsumDominum/SimpleFOCWebUI

 
 

Repository files navigation

SimpleFOCWeb UI

Built from SimpleFOCStudio By JorgeMaker.

Brief Intro

Adapted from SimpleFOCStudio

Graphical user interface for the SimpleFOClibrary. This application allows to tune and configure any BLDC/Stepper SimpleFOClibrary controlled device, using serial port communications.

The main features are:

Adapted from SimpleFOCStudio

  • Plug and play with the SimpleFOClibrary version 2.1
  • Real-time tuning and configuration of the motors
  • Real-time plotting and monitoring of motor variables
  • Code generation for easier integration of the tuned parameters in your code
  • Built with web based frontend

Installation

Conda

Instruction adapted from SimpleFOCStudio

  1. Install Python if you don't have it installed yet
    • Install Anaconda
    • Once you have your Anaconda running open your terminal (on windows anaconda prompt) and run:
    conda env create --name simplefoc -f environment.yml
    • Once this is done you will never have to run that command again, from now on you will just need:
    conda activate simplefoc
  2. Clone this repository or download the zip file
  3. Enter the folder containing the repository using the terminal
    • the command will be something like this:
    cd  some_path_on_disk/SimpleFOCWebUI

Pip

python -m pip install -r requirements.txt

Once you have done all the steps above you do not need to repeat them any more. All you need to do the next time is open your terminal in the SimpleFOCWebUI directory and run the command:

python simpleFOCWebUI.py

Or if using Anaconda:

conda activate simplefoc
python simpleFOCWebUI.py

Uploading pairing Arduino Code

Like SimpleFOCStudio, you will need to run the corresponding serial interface.

Basically there are two things you need to do:

  1. Use the commander interface and add the motor to the commander
  2. Use the monitoring and add the motor.monitor() in the loop

Here is a mockup of the code:

#include <SimpleFOC.h>

....

// include commander interface
Commander command = Commander(Serial);
void doMotor(char* cmd) { command.motor(&motor, cmd); }

void setup(){
  ....
  // add the motor to the commander interface
  // The letter (here 'M') you will provide to the SimpleFOCStudio
  command.add('M',doMotor,'motor');
  // tell the motor to use the monitoring
  motor.useMonitoring(Serial);
  motor.monitor_downsample = 0; // disable monitor at first - optional
  ...

}
void loop(){
  ....

  ....
  // real-time monitoring calls
  motor.monitor();
  // real-time commander calls
  command.run();
}

TODO

  1. Compatibility with SimpleFOCStudio
  2. Custom Commands. (Besides serial terminal)
  3. Zero Sensor (Offset / Electrical) Doesn't work just yet.
  4. Recover nicely on unexpected device / backend disconnect.
  5. Fix random bugs. Sync any missing parameters which needs to be synced.
  6. More device introspection / controls. (ie. Did FOC init work?)
  7. Separated python scripting library
  8. Version with web serial so no need for python backend??
  9. Clean up code (Use Class, Not have random config formats everywhere.)
  10. Make it more usable on multiple devices at once.
  11. Make the UI responsive and support other viewport sizes such as phones.

About

SimpleFOCStudio but with web UI

Resources

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE_SIMPLEFOC_STUDIO
MIT
LICENSE_WEBUI

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 43.5%
  • JavaScript 24.3%
  • CSS 16.7%
  • HTML 15.3%
  • Shell 0.2%