With this little project I will showing how to use your Raspbery Pi to turn on and of an LED, turning the led on and of will be triggered from a web page using php, the request can be sent from any device that can send a http request.
The end goal of this project will be to have a tally system that can show video camera operators when they are on air for us the http requests will be sent from our atem using justmacros (when this complete and I have finished bug testing I will post the just macros code).
What you will need.
- 1 x Raspberry Pi
- 1 x 3.3v LED
- 1x resistor 270Ω
I will be using raspbian which you can download from the RPI site http://www.raspberrypi.org/downloads/
After you have installed and configured raspbian you will need to install Wiring Pi
You can read the install guide for Wiring Pi at http://wiringpi.com/download-and-install/
After you have installed Wiring Pi you will also need to install apache and php, i have included vim as this is what I prefer to use when editing files from the command line.
sudo aptitude install vim apache2 php5
after you have installed the webservice you will need to make sure that it starts at boot time.
sudo update-rc.d apache2 defaults
Next you will need to create the led.php file in the webroot /var/www/
<?php // The GPIO Pin to use $pin='2' $pin='0'; //set the gpio's mode to output system("gpio mode ".$pin." out"); $vido_status = $_GET["status"]; // The value of the variable name is found display to screen // echo "Video Status: " . $vido_status; //get the request and switch led on or off depending on status sent by request if($vido_status == '0') { echo "Off"; system("gpio write ".$pin." 0"); } else { if($vido_status == '1') { echo "On"; system("gpio write ".$pin." 1"); } } ?>
The urls below will be required to make the led switch on and off via a web request for example
Switch On LED
http://yourpi.co.uk/led.php?status=0
Switch Off LED
http://yourpi.co.uk/led.php?status=1
After you have configured the webserver you will need to wire up the LED to your PI
After you have wired up the Pi test and you should see all working well, this is a quick guide so let me know how u get on.
this is the first part of a on going project and this was built as a prof of concept, will post more details as the project progresses and provide details on how you can build.
Hello,
I wanted to know if you finished your Raspberry Pi Led Tally project and if it works with Blackmagic ATEM switcher now ?
We are looking for a similar solution.
let us know and happy easter.
best regards
stéphane
yea it did get finished altho it’s quite a bit different now. will see if I can get the code into a git repo for you when i get time (not doing so much of the video stuff atm).