Servo interference

Hi All

I need assistance with a my first project I am working on please. I have made a system that uses an interupt signal from a Hall Effect Sensor to tell the servo motor to start to move a certain amount of positions determined by my coding (the signal is just to tell the servo to start).

I have a larger servo (3Nm) that has a dedicated servo system which for now, I am just sending the pulse frequency to control the movement. The connection between the Arduino and Servo is Opto Isolated.

The problem is when I power the servo on, the interupt signal seems to be triggered at a very fast rate even though the Hall Effect Sensor has not moved. I tried all trigger combinations of the interupt (rising, falling, low, change) and the results are the same. I also disconnected the motor from the dedicated servo system to eliminate that possibility of interference.

I tested the code and wiring on a stepper motor and driver and I have no interference. And when I put the servo system off, the code runs as expected with no interference.

The user manual for the servo does say that I need an EMI filter at the power source. I did not install one yet however if someone could confirm whether the lack of EMI filter is the cause or maybe it is some other issue?

I am new to electronics so am not to familiar about EMI filter and noise.

Thank you for the help

I have attached my code below:

#define PINA 2 // pulse
#define PINB 3 //sign
#define PINC 4 //enable
#define PINI 5 //interupt pin
#define INTERRUPT 5  // that is, pin 5

volatile boolean fired;


void isr ()
{
if (digitalRead(PINI) == 0) 
{
 
fired = true;
count++;

}
}


void setup() {
   Serial.begin(38400);
 Serial.println("Begin");
fired = false;
 pinMode(PINI, INPUT); //receives signal from first Arduino
 digitalWrite (PINI, 1);
 attachInterrupt (digitalPinToInterrupt(PINI), isr, FALLING);

 pinMode(PINC, OUTPUT);//enable
 digitalWrite(PINC, 1);
 pinMode(PINA, OUTPUT);
 digitalWrite(PINA, 0);
 pinMode(PINB, OUTPUT);
 digitalWrite(PINB, 1);
  
}



void loop() {
 

       if (fired == true) 
 {
     fired = false;
       
     for (int c = 1; c<=1; c++) {
      digitalWrite(PINA, 1);
       delayMicroseconds(300);
       digitalWrite(PINA, 0);
       delayMicroseconds(300);
     }
   
 }
  
    

}

You need to post a diagram showing how you have everything connected.

A link to the datasheet for the servo would also be a good idea.

What Arduino board are you using?

...R

PS ... 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

Thank you, I adjusted to put the message into code format. I am using an Arduino Due

I also attached the layout of the connection from the Due to the servo drive and the spec sheet of the servo drive. I have a detailed manual, and the link is shared below.

I am quite new to this so sorry if the layout is not clear.

Basically the pulse pin and servo pin is connected to a Inverted Buffer and then to a Schmitt Optocoupler which has an open collector output. The 24V and ground is connected to the Optocoupler from the servo drive with the pulse and sign pin connected to the servo drive

The Hall Effect sensor is connected directly to the Due (this is not shown on the diagram). This pin is the interrupt input to trigger the Due to send signal frequency to the servo to move certain amount of positions.

Also a link to the datasheet

https://www.invt.com/products/1661.html

Thank you for presenting your code correctly.

Please display your image(s) in your post so we can see it(them) without downloading it(them). See this Simple Image Guide

...R

Thank you Robin2. I have adjusted the image

As you can see the bottom image is completely unreadable. Please just post a link to the web page that has the datasheet.

Also I think I may have misunderstood what you mean by "servo". The usual meaning here is the sort of thing that is used to move the control surfaces of a flying model airplane. When I can read the datasheet I will know better.

...R

The link is

INVT servo

Yes it is quite a large servo and is used for industrial applications. I started with a stepper system but found I need more speed and accuracy than what I found with the stepper.

sas888:
I tested the code and wiring on a stepper motor and driver and I have no interference. And when I put the servo system off, the code runs as expected with no interference.

The user manual for the servo does say that I need an EMI filter at the power source. I did not install one yet however if someone could confirm whether the lack of EMI filter is the cause or maybe it is some other issue?

Now that I understand better what you are trying to do these two paragraphs from your Original Post seem to point to a solution.

And, sorry, I have no experience of that type of servo.

...R

Thanks Robin2

Yeah you right, today I stumbled upon something to confirm above and learn something new, shielding! I reconnected the original stepper system in a haphazard manner and experienced a similiar problem as the servo system, the reason the unshielded cables where close to the driver. My original connections were lucky enough to be far enough away for it not to be a problem.