(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
    There are 135 posts in this topic. You are on page 3 of 3.
    #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

    #102 5 years ago
    Quoted from legtod2:

    Hopefully the serial port communication won’t be too slow.

    What serial port speed are you using and how often/when is the messaging happening?
    The lamps need to be connected on a common power bus of rectified but unregulated/unfiltered DC. The lamp driver board switches the individual lamp connections to ground.

    Once you hook it all up, let us know if you have issues with the protocol writing to the lamp driver board.

    #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.

    #105 5 years ago

    5V, yep

    pasted_image (resized).pngpasted_image (resized).png
    #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
    #108 5 years ago
    Quoted from legtod2:

    For complex and long winded attract lamp sequences is receives a sequence replay request.

    Nice.
    How long (time wise) can a sequence be?

    #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

    #111 5 years ago
    Quoted from legtod2:

    There are other compatable and they chips are:
    CD4514BCN, MC14514B, MC14514CP, MM14514BCN, NTE4514B.

    Plus HCF4514B, HEF4514B

    I found a few years ago that the Philips HEF4514B datasheet explains operation the best.

    ***************************
    DESCRIPTION:
    The HEF4514B is a 1-of-16 decoder/demultiplexer, having four binary weighted address inputs (A0 to A3), a latch enable input (EL pin 1), and an active LOW enable input (E pin 23). The 16 outputs (O0 to O15) are mutually exclusive active HIGH. When EL is HIGH, the selected output is determined by the data on An. When EL goes LOW, the last data present at An are stored in the latches and the outputs remain stable. When E is LOW, the selected output, determined by the contents of the latch, is HIGH. At E HIGH, all outputs are LOW. The enable input (E) does not affect the state of the latch. When the HEF4514B is used as a demultiplexer, E is the data input and A0 to A3 are the address inputs.
    ***************************

    Quoted from legtod2:

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

    You have them backwards. Better do it like this with steps 3 and 4 also swapped:

    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)

    #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

    #113 5 years ago

    Essentially yes.

    You would have an array for the state of each lamp and each zero crossing would process the array and update the respective state of each SCR accordingly.

    Note on the Bally/Stern lamp board you would write to all four 4514 chips in the one go to speed up the process.
    Start from 4514 address '0000' (binary)
    Inhibit outputs on all four 4514 chips.
    Write the address to the chips.
    Strobe the address in.
    Set inhibit low ONLY on lamps that are to be lit - the addressed output on those non inhibited chips will activate high
    Repeat for the next 4514 address until you've reached address '1111' (binary)

    #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.

    #116 5 years ago
    Quoted from legtod2:

    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.

    Are you sure your power source is unfiltered?

    #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.

    #121 5 years ago
    Quoted from legtod2:

    PC power supply

    There's your problem. Your PC power-supply is outputting a smooth filtered 5V supply like the Point S "Regulated DC Waveform" below.

    However these lamp boards use of SCRs to switch lamps on, requires unfiltered full DC ripple (see Point Q "Rectified DC Waveform" below) to power the lamps. When the ripple reaches zero volts, the SCR switches off.

    Voltage_WaveformsA.jpgVoltage_WaveformsA.jpg
    #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.

    #127 5 years ago
    Quoted from legtod2:

    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.

    If they're connecting it to 43 DC why are you connecting it to 60 AC

    #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.

    #129 5 years ago
    Quoted from legtod2:

    This is the ZCD unit amazon.com link » (not what I paid for it).

    Is this unit detecting zero crossing on the downward or upward cycle?
    Will it work with a 60VAC input?
    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?

    Have you hooked up an oscilloscope to see what's going on?

    #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.

    #131 5 years ago

    Looking at the schematic of this ZCD circuit, you need to service the interrupt when its trigger level is FALLING.
    When the optocoupler switches on from voltage rising on the output of the mini bridge, it pulls the zero crossing output low.

    Schematic==0G-00005677==Mod-Dimmer-5A-1L.pdfSchematic==0G-00005677==Mod-Dimmer-5A-1L.pdf

    #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);
    }
    }

    }

    #134 5 years ago
    Quoted from legtod2:

    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...

    Thanks for sharing your test code - it should help anyone going down this path in future!

    #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.

    There are 135 posts in this topic. You are on page 3 of 3.

    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/page/3?hl=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.