Introduction: Arduino Controlled Webcam Panner
This is an instructable to show how to mount a webcam on a servo in a meccano frame and controlling it via an Arduino board.
For a while now I was looking to do something more than blinking LEDs with my Arduino.
This idea came to me while Skyping in our morning-meet with my colleagues to enable them to control what they see in our office.
So on a rainy Sunday afternoon a while back I pitched it to a buddy of mine and we built the Arducam :)
When I initially wanted to add the Instructable I saw a number of similar instructables, some of which used a thumbstick. Having had an old PS3 remote laying around I decided to incorporate it before building the Instructable ;)
For a while now I was looking to do something more than blinking LEDs with my Arduino.
This idea came to me while Skyping in our morning-meet with my colleagues to enable them to control what they see in our office.
So on a rainy Sunday afternoon a while back I pitched it to a buddy of mine and we built the Arducam :)
When I initially wanted to add the Instructable I saw a number of similar instructables, some of which used a thumbstick. Having had an old PS3 remote laying around I decided to incorporate it before building the Instructable ;)
Step 1: The Meccano Frame
We used an old Meccano set that I picked up at a 2nd hand market to build the frame.
We built it to mount on my tri-pod.
We built it to mount on my tri-pod.
Step 2: Connecting the Shaft to the Servo
We used pratley putty to connect the shaft to the servo's gear.
I picked the cross-shaped gear for no better reason than that I thought I'll need it least of the lot of other gears that I got with the servo and saved them for future projects.
One has to take care to mount this really straight. I lined it up straight using my leveller (waterpas)
It was a fortunate co-incidence that the meccano bracket had almost the same width as the servo we used.
You can fix the servo to the base with a piece of double sided tape.
I picked the cross-shaped gear for no better reason than that I thought I'll need it least of the lot of other gears that I got with the servo and saved them for future projects.
One has to take care to mount this really straight. I lined it up straight using my leveller (waterpas)
It was a fortunate co-incidence that the meccano bracket had almost the same width as the servo we used.
You can fix the servo to the base with a piece of double sided tape.
Step 3: Mounting the Webcam
Webcam
I've used a Logitec webcam.
It's probably a good idea to remove the counter-balance on the camera to make it lighter.
I've not done this since its the office's camera and not mine.
Weight distribution
I've added 2 spacers to avoid that the shaft pushes against the base mounting plate of the camera. They basically displace the weight of the camera to the Meccano frame instead of directly into the servo's gear.
Webcam mounting
The mounting piece for the webcam consist of a wheel with a shaped centre hole to fit to the shaft. This allows traction between the shaft and the wheel to ensure they turn together.
Some space is created by the spacers to prevent the base plate from pressing against the shaft.
Problems:
- There is nothing fixing the webcam to the frame and the webcam it will fall off if tilted to far.
- The Meccano holes on the bracket above the servo are to large and allows to much horizontal movement causing strain on the servo
- Turning momentum of the camera causes over-rotation which in turn places strain on the servo. I want to try fixing it by turning 1deg back after a period of continuous movement but would prefer a mechanical solution. Possibly by adding gear and turn the webcam on a separate belt-driven shaft?
- ...or use a stronger servo :)
I've used a Logitec webcam.
It's probably a good idea to remove the counter-balance on the camera to make it lighter.
I've not done this since its the office's camera and not mine.
Weight distribution
I've added 2 spacers to avoid that the shaft pushes against the base mounting plate of the camera. They basically displace the weight of the camera to the Meccano frame instead of directly into the servo's gear.
Webcam mounting
The mounting piece for the webcam consist of a wheel with a shaped centre hole to fit to the shaft. This allows traction between the shaft and the wheel to ensure they turn together.
Some space is created by the spacers to prevent the base plate from pressing against the shaft.
Problems:
- There is nothing fixing the webcam to the frame and the webcam it will fall off if tilted to far.
- The Meccano holes on the bracket above the servo are to large and allows to much horizontal movement causing strain on the servo
- Turning momentum of the camera causes over-rotation which in turn places strain on the servo. I want to try fixing it by turning 1deg back after a period of continuous movement but would prefer a mechanical solution. Possibly by adding gear and turn the webcam on a separate belt-driven shaft?
- ...or use a stronger servo :)
Step 4: The Electronics
Connecting the Servo and LED
The servo has 3 wires:
- GND
- 5V+
- Signal output
I used pin ~9 to drive the servo.
The LED is connected to the 5V+ and GND with a resistor on the 5V+ line and will emit light when power is applied.
Connecting the Thumbstick
I had an old broken PS3 remote that my son used to play with from which I scavenged a thumbstick.
I used the very cool Instructables from Finnio and jhoffnun to understand the thumbstick and its electronics before removing it and mounting it on a veroboard.
The servo has 3 wires:
- GND
- 5V+
- Signal output
I used pin ~9 to drive the servo.
The LED is connected to the 5V+ and GND with a resistor on the 5V+ line and will emit light when power is applied.
Connecting the Thumbstick
I had an old broken PS3 remote that my son used to play with from which I scavenged a thumbstick.
I used the very cool Instructables from Finnio and jhoffnun to understand the thumbstick and its electronics before removing it and mounting it on a veroboard.
Step 5: Controlling the Servo
Arduino
The Arduino sketch along with all other software for this project is available on github.
The sketch allows for control via USB and the thumbstick.
One can use a modem-control / terminal emulator application such as minicom or putty to communicate with the USB serial port.
Set to Middle:
- the sketch will set the servo to 90deg when it starts
- and when 'm' is pressed
Left and Right
- when the thumbstick is moved on the horizontal plane
- Left when 'f' is pressed
- Right when 'j' is pressed.
Node.js
We've also implemented a little webserver in node.js to facilitate control of the arducam.
Instructions on the project's github site.
Possible improvements:
- allow for proper key-bindings to to the left and right arrow buttons
- allow for 1deg correction back in the source direction to release strain on the servo due to over rotation caused by momentum of the heavy webcam.
- feel free to share the patch if you implement any of these or other improvements :)
The Arduino sketch along with all other software for this project is available on github.
The sketch allows for control via USB and the thumbstick.
One can use a modem-control / terminal emulator application such as minicom or putty to communicate with the USB serial port.
Set to Middle:
- the sketch will set the servo to 90deg when it starts
- and when 'm' is pressed
Left and Right
- when the thumbstick is moved on the horizontal plane
- Left when 'f' is pressed
- Right when 'j' is pressed.
Node.js
We've also implemented a little webserver in node.js to facilitate control of the arducam.
Instructions on the project's github site.
Possible improvements:
- allow for proper key-bindings to to the left and right arrow buttons
- allow for 1deg correction back in the source direction to release strain on the servo due to over rotation caused by momentum of the heavy webcam.
- feel free to share the patch if you implement any of these or other improvements :)