This week lab, we were dealing with Analog Output. First we used a basic motor, then we used a servo motor, and lastly we used a piezo buzzer.
Procedure:
With the basic motor, we hooked up a basic circuit with the motor plugged into analog pin 0 on our Arduino. We also incorporated a potentiometer. Since our Arduino does not have true analog output, only pulse-width modulation (also called PWM), rather than having a way to only power the motor at half speed, we had to use periods. Our periods were designed to turn the motor off and on so quickly that it seemed like the motor was running at half speed. Next we implemented the potentiometer. By allowing the potentiometer to control the duty cycles, the turn of the knob makes the motor seem like its running faster or slower by decreasing or increasing the amount of time that it is turned off. Here's a video of our results:
The next element to incorporate was a potentiometer. The code for this set up was designed to allow the potentiometer to change the direction of the motor based on the resistance from the potentiometer. Here are our results from that portion:
Conclusion:
I was once again pleasantly surprised by how well our lab went. We really didn't encounter any errors with our circuits or with our codes. I'm looking forward to finishing up our analog kitchen project and working more with analog output in the future.
No comments:
Post a Comment