1

I bought an old broken pinball machine and I'm trying to control it with my Raspberry Pi 3. The pinball machine has multiple circuit boards. I removed the controller circuit board and replaced it with the Raspberry Pi.

I connected the Pi to three MCP23017 chips. With two of them I read the input switches of the pinball machine. One MCP23017 communicates with the transistor circuit board. It talks to the chips on the circuit board, which are connected to transistors, which are connected to lamps and solenoids. I connected the grounds of the Raspberry Pi and the pinball machine.

It mostly works, but: It fails now and then. It seems to fail when the pinball machine draws a lot of power, when I use the flippers or after I enabled certain solenoids. The error I get in my software is the same error I get when I give the MCP23017 chips no power. I get the error with both reading and writing registers on all three chips, also the two input chips which are besides connected to the switches not connected to the pinball machine.

What happens here and how can I fix it? Can one device mess with an other device if the grounds are connected?

I'm using a Raspberry Pi power adapter to power my Pi. It also powers the three MCP23017 chips. The transistor board has its + connected to the pinball machine power supply, so the pinball machine shouldn't draw any power from the Raspberry Pi. When I put an ampere meter between the positive pin on the Pi and the red wire, I get 1 μA when the pinball machine is off and -38 μA when the pinball machine is on, so the current flows into the Pi.

Raspberry Pi connected to MCP23017 and pinball machine

Paul
  • 113
  • 5

1 Answers1

1

Unfortunately I can't just give you a link to a solution. There are University courses in Electrical Engineering covering this, but even after mastering the theory it is still a bit of an art.

To make any sensible suggestions You would need to describe the circuitry to which you are connecting (and it is still an EE question).

I have listed below links to a number of related Answers.

A brief summary of the principles for working in a noisy environment

Connect to the Pi GND as common NOT the +3.3v rail.

Take measures to reduce interference.
    E.g. use twisted pair (or shielded cable or shielded twisted pair)
    - a separate cable for each input, with the only common connection the GND at the Pi end.

Use Ferrite rings for common mode rejection.

Use low impedance circuitry
    e.g. a low value pullup e.g. 1kΩ unless there is power limitation.

Use optocouplers for isolation.

Adopt bounce suppression.
    Remember this needs to be BOTH on contact closure AND contact open.
    This can be done in software and/or with capacitor to slow transitions.

Separate power and signal ground.

Use Power Supply filter capacitors to minimise noise.

The MOST IMPORTANT item is layout! Use the shortest direct wiring, and run wires parallel

https://raspberrypi.stackexchange.com/a/9771/8697 https://raspberrypi.stackexchange.com/a/9771/8697 https://raspberrypi.stackexchange.com/a/22691/8697 https://raspberrypi.stackexchange.com/a/24899/8697

Milliways
  • 62,573
  • 32
  • 113
  • 225