servoTurn.Py – a simple python script to turn a servo on a raspberry pi 3

4710 0

This script requires install of the servoblaster program. Please install it into your “pi” home directory as they describe on the servoblaster page.

I used the Adafruit Pan/Tilt servo motor kit and the Miniarduino servo motor kit. They are very similar. If yours needs to be put together,  use the Adafruit Tutorial on how to build servos.

Servos take more power than the Raspberry Pi can deliver without causing errors, so I run a battery to power it separately.  In the pictures you will see an inland battery from micro center, but in my diagrams I used adafruit parts… because they are available in the diagram software. Score one for the supplier who knows their makers and makes diagram software models!

 This diagram is -close- to what I used, instead it has common and available adafruit parts like the LiPo Controller, Pi Cobbler,  and the Servo because that’s what I found in the diagram program “Fritzring” – the standard in these things.  I use servo #0 – which according to the documentation at servo blaster is the same as GPIO #4 which is pin #7 on the Pi Header / Cobbler.

Here is the code :

This script has been tested only on a Raspberry Pi 3 computer.  

Please report any tests or improvements in the comments box at the bottom of this page.

This is a part of the 2017 Rock, Paper, Lasers Science Project.  

Here’s a quick video of it in action : 

 

2017 Rock Paper Laser, Part 1 of 5

 

Facebooktwitterredditpinterestlinkedinmail

Related Post

Hello World

Posted by - August 15, 2015 0
We use python to write all of our scripts. On our raspberry pi every python script starts with a shebang…

GPS AT Commands

Posted by - October 18, 2015 0
AT+CGPSPWR? if off : AT+CGPSPWR=1 Get status : AT+CGPSSTATUS? Get GPS : AT+CGPSINF RESET CODES : What mode ? –…

Raspi-config

Posted by - August 15, 2015 0
First you will need to open terminal. Terminal is located at the top of your raspberry pi screen. Terminal is…

Turn string into array with split

Posted by - October 18, 2015 0
textWithCommas = “bee,apple,pear,dog,carrot,robot” wordList = textWithCommas.split(“,”) print “the second item is : ” + textWithCommas[1] Keep Reading : Identify USB…

There are 0 comments

  1. Pingback: Tales of a 6th Grade Maker: Tribulations of a Laser Cutting Science Fair Project | Make:

Leave a comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.