In this instructable, I will show you how to control outputs using PWM. The circuit that I am using uses a transistor rated at 700 mA. To control devices that use higher voltage/amperage, you will also need a relay.
Pulse Width Modulation simply turns an output on and of rapidly, which can be used for dimming LED's and changing speed on motors.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Parts and Tools
Here are the parts and tools needed to build this project:
NPN transistor I'm using a (2222a)
1k Ohm resistor
Linkit ONE board
Small DC motor (Or any kind of output) OR an LED
Computer with linkit ONE drivers and latest version of the Arduino IDE
Step 2: Wiring
For this step, you can choose the difficulty, you can either plug the led directly into pin 9, or connect a transistor to control higher powered things, like motors.
LED: Put the ground pin of the LED (the shorter one) into the GND pin on the board, and the longer lead into pin 9 on the board.
Transistor: Plug the base of the transistor (centre pin) into pin 9 remembering to add a 1k resistor in between, then the emitter (right pin) to a ground pin, and the collector to the negative pin of the device that you are driving. In my case, the negative lead of a motor. Onto the next step.
Step 3: Upload Code
Download the code here; then double click it to open it. Now, press upload.