I need advice with main train connection

With arduino 5v pin I need to drive 12v train motor.
I make Circuit with http://www.falstad.com/circuit/circuitjs.html aplet

Can be opened File->Import from text

$ 1 0.000005 10.20027730826997 50 5 43
w 608 240 848 240 0
w 528 336 528 272 0
w 496 336 496 144 0
w 816 144 816 352 0
w 608 304 720 304 0
w 784 272 784 352 0
t 736 336 736 304 0 1 0.665612194922671 0.728576975519622 100
t 592 336 592 304 1 1 -11.850388028850372 3.3775083217313337e-8 100
t 512 368 512 336 0 -1 -0.5602090215676974 -0.7098209589422417 100
r 576 400 576 448 0 10000
r 736 368 736 416 0 220
w 800 400 800 384 1
r 640 368 640 416 0 220
w 576 384 512 384 0
w 608 448 576 448 0
w 640 496 640 448 0
w 912 496 640 496 0
w 912 448 912 496 0
w 864 480 736 480 0
w 704 272 528 272 0
w 576 304 576 144 0
w 672 144 752 144 3
w 896 400 880 400 0
w 896 336 896 400 3
w 752 144 816 144 0
w 928 384 928 400 0
w 848 384 928 384 0
w 848 384 848 400 0
w 848 336 848 384 0
S 912 448 912 400 0 1 false 1 2
S 864 448 864 400 0 1 false 1 2
181 672 144 640 144 0 2821.4729396020657 1 12 0.004 0.004
w 640 144 576 144 3
w 608 240 608 208 0
v 848 336 896 336 0 0 40 5 0 0 0.5
w 608 240 608 304 0
w 752 144 752 304 0
w 704 272 704 208 0
w 736 368 736 336 1
d 608 448 640 448 1 0.805904783
d 800 448 736 448 1 0.805904783
d 640 448 640 416 1 0.805904783
d 736 448 736 416 1 0.805904783
w 848 336 848 240 0
v 608 208 704 208 0 0 40 12 0 0 0.5
w 496 144 576 144 0
r 800 400 800 448 0 10000
t 800 384 800 352 1 -1 11.236102820219505 -0.700932399183543 100
w 592 368 640 368 0
w 736 448 736 480 0
w 864 448 864 480 0
w 704 272 784 272 0
w 592 336 592 368 1
w 576 384 576 400 0
w 512 368 512 384 1

It`s corect?Maybe posible better?

train.jpg

No idea what you want with that blob of numbers.

fd4ac0e2ea40cae091a1ecb95d72bc710626dda0.jpg

The circuit looks vaguely like an H-bridge. I don’t think you will be able to properly switch off the PNP transistors as your base will remain at +5V. As you’re designing using BJT type you’re going to lose quite some voltage in the transistors, and get a lot of heat.

You can though simplify it big time by using a ready made H-bridge. Get a modern MOSFET based one such as the tb6612fng, instead of the old BJT designs such as the L293. The IC costs more but the breakout is the same as you don’t need the massive heat sink and so. Do check the stall current of your motor and make sure the H-bridge can handle it.

Oh, another thing: the transistors on both side will switch each other on (through the two resistors and diodes) resulting in a short. Two parallel shorts even. I don't think you want this to happen here.

I newbie,and need to swith on12v train motor in both direction with two arduino pin ,which gives alternately +5 and ground.

In what way?

See #1.

Use a ready made H-bridge. Though they tend to take a bit more than two pins.

For the fun of it I once designed an H-bridge circuit that works with just a single pin (for left, right, stop, and speed control). Still have to build it completely, but the parts worked as expected. Using a bunch of BJT transistors to control the power MOSFETs.