Question: Deliverable You must generate a flow chart for the closed-loop (proportional) speed control algorithm (see Section 4.1). Your algorithm will have to compute an estimate

Deliverable

You must generate a flow chart for the closed-loop (proportional) speed control algorithm (see Section 4.1). Your algorithm will have to compute an estimate of the cart speed, and save this estimate in a variable named speed. In order to compute the content of speed, you will need to measure the number of encoder steps produced during a certain time duration.

For the mini-project you are required to program the Arduino microcontroller to create a closed-loop controller that will first move the cart from the middle of the track to the right end of he track and stop for five (5) seconds. From there, the cart must move to the left end and stop for ten (10) seconds. It must repeat this for a total of 4 loops. You have to specify two speed settings for this experiment: one being the initial speed to get the cart start and the other being the speed setpoint (how fast you want the cart to move at a constant speed) which correlates the PWM value to the number of counts per time step (this speed setpoint may or may not be the same as the initial speed in terms of magnitude). To validate your results, use a 1 to 2 inches high object (e.g. use the disc weight) to prop up the cart track on one end. Your controller should be able to drive the cart up and down the track maintaining a constant speed.

You must submit a short document that includes:

Flow chart of your algorithm, including the speed calculation and speed control method.

Algorithm C code or pseudo code

Hint:

You can utilize the Serial communication port to display such measurement via the Serial.begin(.) and Serial.println(.) commands (for more information please refer to the example in https://www.arduino.cc/en/Reference/AnalogRead). In order to calibrate your encoder with minimum chance of skipping counts, decide on a pulse width modulation amount that would result in a small cart velocity. Typically, a value below 50% duty cycle, loaded into the PWM port, using the analogWrite(.,.) function, results in a small cart velocity. For measuring the speed of the cart (motor) in terms of the number of timer counts per time step (dt), you can use the following pseudo code: Initialize Encoder_Count to 0; for(Timer_Count = 0; Timer_Count < Total Counts in One Time Step (dt); Timer_Count++) { Call Encoder(); } Store the Encoder_Count as the measured speed; You are also encouraged to use the pre-defined time delay functions from Arduino (https://www.arduino.cc/en/Reference/Delay) to set the constant time period instead of using the above for loop technique.

To implement the proportional speed controller, we have to calculate the error or difference between the measured speed value and the speed setpoint value, then based on the error calculated and the proportional gain (Kp) value you have specified, the speed controller should be able to compensate the disturbance induced to the system (e.g. friction and the inclined track in our case). Using the speed measurement subroutine mentioned above, we can come up with a proportional speed controller as described by the pseudo code below: while(|Speed_Setpoint - Measured_Speed| > Error_Bound) { Speed = Speed + Kp*(Speed_Setpoint - Measured_Speed); Set motor speed to Speed; Initialize Encoder_Count to 0; for(Timer_Count = 0; Timer_Count < Total Counts in One Time Step (dt); Timer_Count++) { Call Encoder(); } Store the Encoder_Count as the measured speed; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!