Trying to control a Pan Tilt tripod mount via Arduino and Radio Remote l

Hi noobie here, not sure if this is the correct forum,

Have a code loaded on a Arduino and can control either the Pan or Tilt as long as only I pin is connected as soon as I connect the 2nd or 3rd pin the mount stops responding.
Just connecting the tripod connections to the Nano the pan goes to the maximum right position.
Is there something in the code I am missing or my pinout connections.
I tried 3 different Nanos with the same result.

Code
#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
{
digitalWrite(up, HIGH);
//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
digitalWrite(down, HIGH);
}

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);
}
}

Yeshap:
Have a code loaded on a Arduino and can control either the Pan or Tilt as long as only I pin is connected as soon as I connect the 2nd or 3rd pin the mount stops responding.

That sounds like a power problem. Post a link to the datasheet for the motors and motor-drivers you are using and post a photo of a simple pencil drawing showing how you have everything connected.

To make it easy for people to help you please modify your post and use the code button </> so your code looks like this and is easy to copy to a text editor. See How to use the Forum

Your code is too long for me to study quickly without copying to a text editor.

Also use the AutoFormat tool to indent your code for easier reading.

...R

Yeshap:
Have a code loaded on a Arduino and can control either the Pan or Tilt as long as only I pin is connected as soon as I connect the 2nd or 3rd pin the mount stops responding.

There are 9 pins defined in that program. Are you sure it works with only one of them connected? Or do you mean only one channel from the RC receiver? Is it only Pan or Tilt that work? What about Zoom?

Why not put a few Serial.prints in so you can see exactly what values you're getting from the receiver and where it gets to in the code?

Steve

Thanks for your responses.
Being a noobie, let me figure out how to do Serial.prints and copy to a text editor and will post back.

#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);
  }  
}

connections.jpg

Image from Reply #4 so we don't have to download it. See this Simple Image Guide

c3a1acda9f7e9e2d33bfb9313535fbca39997d56.jpg

...R

Is the code in Reply #4 identical to that in your Original Post? If not please tell us what you changed and what were the effects of the changes.

I can't relate your picture to the description in your Original Post.

...R

No change in code from original post
Link to original web page post that I am trying to mimic.


wireless-arduino-controlled-ptz-camera-system

OK. I now have a sense of what the program is trying to do.

Let's go back to your Original Post and this piece

can control either the Pan or Tilt as long as only I pin is connected as soon as I connect the 2nd or 3rd pin the mount stops responding.
Just connecting the tripod connections to the Nano the pan goes to the maximum right position.
Is there something in the code I am missing or my pinout connections.

Please explain this in more detail. For example I have no idea what you mean by 1 pin or 2nd or 3rd pins or "the tripod connections".

The pin usage in the program is confusing as the comments don't match the code.

#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

Rather than post a copy of someone else's diagram please make a simple pencil drawing showing how YOU have everything connected and post a photo of the drawing. Oftentimes the business of making the drawing brings errors to light.

...R