3 Phase motor controller driver firmware.
This is very much a work in progress. The following list is of currently implemented and planned features.
- Sensors
- Magnetometer
- Back EMF Sensing
- External Sensor
- Motor movement
- Full Torque
- Commands
- Stepping function
- Amplitude
- Velocity
- Position
- I2C Communication
- USB Communication
- Serial Communication
This code is meant to run on the ATmega32U4 on 3 Phase Driver Board.
- Program the Bootloader
- Open a terminal in this project
- cd into
bootloader
directory - Connect programmer to motor
- Power the device (either option)
- Set switch on programmer to "5v"
- Provide 12V power to the board
- Run
make
- Verify that the red LED flashes at 1 Hz
- Program with the main program
- Plug in a USB (internal or external plug)
cd ..
up to main project folder- Plug in DC power (generally 12v)
- Verify that the red LED flashes at 1 Hz
- If not flashing or if it is not visible, do a reset
- If still does not work, reload the bootloader
- requires the motor to be opened to use the programing board
- Run
make
- Verify that the red LED on solid
- Run Calibration procedure
cd Calibration-Tool
- ensure yarn dependencies are up to date:
yarn
yarn mlx
to set the gain to a constant. (26 seems appropriate. Max raw is about 4000.)- reset device
- cycle USB connection
- return
- set LowGain and HighGain to 26
- enter to accept hex value
- Run Calibration Procedure:
yarn start
- Power cycle the motor
Data file? [data.csv]: <enter> Capture fresh? [No]: y<enter> Fresh: true Cycles per Rev: 15 Revolutions: 3 Amplitude: 65 Smooth Control - info: Started watching for USB devices Device attached: 4:38:25 PM None Serial Number [None]: <enter> New serial number [1c28c9e0-b57f-11e9-b138-9de272fac789]: (Must be clamped into test fixture at this point) <enter>
- Look at data.html to verify that the curves are right. Max X and Y should be under 3800.
- Run
yarn mlx
again to reset the gain to a better value iff there is a problem.
- Load calibration data onto device
- Reset device
dfu-programmer.exe ATmega32u4 flash --force <SerialNumber>.hex
- Test the motor
- power cycle the supply or USB
yarn test
- Check for devices present and present the serial number
<enter>
starts a sine testcX <enter>
to to constant X force.
Currently Testing with Quanum MT5206. Also playing with Hoverboard motors.
Don't forget about the submodules we're using. Modern git checks out submodules correctly but older git requires some extra commands:
git submodule init
git submodule update
Only real requirement is running the main Makefile
.
All build steps are configurable on a per machine hostname basis.
Create a file named local.<hostname>.mk
in the project root, next to the main Makefile
.
This file will be automatically loaded and can be used to override any make variables.
The primary use for this is to enable the ability to not have all the needed binaries in the PATH.
While we endeavour to be standards compliant, the reality is that it is difficult to ensure all possible compilers work.
Known working compilers:
- AVR 8-bit Toolchain v3.6.2
GCC_RootDir = C:/Program Files (x86)/avr8-gnu-toolchain
mkdirCommand = mkdir
All paths in uMaker use /
as a directory separator.
Windows's mkdir
/md
does not support /
directory separator.
Installing Cygwin is the easiest way to get building on Windows working.
Make sure make
is "selected for installation".
Try make clean
first.
The current Makefile is setup to program an AVR via USB DFU. It is possible to switch to using an ISP or other bootloader/programmer easily as well.
To get VSCode IntelliSense to work, local.avr-gcc.compilerDir
must be set in your User Settings.
Likely something like "/path/to/avr8-gnu-toolchain"
or "C:/Program Files/avr8-win64"
is needed.
This directory should have a bin
and include
directory inside of it, among others.