Wireless Arduino controlled PTZ Camera System

//Wireless Arduino controlled PTZ Camera System
TUTORIAL


How I made my Wireless Arduino controlled Pan Tilt and Zoom Camera system

OVERVIEW

A while back I made a video on YouTube showing how I built the Wireless RC Controlled Pan Tilt and Zoom Camera system that I use to make my videos, but never got around to make a Tutorial page for it.

In the spirit of “Better Late than Never” here it is!

The system uses the affordable Bescor MP-101 motorized Pan and Tilt head.

I got mine from Amazon.com here : Bescor MP-101 Kit but you can find them at other places as well.

The Bescor works using 4 AA batteries or using a power supply if you are near an outlet.  From my experience the batteries last quite a long time, so I’m using it that way.

I’m using a simple RC Transmitter and Receiver to send Up-Down, Left-Right and Zoom In-Out commands to the Arduino Nano which then moves the Bescor.

To implemented Zoom control I used a cheap LANC remote control made by eBenk:

eBenk LANC Zoom Remote

Once again I got mine from Amazon.

Of course you will need a Camera that has a LANC port to use this function.  I’m using the Canon Vixia HG20 HD Camcorders:

Don’t forget to watch this video to get a better idea on how this works:

Arduino Wireless Remote control Pan Tilt Zoom Camera System

CONNECTIONS

To have Zoom control you will need to get an eBenk LANC remote, open it up and then you will see 2 tact switches that are under the Zoom rocker.  You then need to solder some wires to those tact switches as seen in the shematic above.

We are simulating pushing the tact switches that are on the eBenk LANC remote by connecting them to a 4066 IC bilateral switch.

For more information about the 4066 IC you can check out this tutorial here:

Using the 4066 IC bilateral switch!

Connect the D2-D5 pins of the NANO to CH1-CH5 of the RC receiver.  These will be receiving the commands sent by the RC Transmitter when we move the sticks.

Pins D9-D12 are used to move the Bescor MP-101 head.  The connections pictured above are from the point of view of looking directly at the connector on the Bescor itself.

You then need to power the RC receiver and the 4066 by using the 5V out and GND pins of the NANO.

You can then power the NANO itself using a 5V battery pack or plug it in a USB power Supply.

THE CODE

When you move the RC controller sticks, that information is received by the Arduino NANO that then makes pins High or Low.

Those pins are connected to either the Bescor Up-Down or Left-Right pins, and if you are trying to Zoom, then it sends that to the hacked eBenk remote tact switches via the 4066 IC.

You can have a look at this tutorial video to get a better idea on how the 4066 IC works to simulate pressing button: 4066 Tutorial

Also watch this video for the tutorial on the Bescor MP-101 camera system:  Arduino RC Camera System Tutorial

/* Arduino RC controlled PTZ camera mount
 
Created by Yvan / https://Brainy-Bits.com

This code is in the public domain...

You can: copy it, use it, modify it, share it or just plain ignore it!
Thx!

*/


#define left 11  // Pin 12 controls left pan
#define right 10  // Pin 10 controls right pan
#define down 12  // Pin 9 controls down tilt
#define up 9  // Pin 8 controls up tilt

#define zoomin A0  // Pin A0 controls Zoom In
#define zoomout A1 // Pin A1 controls Zoom Out

#define zoom 4      // Pin 4 connected to RC receiver channel 3 which controls Zoom
#define receiver 3  // Pin 3 connected to RC receiver channel 1 which controls Tilt
#define receiver2 2 // Pin 2 connected to RC receiver channel 2 which controls Pan

// Note that Pin 5 is connected to RC receiver channel 4 but is not used in this code

// Variables to hold the RC Receiver received values
int ch1 = 0;
int ch2 = 0;
int ch3 = 0;

void setup()
{
  // Set the Pin modes
  pinMode(receiver, INPUT);
  pinMode(receiver2, INPUT);
  pinMode(zoom, INPUT);
  pinMode(left, OUTPUT);
  pinMode(right, OUTPUT);
  pinMode(down, OUTPUT);
  pinMode(up, OUTPUT);
  pinMode(zoomin, OUTPUT);
  pinMode(zoomout, OUTPUT);
  
  //Write all pins LOW at start
  digitalWrite(up, LOW);
  digitalWrite(down, LOW);
  digitalWrite(left, LOW);
  digitalWrite(right, LOW);
  digitalWrite(zoomin, LOW);  
  digitalWrite(zoomout, LOW);
}

void loop() {
  
// Get current values of RC Receiver Channels
  ch1 = pulseIn(receiver, HIGH, 20000);
  ch2 = pulseIn(receiver2, HIGH, 20000);
  ch3 = pulseIn(zoom, HIGH, 20000);


// Tilt based on the input from the Right (Up-Down movement) joystick from the RC Transmitter
  if (ch1 < 1200)  // Transmitter Joystick pushed UP
  {
    analogWrite(up, 255);  // Move the Bescor MP-101 Camera Tilt UP
  }

  else if (ch1 > 1700)  // Tranmitter Joystick pushed DOWN
  {
    analogWrite(down, 255); // Move the Bescor MP-101 Camera Tilt DOWN
    }

  else  // Put pins LOW to stop Tilt movement of Bescor MP-101
  {
    digitalWrite(up, LOW);
    digitalWrite(down, LOW);
  }
  

  // Pan based on the input from the Right (Left-Right movement) joystick from the RC Transmitter
  if (ch2 < 1200)  // Transmitter Joystick pushed Left
  {
    digitalWrite(left, HIGH);  // Move the Bescor MP-101 Camera Pan LEFT
  }

  else if (ch2 > 1700)  // Transmitter Joystick pushed RIGHT
  {
    digitalWrite(right, HIGH);  // Move the Bescor MP-101 Camera Pan RIGHT
  }

  else  // Put pins LOW to stop Pan movement of Bescor MP-101
  {
    digitalWrite(right, LOW);
    digitalWrite(left, LOW);
  }
 
   // Zoom based on the input from the Left (Up-Down movement) joystick from the RC Transmitter
   if (ch3 < 1000)  // Transmitter Joystick pushed UP
  {
    digitalWrite(zoomin, HIGH);  // Simulate pushing the Zoom IN tact switch on the eBenk LANC remote
  }

  else if (ch3 > 2000)  // Transmitter Joystick pushed DOWN
  {
    digitalWrite(zoomout, HIGH);  // Simulate pushing the Zoom OUT tact switch on the eBenk LANC remote
  }

  else  // Put pins LOW to stop ZOOM
  {
    digitalWrite(zoomin, LOW);
    digitalWrite(zoomout, LOW);
  }  
}
TUTORIAL VIDEO UPDATE
TUTORIAL VIDEO PART 1
TUTORIAL VIDEO PART 2
DOWNLOAD

Copy the above Sketch code in your Arduino IDE software to program your Arduino.

No libraries are needed for this tutorial.

By | 2018-03-08T08:36:08+00:00 April 3rd, 2017|Tutorials|

5 Comments

  1. Maricko April 20, 2018 at 5:09 am - Reply

    Hi,
    excellent tutorial, can you put a new code, I think this is not good.
    Thanks!

    • Gary July 7, 2018 at 8:23 pm - Reply

      Yes I think you are correct. have tried the code on this page, is this the one that’s been updated?
      If it is it still doesn’t work. 1 input will work but non of the others.
      I am using a FlySky FSi6.
      Its a great idea, sorry it doesn’t work.
      Please advise if there are still problems with the updated sketch.
      I am a noobi with arduino and programing.

      Many thanks for a great idea. Gary

  2. Dan March 19, 2018 at 11:50 am - Reply

    Thanks for the tutorial! My first Arduino project, and it works! One note on the connection diagram, though… I had to connect the ground of the eBenk LANC remote to the ground of the Arduino/breadboard. Without that ground connection the camera would zoom all the time even when I wasn’t moving the controller. The lower contacts of the tact switches are ground. So when I added a jumper connecting the orange wire to the black wire at the 4066 IC, it worked as expected.

  3. Ben March 8, 2018 at 8:21 am - Reply

    Hi

    I’m a newbie in Arduino stuff. But I’m really interested to build the wireless PTZ remote control. It looks, as far I understand, that there is the wrong code placed above, compared with the video. Could you check that?

    Thanx a lot.

    Ben.

    • brainy-bits March 8, 2018 at 8:33 am - Reply

      Hi, wow I guess stuff got mixed up when I created this tutorial page. Thanks for letting me know, I’ve gone ahead and updated the code.

Leave A Comment