Did you ever wonder how fast your fidget spinner spins? Or maybe which one of your spinners spins the fastest? With your Piper Computer Kit, you can build your very own fidget spinner rotational speed detector!
For this project, you'll need your Piper Computer Kit, a photoresistor, a regular resistor and a few household materials.
Step 1) Connect an LED to jumper wires
Find the clear LED, one red wire and one black wire from your Piper Computer Kit's toolbox. Connect the longer lead of the LED to the female end of the red wire and the shorter lead to the female end of the black wire.
Next, wrap some clear or masking tape around the jumper wires to help ensure the LED doesn't disconnect from the wires.
Step 2) Wrap the LED in Plastic
Find a piece of reflective plastic material like you'd find in a snack bag. Wrap the plastic around the LED - this will help to concentrate the light into a smaller area.
Try to make a cone shape so the front opening is smaller than the back. This helps to focus the light. Tape the plastic to keep it in place.
Step 3) Wrap the Photoresistor in Plastic
Now repeat Step 2 with the photoresistor. Again, the front opening should be smaller than the back opening of the cone to make sure the light is focused only on the resistive element. Make sure the two leads on the photoresistor are not touching each other.
Step 4) Reinforce the Components
Wrap the cones with tape and paper to make the cones sturdier.
Step 5) Build the Circuit
Now that we've completed building the LED and photoresistor components, we need to connect them to the Raspberry Pi. The diagram below shows the completed circuit.
Step 6) Mount the Components
Use a paper cup to make a stabilizer stand for the LED. Make sure the LED and photoresistor align so the light shines directly into the photo-resistor.
Helpful hint - you can make the wires longer by daisy chaining them!
Step 7) Connect the Circuit to the Raspberry Pi
Connect the red, black and green wires to the Raspberry Pi as shown below.
When everything is connected, it should look like this:
Step 8) Download the code
On your Piper Computer Kit, open the Chromium web browser and launch this blog post. Download the code here.
Click the Download button in the upper right:
Step 9) Run the code
From your Piper Computer Kit's desktop, open a terminal window by clicking the Terminal button (shown in green).
Next you'll need to connect a keyboard to the Raspberry Pi. If you don't have one, you can open the on-screen keyboard and use that instead.
In the terminal window, type the following command to select the downloads folder:
Then type the following command to run the code.
>> sudo python fidgetSpeedRead.py
So what does the code do? The code takes a measurement of the voltage of the green wire. When more light is shining on the photoresister, the resistance decreases and the voltage on the green wire increases. The program can detect how often this happens and displays how fast the spinner is spinning in rotations per minute.
Step 10) Spin and measure!
With the LED pointing at the photoresistor, place your spinning fidget spinner in between them and check the rotational speed in the terminal window. How fast can you go?
The program is coded for spinners that have 3 blades. But what if your fidget spinner doesn't have three blades? You'll need to modify the code - you can do this by entering this command into the terminal:
>> sudo nano fidgetSpeedRead.py
Find the line where it says 'numOfBlades=3' and change it to the number of blades of your spinner.
then press ctrl+x together to save the file. You can then run the file by typing:
>> sudo python fidgetSpeedRead.py