The STM32 Discovery dev board is used to read an SPI serial interface magnetic absolute angle sensor and drive PWM and DIR signals to an H-bridge for a brushed gear-motor directly coupled to the weighted base. Sample loop is 1024 Hz and the PWM frequency is approximately 8 kHz. A brass and PTFE composite thrust washer is used between the gearbox face and the 6061 aluminum hub of the weighted base.
The beam is dual-ball bearing mounted on a 3/8″ vented cap screw, which is fastened to the rotating platform with a nylon insert lock nut. The vented cap screw allows signal wires to pass through to the angle sensor fixed at the other end of the mount screw. Neodymium magnets are fixed to the beam on an aluminum bracket over the angle sensor.
The gearbox has experienced accelerated wear, likely do to half of the planetary gears being nylon despite being specified in the sales literature as metal. It has been rebuilt several times, with thrust washer moved in the gear stack, and exhibits a “detented” non-linearity while rotating. The PID must compensate for this as well.
The Raspberry Pi is used to update PID loop gains through an SSH terminal WiFi user interface, and generate live plots of the angle and PWM data using gnuplot and NGINX web server. Wireless interfaces allow for full continuous 360 degree rotation to balance the beam.
The Raspberry Pi and STM32 Discovery communicate using bidirectional UART serial. Processing is otherwise completely independent and parallel.
The project is used to demonstrate Zigler-Nichols and other PID tunings. The coefficients used are from the Wikipedia article on Zigler-Nichols tuning method.
Post time: Oct-02-2018