Servo Pod

19,490

52

40

Posted

Introduction: Servo Pod

You ever dreamed to have an orbitcam or any other Pan/Tilt webcam control?

Here it is! With this Made from scratch Servo Pod, you can now control your webcam (or wifi antenna ?) by the palm of your hand or even remotly with a web server.

Step 1: Get All the Parts and Tools

For this Servo Pod, you'll need :

Parts :
1 x Microchip pic16f628(a) (free sample from microchip, don't abuse...)
1 x Dip socket for pic
5 x 4.7kOhm resistor (or 5 "pullup" resistor)
1 x 22kOhm reisistor
1 x serial port plug
2 x Servo Motor (any 5v model witch is powerful enought to hold the webcam)
2 x 3pin plug for your servo
1 x Led
4 x push button
1 x switch
1 x Breadboard

Tools :
1 x Soldering iron
1 x Pic Programmer (cheap on ebay or Diy)

Others :
1 x Webcam ?

Step 2: Flash the Pic

Get yourself a pic programmer and use the software you like (IcProg for me) and Flash the Pic with the following HEX file.

Look on the picture for the basic config.

Step 3: Soldering

Using this schematic, solder everything on the breadboard. Use the Dip socket for the Pic as you might want to flash it again.

Note : the 4 pushbutton are used for "joystick" mode. You should wire them ..on a another board with a cable.

The button wire like this :
rb0 Left (might be right..)
rb1 Right (migth be left...)
rb2 Down
rb3 up

The led is used to show joystick mode, you might want to have it remotly on the joystick board. ALSO NOTE !!! I used a internal resistor 5v led. Add a resistor if your led is not like mine (100ohm should be OK)

Your servo pin could not be the same as mine (1-5v, 2-Signal, 3-Ground) change for your need.

You need a 5v Power source

R1 to 5 = 4.7kOhm
R6 : 22kOhm

J1 = Pan J2 = Tilt

Step 4: The Software (for Serial Com)

Just download my (soon to be good) crapy Delphi made software and have fun !

Note : The switch must be in remote mode (led not lit) to use the serial port

The software is not yet completed... don't forget to open the port before anything or it will crash.

The number on the left is Pan and right is Tilt. Should be something from 65 to 225 (anyway the Pic will ignore anything else)

The small light "arrow" is to move left.. Hold it (you see the pan number change) and release will send data to serial port

When you launch the .exe it also launch a web server on port 2020 where you can control the Servo Pod (connect to serial port before launching your web browser)

To use the webserver its quite simple.
http://localhost:2020/A130 A mean the Pan position this will be 130 (from 65 to 225) if you want 70 right : 070
http://localhost:2020/B130 B is the Tilt position
http://localhost:2020/C010 C will add the number to the current Pan pos

The other letters are not yet implemented. If you want to use this on a webpage you should basicly use javascript http request or send those request in a 1x1 iFrame

I might release the source code (witch is quite ugly...) sooner or later so anyone could finish it (and add more stuff)

NOTE : If some guru would like to dev a better software (im a web dev... not a software dude hehe) the thing is quite simple. All you need to send to the serial port is 2 bytes from 65 to 225. In my software, I convert the String to Int then the int to Char. The Chars (2 bytes) are then send on the serial port. You must also wait for the DSR line to be "high" as this is the hardware handshake to make sure the Pic is ready to receive. Thanks!

Share

Recommendations

  • Epilog Challenge 9

    Epilog Challenge 9
  • First Time Author Contest 2018

    First Time Author Contest 2018
  • Gluten Free Challenge

    Gluten Free Challenge
user

We have a be nice policy.
Please be positive and constructive.

Tips

Questions

40 Comments

hi, how to comunicate con serial, for pan and til?, how to send data, one for pan and one for til?, width A o B and data?, i try to write delphi code, without exit. can explain please. jose.

I was lurking arround on the internet and tought I'd look at some of my old forum post... and guess what... I found this :

[code]

'****************************************************************

'* Name : SERVOPOD.BAS *

'* Author : André Quirion *

'* Notice : Copyright (c) 2005 *

'* : All Rights Reserved *

'* Date : 31-03-2005 *

'* Version : 1.5 *

'****************************************************************

include "modedefs.bas"

CMCON = 7

'Initialisation des variable, constante

pos1 var byte 'Variables de positionement

pos2 var byte

cont var byte 'Compteur

mode var byte 'Variable du mode

'Initialisation des valeurs

pos1 = 157 'Position centrale du servo au demarrage

pos2 = 152

mode = 0 'Mode joystick au demarrage, changer au choix

high porta.2 'Allumer la LED du joystick, changer au choix

if mode = 0 then goto joystick

if mode = 1 then goto remote

remote:

for cont = 0 to 40

pulsout portb.4,pos1 'Impulsion vers les servos

pause 8

pulsout portb.5,pos2

pause 8

next cont

high portb.7 'Handshacking hardware

serin portb.6,N2400,100,fin,pos1,pos2 'Attente des données serie.

fin:

low portb.7 'Handshacking hardware

gosub modeDetect

if mode = 1 then

goto remote 'Retour au debut des instruction

else

high porta.2

goto joystick

endif

end

joystick:

if portb.3=0 then pos2=pos2-1

if portb.2=0 then pos2=pos2+1

if portb.0=0 then pos1=pos1+1

if portb.1=0 then pos1=pos1-1

pulsout portb.4,pos1 'Impulsions vers les servos

pause 8

pulsout portb.5,pos2

pause 8

pause 20

gosub modeDetect

if mode = 0 then

goto joystick 'Retour au debut des instruction

else

low porta.2

goto remote

endif

end

modeDetect : 'Quel mode ?

if porta.3 = 1 then mode = 1

if porta.3 = 0 then mode = 0

return    

[/code]


Thats the BASIC code that compile using PicBasic Compiler. It's the code thats sits in the PIC

Don't know if you're still interested about it. Have fun :D

Hello Any chance you could send me the source for the Pic and also the source code for the program please. Andy

I was lurking arround on the internet and tought I'd look at some of my old forum post... and guess what... I found this :

[code]

'****************************************************************
'* Name : SERVOPOD.BAS *
'* Author : André Quirion *
'* Notice : Copyright (c) 2005 *
'* : All Rights Reserved *
'* Date : 31-03-2005 *
'* Version : 1.5 *
'****************************************************************
include "modedefs.bas"
CMCON = 7
'Initialisation des variable, constante
pos1 var byte 'Variables de positionement
pos2 var byte
cont var byte 'Compteur
mode var byte 'Variable du mode
'Initialisation des valeurs
pos1 = 157 'Position centrale du servo au demarrage
pos2 = 152
mode = 0 'Mode joystick au demarrage, changer au choix
high porta.2 'Allumer la LED du joystick, changer au choix
if mode = 0 then goto joystick
if mode = 1 then goto remote
remote:
for cont = 0 to 40
pulsout portb.4,pos1 'Impulsion vers les servos
pause 8
pulsout portb.5,pos2
pause 8
next cont

high portb.7 'Handshacking hardware
serin portb.6,N2400,100,fin,pos1,pos2 'Attente des données serie.
fin:
low portb.7 'Handshacking hardware
gosub modeDetect
if mode = 1 then
goto remote 'Retour au debut des instruction
else
high porta.2
goto joystick
endif
end

joystick:

if portb.3=0 then pos2=pos2-1
if portb.2=0 then pos2=pos2+1
if portb.0=0 then pos1=pos1+1
if portb.1=0 then pos1=pos1-1

pulsout portb.4,pos1 'Impulsions vers les servos
pause 8
pulsout portb.5,pos2
pause 8

pause 20

gosub modeDetect
if mode = 0 then
goto joystick 'Retour au debut des instruction
else
low porta.2
goto remote
endif
end

modeDetect : 'Quel mode ?
if porta.3 = 1 then mode = 1
if porta.3 = 0 then mode = 0
return    

[/code]


Thats the BASIC code that compile using PicBasic Compiler. It's the code thats sits in the PIC

Don't know if you're still interested about it. Have fun :D

Hi, Thanks for your interest in this project, but unfortunaly, I kinda lost the source code of both the PIC and Delphi program. I'm still trying to recover something this week, but I wouldn't bet on this. I think your best solution would be to start from scratch. It wasn't that complicated to code. The PIC code was done using Pic Basic Pro compiler. I've used the based Servo example project and built around it. There is also a simple Serial/RS232 sample you could use. Good luck ;) And just to let you know, my current wecam setup is a Logitech Orbit Cam with built-in Pan/Tilt functionality ;)

can you explain how to use javascript http request
i have built de servopod , and i like it , how can i use it online ?
cause at work i would like to see my doorway

for the frame i use nerd-cam 2 (google it) enclosure , it a well made acrylic housing
it look very professional at low cost ,i use webcam xp

Hi, It's a shame I never got time to finish the Delphi part of this project. I'm now using a nice logitech orbitcam :) Anyway, I think you could write your own software (VB or anything simple you might want to use). If I remember correctly (as I lost the sourcecode...in a backup problem)... to move the ServoPod from serial, you only need to send 2 coordinate (from 0 to 255) I was using PicBasicPro and ... I'm trying to remember... but I think I was only using a simple "SERIN DATA" and the data was 4 byte variable. Like... XXYY ... so if you wanted to move to 255,255... you just had to send FFFF... but also... I think on the PC part I was actualy sending 255,255 (byteshifted into each other) and the serial "socket" was converting this to a word... anyway this might sounds weird and really complicated, but I'll do my best to find the source-code... for the 4th time ;)

I just reread my instructable (funny...) and It's basicly explained (how cool I was back then!) in Step 4. Forget what I said before... I send Char... so I guest you'll have to send "FFFF" to the serial port (after waiting for DSR line to get high... I remember now!) and it will move the servo to 255,255 (actualy... 225,225 as this is the limit I implemented in the code.

i'd like to see an instructable where someone explains how to use servos, for the complete noob

i built a simple wireless one with an old RC car... it was cool and it took me ten minutes to make :)