<< Prev Next >>
No progress this week due to grass cutting, power steering fluid leak in the van and trying to get the Trans Am to run (new battery).
About all Iíve managed is to work on the lamp controller schematic in ExpressSCH. Just about done. Ready to wire up the switch matrix breadboard Ė just need some time and energy!
Announced the project on RGP as part of a big thread on building a game.
The switch connector board. Two Gottlieb connectors going to one to the breadboard.
The one Gottlieb connector is actually one I stole from some Williams parts. The original had
been severed off of the game.
Whew, what a week. Had holidays so Iíve been concentrating on this project mostly. Wild ups and downs. On Tuesday (my birthday) had horrible problems and was up until 12:30AM trying to work through them. Very depressing. Wednesday was pretty good but then Thursday night something went wrong suddenly at 10pm. That was really stressful and again I was up until 12:30am trying to figure out what was wrong.
Finally today (Friday) main problems eliminated and things are ok.
Last weekend through Monday finished wiring up the switch matrix breadboard.
On Tuesday, I was wiring and soldering up my connector board Ė same idea as for the lamp matrix. I used a different proto-board type that was a little friendlier for the .156 inch connectors. I also sawed a part off once done to keep the size down.
Note for future reference: drill the holes for mounting screws and do the sawing BEFORE doing all of the soldering!
It went pretty fast until I hooked it up. Then I came to the grim realization that I had made several mistakes. This was at 3pm. Wasnít until about 9pm that I had corrected those mistakes. So depressing. First, I had the rows and columns backwards. So I had to unsolder and re-solder the A1J7 connectors. I had incorrectly documented the diode orientation with respect to the connector wires. That was why the rows and columns were backwards.
The other goof was I managed to mess up documenting the wires used. I thought the wires on A1J7 used were 12-15 and 17. But in fact it was 13-17. Díoh!!! I even did continuity tests before to confirm. It is hard to keep straight the individual pins in the connectors.
Just to add to the confusion, the special switches on the coin door, were laid out correctly, and the one diode I added for the outhole switch was correct also. So I had a hard time keeping straight my row-column transformations, but in the end I got it all correct. I re-did the document, which was heavily used in testing.
Once re-wired, I did continuity tests with a 6V battery and #44 light in series. That way I knew I had it all wired correctly to the connectors.
But when hooked up to the game and debugging through the PC, the switch reads were sometimes right but often wrong, and inconsistent also. I was also worried than i/o pin P8 of the BS2p24 was no good, since it appeared to be physically missing from the end of the board!!
Finally at 12:30am I realized that on the breadboard I had neglected to hook up the 12V signal to the circuit! I went to bad satisfied that I was on the right track.
In the morning I added the 12V to the circuit and it all worked magically. Then wrote more switch controller code and master controller code and some PC code also. Testing advanced well and the two BS2p boards talked to each other at 9600 fine.
Then came Thursday night. Wrote more PC code, updating what was there for the switch matrix, etc. Around 10pm things were almost working Ė on the PC side I could see the correct commands coming in from the master.
There was a synch problem however, and I needed to make sure that the master did not send switch commands to the PC until the PC had issued a reset to it. This only took a couple of lines of code but then WHAM! Everything went bad.
Suddenly the PC was seeing a continuous stream of garbage bytes coming in no matter what I did. Nothing valid at all. It smelled like a hardware problem.
I first swapped out the MAX232 line driver chip with another. This seemed to help and the continuous stream of garbage stopped abruptly. But there didnít appear to be any PC to master communication going on at all.
Did more checking then finally at 12:30am while measuring voltages, I thought the reading of 1.29V on i/o pin 1 (TX) looked wrong. So I went to bed satisfied that I was on the right track (replay of Tuesday).
Today while lying bed it occurred to me that I may have wrecked the BS2p i/o pin by drawing too much current. In parallel, I had a status LED hung off there. So during transmits, the LED would blink and indicate activity, without requiring any CPU resources.
But the LED current, plus the current to the MAX232 may have exceeded the 20-25ma limit per pin.
So I switched to i/o pin 5 from 1. I was able to send data correctly to the PC but still couldnít receive any. Did several tests to confirm that. Then while checking voltages again, I realized that MAX232 pin 8 did not have continuity to the serial port header, even though it looked fine.
Pulled the chip and sure enough, I had bent pin 8 under when inserting the IC the night before! Straightened the pin out and re-inserted. Note that I got rid of the status LED.
All worked well after that!
So Iíve been writing PC controller code and will continue with that. As it stands now, I can push the start button and begin a game. All switch closures are registered fine and shown on the display. Lamps work and I stop when the ball goes into the outhole. I feel really good/relieved now. Too much work for my week of holidays!
The finished switch matrix controller powered by the BS2p24.
So Friday I had to get up early to get the kids to school. I was kind of tired all day but worked on the code. Mostly Java code. Things were ok. Started adding rules for the game. Was able to play a game with some scoring. On Saturday morning I was to finish the rules and have a relaxing afternoon.
Instead had more grief, but it was self-inflicted and mostly software-related. I couldnít believe that I wasted over an hour to track down a dumb bug whereby the bonus multiplier wouldnít increase. Sheesh, thatís the stuff I get paid for and I should have fixed that in 5 minutes or less. Not very sharp.
Then it became obvious that the way I was notifying the PC of switch closures was flawed. As it stood, a switch closure for an individual switch was only recognized on the PC once every 3 seconds or so. Could be less if a different switch in the same byte was updated.
Anyway, I had to alter the BS2 switch controller code, and also update the master controller and PC code. I changed the logic for sending state data so that only the switch closures detected where set to binary 1 (rather than sending the current state of all switches in the byte). So now, when the PC receives the data, it simply generates a switch event if the corresponding bit is a 1.
This applies to sending a single matrix byte or the whole matrix. But I still also send the complete matrix state every 3 seconds or so just so things stay in synch.
After those changes, things worked great. Fortunately I had no errors. Switch response time as seen on the PC is fast now. I can poke a switch rapidly and all closures (or most anyway) are detected nicely.
So as of Saturday I was able to play the game with the real Solar Ride rules. Of course no coils yet so itís kind of boring. But this is a major milestone so Iím happy.
Also tweaked the master controller code to wait 12ms for the commands from the switch controller, then wait up to 8ms for commands from the PC (for lamp commands and later coil commands). This in effect gives the switch controller a little high priority. I could perhaps reduce these times further (perhaps 6ms/4ms) to further improve responsiveness.
I should also try increasing baud rate to the PC to 9600 and see what happens. The BS2 in debug mode seems to run at 9600 ok.
The one great software need I see now on the PC is for a display manager. Instead of any code writing to the display are directly, there should be a priority queue that the display manager reads from. It should have itís own thread also.
It needs to handle events, and the events need to include:
- A priority.
- An "interruptible" attribute.
- Min/max display times.
So if I want to display something important, I can guarantee that it wonít be wiped out by something unimportant.
It also would allow for more advanced display techniques and simple special effects. I need simpler ways to have different fonts shown, and to be able to control rows and columns of text (need CRLF support).
Testing the switch matrix with the lamp controller and master controller also.
Taking a break to sell stuff on ebay. Bought some components for the relay controller today, and yet another breadboard. Each relay will be controlled by a 2N4403 PNP and TIP102 NPN transistor pair. This is the same duo that Williams and others used for their relay controllers.
Also investigated N-channel MOSFETs, which Williams and Sega have used more recently. The MOSFETs donít require a pre-driver transistor like the 2N4403 so less parts means less board space, etc.
However, I was unable to buy the 20N10L MOSFETs that they use. Couldnít find NTE2987 either. I may order some equivalent ones from GPE since his are cheap. But for now I can use the 2N4403/TIP102 pair.
Drew the basic schematic in ExpressSCH for a single relay. I can test this out soon. Learned something about PNP transistors yesterday. Somehow managed to miss the fact that the emitter-base flow is different for PNP from NPN. Clears up some of my conceptual problems.
I should be able to nicely use one of the spare Picaxeís I have laying around for this.
Ordered some MOSFETs from GPE so if I want to go that route Iíll have some in hand. Also ordered more TIP107/TIP102s/2N4403ís plus the Gottlieb .156 card edge connector pins.
Spent time on Saturday and investigated the Solar Ride coil wiring. Havenít got it 100% mapped out but again the Buck Rogers schematic saved the day. The Solar Ride schematic had a typo in the connector wires to the Q and T relays. They had them listed as non-existent A3J4 wires when in fact they are on A3J5. Buck Rogers corrected that.
The connector for the optional chimes and the knocker are self-contained in a Molex .093 6 pin connector block. If I want to add chimes or knocker I just need to build the other half of the connector. Will skip the chimes but plan for a knocker.
The A3J4 connector contains most of the wires for the other coils. Unfortunately the Q and T wires on A3J5 are a pain, as A3J5 is mostly dedicated to lamp connectors, and that block is plugged into my lamp connector board.
I think I will cut those 2 wires in A3J5 and try and insert into empty slots in A3J4 (once I got the connector pins from GPE).
The only wire mapping questions remaining are what connectors and wires are used to drive the chimes and knocker. According to the block schematic they should go to A2J1 (power supply) and A3J2 (driver board). Donít see these wires listed on the system 1 schematics so I will need to manually determine which ones. Both A2J1 and A3J2 are unconnected currently.
With those wires mapped I will then actually test powering the coils to ensure all is ok. Still need to solder the wires for the bank reset coil. With that task done I can then build the relay controller board and wire up the relay connector board.
Checked into opto-isolators like the 4N35. These would be good for isolating the Picaxe i/o pins from a transistor failure.
Finished determining the coil wiring last night. Basically I had the same diagrams in 3 places: from the Solar Ride manual, from the Buck Rogers manual and from the generic System 1 manual. Turns out they donít align 100%, reflecting changes along the way I guess (possibly just doc changes Ė not necessarily changes to the actual platform).
Since the Buck Rogers diagram had corrected the wrong wiring for the Q and T relays, I took it to be the authoritative source of information. Unfortunately it wasnít as useful for tracking down the driver connections.
Eventually went back to the Solar Ride diagram and found the info I needed for the A3J2 connectors. Also figured out that the chimes would attach to A6P2 indirectly via connector A7 (which I donít have).
With all wires accounted for I then went a did a manual coil firing test. Just hooked up clips to the positive and negative terminals of the 25V bridge rectifier. Fired the 3 kickout holes and the bank reset successfully. Also had to solder the bank reset coil wires on first. Used larger de-soldering braid to clean the terminals first and it worked very well.
I will test the Q and T relays once I move the wires to the new connector.
So it all looks pretty straightforward Ė I know the positive and negative connectors for the coils. I will be interfacing to the negative side of the circuit, and those connections will be connected to the collectors of the TIP102s and switched to ground.
Also wired up cable and hooked up my old 14 inch color TV in the workshop! I used an ABC switcher and tapped in to a connected joint running through the workshop area.
Put the TV on the new shelf I installed last weekend. Everything is cleaned up nicely and the oscilloscope can sit nicely on a shelf now.
Started putting the relay controller breadboard together last night. Put on the standard 5V regulator circuit, plus the serial port header and Picaxe chip. Hooked up the serial to Picaxe connections. Using the newer Picaxe download circuit, which adds a 180 ohm resistor to pin 2, and a Schottky diode to pin 3.
I am starting with one of my dead Picaxes, in the hopes that it will come to life with the newer circuit set up.
Powered the regulator up and got 5.01V so it looks good.
Tonite I will add a reset button to the Picaxe and hook up an LED for testing. Also need a 5V on/off switch so the Picaxe has no excuses. Hoping I can program it to flash an LED. If not, I will switch to a new virgin Picaxe. That should work and weíll see how the new serial circuit works.
If I can program any Picaxe, then I will next build the circuitry for a single relay. For now I will just put the TIP102 on the breadboard. I can then test switching a load on and off. Hopefully will be able to try directly switching a Solar Ride coil.
Once that works then I can build out the circuitry for 8 relays, and put the TIP102s and connectors on a perfboard for soldering. This board should be pretty easy to set up, as I will only have two 7 or 8 pin Gottlieb connectors plus an 8 pin connector from my breadboard. I will put the TIP102s on there also and use heavier wiring (e.g. 16/18 gauge instead of 22). All other low-powered components can stay on the breadboard.
I think I will need a ground connection from the relay board to the connector board, and from the connector board to the TIP102 emitters, and from the TIP102 emitters to the Solar Ride ground. So we might have single awkward ground wires dangling about. Maybe A3J4 has a ground wire already on it?
On Wed. I finished wiring the Picaxe connections and added a single relay test circuit. First just used a power resistor as load and measured the current to verify that it worked ok. BTW I first tried the 2 Picaxes I had killed before. No luck. Tried a new one and it worked fine.
I then did a quick and dirty hook up to Solar Ride to test out the kickout holes, out hole and bank reset. It worked right away and it was magical. The 100ms pulse seemed ok for the kickouts. For the out hole the ball kicked nicely into the plunger lane every time.
Then came the bank reset. It reset one drop target fine but didnít have enough power to reset the bank. Not totally surprised or worried, since my connections were via flimsy wire and alligator clip connections, so there could be some resistance.
I increased the pulse to 150ms but it didnít help. I tried 200ms but fried the Picaxe during program download! $^%^!!!! Every previous successful download I made sure I didnít have the connection Solar Ride. The last time, I left it powered on and connected. I held the reset button in as I started the download, so the new program would download before the existing program started firing the coil.
But I was too slow or whatever and the coil fired at the moment of download. Shit! Down to 1 Picaxe. Ironically when I looked over the bank was reset at least.
Last night I did some measurements on the relay circuit to see if the currents flowing were as expected. They were. 920uA through the base of the 2N4403 with the 4.7K resistor. With a 4.7K resistor between the 2N4403 emitter and the TIP102 base, the current was 692uA.
That didnít sound enough for the TIP102. Even with a gain of 1000, that translates to only 692ma Ė far less than a big coil would need. So I tested a 1K resistor then 470 finally. Currents were 3.06ma then 5.77ma. With a gain of 1000, that allows 5.77 amps through the TIP102 collector to emitter, and that should be fine.
Also measured the voltage from 2N4403 collector to TIP102 base as 3.6V. Drop across 2N4403 was about 300mv. Drop across 1N4004 diode was around .6V. 2.7V dropped across resistor then.
So I think having the 470 versus 4.7K should allow bank reset to work good.
Fearing another Picaxe accident, I ordered more from Peter Anderson today. Two more 18Aís plus and 18X and also a BasicX BX24.
Those are supposed to over 5 times faster than BS2p24, use a more advanced (compiled) Basic, allow a single 32K program (as opposed to eight 2K programs) and have 400 bytes of RAM as opposed to 26 + 128 or whatever it is.
Weíll see how it works. Iím thinking if I wanted the entire game controlled by micros (no PC or serial port), then the BX24 might have enough resources.
Built out the relay breadboard last night for 7 relays. I will include support for the 4 main coils plus the 2 relays (Q and T) and the knocker. Just need to run wires over to an 8 pin connector, and put on the new Picaxe. Then I need to build my connector board.
The connector board will have two .156 inch connectors for A3J2 and A3J4, plus a single 8 pin .100 inch connector from the breadboard. The connector board will also contain the TIP102 transistors so I can use heavier wire for collectors and emitters.
The board will also connect the breadboard ground to Solar Ride ground.
Didnít do a lot on the weekend except to construct the relay connector board as described above. This was a very simple board to make and wire up, although I fretted a lot about the wire hook ups due to the high currents involved. They really should have fatter copper traces on the board and I should be using 16-18 gauge wire. But in the end I opted for simplicity and stuck with standard wiring and 22-gauge wire. Things may burn up, especially if I have a software failure and leave a coil on. But my feeling is that the 100ms pulses and currents of 1-2 amps will not overly stress the connections in the short term. No way would this be good long term!
I tried to tie the ground strips together well, and also connected to both of the two ground wires present on the A3J4 connector. So with grounds tied to Solar Ride and the breadboard, there should be no ground loops.
I did not finish making the 8-pin connector wire to join the breadboard to connector board, but I at least cut and tinned the 8 wires for that. I will crimp those connectors tonight hopefully.
Next then is to create the Picaxe software. This should be pretty straightforward, as I can use the lamp controller code as a starting point. Then I can start testing. Hopefully I will have enough code space to add a small test feature, e.g. fire coils in order a couple of seconds apart. Perhaps I can control this by an input DIP switch for now. That way I can ensure all works well without requiring a hook up to the master micro controller.
Throughout all of this I must pray that I donít fry my last Picaxe. Peter Anderson is mailing more to me today.
Still need to move the Q and T relay wires over from A3J5 to A3J4. But I donít really need those too badly, and besides, I need to wait for the terminal pins to arrive from GPE to do this. I wonder what the steady state current of those two relays is, and would I need to heat-sink the associated TIP102s? I guess I should do a test and measure the current.
Had some success yesterday, but it was a battle. Wrote the Picaxe code for the relay controller. Very simple except I decided to complicate it by adding some test modes. I decided this was probably a worthwhile feature.
So I have both a local and remote test mode. Remote test mode will be activated when a set mode test command is received over the serial connection. Local test mode is activated by flicking a dipswitch attached to input 0.
In test mode the coils are pulsed in order for 100ms, with a 2 second gap between them. A remote set mode normal command resumes normal operation, as does flicking the dipswitch off.
Local test mode is great for standalone testing (like I did initially) and remote test mode is good when hooked up to the game and the board is inaccessible.
Had to make my 8-pin connector first and wire in the dipswitch before hooking everything up.
It didnít start out very well though. As soon as the Picaxe powered up the bank reset coil locked on. Not sure if the others came on although I suspect they did too. After powering down and checking the TIP102s, the one for bank reset was very hot. Did a couple of other quick power-ons and same problem. Took everything apart and checked for shorts or incorrect wiring.
Tried it again and same result. Disconnected the breadboard connection for the bank reset circuit and it still locked on (no others on). That was a bad sign. Did a resistance check on the TIP102 and it looks like it was fried Ė low resistance from collector to emitter.
Then I figured out that the coils go on when the Picaxe output pins are LOW. Whoops. Forgot that fact in the code. I was carefully setting all pins low to be "failsafe", when in fact I was cranking them all on!
Reversed the high/low logic in the code.
But then I had to replace the transistor. Spent about an hour doing that. I had troubling unsoldering the transistor leads cleanly Ė lack of experience I guess. And I pulled up one copper trace on the perf board, so I had to move the transistor. Managed to salvage other wires and connections, so in the end it worked out.
The TIP102 that died was one I bought at Active. The others were Fairchildís from GPE. So Iím not sure if this TIP102 died because it was cheaply made. Or perhaps because it was the first I soldered to the board, perhaps I overheated it then. I wouldnít think that being on for 10 seconds or so would kill it that fast but who knows.
Anyway, got it back together, powered up, put the dipswitch in test mode, and it worked! The outhole wasnít firing at first. I think it was my connector to the connector board, based on continuity checks. Next time powered up that worked too.
So the 4 main coils fired in order every 2 seconds and seemed fine. Bank reset worked fine. Great stuff!
Now I have to interface to the master micro controller and the PC and handle real commands. Should be straightforward but who knows.
If that works ok then I can incorporate coil firing into the business logic of the game and play pinball!
One flaw with having the outputs firing the coils when low is that on Picaxe power up or reset, the pins will be initialized low, hence the coils will start to energize. The first instruction in the program sets all pins high (coils off), but this is not nice.
What I should have done is insert a 74HCT240 chip between the Picaxe and the 2N4403s to invert the values. Oh well, the initial surge is short lived.
I will also be adding the coil commands to the game console so you fire them at will or set test mode. Of course, I can do a smarter more dynamic test mode via command scripts. So I can fire coils in any sequence for any period via script.
Had another long evening last night, working to past 11pm. Starting to get sick again too. Did the hookup up of the relay controller board to the rest of the system. Had to make a 3 pin connector for reset, interrupt and data lines from the master BS2 to the Picaxe. Fortunately I found a good connector from the old Fisher VCR.
The good news is I didnít destroy anything. The bad news is that the Picaxe doesnít seem to be recognizing interrupts from the master. I actually plugged in the power connector backwards on the relay board. Within seconds I could smell something burning so I quickly powered off.
It was the 7805 burning up but I saved it in time. Fortunately too I had the 5V switch off so the Picaxe would have seen none of this. First time Iíve done that!
Fixed minor bugs in PC code and Picaxe code. Wrote most of the code for PC and Picaxe before last night, and updated the master BS2 code before testing.
Iím at a loss as to why the interrupts arenít working. Will do lots of testing tonite. Simplified the Picaxe code a bit today and added some debug variables, which will hopefully help solve the problem.
Kind of disappointing, as I was hoping to be able to play a real game last night.
Got some parts in the mail from GPE this morning. More TIP102s and TIP107s, plus MOSFETs that could be used in place of the TIP102s on the relay board. Also got the Gottlieb crimp connector pins, so I can re-locate the Q and T relay lines from A3J5 to A3J4.
Another disastrous night. Nothing accomplished at all. I canít believe that the interrupt line doesnít work properly. Such a simple thing that worked 100% for the lamp controller.
Worked on this until about 11:30pm. Did several tests. Canít see a pattern as to what is wrong. Extremely frustrating.
Here are the facts as I see them. If I put +5V on the Picaxe interrupt line directly, it will do the interrupt. So that leads me to believe the input pin is ok and the Picaxe software is ok. That leaves the wiring from the BS2 and the BS2 i/o pin and software to look at.
I measured the voltage on the BS2 interrupt pin at 4.72V. I presume it is less than 5 due to a diode. I measured the voltage on the Picaxe pin at 4.72V. For this test I had to set the pin high in the BS2 code and leave it on. I think in this state interrupts occurred.
But with a short pulse on the pin, interrupts only seemed to occur maybe once every 20 or more pulses. BTW the PULSE2MS constant in the BS2 code is wrong I think. I had it at 1695 units. But each unit on BS2P is .75usec, so that would only be 1.27ms. Still, that worked for the lamp controller. Changed the value to 2667 (2.0ms) and also tried 5000 and 10000 with no improvements.
Measure zero resistance on the connector line. Tried jumpering a solid core wire directly from the BS2 board to the Picaxe board. This didnít help. Why not???
The other puzzlement is why when the interrupt finally did trigger did the interrupt code seemingly get hung on the serin? The BS2 would send data every 3 seconds, which should have satisfied the request.
I did confirm that the interrupt routine was triggered. At some points I set a var as the first line of code in the routine and did a debug right after it, and I saw the var value.
Also tried the oscilloscope on the interrupt line. Because I was only pulsing it every 3 seconds, it was hard to get a good reading. But I did see the thing blip every 3 seconds so some sort of signal is going there. Although curiously the line would drop down on the graticule, not go up. Hmmm.
Tonite I will try a simple test program on the Picaxe, to see if I can just read the input pin values correctly as 0 or 1. If that doesnít work then that is the problem and we go from there. If it does work then I donít know what the hell is going on.
Other options would be to try different input pins on the Picaxe, different output pins on the BS2P and then the final solution: replace the Picaxe with my spare BS2.
<< Prev Next >>
Last updated: September 26, 2008