Gertboard-Pi Potentiometer Controlled Motor

 

  • In the potmot (for potentiometer-motor) test we use a potentiometer (“pot”) connected to the analogue to digital converter (A/D) to get an input value, and this value is used to control the speed and direction of the motor. It is set up so that at one extreme, the motor is going at top speed in one direction, as you move the wiper towards the middle it slows, at the middle the motor stops, and as you continue to move the wiper along, the motor speeds up again but in the other direction.

Gertboard-Pi Potentiometer Controlled Motor

  • To wire up the Gertboard for this example, jumpers connect GP8 to GP11 to the pins directly above them to allow us to control the SPI bus using GPIO8 to GPIO11. You must attach your potentiometer to the AD0 input. GPIO17 controls the motor B input and GPIO18 controls the motor A input using the pulse width modulator (PWM). Thus GP17 must be connected via a strap to MOTB, and GP18 must be connected to MOTA. The motor and its power source must be connected to the screw terminals in J19 at the top of the board.

Potmot test in Python:
This program, potmot-wp.py, uses spidev to control the A/D and WiringPi for Python to control the motor with the hardware PWM.
Gertboard-Pi Potentiometer Controlled Motor SchmeaticThe potentiometer position (read by the ADC) determines motor direction and speed (PWM value) as follows: middle value (511) results in no movement, 1023 results in max speed one way, 0 results in max speed the other way.
Download and install WiringPi:
If you don't have WiringPi for Python installed already, the best way to instal it is:

 

For more detail: Gertboard-Pi Potentiometer Controlled Motor Schmeatic


About The Author

Ibrar Ayyub

I am an experienced technical writer with a Master's degree in computer science from BZU Multan University. I have written for various industries, mainly home automation and engineering. My writing style is clear and simple, and I am skilled in using infographics and diagrams. I am a great researcher and am able to present information in a well-organized and logical manner.

Follow Us:
LinkedinTwitter
Scroll to Top