Microchip PIC16 motor development board
This document specifies and describes a development board for PIC161713 and compatible 28-pin microcontrollers. The board is designed specifically with motor control in mind, with dedicated headers for RC servos and DC motors, including dedicated connections for H-bridge control, quadrature encoder and current sense. The board also supports serial communication (SPI, I2C, USART) .
The board provides easy connection to both RC servo motors and DC motors (including H-bridge, encoder and current limit pins) via dedicated headers.
RC servo motors
Dedicated headers for two DC motors are available on the board. The headers are standard 100mil-headers.
Headers for each DC motor
Connector 1, to motor amplifier/H-bridge. This connector has pins for common signals used in H-bridge IC’s and motor amplifiers.
Ground connector to amplifier.
Programming and debugging
Standard 6-pin ICSP header with PICkit3.
The LEDs are routed directly to the i/o pins via a series resistor.
Value of series resistor
Note that the absolute maximum rating for DC current per output pin is +/- 25mA according to data sheet.
A red LED has a Vf at about 2,2V and should normally have a current of about 20mA. With a high level of 5V, this corresponds to a resistor value of
R = (5-2,2V)/20mA = 140Ω
Since this is pretty close to the maximum current of 20mA we need some safety margin and limit the current a 330Ω resistor is selected. Anywhere between 200 – 500 ohms should be OK (Williams).
The LEDs and series resistors, load the ports to some extent, whether or not they are actually used. The LEDs should therefore be considered disconnected if the port is programmed to be used for other purposes.
Switch as inputs to digital inputs
The switch output should be connected (strapped) from the point “Switch output” on the PCB, to the input pin of choice.
The switch can have two different configurations, for pulling the input high or low when the button is pushed. The pull-up resistor (if used) need to be soldered in the appropriate place on the PCB, together with a correct strap. See user codumentation for details.
The resistor values values should be large to minimize currents, at least 10k and up to 100k.
For pulling the input low when pushed, the internal pull-up can be activated, which eliminates the need for an external pull-up resistor.
Potmeters as input to ADC
There are four dedicated headers for ADC inputs. these can be used for potmeters or other analog sensors.
Note that the ADC module needs a reference voltage. The input voltage is measured relative to this reference voltage. The PIC16F1713 has a variety of options regarding reference voltages. The most straightforward option is to use Vcc as voltage reference. Please refer to the data sheet for a detailed description of the options.
Two dedicated connectors for serial communication is provided (in addition to the SPI programming header).
General serial communication header
A general, proprietry header for serial communication is provided, with the following serial modes, depending on configuration in the application software:
An FTDI-compatible header is provided for easy communications with FTDI-based serial to USB converter cables, for use with direct connection to a computer (terminal programs or other).
Routed to RX/RC7 and TX/RC6.
Power pin is disconnected, but if needed can be strapped to Vcc via dedicated holes in the PBC.
Output pin assignment by PPS output selection registers
All pin digital outputs default to PORT latch data. Alternate outputs can be selected as the peripheral digital output with the PPS output selection registers.
In order to optimise compatibility with other devices, the standard pins should be used as much as possible.
PWM output pins
There seem to be a total of four PWM outputs on the PIC16F1716, with two on each of the two peripherals:
The PWM ouputs are placed so that they are compatible with the normal position.
All PWM outputs can be placed on port B or C using the PPS module.
Since four PWM outputs are available, consider if inverted versions can be used for H-bridge inputs, as an alternative to an extra inverter IC, for two motors.
Timer input pins
The timer inputs will be used for receiving the Hall sensor outputs.
There are 5 timers altogether on the PIC16F1716, but only Timer0 and 1 have external inputs (TxCKI). Consequently there are not enough external timers to receive both Hall sensor signals from each motor, hence it is not possible to sense direction this way for two motors. However, it should be possible to feed this signal into another pin and detect in software whether it is leading or lagging the main signal.
Timer0 can be configured to ports A and B, while Timer1 can be configured to port A only.
T0CKI and T1CKI are on their default positions RA4 and RC0, respectively.
Clarifications and investigations
Look into use of Timer1 for 16-bits PWM, as on AVR
PGM/LVP (Low Voltage Programming) can simply be disconnected. Disable LVP bit in configuration word. This seems to be necessary in order to use the corresponding pin RB3 as normal i/o. Possibly turned off automatically at programming if low voltage programming is not used. Check in MPLABX.
What is DAC2OUT1 — AN Digital-to-Analog Converter output on pin RA5?