- L Abe (Code development and documentation)
This is a attempt to implement a PID Controller using:
- Toradex Colibri VF50;
- Motor Maxon RE25 118754;
- H-Bridge L298;
- Encoder HEDL 5540 110514.
This code was not tested, use at your own risk.
Check configure-toolchain to learn to configure Toradex Software Development Kit (SDK) for cross-compilation of C/C++ code to the ARM architecture.
-
Setting environment for cross compilation:
. /usr/local/oecore-x86_64/environment-setup-armv7at2hf-neon-angstrom-linux-gnueabi
-
Compiling the controller:
make all
-
Clean directory:
make clean
-
Copying binary to colibri VF50:
scp ./bin/controller [email protected]:/home/root
-
In the target terminal, run the application:
./controller
- The original PID Controller was written by tfoliva.
- The driver to control the motor is based on a H-Bridge configuration, that can control direction and speed.
- The sensor code compute the motor's speed using the time difference between N pulses from the encoder's Channel I. A new thread was created to keep getting the sensor data and not interfere in the main code.
- To make a timer to update the pid control was created a loop to wait until the next execution.