Jump to content
IGNORED

Thomas the tank engine. TTTE.


Recommended Posts

The next fiddly job. I'm not sure how I'll go with this one as it's a max6818 in a SSOP20 package which is the smaller one.

I'm going to use these to de-bounce the switches.

I'll use a bit of code detect the rising edge of the output from the chip to trigger the playfield actions. The code will stop it from triggering multiple times while the switch is closed.46bdd4522331b861b768bc91a01468f2.jpg596f3b6e39c6bbd02397748fffb2f5bf.jpg

 

Sent from my SM-G930F using Tapatalk

Link to comment
Share on other sites

The next fiddly job. I'm not sure how I'll go with this one as it's a max6818 in a SSOP20 package which is the smaller one.

I'm going to use these to de-bounce the switches.

I'll use a bit of code detect the rising edge of the output from the chip to trigger the playfield actions. The code will stop it from triggering multiple times while the switch is closed.46bdd4522331b861b768bc91a01468f2.jpg596f3b6e39c6bbd02397748fffb2f5bf.jpg

 

Sent from my SM-G930F using Tapatalk

 

OK Trev , your figure it out, then send me a few ! :lol Interesting to see how you go with this.....hope you have a good heat gun

Link to comment
Share on other sites

OK Trev , your figure it out, then send me a few ! [emoji38] Interesting to see how you go with this.....hope you have a good heat gun

No heat gun, but I've watched Dave Jones do it with a soldering iron on EEVBlog on Youtube.😉 Or was that the larger packages.

At least the boards will be easier to hold than those LEDs.

 

Sent from my SM-G930F using Tapatalk

Link to comment
Share on other sites

Can't you get regular TTL sized chips Trev, Seem your making life difficult for yourself with all this SMD stuff.

No they don't seem to be available.☹

I call it a challenge.😉

Sent from my SM-G930F using Tapatalk

Link to comment
Share on other sites

I think I was a bit too ambitious with the Aussie Arcade pin as a first attempt, with Thomas I'll be able to iron out a lot of the bugs before I get back into AA but they'll both get done eventually.

 

Sent from my SM-G930F using Tapatalk

Link to comment
Share on other sites

Here is about the easiest way to achieve switch de-bouncing Kev. It uses just two gates from a chip with 6 gates so each chip can drive 3 switches.

 

It is actually a "pulse stretcher" and depending on the RC, (resistor/capacitor network), determines the length of the pulse length.

 

http://circuitswiring.com/circuit-diagrams/5/2009/07/schmitt-trigger-pulse-stretcher-circuit-diagram.jpg

Link to comment
Share on other sites

I like these addressable LEDs. I've used the Adafruit Neopixel library as it lets you turn any combinations of LEDs on with any colour and any brightness very easily.

This was just a very simple setup to learn how they work. I've also hooked up a couple of buttons too so I can turn on individual LEDs with the buttons (not shown). Not bad for just one signal wire and two power wires.😁

 

Sent from my SM-G930F using Tapatalk

Link to comment
Share on other sites

The basic code for using these LEDs is below.

 

Please note the "Adafruit_NeoPixel.h" should be between a less than and greater than symbol but it won't post them here.

 

#include Adafruit_NeoPixel.h

 

int Pos;

int Rd;

int Gn;

int Bl;

 

// Parameter 1 = number of pixels in strip

// Parameter 2 = pin number (most are valid)

// Parameter 3 = pixel type flags, add together as needed:

// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)

// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)

// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)

// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)

 

// This is set to 6 LEDs on pin 8

 

Adafruit_NeoPixel strip = Adafruit_NeoPixel(6, 8, NEO_GRB + NEO_KHZ800);

 

void setup() {

 

// Turn on NeoPixel library

strip.begin();

 

// Initialize all pixels to 'off'

strip.show();

 

}

 

void loop() {

 

// Set led position to change

 

Pos = 4; // Changes the 5th led in the string. The first, being the closest to the Arduino, is zero

 

// Set Red (Rd) Green (Gn) and Blue (Bl) values: 0 for off up to 255 full brightness.

 

// This is bright purple

 

Rd = 200;

Gn = 0;

Bl = 200;

 

// This line loads the values

strip.setPixelColor(Pos, Rd, Gn, Bl);

 

// And this updates the string of LEDs

strip.show();

 

// To turn an LED off just set all three colours to zero

 

}

 

// Cheers Trev

 

 

 

 

Sent from my SM-G930F using Tapatalk

Link to comment
Share on other sites

I spent a couple of hours yesterday scratching my head trying to figure out why my code wouldn't work properly only to realise I'd typed in Flag1 = 0 where it should have been Flag1 == 0 as it was in an IF statement.

 

I sometimes wonder if it would have been easier learning c++ if I didn't know BASIC.

 

Anyway I've now got all the target and rollover switch inputs working and their associated lamps lighting and scores recording. There are 10 switch inputs

One each for

 

T target triggers the T lamp

H target triggers the H lamp

O target triggers the O lamp

M target triggers the M lamp

A target triggers the A lamp

S target triggers the S lamp

THE rollover triggers the T, H, E lamps in order

TANK rollover triggers the T, A, N, K lamps in order

EGI inlane rollover (left side of playfield) triggers the E, G, I lamps of "ENGINE"

NNE inlane rollover (right side of play field) triggers the N, N, E lamps of "ENGINE"

See pic for layout details.

 

As each word is completed a bonus light will be lit and if all words are lit spelling "THOMAS THE TANK ENGINE" the bonus is added to the score and all the lamps are reset. The bonus will be added again when the ball drains.

I hope this makes sense.

 

Next on the list is the bonus scoring routine. I don't have the LED displays yet so I'm using the terminal software in the Arduino ide to show the score temporarily.

This has taken about 2 full days so far.

Cheers Trev

11d74df6bf835bb779aa1de56462b1a2.jpg

 

Sent from my SM-G930F using Tapatalk

Link to comment
Share on other sites

I spent a couple of hours yesterday scratching my head trying to figure out why my code wouldn't work properly only to realise I'd typed in Flag1 = 0 where it should have been Flag1 == 0 as it was in an IF statement.

 

That seems to be my most common problem too.... knowing stacks of programming languages I'm always mixing up my syntax.... The worst is when you're typing up code in an editor that doesn't support syntax highlighting, as I can read over incorrect lines multiple times but always read them as correct because I'm thinking of the wrong language...

Link to comment
Share on other sites

Today was consumed with tracing the wiring on the playfield and writing down pin numbers, wire colours and where they all go for the switches, solenoids and relays.

I also decided on a route for the addressable LEDs on the playfield and backbox so I know what position in the string each light is and what it does.

I then modified my test code, based on an Arduino Leonardo micro, to work on the Mega I'll be using. This meant changing pin numbers for certain functions and adding a lot more.

I managed to write code to fire the Pop bumpers and slingshots, add a very simple attract mode (it currently just flashes and LED but I can improve on that later) that senses the start button and starts a game .

I now have code to increment the ball numbers, handle the outhole sensing and firing of the solenoid and detect when the game is over as well as calculating and adding the bonus to the score.

I need to add more bits but I'm happy with the progress so far. I think I'll finish wiring the playfield power soon and give it a test.

I also gutted the Thomas and Percy (torches) toppers ready for modification. They're only going to have lights in the front so I removed the sound boards (unfortunately they didn't say anything I could use), speakers and switches and I'll just wire the leds to a pin on the Arduino.

Cheers Trev

 

Sent from my SM-G930F using Tapatalk

Link to comment
Share on other sites

@stuzza does it again. How's this for a topper.

It'll be mounted on a sheet of thick polycarbonate that extends down the back and screws to the back of the backbox.

The chimney will be painted black and the cabinet a medium/light blue with signal red rails and lockdown bar. I'm not sure what colour the coin door will be yet.

Cheers Trev 939bac60eab18172698a1ae3ddd95bf1.jpg86251e2dd7967346e07e6cdbdcc7ac22.jpg

 

Sent from my SM-G930F using Tapatalk

Link to comment
Share on other sites

I spent a bit of time yesterday working on more code, I added the bonus scoring routine into the main code, more target scoring code and a couple of lines to turn the flippers off during the attract mode. I also wired up more LEDs as I need 41 in total. Plus two separate LEDs for the topper lights. Some of the wiring on the addressable LEDs was badly crimped and was stopping the data signal from going down the line, so they were all checked and the dud ones replaced with good. I think I'm now ready to try it with the playfield, maybe Sunday. It won't have a debounce circuit fitted but at least I can see if it all works as planned.

Cheers Trev 71f2d399c75879ec63704bc55bfc0dc2.jpg

 

Sent from my SM-G930F using Tapatalk

Link to comment
Share on other sites

Fiddly job… But it looks like you did that very cleanly!

 

How did you solder the pins onto the PCB? Do you have a photo that shows one from underneath?

 

Last time I tried to solder one of those three-pin connectors, the plastic started to melt almost immediately, so the pins came loose and out of alignment. I eventually managed, but it was messy and fiddly.

 

Michi.

 

Mabie using a silver track repair pen to fix the contacts to a pcb rather than soldering directly as an alternative.

Edited by ozfalcon
Link to comment
Share on other sites

The next fiddly job. I'm not sure how I'll go with this one as it's a max6818 in a SSOP20 package which is the smaller one.

I'm going to use these to de-bounce the switches.

I'll use a bit of code detect the rising edge of the output from the chip to trigger the playfield actions. The code will stop it from triggering multiple times while the switch is closed.46bdd4522331b861b768bc91a01468f2.jpg596f3b6e39c6bbd02397748fffb2f5bf.jpg

 

Sent from my SM-G930F using Tapatalk

 

 

Just made a note for myself - When debouncing many inputs - Use a max6818 - Especially for the ESD protection.

I might look at updating my own circuit with the max6817 dual channel version of this chip if I have any ESD issues.

 

Regarding the code to detect the rising edge,

Wouldn't code that just looks for change of state to trigger an event be easier than detecting rising edge?

ie. The max6818 should remove those multiple rising edge triggers (bouce) while the switch is closing/closed [and at opening too!].

(Or whichever debounce method you choose to use).

 

UPDATE: Looks like you got code working in a subsequent post - Are you using debounce circuit yet?

Edited by ozfalcon
Link to comment
Share on other sites

This thread name has been changed to a more relevant one and the programming discussion has been moved to a new thread , Thanks @Arcade King, to keep this thread about the pinball details.

Thanks for the input guys.

Cheers Trev

 

Sent from my SM-G930F using Tapatalk

Link to comment
Share on other sites

The reason behind this pinball machine.[emoji4]

 

Ah, I see. Because your son is ready to play pinball…

 

Just as my son was ready to play Lego when he was about 24 months old. I just had to go out and buy a whole bunch of bricks because I didn't want my son to grow up neglected, did I… ;)

 

Michi.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...