DC motor controlled by Transistor ------------------------------------------------- ![ScreenShot dcmotor](https://github.com/gavinlyonsrepo/RpiMotorLib/blob/master/extra/images/RF310T11400.jpg) ![ScreenShot Tran](https://github.com/gavinlyonsrepo/RpiMotorLib/blob/master/extra/images/tran.jpg) Hardware -------------------------------------------- ![ScreenShot sch](https://github.com/gavinlyonsrepo/RpiMotorLib/blob/master/extra/images/motor_gpio.jpg) DC motor controlled by Transistor connected to a GPIO pin and feed a PWM signal for speed control. No direction. Used for fans and applications where direction not needed. This video explains setup and theory well. [youtube Video](https://www.youtube.com/watch?v=W7cV9_W12sM) This library was tested on a number of motors including the RF-310T-11400 Software ------------------------------------------- The file rpi_dc_lib.py contains code for this component It consists of a class called TranDc and two methods Class init: | ID | Name | Type | Default | Help | | ----- | ----- | -- | --- | --- | | (1) | pin | int | | GPIO pin connected base of transistor | | (2) | freq | int | 50| PWM freq in Hz of control signal | | (3) | verbose | bool | False | Write pin actions to console| The methods are called 1. dc_motor_run = Drive motor forward, two args = duty cycle % , step delay in seconds 2. dc_clean_up = Switch's GPIO pins off 3. motor_stop = Stop motor output immediately. PWM object kept alive for reuse. More example code is in the Transistor_DC test.py file in example subfolder of rpiMotorLib repository.