July 2004

DC Motor Control with a TIP120 Transistor

This example assumes you’re using a DC motor that runs on low voltage DC, in the 5-15V range. Connect leads to its terminals, and run if from a benchtop power supply if you have one. Try changing the voltage on it, and seeing what effect it has. Don’t go over the motor’s rated voltage. Connect a switch in series with the motor and use it to turn on the motor.

Continue Reading »

BX-24
PicBasic Pro
pBasic (Basic stamp)

Permalink

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 PWM command has three parameters: the pin, the duty cycle (a byte), and the number of times to pulse the pin (a word). The duty cycle is how long the pin is on for each cycle. If the duty cycle is 100% (255), then the pin is on all the time. A duty cycle of 50% turns the pin on for half of each cycle, and so forth.

At 4MHz, one on-off cycle is about 5 milliseconds. A higher number of cycles makes for smoother PWMing, but less interactivity, because the PIC does nothing else until it’s finished all the cycles for each PWM command.

Continue Reading »

PicBasic Pro

Permalink