Other Projects

PiStrobe - BananaPi Stroboscope

3 1523
Edited by Crypter at Wed Mar 11, 2015 07:30

Despite my troubles with the ethernet card (LeMaker, shame on you for ignoring this!) on my BananaPi I was working on this project and now I'm finally done with it!

Technically, this is just one very precise, very fast, customizable LED Blinky. Other than that can be used to tune string instruments and "stop" the motion of your computer cooling fans.

-"How on earth do you tune musical instruments with a freaking LED?!"
The answer is - easy. And very, very accurately. A string instrument vibrates it's wires to make sound, each note has a precise frequency of X Hz (ex. A is 440Hz). If you pulse a light at that string at 440Hz you'll "freeze" it in time because you'll be able to see the string at the very same position every time. If the frequency is 441Hz or 439Hz it will be slowly moving, very easy way to notice if you are out of tune.

The same principle goes for rotating fans and engine shafts and speaker membranes.

Now, when I told you the fun part about it it's time for some technical documentation (the Too Long Didn't Read part)...
The program uses ncurses library, it means it has a very nice (G)UI when you run it inside a SSH session/terminal. The screenshot below is pretty self explanatory...

While it's working it will rape one of the CPU cores and hold it to 100% usage, that's because I'm checking about 1 million times a second if the LED should be ON or OFF. Don't worry, it's OK unless you forget it running for like... a day (highly unlikely that will happen anyway). I can use TVHeadend and watch TV on my laptop while this is running, The BananaPi can handle it easily.

The source is compiled using
  1. gcc -O7 -o strobe strobe.c -lrt -lncurses -lwiringPi
Copy the Code
The source and a precompiled binary can be found here

Give permissions to the binary to be executed with "chmod 777 /location/of/file/strobo"
Run it with "./strobo" or "/location/of/file/strobo"

This is how the LED should be connected to the BananaPi
Post reserved by Author, I keep my cookies here

Edited by Crypter at Fri Aug 28, 2015 15:03

Finally an update!

The new version has a new feature, that is manual input of the precision, previously you could do that only with the (G)UI, and it has a small bug fixed, now the LED will go OFF for sure after the program is closed.

Oh, and now you can choose which pin to be used by adding the pin number after the program.
This would run the program on WiringBP pin #5 instead of the default #7
  1. ./strobe 5
Copy the Code

The following command would give you full list of available pins
  1. gpio readall
Copy the Code

Also, I figured I could use this software to control servos! If you connect the control cable from the servo to the pin used by the software using specific timings you can give commands to it.
You'll need to set the Frequency to 50Hz and the Precision from anything between 10 and 20. You control the servo with the precision, a precision of 13 will center the servo. It's not 15 because the scale is logarithmic and not linear. This is a possibility, not a feature, maybe it will be one day, who knows...

You can get the new version here:

If you have problems running it just execute install.sh, it should fix everything.
  1. sh install.sh
Copy the Code

I'd love to hear your feedback, I'm waiting for your comments!

You have to log in before you can reply Login | Sign Up

Points Rules