Geeko Stepper Driver (or motor) interferes with interrupt pin on uno

I have a pretty simple circuit setup using an uno, a davis wind sensor and a geeko stepper driver board running an 18V stepper motor.

I am monitoring wind speed with the davis that runs on an interrupt on pin 2, and the geeko is connected to 5,6,7 as per a pretty typical layout.

What is meant to happen, i determine wind speed, and the stepper moves to a certain position, thats it.

Now, when i have the stepper unplugged, i run the code, and the wind sensor comes in perfectly. (also, if i have the stepper plugged in and it doesn’t need to change its position, perfect reading again)… The problem arises when the stepper needs to change its position, and hence the wind speed reading just go nuts. Basically random readings but much higher than would be expected.

attached are the schematics, geeko has its own power source, then just connects up to 5,6,7 and GND on the uno. davis uses a pull down resistor to avoid bouncing,

also attached is my full code, but i don’t think the code is at fault, because i converted to a different driver L298N and the project works as hoped, so im guessing its to do with geeko, some kind of EM perhaps, or somehow messes with interrupt pin on uno…

any help would be greatly appreciated. ive been stuck on this for two weeks (not the greatest electronics person either, so its tricky)

davis_speed_gate_uno_v1.7.ino (4.37 KB)

To start with, DO NOT disable interrupts except for the briefest possible time to take a copy of the value in the variable Rotations. Like this

noInterrupts();
   copyOfRotations = Rotations;
   Rotations = 0;
interrupts();

Use the copy in all your calculations

I suspect it is not necessary to set Rotations back to zero. You don't set your kitchen clock back to zero whenever you look at the time.

...R

post a link to the geeko driver. ( love that name ! )

wiring and power supplies and such need to conform to both the driver and the Arduino's requirements.

it seems you want to count rotations.
then calculate wind speed
then control

make sure your sketch is doing that, in that order.

if the problem is related to power then it is a hardware problem.

if the code works except when the power is applies or removed. that points to something power related.
have you checked to make sure your Arudino power is unchanging ?

sorry, my bad. that should've been gecko!

gecko driver

What's got four legs, programs microcontrollers and sticks to the ceiling?

I worry that having sticky toes would make typing hard work!