Documentation 05

//Labs


Transistor and Relay Lab

This is the first lab I did. In the first time, I connected the diode reversely and it did not work though on the instruction it already highlighted the silver band’s direction...


video 5.1 Turn the microcontroller on and off every 1 second


video 5.2 change the speed of the motor with the potentiometer

H-Bridge Lab
It was a little confusing for me to remember the pins of the motor driver the first time (AIN2 pin is above AIN2 pin). So I connected them after reading the datasheet of the motor driver and the Arduino several times.

video 5.3 using the H-bridge to reverse the direction of the motor

Then I used mapping to map the analog input of the force sensing transistor to control the speed of the motor. Here is the code:
fig 5.1 code of changing the speed of the motor using the potentiometer

I forgot the range of the motor so I started with 100 and see how it worked. This video is the one when it is between 0 to 255, which is the correct range that I found out?