0

I currently have a project I'm working on using a Raspberry Pi, connected via I2C to a GPIO extender (MCP23017), which is using a Transistor (TIP120) to control a Solenoid Valve and a DC Motor in parallel. Everything works just fine until I power the motor, which only intermittently causes the GPIO extender to reset. Diagram as follows: enter image description here

The microcontroller and the motors are on separate power supplies, connected only via the ground rail. I'm sure I'm missing something simple, a diode somewhere maybe, but I have been unable to figure out exactly why the reset is happening. It works perfectly fine without the motors connected.

  • If you haven't already done so you are likely to blow up the transistor, and possibly circuitry connected to it (such as the Pi). The correct use of a flyback diode elinux.org/File:Relay_drive.png – Milliways Dec 31 '17 at 4:17
  • I've soldered on a flyback diode per that diagram, but that hasn't solved the problem. I've seen no problems with the Pi, or the transistor, or even the GPIO expander for that matter. The issue really seems to be with the motor, and not until it gets up to speed. Even with the diodes I think the back voltage is enough to pull ground up enough such that the difference between ground and vdd is less than the required 1.8 volts. I could be far off but that's my guess. – dburnsii Dec 31 '17 at 5:39
  • My comment was not intended to fix your "problem", but to prevent damage. The question is unanswerable given the information supplied, and is more likely to be related to wiring/layout. – Milliways Dec 31 '17 at 6:28
0

The issue really seems to be with the motor, and not until it gets up to speed.

That suggest it is the noise from the motor which is tripping your circuit. I don't think it is ground-bounce (the ground coming up) because the current is highest when you start your motor and you report no problems with that. Add a snubber circuit (RC) over your motor connections.

Check if your decoupling is good. See if you can add e.g. 1nF direct between power and ground.

You might also add some capacitors around your I/O lines to 'drown' any noise spikes. The usable value depends on how fast your I/Os are switching. e.g. 10nF..100nF before the resistor to ground.

Are your 23017 and the motors all driven from the same supply?

  • I felt that what you're saying could be the issue, but maybe you could help me understand how? I have the 23017 and the motors on completely separate power supplies, so the only link between the two is the ground rail. I am much more a software guy than a hardware guy, but is it a dumb question to ask how could I be getting noise from isolated voltage sources? Also, I have a diode over the Solenoid which is connected directly to the motor with no more than 2 inches of wire. Is this sufficient or do I need something even closer to the terminals? – dburnsii Dec 31 '17 at 6:15
  • DC motors have brushes which spark and that will produce noise in anything around them. See it is a set of very nasty radio transmitters next to your circuit. 2 inches is rather long. I suggest you add a diode over both the motor and the solenoid. – Oldfart Dec 31 '17 at 6:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.