Cornell University EE 476 Final Project
Fertilizer Feed Rate Controller
The whole idea behind the microcontroller is to modify the output created based upon the input.
Ground speed of the tractor from a radar unit (square wave at 17 Hz/MPH)
Shaft rotation speed from fertilizer delivery system (square wave with fixed number of pulses/rev)
User input through keypad to determine relative fertilizer delivery rate to ground speed
PWM control for fertilizer motor drive shaft speed
LCD for output to user
The 8515 has the nice feature of a very flexible set of operations possible with its 16 bit timer1, as well as interrupts based on external events. These features are exploited in the operation of the controller.
The output of the Radar ground speed sensor is a 12V DC square wave signal with a frequency of 17 Hz/mph. This is converted to a 5V square wave through a series of transistors (see schematic) and connected to the 8515 ICP (input capture pin) This allows an external event to trigger a capture of timer1, which allows the microcontroller to measure the time between rising edges of the square wave which leads to the frequency of the waveform. This frequency is then converted into the ground speed of the tractor.
The other input is the shaft rotation speed of the fertilizer delivery drive. A proximity sensor is used to sense the motion of gear teeth that travel past the sensor as the shaft rotates. Since there is only one ICP connection, the shaft rotation is hooked up to the external interrupt pin, which causes the microcontroller to execute a specified segment of code on a rising edge. This code is written to perform the same duty as the hardware of the ICP - capture the value of timer1. Since there are two external interrupt pins, it is possible to expand to the measurement of two shaft speeds.
The input ground speed from the radar sensor and the shaft rotation speed from the proximity sensor are then fed into a control algorithm which controls the duty cycle of a PWM signal. This PWM signal is then used to control a MOSFET which drives the 12V/15A drive motor for the fertilizer feed. The Atmel 8515 has the hardware ability to use timer1 in a PWM mode. However, when this is activated, timer1 cannot be used for any purpose except for PWM generation. Since it is necessary to use timer1 for measuring the frequency of the radar and shaft rotation speed inputs, we must come up with a second method for PWM generation. This is done by using the compareA/B match and overflow interrupts of timer1. On timer1 overflow, the output for the PWM is set high. When compareA matches, it sets PWM1 output low, and when compareB matches, it sets PWM2 low. This way we have the ability to generate two PWM signals using timer1 while still using it for measuring the frequency of the radar and shaft inputs.