Introduction
Authors: Iustinian Bujor, Cristian Pop, Microchip Technology Inc. |
This application note describes how to drive a Switec stepper motor as a metronome, using mainly Core Independent Peripherals (CIPs), with minimal involvement of the core.
A metronome is a device with a swinging pendulum, which oscillates with a frequency that represents the number of beats per minute. It produces an audible or a visual signal, or both, whenever an oscillation period is completed.
In this document, the metronome was implemented using a Switec stepper motor because it requires low current, and it can be driven very precisely using the microcontroller pins, without any additional hardware, and it has a configurable number of steps to run.
The metronome is driven by sending specific waveforms to the motor’s inputs. These waveforms are generated by a circuit composed entirely of CIPs. This application note describes all the peripherals used and how they are connected. The implementation is presented gradually, starting from driving the motor in one direction, up to controlling the direction of rotation, and the number of steps to run.
The waveforms generation is made independently from the software, thus, the core load, the program, and data memory usage are minimal.
The PIC16F18446 Curiosity Nano Board together with a Switec stepper motor were used for this project. The implementation can be ported to other platforms, but some limitations might appear due to the hardware characteristics of the microcontroller used.