In a previous How-To Guide I demonstrated how to blink a Snap Circuits LED with the Kano Computer (blinking an LED is the “Hello World!” of hardware hacking) and in this guide I’ll demonstrate how to drive a variable speed fan with Snap Circuits and the Kano Computer. I’ll actually use the same Scratch program that I used to blink the LED to control the speed of the motor. When I pressed the up arrow on the Kano keyboard, the LED blinked faster and faster. Conversely, when I pressed the down arrow the LED flashed slower and slower. In this circuit, when I press the up arrow the fan will increase in speed and when I press the down arrow the fan will decrease in speed.
Learning how to drive motors with a microcontroller is a basic skill that you will need if you are interested in robotics. You can safely use the Snap Circuits transistor with the Snap Circuits motor (M4) since there isn't much load on the motor simply spinning the fan attachment. Do see the the caveats toward the end of this article regarding using transistors with motors.
Optional: Mobile Phone Battery Pack (I used the battery pack to power the Kano so I could shoot pictures at my table top photography studio, but you can leave yours connected to your TV and the wall wart that comes with the Kano Computer).
1 Snap Circuits Base Grid (11” x 7.7”) # 6SC BG
1 Snap Circuits Motor # 6SC M4
1 Snap Circuits Wind Fan # 6SC M4B
1 Snap Circuits NPN Transistor # 6SC Q2
1 Snap Circuits Slide Switch # 6SC S1
1 Snap Circuits Battery Holder (2-AA) # 6SC B1
1 Snap Circuits 100 ohm Resistor # 6SC R1
2 Snap Circuits Conductor with 3-snaps # 6SC 03
I created a custom made interface cable to connect the Kano to my Snap Circuits using an HDD indicator LED from and old computer, electronic shrink tubing, wire glue, and the following Snap Circuits Jumper Wires:
1 Jumper Wire 18" (Black) # 6SC J1
1 Jumper Wire 18" (Red) # 6SC J2
Where to get the Kano and Snap Circuits:
Connect the Snap Circuits to Kano Computer Raspberry Pi Header Pin
While I had the Kano Computer disconnected from power, I opened the case and connected a Hard Disk Drive indicator LED from an old computer to pin 9 (Ground) and pin 11 (GPIO17) on the Raspberry Pi. I cut away the LED housing and spliced a red and black Snap Circuits Jumper Wires to connect to my Snap Circuits adjustable speed fan circuit.
Build the Adjustable Speed Fan Circuit
The circuit is actually fairly simple. We don't want to connect a motor directly to the Raspberry Pi since this might cause the Raspberry Pi to reset (or worse). The black Snap Circuits Jumper wire is connected to pin 9 (Ground) on the Raspberry Pi and to the (-) terminal on the Snap Circuits Battery Block. The red Snap Circuits Jumper wire is connected to pin 11 (GPIO17) on the Raspberry Pi and to the 100 Ohm resistor (which is connected the base of the NPN Transistor). We'll be using the transistor as an electronic switch. When we set pin 11 to high (3.3 volts) it will switch the transistor on and current can flow thru the circuit and spin the fan. When we set pin 11 to low (0 Volts) it will switch the current off and no current will flow thru the circuit and the fan will soon cease to spin.
In a way the transistor works like the Snap Circuits Slide switch--when the switch is open no current will flow and when the switch is closed current will flow thru the circuit. The advantages are that we are not connecting pin 11 directly to the motor (which can cause more than a few problems on the Raspberry Pi) and that we can switch the transistor on and of really quickly, say, 100 times a second. You couldn't switch the slide switch on and off that quickly!
To run Scratchgpio5, from the Kano Desktop click on Apps...Read more »