Control :: Electronics :: Solenoids

This is a follow-up to the original post on controlling solenoids with a Pinball Controller’s “Power Driver 16” board. I’m adding some photos to aid with the wiring and assembly, as well as giving a few troubleshooting tips.

Power Driver 16

Overview showing the Power Driver 16 and the Mini RS-485 Master

Click through to see a larger image. This is an overview of the Power Driver 16 and Mini RS-485 Master, showing the inputs, Mini Master output, and connection to the solenoid driver.

Mini Master RS-485

Detail of the Mini Master connections.

Click through to see a larger image. This detail shot shows the inputs to the Mini Master: Orange wire is Power (5V), Blue wire is TX from the Arduino, Black is GND. The outputs of the Mini Master are: White for TX(+) and Black for TX(-).

Power Driver 16 detail

Detail of the RS-485 lines running to the solenoid driver.

This is a detail showing the Mini Master output coming in on the Pinball Controller’s Power Driver 16 port labeled J9. Pin one is Serial +, which gets the White TX(+) wire, and pin 2 is Serial-, which gets the Black TX(-) wire from the Mini Master.

Arduino SPI RS-485

Arduino connection of the SPI interface to the Mini Master RS-485 converter.

Click through for full size image. This shows the Arduino SPI interface to the Mini Master RS-485 converter. It is a three-wire connection, with 5V power, signal and ground.

Arduino Uno pinout

Arduino pinout showing SPI interface pins.

 

SPI interface uses the GND, MOSI and 5V pins when connecting to the Mini Master RS-485 converter.

Advertisements

20 comments

  1. Hi,

    This is a great series of posts! I am going through the process of making my own custom machine right now as well. Currently I have the switch (up to 64), lighting (up to 64 Leds) and dot matrix display boards working using two Arduino’s that are each serial interfaced to a PC which will act as the main game controller, sound player and controller for a video monitor which will take the place of the standard translite in the backbox. P.S. I decided to use two Arduinos as I believe the 96×16 Dot Matrix boards that will display animations and scores take up a lot of processing power and I want the Arudino that handles the switches and lights to be as light as possible.

    Being a programmer, what I lack is some of the electrical knowledge required for the last pieces of my puzzle: the solenoids and the power supply(s). This is where I am going to follow your lead as it looks like you have these pieces licked.

    I do have a couple of questions for you. On the page: https://howtobuildapinballmachine.wordpress.com/2014/09/25/control-electronics-solenoids/
    you say “This is a follow-up to the original post on controlling solenoids with a Pinball Controller’s “Power Driver 16″ board.” Where can I get a link to the original post?? I suspect there is some important information in there I will need.

    Also, doing a quick reading through of your use of the Mini RS-485 Master and the The Power Driver 16, it looks like I may have a few questions about how they are used and interfaced. If that happens, would you mind if throw you a few questions and if so what is the best way (email?) to contact you.

    Thanks and hope to hear from you soon!

    Courtney

    1. Hi Courtney,

      Thanks for your message! Would love to see more of your project, do you have a website or blog? I also have a Facebook community page, where people can post links to what they are working on or just connect with other builders:

      https://www.facebook.com/howtobuildapinballmachine

      The original post you are referring to (I think) is here:

      https://howtobuildapinballmachine.wordpress.com/2014/02/04/control-electronic-solenoid/

      It was mostly links to the Pinball Controller site and PD-16 docs, so it deserved a follow-up…

      As for the RS-485 Mini Master, it is mainly used to convert the SPI signal into a true differentially driven signal required for the PD-16.

      Also, another great place to find information and ask questions is the Pinball Controller forum. Lots of experienced guys lurking there, and there’s at least a few that have an immediate answer to almost any question:

      http://www.pinballcontrollers.com/forum/index.php?board=17.0

      Hope this helps! My google mail alias is brian90254 if you want to email me directly,

      Brian

      1. Thanks for the reply. Good to hear you are still around and this is an active site 🙂
        Unfortunately I do not currently have a blog. It is something I have wanted for a long time but It always becomes a hassle trying to find some simple software that I can host somewhere that doesn’t require any time to learn how to use 😦 But I’ll see what I can do about posing my progress somewhere at some point (although my theme is still TOP SECRET!)

        I have ordered the PD-16, mini Master, and the power supplies so hopefully I will be able to follow your lead in the next few weeks and get the solenoid part of the puzzle working. Then I will be ready to start wiring up an actual box to see how all the part work together. My biggest concern is having noticeable lag between my two Arudinos and the PC via the serial ports. With a test board of a dozen switches, another test board of 24 leds, and the dot matrix displays, the speed feels instant but I know once it gets put into a real environment things can change.

        I was fortunate enough to find a scrap pinball cabinet and playfield on Craig’s list without its backbox, or any circuit boards, that I can use to test wire everything. If that step succeeds I would then move forward to writing some PC software that will mange the game state, video and sound, and then move towards a custom playfield.

        Anyway, thanks again. I will keep you posted on the progress although I know it will be slow (and now I have to wait a couple weeks for the solenoid and power supplies). And I am sure I will be firing off a few questions in the near future 🙂

        Courtney

        oh P.S. PinballContollers.com is no longer carrying the RS-485 Mini Master boards (a link I found on your site). The owner was nice enough to send me a link to http://www.futurlec.com that still sells the board (and for a lot cheaper). I had to buy mine off Ebay because Futurlec doesn’t take Discover cards.

  2. Hey Brian,

    So far I have not had any luck getting my combination of Arduino, Mini Master RS-485, and Power Driver 16 boards to fire a solenoid.

    I’ve tripled checked my wiring (from the Arduino to the mini-master to the PD-16, and from the power supply to the coil).
    The code to test the solenoid firing compiled and uploaded to the Arduino.
    On the PD-16, it looks like all the correct power leds are on.
    I checked that there is 5v and 36v at the right places on the PD-16 board.
    I applied momentary voltage to my pop bumper coil and verified that it fires.

    I suspect that the problem is somewhere in the serial signal from the Arduino -> Mini Master -> PD-16.

    Did you happen to get this working the first time you tried it or did you have to debug something? In particular, did you have a way to test if the PD-16 is receiving a serial port signal?

    Courtney

    1. Hi Courtney,

      I had this same problem. And…

      i just solved this problem yesterday. Double-check your mini-master jumper settings. One of my jumpers was set to HALF instead of FULL.

      I just carefully examined the picture Brian posted on this website showing his setup with the mini-master and made sure my mini-master was exactly the same. One of the jumpers was in a different position. I changed it. And tested with Brian’s Solenoid Arduino test.

      Hope this helps-
      Dan

      1. Dan,

        Thanks for the tip. I had actually figured out the problem but hadn’t posted the solution here (which I should have just in case others run into the same issue).

        Brian has his SPI connections to the Mini Master running off the ICSP header (at one end of the Arduino). I happened to have noticed that the MOSI pin is just a clone of pin 11 on the main IO header. When I switched to pin 11 instead of the ICSP header pin everything started working. I am using a Spark Fun Arudino Red board which is suppose to be a clone of the UNO and also has the ICSP header so I am not sure why it wasn’t working with my board.

        Now when I say working, I mean that the sample solenoid firing code is firing off my coils. When I try to fire one off myself (in response to a switch being pressed) nothing fires and generally I am blowing the fuse on the Power Driver board 😦

        There are a couple of things I am still a little fuzzy on.

        First: When I send a command to fire a coil, am I suppose to then fire another command to turn the coil off?

        Second: I have turned the Watchdog circuit off, but I am seeing the watchdog light constantly flashing on. Somewhere I seem to remember reading that the power Driver board might actually need a continuous stream of commands to keep it active, regardless if the commands actually tell the driver board to do anything or not. And that Pinball Controllers master board automatically sends a continuous stream of commands to the driver board but when using an Arduino you have to do this yourself (or turn off the watchdog circuit).

        If anyone has any thoughts on these questions, I’d greatly appreciate it!

        Thanks

        Courtney

      2. Hi Courtney-

        Ok. I’m a little unclear about what you mean by ‘firing one by yourself’? Do you have a button or switch wired to the Arduino and you changed the Arduino code to use that button/switch to fire the solenoid instead of the serial monitor?

        Otherwise, I think you need a hardware relay component thing. Read Brian’s post about Flippers… The old style and the new style way of doing flippers.

        For your other questions…
        First, No firing the coil doesn’t require two commands.
        Second, No idea. But I don’t think this is what’s causing the problem.

        Hope this helps-
        Dan

      3. Hi Dan!

        Glad you chimed in, it’s great to see a community building around Custom Pinball Machines!!

        In response to Courtney’s question, a true Arduino has the MOSI, MOSI and SCK wired to both the ICSP header (3×2 rect) and to pins 11, 12 and 13 respectively. So getting it working by moving MOSI to pin 11 can only be a function of the wiring of the Sparkfun clone Arduino…

        As for code to combine reading switches, and in turn firing solenoids, I’ve got full game code posted on my website here (for example purposes only):

        http://www.space-eight.com/Downloads.html

        There are three game examples under “ARDUINO::CODE – Game Master Code”.

        What you’ll find in this code is that the switches are read every cycle. And based on the use case, the solenoid can be held on (like flipper or gate), or set to turn off after a delay period based on the number of program loops. So, yes, you have to send a command to both turn on, and then turn off the solenoid, if you are simply triggering off of a switch event (like a thumper or slingshot).

        I would not count on the watchdog of the solenoid driver to turn off the coils for you… In fact, if you’re burning out fuses, chances are you have a high power coil set to turn on and are not turning it off in a timely manner (on the order of 100ms). As Dan pointed out, if it’s a flipper, they usually have a “hold” coil that runs at a much lower current and can be held on constantly. Same may be true for certain gates and relays.

        So, download and take a look at the game code, see how it handles the countdown delay of momentary firing of coils, and feel free to use whatever portions you need.

        Hope this helps!

        Brian

  3. Thanks guys…all input is greatly appreciated and helpful!

    At first I thought that simply sending a command to ‘fire’ a solenoid would do just that – the driver would briefly turn on and then off a solenoid. I didn’t quite understand that you have to control both the on, and then off, cycle. So I was probably just leaving the coils on and burning out the fuses. Now I am glad that I wired the solenoid power to the fused connector on the driver board instead of directly from the power supply!

    Just an FYI, I wasn’t dealing with the flippers yet. Just a couple of pop bumpers.

    I was pretty much using Brian’s (and thus Pinball Controllers) sample code to fire the solenoids. Now that I understand how the serial commands work, I get what you were doing with the solenoidFireFlag array in the code.

    I have started setting up a Word Press blog to document my own development process. I don’t have a lot of free time to work on the pinball machine itself so I don’t want to take away from that time constantly updating the blog but hopefully I will have something up soon to at least show my progress (and it will be a slow process unfortunately). I will let you know when I have something useful posted on the blog.

    Courtney

  4. Oh by the way…

    I made a LED driver circuit using a chain of 74hc595 8-bit shift registers which is controlled by my Arudino UNO. It can control up to 64 LEDS.

    The circuit is pretty simple but there are a lot of wires (basically 16 wires per shift register x 8 shift register chips).

    I tried downloading a free CAD circuit designer program from a website that will then print out actual circuit boards from your layout. I’ve been messing with it but it is a bit out of my realm of expertise.

    If anyone has any experience with CAD circuit design software I’d love to hear from you…if I can’t make progress sometime in the near future it would be great to have someone to hit up with a few basic questions.

    Courtney

  5. What a lot of people are doing these days is to use the Neo-Pixel from Adafruit (and others). It’s compatible with Arduino, but even better you can use a Fade Candy board to offload the bit-shifting, and just send high-level commands. Companies like FAST Pinball also have their own version of this LED. Worth a look, much easier than trying to spin you own boards…

  6. Thanks space8. I ordered some Neo-Pixels from AdaFruit to play with next weekend!!!

    Unfortunately I moved backwards a big step with the Solenoids.

    I had previously said my solenoids are firing with the Power Driver 16 board (and Mini Master).

    This is true but the firing is completely inconsistent.

    I wrote a simple loop to fire each solenoid (0-7 in Bank 0) in order with a one second delay between each firing. I simplified my setup to one have one coil wired to the board.

    After some random point (maybe 15-25 loops) the one coil fires. Sometimes it fires once, sometimes it fires a couple of times rapidly. Then it might fire again after a few more loops (maybe not). And it doesn’t always fire when the command to fire that particular is sent. it seems to happen randomly.

    I was using a Arudino UNO clone so I replaced that board with a real UNO (that did not fix it).

    I then created a new two wire serial connector from the Mini Master to the Power Driver 16, shortening the wire from about 2 feet to about 4 inches. (this also did not fix it).

    For the life of me I cannot figure out what is wrong.

    It feels like the power Driver is either dropping serial data or not processing all of the data. On the other side, maybe only some of the serial data is making it from the Arudino, through the Mini master and to the Power Driver 16 board.

    I have the Watchdog switch on the Power Driver board set to off so I assume the Power Driver board is not blocking any signals.

    At least since I have dropped to one coil, and I am now sending both and On and off command to the power driver board, I am no longer blowing fuses.

    This is a puzzle, and a big one, that I must figure out for me to continue on the game 😦

    Courtney

  7. Sounds like your Arduino might be browning-out and reseting, or otherwise picking up noise on the power line… Might want to double-check your power supply voltage, and possibly add a cap.

    Probably best way to move forward with trouble-shooting is to put some diagnostic print statements in your code and view them on the terminal. Include some statement during the start-up init phase to know if the Arduino has reset, and then probably print out each solenoid number as it fires/un-fires.

    The mini-master is supposed to alleviate problems with SPI signal noise, but it’s always a good idea to make sure every board has a ground wire coming back to a central location. Are you powering the Arduino off the USB or does it get the same power as the PD-16?

    Hope this helps!

    Brian

  8. Ah the power again. This was an area that I have been most unsure of.

    First, I have print statements in the code that show me which coil I am firing (also displays in binary so that I can see that each bit is correctly set for each coil).

    In the loop() method, I have an overall loop counter that is initialized to zero in the setup() method and increments and prints after each round of 8 coils is fired. That is never resetting to zero which would only happen if the Arduino had restarted the setup() method at some point.

    As for the power:

    I have a single power strip run into the cabinet. This power strip has plugs that connect to the 5V power supply, the 36V power supply, and a power transformer that connects to the Arduino.

    The Arduino is connected to my PC with a USB cable so I can upload code from my laptop and use the serial monitor for debugging. I believe that when the Arduino is plugged into a USB cable AND is plugged into a power transformer at the same time, that the power comes from the transformer not over USB.

    For the Mini Master: I have tried running power from the Arduino 5V and GND connections to the Mini Master. I have also tried running power and gnd from the 5V power supply directly to the Mini Master.

    The power to the Power Driver 16 board has always been directly connected to the 5V power supply.

    Since everything is running off one power strip I kind of assume everything has a common ground. Maybe that is not necessarily the case when the power from the power strip is split to separate devices (e.g. the 5V power supply, the Arduino, etc)?

    The other thing I am unsure about is that Watchdog circuit on the Power Driver board. It is my understanding that the Watchdog can cut power to the solenoids if it detects a loss of data from the master board..thus trying to prevent coils from getting stuck on and burning out if the master board connection fails in any way. I have the Watchdog circuit turned off using the dip switches. I still occasionally see the watchdog LED turn on. It makes me wonder if that could be causing issues as well.

    I happened to have ordered a 2nd Mini Master which I just got in. I can still try switching that board out in case the original isn’t functioning although I doubt that is the problem. At least it would eliminate another piece of the puzzle. I have checked and rechecked the current Mini Master jumpers and they seem to be correct.

    Any additional thoughts would be great. And thanks again for your input and time.

    Courtney

    1. Hi Courtney/Brian,

      I just started up my project and am seeing something pretty similar, and this looks to be a relatively common problem, any guidance as to what eventually did it? Was it the arduino browning out, or was it something in the software?

      Initially I’m trying to get my first coil to be firable consistently and had a time when it was working, but the inhibit LED on the powerdriver is generally coming on. For what it’s worth I’m currently sending just one of the 2 banks…

  9. Hi,

    I wanted to ask where I can find the female connectors to connect to the PD-16. (The red ones). I was looking to Digikey but I am not sure. I need female connector for 0.100 and 0.156 pitch.

    Thanks

    Salim

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s