(Topic ID: 193656)

Build your own lamp driver

By legtod2

6 years ago


Topic Heartbeat

Topic Stats

  • 135 posts
  • 12 Pinsiders participating
  • Latest reply 5 years ago by legtod2
  • Topic is favorited by 14 Pinsiders

You

Linked Games

No games have been linked to this topic.

    Topic Gallery

    View topic image gallery

    Schematic==0G-00005677==Mod-Dimmer-5A-1L.pdf (PDF preview)
    Transformer (resized).jpg
    Voltage_WaveformsA.jpg
    NewPrototype (resized).jpg
    pasted_image (resized).png
    pasted_image (resized).png
    SchematicPage3 (resized).jpg
    SchematicPage2 (resized).jpg
    BreadBoard (resized).jpg
    SchematicPage1 (resized).jpg
    jeremylampdriver (resized).jpg
    xxP7063229 (resized).JPG

    You're currently viewing posts by Pinsider legtod2.
    Click here to go back to viewing the entire thread.

    #1 6 years ago

    I have started a separate thread on pinball lamp driver to enlist input on choices for building your own lamp driver board.

    I have another thread on my arduino conversion of Close Encounters machine.

    Before putting solder to board I am pausing to enlist input of others.

    My original plan was this.

    Create a separate board the is controlled by i2c or spi connection. Allow 32 to 64 output lamp/led controls. Switch will basically be a low side switch. No pwn controlled output.

    A bank of 4 or 8 shift registers to feed 4 or 8 darlington unl2803.

    Traditional circuits use fets or mosfets as opposed to using an array bank approach.

    Another issue to consider is max current draw and heat stress on board.

    Any comments or suggestions on building your own lamp driver board ?

    #3 6 years ago

    Zacaj,

    Would there be an alrenative to the unl2803 that would take the load ?

    #5 6 years ago

    May aim is to handle incandesents. My version one board did have a heat issue. Guest it was the draw on a single ground lead. Not sure if multple ground leads would help. The outputs will be constantly strobed.

    #12 6 years ago

    This whole journey is for education and learning. I would like my lamp driver board 2.0 for use in my arduino powered pinball machine to work, as opposed to melting ground wires on lamp driver 1.0 boards.

    I have some working code to filling the shift registers and latching it out to turn on the lamps.

    Can easily replace the design to use shift registers to (fets or mosfets or tips) to get arround the max current and max heat for 32 or 64 lamps.

    I saw what Hugh uses for open pinball project, and I will lookup the LISYS does. This can be a clean sheet of paper for something I can build and learn from.

    #14 6 years ago

    I believe the multiple ground paths are the right direction along with the use of 100 mil 8 pin connectors on the board.

    Also the use of individual 2n7000 may be prudent and remove the unl2803's from the picture.

    So assume that the shift registers are daisy chained and one board hosts 4 shift registers giving 32 output lamp controls.
    This also means 32 individual 2n7000's. Giving thought to ground lets assume 4 output ground pins so we can trace fault to individual shift registers.

    With this in mind our inputs of 3 pins to control the daisy chained shift registers, and 32 output pins to the lamps (4 x 8 pin 100 mils) and 4 ground leads. this may fit the bill. Of course this would be a low side switch so no resistors should be required.

    #15 6 years ago

    If I recall correctly the Gottlieb system 1 output driver board used multiple output paths.

    I have two Gottlieb machines now (Jungle Queen and Close Encounters).

    #18 6 years ago

    Good point about the key pin and have one pin for ground. Good idea CactusJack.

    Jwilson, I am using roughly 32 controlled playfield lamps. I think they are all 44 but not sure.
    Being a newbie, not sure what the correct choice is for this application. Thats why I'm asking for input.

    #19 6 years ago

    CactusJack do you mean LISY1 or LISY80 boards for this website http://www.lisy80.com/english/lisy1/ ?

    If so its really cool what he did using the pinmame roms and a pi zero.

    #21 6 years ago

    CactusJack,

    The fellow posted on vpforums a while back for assistance with pinmame to work with linux. The pinmame world is dominated by windows rather than linux and some of the source code did not work ported over.

    The solid state machines have roms which help drive the machines, and I was always curious of what the rom actually did in a virtual pinball and solid statemachines.

    Long story short, its cool how he made a system 1 and system 80 mpu board using the pi and his own motherboard.

    #22 6 years ago

    Bally used the 2n5060 for its lamp driver board. I am still searching for an array chip but have found nothing that was standardized.

    The 2n7000 and BS170 are common interchangables.

    Any other suggestion on a suitable transistor that won't break the bank and survive the test of time?

    #25 6 years ago

    Cool doc barakandl.

    #26 6 years ago

    CactusJack,

    Lets assume max 10amp, 6-9volt DC, 32 x #44 bulbs. Avg amps will be less than 10, maybe 5-6amps.

    How does the math look for our lot of transistor candidates.

    #36 6 years ago

    Alrighty, here is one that I am considering for my transistor
    https://www.digikey.ca/product-detail/en/fairchild-on-semiconductor/BS170_D26Z/BS170_D26ZCT-ND/3042544

    This guy may fit the bill and ordering quantity of 100 keeps the price managable.

    Since I want to keep my machine lamps as is, no led replacements for this cab ( maybe I will look at it on the other three machines). My Close Encounters machine is already a bit of a frankinstien creation anyway. It is my mule and idea testing machine.

    The shift registers will talk to the bs170 and turn them on/off.

    #43 6 years ago

    Jwilson,

    Do you have a link to a write up on your custom machine. I'd like to read up on it

    #45 6 years ago

    So it you that Hugh was refering to for the EM machine done using opp. I finally connect the dots.

    I am looking forward to seeing a write up of an em ussing opp

    #46 6 years ago

    I ordered 100 of the BS170 from digikey.ca. So far I have found digikey pretty quick on filling orders for my electronic stuff.
    Going to use fritzing for my drawing.

    11 months later
    #48 5 years ago

    Jeremy, how did you make out with your EM machine. I understand you switched out the OPP boards for p-roc boards.

    How did you make out with the lamp driver board ? Did you end up using mpf and a p-roc lamp driver board ?

    Sorry I have been away from the forum for a while and still catching up.

    #49 5 years ago

    I am resurrecting this thread... I have been away for a while (Life has a tendency of pulling us away from our hobbies).

    Lately I have been working on my Close Encounters hybrid for the raspberry pi python logic to drive the backglass display.
    My break it code testing between the pi and the arduino shows that under high playfield activity, the backglass display can lag behind.
    This primarily happens when the Bonus count down happens or the spinner is spinning like a top or the thumper is shotgunning the ball repeatively against the wall. None of these issues really cause a problem unless you are watching the scoreboard and the sync is usually a couple of tenth of seconds off.
    The count down can be cured by adding a brief delay between the arduino count down and the pi to allow the count down display catch up. So far I am living with it but my obsessive compulsiveness will kick in and I will fix it.

    As far as my lamp driver board I have all my parts and testing the design on my bench system before applying to the machine.
    My bench test bed consists of my Ubuntu desktop PC connected to my spare arduino mega. The mega is attached to my prototype lamp driver board and the board connects to my breadboard of LED lamps. Presently the prototype lamp driver board only pushes 16 LED lamps.

    My intension is to switch out my Close Encounters incandesent lamps for LED's. My PC power supply board will be used to push the 5 vdc to the LED lamps.
    My playfield has 32 bulbs so my board should be easier to build that the 64 bulb monster I originally planned for.

    Previously I tried my present lamp driver board on the incandesent lamps and found it heated up quickly and would stop working.

    Any way, I will write up my experience as I go since I have time once again to do this.

    #51 5 years ago

    I have flip flopped from led back to lamps. This is changing my board design.
    Right now I am planning on using 4 shift registers 595's, mosfet n channel BS170, and 1k ohm resisters per shift register data port.

    If I look at the original gottlieb system 1 driverboard, this emulates pretty close what it was doing to drive my playfield lamps.

    I am not sure that I have the correct resistor size but my best guess is consistant with the original gottlieb system board design.

    The board will be driven from my adruino using clock, latch, and data pins between the two plus 5volts and ground.

    Will post my hand drawn schematic later.

    #53 5 years ago

    Jeremy,

    I saw the lamp driver you built (Picture copied from your thread). Looks like 16 tip 102 Mosfets ??? not sure. What would you recommend over the BS170's
    Originally I was under the impression that the BS170's would do the job since that were rated at 500 mA, 60 V. Mind you I have no idea what kind of max amps will be going thru it. Basically I have 32 CPU controlled playfield lamps to deal with.
    Also your design looks like what I was planning to build but I was going for 32 instead of 16.
    You mentioned problems with programming and libraries and flickering. What happened ?

    My plan is to use the Arduino mega and do all my own code from scratch. So far I have a working prototype using LED's to test my bit flipping coding.

    Will try a quick bread board of 8 incandesents with my existing stock of bs170 to see what happens.

    jeremylampdriver (resized).jpgjeremylampdriver (resized).jpg
    #56 5 years ago

    Jeremy, which n-channel mosfet would you recommend than ?

    Zacaj, filter caps ? Do you mean capacitors ? And any were special on the IC ?

    3 weeks later
    #61 5 years ago

    I have been messing arround with my bread board to test my Lamp driver board 2.0.

    Since I had on hand 100 BS170's I used them on my trial.

    Used 6vdc power source for the lamps and hooked every thing up for four lamp trial.

    Worked ok on my work bench.

    BreadBoard (resized).jpgBreadBoard (resized).jpgSchematicPage1 (resized).jpgSchematicPage1 (resized).jpg

    SchematicPage2 (resized).jpgSchematicPage2 (resized).jpg
    #62 5 years ago

    Lessons learned on my bread board ...

    The default state of the shift register is On. So when I power on the arduino and my external 6 vdc power source at same time all lights turned on.
    While this lasts only a few seconds it could be nasty if this design was for a solenoid driver board.
    Imagine all solenoids firing at once, popping a fuse or just plain scaring the pant off you.

    If you look at my hand drawn schematic, you will notice I did not put any resistors between the shift register and the transistor gate pin.
    This may be a mistake on my part, but since this is a low side switch and it is just dumping ground I felt it was not required.
    Also you will notice I did not put any capacitors, this is because I did not have any on hand in my el-cheapo parts bins.
    Perhaps it might have been wise to have one on the 5 vdc side of the shift register. Again I got lazy because my 5vdc source is the arduino.
    For my frankenstien cabinet, the 5vdc source will be a pc power supply 5vdc connection.

    The external source for my Lamp 6 Vdc power supply for my cabinet will be unfiltered from a bridge rectifer.
    That power goes thru an 8 amp fuse. That power is daisy chained on the playfield lamps. Each of the 32 cpu controlled playfield lamps grounds will go to individual pins on my lamp driver board.

    Building this board is starting to take shape in my mind, and I have been experimenting and learning on the bread board.

    Soon I will solder my next bastardized creation.

    Oh yeah, I should really be using Fritizing and do up my schematics rather than hand draw them. Guess I'm lazy in that department too, don't want to have to learn fritizing to do drawings.

    #64 5 years ago

    Zacaj,

    Perhaps its floating but my comment is based on the following observation.
    Turn on power to arduino and external power source at the same time (given present wiring diagram).
    All lamps turn on briefly for 3-4 seconds.

    As far as pullup/downs, I probably should add 1.0K Ohms 1/4 W resistors between the shift register and the gate pin on the bs170 transistor.
    Lastly I should also add capacitors .01UF, 20%, 100V to the 5vdc side of the shift registers.
    Unfortunately, I had no caps on hand putting this bread board together.

    I see a digi-key order coming up.

    #67 5 years ago

    Hugh/Zacaj

    Thanks for the extra eye on my scribbled diagrams. My next step is to order my caps and header pins.

    I have a couple of proto boards. I never gave any consideration to heat. My test only had 4 bulbs attached, the real mcoy will be 32 bulbs.
    During actual game play I could expect half of them on. That current may generate heat that my bread board is not reproducing.

    This is probably the time for me to order beefier transistors rather than using the bs170's.

    #68 5 years ago

    Update:

    Ok I have finally farted arround enough and fixed my breadboard to work with the restart/power up issues with the 595 shift register.
    My original schematic did not allow for float on the 595. The symptum was, when you freshly power on or reset both the arduino and the remote power source all the lamps would turn on and stay on for a number of seconds. This is fine for a lamp controlled shift register but not good enough if it was controlling Solenoids, motors, relays. What would happen is all the solenoids would clatter or lock on till the arduino finished booting.
    The solution was to add a 10 K pull down resistor to the latch pin. The value was dervived from other forms that suggested for 5 volt source a pull up resistor s/b approx 5K and pull down 10 K. This may spark some discussion, but for my breadboard design it is working (for one shift register).
    Sure there are other was of dealing with the bootup/reset issue but this fix just required a 10k resistor between Latch and ground.

    The second thing was to add a 50V .1uF ceramic caps between the Pin 16 (Vcc) and ground.

    For clarity sake, the 5 volt power source is coming from the USB port connection between the raspberry pi and the arduino.
    Also Q1- Qx connects to a BS170 transistors then onto my 6volt lamps.

    I am about to test the daisy chain of 4 shift registers to control my 32 lamps (more to come on that to come).
    SchematicPage3 (resized).jpgSchematicPage3 (resized).jpg

    #70 5 years ago

    Hugh,

    The original Gottlieb System 1 driver board for the Close Encounters machine powered both the Solenoids and the lamps. If I really wanted to get creative I could scope creep the solenoid driver into my lamp board.

    Today my hybrid pinball machine, I have to power on my raspberry & arduino first (wait till boot completes) then power on my pinball cabinet.
    The reason for that order is, the solenoids all fire at once and sometimes blow the fuse if I reverse the order of startup.

    My present independant solenoid driver board has to be powered on after the arduino and pi are booted and not before.

    I could cirumvent this issue by having a relay between the arduino and the cabinet power supply. The relay would enable the solenoid and lamp dc power after they complete their boot up sequence and then problem would go away (Theoretically)

    Also forgot to mention. I have diagnostic button to help me locate solenoid, lamp, sound, and other issues. It exercises every lamp, solenoid, etc component.
    Your method to flash all bulbs sound like a good idea to find burnt out bulbs at boot up time.

    What can I say, this is a frankenstien machine that is not yet completed. It has allowed my to learn as I add pieces and improve them as I go.

    Right now it's more of a blob than a monster.

    #73 5 years ago

    Hugh,

    So far I have been component testing each part of Frankenstein as I go.
    The solenoid driver needs revision for boot up/restart purposes, so far I is a work around with the knowledge one day I will burn out a transistor or solenoid because I did the wrong startup procedure.
    My back glass Pi system has been a separate component.
    The sound system a separate component.
    The switch input matrix separate
    The rules and game play separate.
    The diagnostic separate.
    I hear what you are saying, some were along the way I may clog the drain and pop a chip.
    That’s likely a big possibility. I learn best by repetition and by making mistakes.
    Lucky for me, I have the good fortune to have the input and advise from experienced pinball service people.
    People like you and other pinside contributors have aided me tremendously to get to where I am so far.
    Without that help, I never would be were I am so far.
    Thank you and others for assistance so far.

    #75 5 years ago

    Cactus jack,

    I plagiarized the use of a pull down resistor on the latch pin from another forum. Was this the right thing to do, my level of experience was to copy another example from the good old inter web and try it. So far it seems to work from my breadboard model. Yet to test daisy chaining 4 595’s and put it to the test.

    After successful prototype testing, I plan to solder up my board and test in my pinball cabinet.

    3 months later
    #82 5 years ago

    For completeness I explored the theory behind using the Bally AS-2518-23 Lamp driver. This example uses a 4 - 16 Decoder via IC 14514B.
    Essentially 4 pins controls turning on one of 16 pins (only one on at a time) with 4 more pins enabling each of the other 3 IC's. The bally Lamp driver board has 4 of the decoder IC's so 60 plus pins to turn on/off.
    Enough about the board and more about what I am thinking of doing with it.
    In order to have a component design, a dedicated uno will receive state information (Lamp on/off, array of all available lamp pins).
    The uno will update its state table from the master arduino mega.
    The dedicated uno will cycle thru the state table and strobe each lamp that is in an on state.
    Of course since only one pin on at a time the turning on/off many pins so quickly the human eye can not tell.

    This approach differs from my previous thinking of turning on a lamp and leaving it on till its state changes from on/off - off/on.

    The cost of a second hand bally AS-2518-23 is negligable in comparison to me building a board and the time I spend testing it.

    Lets see how this one turns out.

    #84 5 years ago

    Scratching my head Zacaj. A little knowledge (on my part) can be dangerous. But since the MC14514b chip has 4 pins to switch on and off the 16 output pins and my feature lights are all dc current why do I need to worry about zero crossing.
    The board is low side to the lamps so it just turns on and off ground to a pin.

    Am I missing something?

    #86 5 years ago

    Here is the data sheet for the ic https://www.onsemi.com/pub/Collateral/MC14514B-D.PDF

    Setting data pins 1 - 4 and setting strobe pin should do the trick ?

    Maybe I am missing something.

    #88 5 years ago

    Very educational. That explain other postings where lamp driver issues complain about flickering.

    #90 5 years ago

    I found this posting as well. So I have some more research and learning to do.

    http://www.bristolwatch.com/ele2/zero_crossing.htm

    #91 5 years ago

    ok it sounds like I need a circuit that generates an interrupt to perform the correctly timed pulses.
    One of the arduino interrupt pin detecting the zero crossing would then perform the ISR to strobe the appropriate pins.

    I think I need to pseudo code this and identify what the circuit is that detects the zero crossing.

    I have seen examples of the optocoupler as the zero crossing detector, but are there any native internal arduino zero crossing?

    Lastly is there any other way to do zero crossing detection without a dedicated circuit?

    #92 5 years ago

    Here is a very simple example of setting up a circuit that generates the pulse and using an iterupt pin to detect.

    https://electronics.stackexchange.com/questions/364165/counting-the-number-of-zero-crossing-using-arduino-uno

    #94 5 years ago

    My MPU is a arduino...

    #96 5 years ago

    Zacaj, what type of circuit was being used for lisy35 project

    #99 5 years ago

    At long last I have my arduino prototype code written.
    I am using a dedicated Arduino Uno to receive serial messages from an Arduino Mega.
    The uno is communicating to the balley lamp driver board.
    My Balley lamp driver board and my zero crossing parts have not yet arrived.

    The uno receives individual lamp on/off requests or a single array state table.
    From there it updates the individual update or array state table changes.
    It manages its own local copy of the 60 lamps states and that copy is used to strobe the lamps accordingly.
    The uno has pin 2 dedicated as a zero crossing pin interrupt. The interrupt uses the local state table to strobe the lamps.

    Getting closer. Now all I need is the board and parts to arrive.

    #101 5 years ago

    Quench we will see how it works in practice. Hopefully the serial port communication won’t be too slow.
    The messaging is really tiny and in one direction only.

    Message Prefix L + Lampnumber
    Lampnumber 1 to 60 and lamp state is off.
    Lampnumber 65 to 124 and lamp state is on.
    If number is greater then 64 then subtract 64 to get the real Lampnumber.

    Message Prefix A + 60 char state array 0 = off, 1 = on

    #103 5 years ago

    Quench, the lamps on connected to the bridge rectified DC Lamps. The Serial ports between the mega and arduino are 115200 (or whatever speed I want to set it at. And the driver board switches the lamps to ground.

    I expect I may have to experiment a bit with timing on the Zero Crossing using a short delay but I will deal with that when I start testing.

    There are no fancy lamp attract routines in place on the mega, just the regular lights to switch scoring lamp on/off.

    Once its working I will consider making attract routines.

    1 month later
    #104 5 years ago

    I have not received my zero crossing detector parts yet. It appears I had a shipping issue and re-ordered from another supplier.
    In the time being I was trying to map out my interconnect to my arduino and bally lampdriver AS-2518-23 board.
    The J4 Interconnect seems pretty simple except pin 3.

    Here is the mapping of arduino pins and bally driver board J4 connector
    Arduino pin 22 = J4 Pin 14 (A0)
    Arduino pin 23 = J4 Pin 15 (A1)
    Arduino pin 24 = J4 Pin 16 (A2)
    Arduino pin 25 = J4 Pin 17(A3)
    Arduino pin 26 = J4 Pin 7 (P0)
    Arduino pin 27 = J4 Pin 6 (P1)
    Arduino pin 28 = J4 Pin 5 (P2)
    Arduino pin 29 = J4 Pin 4 (P3)
    Arduino pin GND = J4 Pins 1,2, 11,12
    Arduino pin 3 = J4 Pin 13 Strobe
    =======================
    Arduino to Zero crossing circuit
    Arduino pin 2 = From zero crossing
    =======================
    So my question is what is J4 Pin 3 doing on the Bally Board ? (My assumption is this is the logic 5 volts)
    If the assumption is correct, I can feed 5volts from Arduino pin to J4 Pin 3.

    #106 5 years ago

    Thanks zacaj.

    2 weeks later
    #107 5 years ago

    Here is a quick update. I have been experimenting with the Bally AS-2518-23 lamp driver board.
    My Zero Crossing detector board arrived finally (I now have 2 Zero crossing boards due to shipping errors).
    I built a quick and dirty proto type board to allow me to test.
    From the picture below you can see the bally board and the three Arduino boards.
    You can see the uno is plugged into the Bally board and the Zero crossing board.
    That Zero Crossing board is also good for christmas tree lighting projects and other light dimming projects.
    The dedicated Uno Lamp driver is receiving serial messages from the Arduino Mega.
    It receives a state array of the 60 lamps. For complex and long winded attract lamp sequences is receives a sequence replay request.
    Once the uno receives a sequence replay request it uses the sequence subroutine and plays it with out the Mega having to send a lot of serial traffic.
    If new updates are sent the sequence replay is aborted.

    NewPrototype (resized).jpgNewPrototype (resized).jpg
    #109 5 years ago

    Quench, I am experimenting right now.So nothing complex or long.

    When the machine has no inputs during an idle time interval (no switch matrix activity) then an idle time out sequence is played.
    The play field has 33 lamps so I am experimenting with pattern play sequence right now.
    Simple patterns like strobing up and down the 1k to 20k bonus lamps, random lamps, the playfield on the Close Encounters doesn't really have an
    impressive array of lamps on the play field.

    #110 5 years ago

    Reading the decoder chip spec is confusing.

    My balley board is using the E-620-37 4 to 16 decoder chip.
    There are other compatable and they chips are:
    CD4514BCN, MC14514B, MC14514CP, MM14514BCN, NTE4514B.

    The NTE4514B (output active high option) of a 4 to 16 line decoder with latched inputs. The NTE4514B presents a logical “1” at the
    selected output. The latches are R-S type flip flops which hold the last input data presented prior to the strobe transition from “1” to “0”.
    These high and low options of a 4 bit latch/4 to 16 line decoder. The latches are RS type flip flops and data admitted upon a signal incident at the strobe input, decoded, and presented at the output.

    Pin 1 of the chip is Strobe and Pin 23 is inhibit.

    Just for Shits and giggle is psuedo code to turn on pin S2
    1) Zero cross pulse generates interupt
    2) Set inhibit pin low
    3) Set strobe pin high
    4) Set Data pin1 low,Data pin2 high, Data pin3 low, Data pin4 low
    5) Set strobe pin low
    6) Set inhibit pin high

    Question is step 2 & step 6 correct or do I have them backwards

    #112 5 years ago

    Continuing that line of though, changing to another address on same chip and same zero cross
    1) Zero cross pulse generates interrupt
    2) Set inhibit pin high (outputs all go low)
    3) Set Data pin1 low,Data pin2 high, Data pin3 low, Data pin4 low
    4) Set strobe pin high
    5) Set strobe pin low
    6) Set inhibit pin low (output S2 goes high)
    7) set inhibit pin high
    8) set data pin 1 high, data pin 2 high, data pin 3 low, data pin 4 low
    9) set strobe pin high
    10)set strobe pin low
    11)set inhibit pin low (output S3 goes high)
    12) repeat step 7 to 11 for other Sn pins that need to go high

    #114 5 years ago

    That works just tickety-boo.

    #115 5 years ago

    Guess I spoke too soon. I can turn on lamps, they just don't shut off.

    I will post a sample test arduino script which demonstrates what I am doing.

    #117 5 years ago

    Here is a sample of the code ...

    #define ZERO_DETECT 2 // Your arduino interrupt pin
    #define BOARD_LED 13 // on board LED

    // volatile required if you are going to reference this variable
    // outside of the interrupt procedure
    volatile byte zeroCrossCounter = 0;
    int AOutputs[] = {4,5,6,7}; // Which arduino pin to turn on (1-15)
    int UOutputs[] = {8,9,10,11}; // Which arduino pin to decoder (U1 - U4) for its lamp turn on (pins 1-15)
    int Strobe_Pin = 3;
    char c;
    int v;

    void setup() {
    Serial.begin(115200);
    Serial.println("Enter Lamp # to turn on (0-15):");
    // You don't need a pullup since you can use the Arduino pullup
    pinMode(ZERO_DETECT,INPUT_PULLUP);
    pinMode(BOARD_LED,OUTPUT);
    digitalWrite(BOARD_LED,LOW);
    attachInterrupt(digitalPinToInterrupt(ZERO_DETECT),AcZeroCrossingInterrupt,RISING);
    pinMode (AOutputs[0], OUTPUT);
    pinMode (AOutputs[1], OUTPUT);
    pinMode (AOutputs[2], OUTPUT);
    pinMode (AOutputs[3], OUTPUT);
    // Which IC (U1 - U4) chip to speak to
    pinMode (UOutputs[0], OUTPUT);
    pinMode (UOutputs[1], OUTPUT);
    pinMode (UOutputs[2], OUTPUT);
    pinMode (UOutputs[3], OUTPUT);
    pinMode (Strobe_Pin, OUTPUT);

    v = 8;
    }

    void loop() {
    if (Serial.available()) {
    c = Serial.read();
    if (c != 10) {
    v = int(c) - 48;
    Serial.println(v);
    }
    }
    }

    void AcZeroCrossingInterrupt () {
    if ( ++zeroCrossCounter == 60 ) { // blink LED approx every 1/2 second
    zeroCrossCounter = 0;
    digitalWrite(BOARD_LED,!digitalRead(BOARD_LED));
    }

    for (byte b = 0; b <=15; b++) {
    digitalWrite(UOutputs[0], HIGH);
    if (b == v) {
    for (int a = 0; a<=4; a++) {
    if (bitRead(b,a) == 1) {
    digitalWrite(AOutputs[a],HIGH);

    } else {
    digitalWrite(AOutputs[a],LOW);
    }
    }
    digitalWrite(Strobe_Pin,HIGH);
    digitalWrite(Strobe_Pin,LOW);
    digitalWrite(UOutputs[0], LOW);
    }
    }

    }

    #118 5 years ago

    For my testing prototype the power source for the lamps is a PC power supply providing 5 VDC to my lamp string.

    #119 5 years ago

    The testing source program you simply type in the lamp #
    For example I enter 1 and lamp # 1 turns on
    Then I enter 2 and lamp 2 turns on and lamp 1 remains on

    #120 5 years ago

    I bet your next sentence is this,
    I need to use the power supply from my pinball machine.

    And that the PC power supply that I am using is filtered.

    #122 5 years ago

    Time for me to use my handy dandy transformer prototype board...

    Transformer (resized).jpgTransformer (resized).jpg
    #123 5 years ago

    I built this for testing my Electromechanical solenoids. You can see my home made 4 diodes to convert AC to DC for testing the attached knocker.
    I will add another one for the lamp side tape on this transformer and convert the lamp side tape to DC.

    This should approximate my unfiltered power needs.

    #124 5 years ago

    Still no joy in mudville...

    In my previous testing using a PC power supply to provide 5vdc to my lamps, the lamp would turn on and stay on forever.

    I have swapped out the PC power supply for a transformer that came out of an old Bally Electro Mechanical pinball machine.
    Using that transformer I added two Bridge rectifiers to the 60 volts AC tap and to the 6 volts AC tap to provide me with 53.4 volts DC and 5 volts DC.
    There are no capacitors just some fuses on my home made handy dandy power supply for the lamps.

    Using the new power supply I reconnected the lamps and tried my testing again. This time the lamps did not turn on or off or even flicker.
    So I checked the voltage across the DC side of the bridge and I see 5.4 vdc for the lamp bridge and 53.4 vdc for the coil bridge. Damm not working.

    Next I disconnected my home made powersupply and reconnected the PC power supply to the lamps.
    This time the lamps would come on when requested but never turn off.

    Scratching my head and drinking a beer for inspiration.

    Any thoughts in Pinside land ?

    #125 5 years ago

    I just re-read the Bally Theory of Operation document. It states the the Zero Crossing detector circuit input is the +43 vdc line to the solenoid common.

    In my case the ZCD is plugged into 120 ac wall outlet.

    I scratched my head and unplugged the 120 ac from the wall to the ZCD and tried using the 60 AC tap and neutral tap of the transformer to the ZCD and retry my testing. Still no luck the lamps will no turn on or flicker.

    I did not retry testing by unplugging the the 60AC tap and replace it with the 6 AC tap connect.

    #126 5 years ago

    And more reading states the MPU performs a slight delay after zero crossing to allow the voltage to appear.
    I seem to remember this thread https://pinside.com/pinball/forum/topic/lisy35-help-with-bally-lamp-driver-code-needed#post-4690065 where a delay was added after the detection of the interrupt.

    His solution was to add this delay...
    //wait a bit before first ignition
    _delay_us(800);

    For the arduino adding a delay within an interrupt or ISR is something I need to research a bit on.
    From my reading adding a delay() inside an ISR is ignored.

    More learning required, I think I need another beer to mull over my options.

    #128 5 years ago

    Zacaj,

    This is the ZCD unit https://www.amazon.ca/RobotDyn-controller-control-Arduino-Raspberry/dp/B077GMFSMF (not what I paid for it).

    Basically what project people would used to make a arduino light dimmer project.

    Since it detect zero crossing, I thought I could use it for for my needs.

    #130 5 years ago

    Quench

    Answers:
    Is the unit detecting zero crossing on the downward or upward cycle.
    "attachInterrupt(digitalPinToInterrupt(ZERO_DETECT),AcZeroCrossingInterrupt,RISING);"

    Right now its set to RISING
    mode: defines when the interrupt should be triggered. Four constants are predefined as valid values:

    LOW to trigger the interrupt whenever the pin is low,

    CHANGE to trigger the interrupt whenever the pin changes value

    RISING to trigger when the pin goes from low to high,

    FALLING for when the pin goes from high to low.

    What happens when you power the lamps from your PC power supply and use this ZCD to trigger your interrupts, do the lamps ever turn on? i.e. is your Arduino detecting/executing interrupts raised by the ZCD?

    The lamps do turn on when I instruct them to turn on; however, they don't turn off unless I disconnect the PC power supply.
    The uno flashes LED 13 every half second to show that the ZCD is working. And yes it is blinking.

    Lastly, I don't have an scope.

    #132 5 years ago

    Its working now. Thanks to Quench's reference to change the zero crossing from RAISING to FALLING detection.
    The other key was to remove the AC will plug from the wall outlet (to Zero crossing detection) and feed the AC from the 60 acv tap and common tap of the transformer. See youtube

    #133 5 years ago

    So if you are crazy enough to want to build your own combination uno driving a bally AS-2518-23 lamp driver board and separate Zero crossing detector here is a simple sketch to test your devices are working copy and paste the following into your arduino ide...

    /* ======================================================================================================
    *ZeroCrossTest.ino
    *Feb 2, 2019 Todd Legere
    *Purpose: Test arduino communicating with bally AS-2518-23 lamp board and Zero Cross Detector
    * Arduino built in LED lamp will flash every 1/2 second to show that Zero Cross detector working
    *Open the serial console and choose which lamp pin to turn on.
    *By default lamp one on at startup
    * ===================================================================================================== */
    /* Pin outs from Robodyn Zero cross detector
    * ZCD Pin 1 - Uno 5vdc
    * ZCD Pin 2 - Common Ground bus
    * ZCD Pin 3 - Uno Pin 2
    * ZCD Pin 4 - Empty (Not used)
    */

    /* Pin outs from Uno to Bally AS 2518-23 board
    * Uno Pin 3 - J4 Pin 13 Strobe
    * Uno Pin 4 - J4 Pin 14 A0
    * Uno Pin 5 - J4 Pin 15 A1
    * Uno Pin 6 - J4 Pin 16 A2
    * Uno Pin 7 - J4 Pin 17 A3
    * Uno Pin 8 - J4 Pin 7 P0
    * Uno Pin 9 - J4 Pin 6 P1
    * Uno Pin 10 - J4 Pin 5 P2
    * Uno Pin 11 - J4 Pin 4 P3
    * Uno Pin 5vdc - J4 Pin 3 5vdc
    * Uno Pin Grd - Common Ground bus
    */

    /* Ground Pins from Bally pins J4
    * J4 Pin 1 - Common Ground bus
    * J4 Pin 2 - Common Ground bus
    * J4 Pin 11 - Common Ground bus
    * J4 Pin 12 - Common Ground bus
    */

    #define DEBUG 0 // Set to 1 to see Frequency (Value should average to 60Hz)
    #define ZERO_DETECT 2 // Your arduino interrupt pin
    #define BOARD_LED 13 // on board LED
    #define SECONDS 2.0 // Use two samples to avg frequency calc

    // volatile required if you are going to reference this variable
    // outside of the interrupt procedure
    volatile byte zeroCrossCounter = 0;
    volatile int count = 0; // Used to calc frequency value

    int AOutputs[] = {4,5,6,7}; // Which arduino pin to turn on (1-15)
    int UOutputs[] = {8,9,10,11}; // Which arduino pin to decoder (U1 - U4) for its lamp turn on (pins 1-15)
    int Strobe_Pin = 3;
    char c;
    int v;

    void setup() {
    Serial.begin(115200);
    Serial.println("Enter Lamp # to turn on (0-15):");
    // You don't need a pullup since you can use the Arduino pullup
    pinMode(ZERO_DETECT,INPUT_PULLUP);
    pinMode(BOARD_LED,OUTPUT);
    digitalWrite(BOARD_LED,LOW);
    attachInterrupt(digitalPinToInterrupt(ZERO_DETECT),AcZeroCrossingInterrupt,FALLING);
    pinMode (AOutputs[0], OUTPUT);
    pinMode (AOutputs[1], OUTPUT);
    pinMode (AOutputs[2], OUTPUT);
    pinMode (AOutputs[3], OUTPUT);
    // Which IC (U1 - U4) chip to speak to
    pinMode (UOutputs[0], OUTPUT);
    pinMode (UOutputs[1], OUTPUT);
    pinMode (UOutputs[2], OUTPUT);
    pinMode (UOutputs[3], OUTPUT);
    pinMode (Strobe_Pin, OUTPUT);

    v = 1; // Turn on lamp 1 in the begining
    }

    void loop() {

    #if DEBUG
    delay(SECONDS * 1000);
    noInterrupts();
    float hz = count / SECONDS/ 2;
    interrupts();
    Serial.print(hz);
    Serial.println("Hz");
    #endif

    count = 0;

    if (Serial.available()) {
    c = Serial.read();
    if (c != 10) {
    v = int(c) - 48;
    Serial.println(v);
    }
    }
    /*
    * Simple cycle thru lamps 1 - 4 lamp display One at a time
    for (int t = 1; t <= 4; t++) {
    delay(250);
    v = t;
    }
    */

    }

    void AcZeroCrossingInterrupt () {
    // Canadian Power is 60Hz, European and other area's 50Hz change counter to match your geo area.
    if ( ++zeroCrossCounter == 60 ) { // blink LED approx every 1/2 second
    zeroCrossCounter = 0;
    digitalWrite(BOARD_LED,!digitalRead(BOARD_LED));
    }
    count++;

    for (byte b = 0; b <=15; b++) {
    digitalWrite(UOutputs[0], HIGH);
    if (b == v) {
    //
    for (int a = 0; a<=4; a++) {
    if (bitRead(b,a) == 1) {
    digitalWrite(AOutputs[a],HIGH);

    } else {
    digitalWrite(AOutputs[a],LOW);
    }
    }
    digitalWrite(Strobe_Pin,HIGH);
    digitalWrite(Strobe_Pin,LOW);
    digitalWrite(UOutputs[0], LOW);
    }
    }

    }

    #135 5 years ago

    No problem, really appreciate your help and others who have contribuited to my learning journey. I am an electronic's neanderthol.
    I will also post the sample code that allows this to receive serial messages to drive the entire Bally 60 lamp array.
    The messaging will allow to either receive individual lamp pin updates or receive the whole lamp array.

    You're currently viewing posts by Pinsider legtod2.
    Click here to go back to viewing the entire thread.

    Reply

    Wanna join the discussion? Please sign in to reply to this topic.

    Hey there! Welcome to Pinside!

    Donate to Pinside

    Great to see you're enjoying Pinside! Did you know Pinside is able to run without any 3rd-party banners or ads, thanks to the support from our visitors? Please consider a donation to Pinside and get anext to your username to show for it! Or better yet, subscribe to Pinside+!


    This page was printed from https://pinside.com/pinball/forum/topic/build-your-own-lamp-driver?tu=legtod2 and we tried optimising it for printing. Some page elements may have been deliberately hidden.

    Scan the QR code on the left to jump to the URL this document was printed from.