It is going to take me a little while to try out all of these suggestions, but I am very grateful for them!
As you have probably all already guessed, I am still quite new to electronics.
but before the opto-couplers u could test what happens when u turn on the motor manually...
with and without separated power supplies...
I will try that, the H-bridge board uses 5v and 24v so I will have to connect an additional adapter.
1. If you haven't already done so, connect a large decoupling capacitor (say 1000uF) between the motor supply +ve and ground, close to the motor H-bridge. Use the negative side of the capacitor as a star point to connect the ground lines to the H-bridge (which should be as short as possible), the 24V power supply, and the Arduino. The idea is to prevent the motor current inducing any voltage on the ground lines.
I dont quite understand. Do you mean to connect the capacitor before (Vs) or after (output) the H-bridge?
2. Keep the motor wires well away from the wires to the IR sensor.
They are never closer than 6 inches and they run perpendicular to each other.
3. If you have a spare ground pin on the Arduino, connect the ground side of the sensor to that and not to any other ground.
I have tried that, but not in conjunction with the other suggestions, I will try it again.
4. Use shielded cable between the IR receiver and the Arduino, shield connected to ground pin in point 3 above.
I will try to find some shielded cable. Will twisted pair be any help?
5. An external pullup resistor between pin 19 and +5v will reduce the sensitivity of that pin to noise. Try 2k2 or 4K7. Too low a value will stop the sensor working.
2k2 = 220 ohm? and 4k7 = 470 ohm?
6. A capacitor between pin 19 and ground will also reduce the sensitivity to noise. Try 0.1uF. Too high a value will reduce the speed at which the sensor responds.
I did try that without success, but I will try again.
Why have you got a 10K in series with the step and direction pins to the controller? That is making them more prone to picking up interference, why can't you just connect the pins directly?
Well I can and I used to have it like that. Installing the resistor network was one of my shots-in-the-dark in trying to figure out this problem. BTW, I have been reading your website, Grumpy Mike, it has been incredibly informative (although a lot of it is still over my head).