Subscribe by email

PIC16F886 horn driver

A very interesting horn driver project presented by Microchip technology is presented in this circuit diagram . This horn driver project is based on PIC16F886 microcontroller , from Microchip . This microcontroller horn driver circuit diagram is very simple and require few external components . The PIC MCU has peripheral resources within the device to provide horn driver services in a very simple manner.
The PIC MCU peripherals include the Enhanced CCP (ECCP) module in Pulse-Width Modulation (PWM) Half-Bridge mode to drive the 2 horn drive leads and a single ADC input to monitor the horn feedback after it has been conditioned.
Horn characteristics are required to determine the defined parameters for the range of the PWM module.

For example , a horn with a resonant frequency of 3.5 kHz ± 0.5 kHz; the PWM module generates a PWM frequency output from 3 kHz to 4 kHz with 50% duty cycle.
With a device that is running off of the internal oscillator at 8 MHz, the clock source to Timer2 that drives the PWM period generates 2M clocks per second. For a 3 kHz period, this is 667 clocks per cycle, and for a 4 kHz period, this is 500 clocks per cycle. Because Timer2 is an 8-bit timer, accepting only a maximum value of 255, these clocks per cycle must be divided (a prescaler of divide-by-4, yielding 166 clocks per cycle for 3 kHz, and 125 clocks per cycle for 4 kHz) .

The PWM output driven by the ECCP module in Half-Bridge mode, with both the P1A and P1B outputs active-high, will step through the 125 through 166 clocks per cycle periods at a period rate, and as the Period register is loaded, the value will be dividedby- 2 and loaded into the Duty Cycle register for a 50% duty cycle. This will become the new PWM period for measuring the feedback from the driver, and drives the transistor that raises the level that the horn lead sees, to 9V.
Software for this project was developed by Bill Anderson , Microchip Technology Inc..
You can download the software for the PIC16F886 project following this link : PIC16F886 horndriver.
PIC16F886 horn driver schematic circuit

Add new comment