Question
Develop a C-language code for PIC18F4550 to control the position (speed and direction) of a DC Motor based on the feedback from a potentiometric sensor
Develop a C-language code for PIC18F4550 to control the position (speed and direction) of a DC Motor based on the feedback from a potentiometric sensor connected to the shaft of the motor.
When the motor is at the desired position, the variable resistor is at its exact center. We aim to bring the motor back to the central point whenever there is a disturbance in the motor position. The motor should return quickly, with higher speed, in case of a large disturbance and slowly in case of a small disturbance.
This sensor is a variable resistor whose resistance can change from 1 kOhm to 5 kOhm (Middle value is 3 kOhms). It is connected in series with a fixed resistor whose value is equal to 6 Kilo Ohms. The overall potential divider circuit is powered up with a 5V power supply.
The fixed resistor is connected to the ground and the variable resistor is connected to 5V.
The analogue output of this feedback sensor setup is fed to the ADC channel 0.
Design the circuit in proteus of a full H-bridge with a motor and the sensor circuit, and then calculate the range of the analog voltage output of the potential divider setup. Based on your output range, calculate the appropriate positive and negative voltage reference values needed for maximum resolution of ADC and connect fixed voltage sources of these reference values with the Vref+ and Vref- of the microcontroller. Activate the voltage reference using the ADC control registers and see to which pins these references have to be connected.
Use the 8 most significant bits of ADC and ignore the least significant 2 bits.
Step by Step Solution
3.51 Rating (154 Votes )
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started