Motor Speed Control using BeagleBone PRU

Greg Raven created this motor speed controller based on a Texas Instruments demonstration project.  His implementation uses RemoteProc and RPMsg framework to connect the PRUs (Programmable Real-time Units) to Linux userspace.  The PRUs are 32-bit RISC processors which offload real-time tasks from Linux running on the ARM processor.
screenshot-from-2016-12-30-23-29-23
The system implements a Proportional Integral Derivative (PID) controller. The controlled parameter is the rotational speed of a DC motor. The DC motor is fitted with a quadrature encoder which provides both RPM and directional data.
screenshot-from-2016-12-30-23-29-48
The quadrature encoder outputs are connected to the P8 header on the BeagleBone.  The DC motor is controlled with a Pulse Width Modulation (PWM) signal from a pin on the P9 header.  The PWM peripheral resides on PRU1.  The quadrature decoder peripheral is located outside the PRU and is accessed via the internal bus.
screenshot-from-2016-12-30-23-30-10
The PID loop is a controlled by a userspace program.  The program communicates with the PRU via character devices instantiated with the RemoteProc messaging driver.
screenshot-from-2016-12-30-23-33-15
A web server runs on the BeagleBone and allows a web browser to graph the control loop behavior.screenshot-from-2016-12-30-21-02-13

Resources

The source code is shared on GitHub:

screenshot-from-2016-12-30-20-49-31Greg-R/pru-pid-motor

The project details are shared on Hackster.io:

The main documentation file [PDF]:

Motor Speed Control Using Beaglebone PRU

Screenshot from 2016-12-30 23-50-35.png