I am having an interesting issue on my most recent project. I've attached the wiring layout, which I put into circuits.io. The basic system is 2DC motors with encoders being driven by PWM. I control the PWM signal of each independently using 10k pots. I am using an N-type MOSFET to control the motors with an external 12vdc power supply.
Each motor has an encoder, powered with the arduino onboard 5vdc. I am collecting 1 of the signals from the encoder and counting it for a 1 second duration to ultimately calculate the speed of each motor and display it on an LCD.
Overall, the system works well. I can control each motor from zero to full scale, and I get speed readouts for each which seem accurate, most of the time. This is where the problem is. I am occasionally getting noise between the two motors. Lets call the two motors motor A, and motor B.
with motor B set to off, I turn up motor A slowly. Motor A starts reading speed on the LCD as usual. But then sometimes, but not always, I start to see motor B speed drift on the readout. This also seems to slightly affect motor A's speed signal. I found that if I spin motor B and stop it, I can find a position where Its speed signal is solid zero, and the problem goes away. Then if I rotate again, I can find a position where the problem is back.
In troubleshooting, I have found that if I disconnect motor drive power positive (not encoder power), the drifting signal will also go to zero. I found that interesting since I would think the problem is in the encoder power circuit, not the motor.
Any thoughts? I would greatly appreciate your help. I am novice at this, but my project requires accurate speed readout as the motor are driving peristaltic pumps for a lab test.
I am unfortunately in a situation where I cannot get at my code at the moment. I will hopefully be able to post it tomorrow. I am using the TimerOne library to use a 1second timer interrupt to perform the encoder counting.
Looks like you don 't have the 12v and the 5v grounds connected together.
thanks for the reply justone. Sorry, that is an error just in the digital wiring diagram. In my actual setup the 12v and 5v grounds are tied together.
Hi,
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Not a fritzy picture please.
A hand drawn circuit will help you check your wiring as you reverse engineer.
Thanks.. Tom... 
Tom - Will do in the morning. I am a novice but will do my best. I take it the image I attached was too poor of quality to view?
I take it the image I attached was too poor of quality to view?
It is a serious problem with Fritzing and not your fault.
In Fritzing diagrams parts and pins are often unlabeled, component types and values are usually missing, connections are unclear and sometimes impossible to interpret without ambiguity.
Conventional schematic diagrams have been the universal circuit language for about a century, and if you are interested in electronics it is worthwhile to learn how to read and draw them.
Okay all. I have attached a hand drawn schematic as well as schematic of the motor encoder per the manufacturer to the original post. Sorry, I did not draw that directly into my schematic. I appreciate your help and hope this is legible enough for you to understand my circuit and help troubleshoot the problem.
My inclination right now is to change from an N-type to a P-Type resistor to keep the motor grounded while it is not in use. It seems that the hall and motor circuits are isolated, though, so I am not sure if this would actually help.
The encoder output circuit diagram indicates that user supplied pullup resistors between 1K and 4.7K must be attached to the HA and HB open collector outputs. Your schematics do not show any. When the encoder is trying to output a high without the pull up then the circuit goes into extremely high impedance mode and the Arduino input to which it is attached can easily pickup up random noise.
Try adding the 1 - 4.7 K resistors to the encoder output, as shown in the Encoder Schematic.
Thanks Due_unto
To make sure I am reading it correctly, should I put the resistor between Vcc and the Hall output, or in series with the hall output and the arduino?
From the Hall output to Vcc. The term "pull up" usually always refers to "PULLing a line UP" to a positive voltage source, like Vcc, through a suitable resistor.
Hi,
Fine with the diagrams, just post them in current post, rather than old post please.
Tom... 
Hi,
You need to fit 220R resistors in each of the MOSFET gate circuits, that is between the gate and respective Arduino output.
Also 10K resistr from gate to source on each MOSFET as well.
This is to limit gate current due to gate capacitance and to keep the MOSFET OFF when the Arduino is booting up.
Due-unto instruction about the 4k7 pullups will certainly help to fix your problem, look at the diagram you have posted on the suggested encoder wiring, 4k7 from each output to 5V, not in series.
Thanks.. Tom... 