Circuit for speedcontrol marklin locmotive

I'm looking for a circuit for speedcotrol with an arduino uno of my marklin train.

Is your train digitally controlled or still good old analog?

If analog, you might want to add that Marklin uses AC (I think 14V) and that direction changing is controlled using a higher voltage pulse (if I'm not mistaken).

Analog

This can easily get outside my area of knowledge. I however think that it's the easiest to convert your locomotive(s) to 3-rail DC. After that you can use the standard circuits like a L298 H-bridge. Something to read: Running DC on 3 rail track

Be aware that you no longer can use your normal Marklin control unit (transformer) after the conversion.

The L298 is a bit outdated but ready made boards are available. It can give you a stepping stone.

More knowledgeable people here might be able to advise better.

Hi, I think we need more information. Is it 3 rail Marklin or later 2 rail. Is it AC or DC to the rails.

Can you post a picture of your existing controller and what it has written on it?

Thanks.. Tom.. :) PS have you googled?

Hi, I googled marklin arduino analog controller

and got

https://www.marklin-users.net/forum/yaf_postst18814_Marklin-analog-set-control-via-Arduino.aspx

Tom... :)

It's a 3 rail ac train. I want to keep it ac.

Märklin trains have a universal motor so no need of converting it. It will run on DC or AC :) So a simple H-bridge or even simpler a single transistor will do. Because you don't need the H for controlling the direction. That's done with a 24V pulse. So just PWM 24V with a transistor and you're done. Just keep under 50% for driving (but probably even less because it will be a race car otherwise) and just make it 100% for a second to change direction. Downside is, then you have limited steps for control. Other option is is to use two supplies (12V and 24V) and just PWM with the 12V and switch to 24V for the pulse (via a relay).

Thanks for the advice. I'm gona try the dc option