Lab 5
Net ID: pp386
Objective: Open Loop Control
Prelab
I checked out the datasheet and the documentation of the dual motor driver.
What pins will you use for control on the Artemis?
I have used the Analog pins A0,A1,A2,A3 as control inputs to the 2 Dual motor drivers. I have used all the pins which are together to each other because it was helping me reduce the length of the wires.
Why is it recommended to use 2 batteries?
Two different batteries are recommended to for two different subcircuits because the smaller 650 mAh battery will power the Artemis and the sensors and the bigger 850 mAh battery will power the motor drivers and the motors. This is done because we can power 2 different subcircuits individually and 2 batteries would give enough power to the circuit.
Lab Procedure
I first connected and soldered all the circuits and fit everything inside my car. I used tape to fit all the circuitry into my car and close the encasing.
-
After that I connected the function generator to the motor driver. Some reasonable settings for the voltage value VIN for the motors is around 3.7 V. For this value of VIN, my motor was running.
-
THe analogWrite command is used to generate PWM signals on the Artemis and these PWM signals can be used as inputs to the motor driver and hence drive the motors. I did not click a picture of the oscilloscope after I tried it out but I was able to observe a square signal on the oscilloscope.
-
Done as instructed, picture shown above.
4,5,6. Then I showed that the motor connection was working and the motors were running in both the directions.
7.1 I noticed that for the lab floor, motor values of around 60 were sufficient to move the car from rest. Here 60 is the value of the PWM input through the function AnalogWrite.
7.2 I applied a calibration factor since my motors were not running with the same speed. I found out through trial and error that when my right motor would run at 64 and the left at 59, my car was able to travel straight. As you can see in the video below, the car moves straight.
7.3 Open Loop Control I added the following functions to the car to make it move front and back and turn and stop.
### Additional Tasks
-
According to the documentation, analogWrite generates a frequency around 490 Hz. I read some articles online about generating a faster PWM signal, but I didn’t find any benefits towards the manual configuration of the timers to generate a faster PWM signal as the motors donot respond to a much faster PWM signal, and rather the other circuitry like the sensors also need to take readings at standard intervals of time. Hence, a PWM signal of 1ms to 2ms is used as an industry standard.
-
Ramp Up and down with Bluetooth values
This is the code.
I couldnt calculate the top speed of the car since I didnt have a large enough area to let the car hit top speed. The minimum speed of the car is obviously 0.