I have a project with two Nano 3.0's, one a master and the other a slave. The master drives a stepper motor via stepper driver, a SS relay, push button switches, etc and inputs two switches as inputs to pull down pins. The slave drives another stepper motor on instruction from the master. Both are powered with 12v wall plug supply. With the USB cable connected, under certain situations one of the input pins appears to lose its internal 5v supply causing switching detection problems. The 5v supply to the other switch is ok. When I remove the USB cable everything works fine. I tested the voltage between the USB ground and the ground connector on the USB socket and there seems to be a rapidly fluctuating voltage of around +/-1v, don't know if this has any bearing on the problem.. Why should this be happening..? I've had 12v supplies and a USB cable connected in other projects and never had a problem...
and inputs two switches as inputs to pull down pins. ...
...one of the input pins appears to lose its internal 5v supply causing switching detection problems.
Sorry, I don't know what you're trying to say. Do you have pull-up resistors (or are you using the internal pull-ups) with the switches pulling-down? Or do you have pull-down resistors with the switches pulling-up?
When I remove the USB cable everything works fine. I tested the voltage between the USB ground and the ground connector on the USB socket and there seems to be a rapidly fluctuating voltage of around +/-1v, don't know if this has any bearing on the problem..
If you are measuring between the computer-USB ground and the Arduino ground (with the USB disconnected), that could be normal.
Hi, Yes using internal pull ups. Voltage measurement from PC USB ground to Arduino ground. I’ve attached an image of the schematic, apologies for the bad quality. The microswitches pull D5 and D4 down to the 12v power supply ground. The problem occurs if I connect the USB to either of the microcontrollers. D4 has the problem, D5 is fine. The strange thing is, on initial power up with both switches open they both work fine if operated manually. When the ‘integrated’ stepper motor is driven to automatically close the D4 switch and then driven again to open the switch, the switch, although now physically open, reads as if it is still closed… The voltage açross the open switch at this point reads around 0.1v when it should read nearly 5v from the internal pullup. Even stranger is that if left alone in this state for a short while, the voltage across the switch starts to rise, and after about a minute is back up to 5v. If I then manually operate the D4 switch the same problem recurs, 0.1v then up to 5v after about a minute. Also at this point if I manually operate the D5 switch, the D4 input follows the D5 input…
One last thing, on power up, if I move the stepper motor by hand, and use it without power, to close and open the D4 switch, everything is still fine, it’s only when the stepper is powered up to close the switch that the problem occurs. Removing the USB cable makes things operate normally again…
Hi see you have the Nano connected to the stepper controllers, but no gnd connection between the Nano and the controller, for signal gnd reference…
You two power supply negatives should be connected together.
Didn't think I'd need it, both stepper drivers use optically isolated control circuitry. I assumed that this means that they are totally isolated electrically and can be driven without regard to other components in the system...?
I just noticed that the PUL line to the driver is right next to the problematic D4 switch input so this shows that this arrangement is causing the problem... How is the question...
Can you post link to data/spec of the drivers please?
Attached are the two spec sheets for both of the stepper drivers. Pages 6-7 for the UIM240xx and page 5 for the msd325. I use a common anode arrangement for both with pull to ground for the inputs. I will attach a better circuit diagram in a following post.
UIM240xx_STEP_DIR.pdf (1.18 MB)
msd325-microstepping-driver.pdf (268 KB)
Both drivers have optos between VCC and inputs, so don't share grounds.
12volt is borderline for a Nano. A 7-9volt supply would be much better.
Circuit diagram as promised.
CircuitDiagram.pdf (70.4 KB)
You might need to put some bypass capacitors across the 12V lines at the Nano and stepper controller power inputs.
What would this achieve..? Is this general good practice ( in which case what exactly does this do, how and where in the circuit? ), or do you think this will help solve the specific problem and if so how..?