HTML controled ServoBlaster Pan Tilt servos

Snap 2016-01-29 at 16.12.26I spend lot of time trying to build a web based interface to control two servomotors (pan and tilt) using ServoBlaster  and Raspberry PI. I just wanted to share with you the result and hopefully it will help someone in the furture…

You can found the assemply of the servos here but this post is realy dedictaed to the HTML interface.


Needs : 

ServoBlaster  is a simple interface which help to control several servermotor just wrinting data in a /dev/ devices. to control the servos you just need to put values into this ddevices with and echo. To see all possibilities for ServoBlaster  and hwo to install it you can read the complete doc here.

I selected HTML5 for a beter interoperability, especialy with smatphones. I wanted a silmple page for the demo, not a lot ot time has been spend to the design, I only worked on the  technical stuff, not the design. Then it is up to you to change the design to have it integrated on your project.

I wanted for this project : 

  • to have a range input type to be able to move on both way for the pan and tilt.
  • an automated move from left to righ and reverse when I click on a bouton and the same for top/ bottom.
  • a low power consuption, only consuption when the move is ordered.
  • a simple installation and configuration (or not configuration at all !

You can find the complete code here : 

The first one index.php contain the display, the bouton and the java script code. When the pan or tilt value will change the page action.php will be called and write data into /dev/servoblaster to update the position for the servos.

HTML controled ServoBlaster Pan Tilt servos

index.php page HTML controled ServoBlaster

Leave a Reply

Your email address will not be published. Required fields are marked *