Monthly Archives: July 2004
DC Motor Control with a TIP120 Transistor
Here’s the schematic for the capacitors and the regulator:The simplest program for this would be as follows (on the BX-24): Sub main() call delay(0.5) ‘ start program with a half-second delay do call putPin(13,1) call delay(1.0) call putPin(13,0) call delay(0.5) loopend sub In PicBasic Pro, the code would be as follows: pause 500 ‘ start program with a half-second delay main: high PORTD.2 pause 1000 low PORTD.2 pause 1000goto mainFor pBasic and mBasic, use the PicBasic Pro example and change the pin names.If your power supply for the microcontroller is compatible with your motor, you can wire the motor supply in parallel with the 5V regulator. For example, I use a 12V DC 1000 mA power adaptor, so I can use a 12V motor, if the power from the motor is wired in parallel with the 5V regulator’s input, like so:Note that the motor and the BX24 need a common ground (in our case, they get it through the transistor’s base; see above schematic).A motor controlled like this can only be turned in one direction. Continue reading
Simple PWM in PicBasic Pro
This is an example of pulsewidth modulation for the PIC. The value received from an analog input is used to dim an LED, using the PWM command. The LED is on RD2, and the analog in is on RA0. The … Continue reading