Redirect pulse from INPUT to OUTPUT PIN


I have the following scenario: Motor connected in a ARDUINO UNO board that is receiving pulses from another MEGA board.

INPUT pins (0 = Pulse 1 = DIR) in ARDUINO UNO
OUTPUT pins (5 = Pulse, 6 = DIR) on the same board attached to the motor.

I need to redirect pulses that are coming in INPUT to OUTPUT, but the engine getting giving leaps.

Does anyone know a way to redirect the pulses so that does not give leaps?

Thank you

What does give leaps mean?

Why do the pulses need to go through the Arduino? Why not connect directly to the motor?

It means that rotates not constant.

Because the software I’m using the MEGA board only accepts sequential commands, and the UNO would be to move an engine specifically.

I need that when a card send the signal it move, and when the other plate to send it also move the motor.

Other plate?

So how should the signal be processed. In the first post you made it sound like an exact copy should be sent, in which case you just wore them together and don't involve Arduino.

I think we'd get a lot further with a more detailed description of the problem.

What kind of pulses? Servo?

Im looking for advice on how to achieve a similar operation.
im wanting to write code for a CNC plasma cutter torch height controller
when the table is not cutting the step and direction signals need to be passed through the arduino to the output pins but when cutting the input pin will be ignored and a height sensor signal fed into the arduino will be used to calculate a height error and output alternative step and direction signals.

The signal used to trigger the plasma cutter will also be used to switch from Torch height control to bypass (trigger happens to be the grbl spindle command)

(see there is a good reason to duplicate digital signals from an input pin to an output pin)

I would like to think it was a simple problem but the more i try to find a solution the more i question if the digital input pin will track a step signal from a cnc controller like Mach3 or GRBL and duplicate the signal on an output pin.

If you would be so kind as to give me a kick in the arse in the general direction of a solution it would be much appreciated.

boolean PassThruMode = false; //if this is true, pass through the pulses, otherwise we will control the pins
int InputPin = 2;
int OutputPin = 3;
void setup() {
  pinMode(InputPin, INPUT);
  pinMode(OutputPin, OUTPUT);
void loop() {
  getInstructions();  //updates the PassThruMode variable based on serial inputs
  if(PassThruMode) {
    digitalWrite(OutputPin, digitalRead(InputPin));

Now you just have to write the getInstructions() function.

MorganS. Thanks for your time and assistance, much appreciated

That's confirmed what I had in mind, Im going to set it up on the bench this afternoon.
program one Uno with Grbl and the Code for the THC on another and will monitor the output with a scope.

I can save myself code as the bypass will be controlled by a digital input as well (no need for serial comms input).

The output from the 2nd Uno when its in control will hopefully use accellstepper library to create the new step and direction signals based on the outcome of a sensor input.

I have already built a pcb to measure the arc voltage which works but i dint have the courage to connect its output to anything yet. It measures the 100v 5 - 50A output from the plasma cutter based on a potential divider using monster resistors. Until i see what is actually measured and when, i wont actually know whether or not it will be used to control the cutter. I could use it as belt and braces - a second input to confirm the pilot arc has triggered to reduce false input/operation.

100V doesn't need physically big resistors. You only need to siphon nano-amps from it, so regular 1/8W or 1/6W resistors will do fine.

It is however a good idea to consider a chain of multiple resistors that add up to the total resistance required. The input might see giant sparks of 1000V or more, so you need more physical distance between your high-voltage input and any low-voltage parts. With careful design, the smaller resistors will explode in the worst fault conditions and save your life. Make sure you look around more than one website or textbook for this part of the design. There's a lot of bad designs out there which will work, but they might burn down your house if there's a fault.

Good advice.
I did trawl google for circuit ideas but that does not necessarily mean to say i have chosen well.

I have tried to attach an image of the schematic but it looks like attached image source has to come from a URL not a local drive.

if you let me know how to circumnavigate this i will send the image


How to insert images in a forum post

I was always using quick reply

im wanting to write code for a CNC plasma cutter torch height controller

Seems like a rather harsh environment for a poor little hobbyist microcontroller board. I’d think you’d want something more robust (industrial temperature range components, etc) and perhaps EMC hardened. Plus, if your programming experience is limited, an industrial control application may not be the best first real project.

Hi gfvalvo,

That’s a huge assumption and its not my first project by a long shot.
I have over twenty five years experience in numerous engineering disciplines.
yes i could spend thousands on control gear and disagree that the humble micro isn’t up to the job.
when i was a boy the Z80 was the go to processor of choice for not only primitive cnc machines but also spacecraft. If i don’t try to make stuff work i will go insane and learn nothing, granted working on projects will probably drive me insane as well.

Your suggestion of more robust components i would suggest was a stab in the dark as there are no values mentioned on the drawing, the micro board and its associated filtering is also not shown on the drawing.

I do appreciate your over zealous concern for both my project and my safety its quite touching.

My comment regarding components was limited to the actual Arduino board itself, which is clearly a hobbyist device.

So you've got all this experience and knowledge but you'd rather have the potential lag coming from doing this with software than to use a hardware switch and have it work better?