Introduction: Motor Driven Pendulums
Here I am going to make two pendulums, or swings that are driven by motors which are in turn controlled by a PIC32 MCU, and to implement some functions, ie. to simulate motion of the pendulums under gravity or effect of a spring, by controlling the motors.
Step 1: Step 1: Materials and Tools
In this project we need:
A NU32 development board
A DRV8835 dual motor driver carrier
2 MAX9918 current-sense amplifiers
2 DC motors with encoder
2 printed circuit boards with encoder counting chips counting in 4x mode (quadrature inputs from the encoder and an SPI interface to the NU32)
Battery pack
Wire, breadboard, resistors and capacitors
Laser cutted pendulum parts
Step 2: Step 2: Wiring
Wire the PCBs as pictured.
The decoders communicate with the NU32 via separate SPI channels as it can be buggy to use one SPI with slave selector pins
Refer to Embedded Computing and Mechatronics with the PIC32 Microcontroller for details
Step 3: Step 3: Code
Step 4: Functions
Here are two examples
1.One pendulum following another
2.Virtual spring, demonstrated as PWM duty cycle as change of force cannot be filmed