00 scale turntable project

Thank You for accepting my membership. I'm very much a novice but keen to learn. What I'm trying to build is a turntable with 1 main in/out and no more than 2 extra routes at say 30 and 60 degrees from the starting position (to be recognised by a Hall sensor). Mainly it will do a 180 degree turn but occasionally, I'd like to turn to line up with the other two tracks. It seems to me that I'd need push buttons set up. Most push button arrangements seem to be local to the arduino nano but I'd like to operate them from a distance of say 4m. It's also the loop concept that I'm struggling with because this project will not involve continuous looping. For example: reset to 0 degrees (home function) turn 180 degrees, then stop looping. I could of course put in delays and manually switch off stepper power. This would be the simplest solution. Comments would be appreciated.
2021-06-12T23:00:00Z

is it software question or hardware?

Hi Joanne - welcome.

I usually approach things like this by breaking them down into smaller parts - get those parts working individually - and then bring all the working / tested parts together for "project complete" testing; and I think this approach would suit your project too.

Could you start by telling us a bit more about the turntable?

The loop function always runs; in essence the processor is always doing something - even if it's only to check that nothing more needs to be done. So in your case it would probably be busy in essence asking

  1. Are we where we're supposed to be?
  2. If "yes" then repeat from step 1
  3. If "no" then move something to fix it
  4. Repeat from step 1

From what you've said I suspect that we're going to need to;

  • Monitor Hall sensors
  • Monitor push buttons (4m distance might require some special considerations)
  • Command motor movements

It's a peco LK-55, currently driven by a geared (but non-digital) motor via a chain drive. Currently indexed by neo magnet latch operated by manual cable. It works but jams or misaligns too often. My thinking was to use a stepper motor and therefore automatically set the position, adding 2 extra positions in the process. It's about 4 meters away from where I sit at the controls. I have components on their way but not here as yet, apart from the driver module for the stepper.

Looks like a fun project.

My first thought was "you might need to account for stepper motor speed when it's close to being in position".

I don't think switches being about 4m away will be any great cause for concern so long as the cable isn't run parallel to any other cables that might induce a voltage into them (and even if they did you could probably mitigate that by using a twisted pair and/or more agressive pullup/pulldown resistors).

@joanne99, your topic has been moved to a more suitable location on the forum.

Don’t get intimidated by loop()…
It simply means that when something has completed its turn, the processor will be ready & waiting to do something else. Try to avoid delay() whenever you can.

There are a few people here with model RR experiences, but it sounds like your turntable already has most of what you need.

When wiring the switches, my preference would be switch down to 0V, not up to +12/5V…using a pull up of maybe 4K7 to pull a little bit extra current through the longer cable.

Good fun, you’ll learn a bit with this.

The misunderstanding regarding loop() is essentially that it is not beholden to any one process or decision.

It implements a series of tasks such that in effect all are performed simultaneously - this can be seen as "multi-tasking" or "timesharing". Each task is encapsulated as a "state machine" and essentially "called" one after another in a chain.

So what do each of these tasks look like? Well, each has a "state" which selects from a number of simple actions such as reading an input or the time (that is, millis()) to determine whether any further action is required. Most of the time, nothing further needs to be done in which case the task simply drops through to the next task in the list.

If there is a need for a further action based on the input, then whatever part of that action can be performed immediately, is executed and if a further action will be required depending on the consequence of this immediate one or on another criterion, the "state" is adjusted so that on successive passes through this task, the new situation will be tested and again, acted on accordingly.

So each of the tasks in turn either does nothing, or does something that takes little or no time to do and sets the state for what needs to happen on the next pass through its own part of the loop.

Your project will involve continuous looping - all Arduino projects do. However, most of the time, nothing will be done in that loop. Only when a button press is detected will you actually do anything.

I suggest using the existing motor. Get a controller and a H-bridge to control it. Use opto devices at the stopping points.
Pay respect for the inertia in the turntable! You might need a quite beafy stepper.
00 scale and a locomotive on the TT sounds heavy, noticeable inertia.

Thanks for all the advice so far folks, much appreciated. Plan now is to wait for the arrival of components (expected this week). Then to rig up bench experiments. I'm thinking I might try getting the simplest of sketches up and running first on the actual turntable (just doing a smooth and accurate 90 degree turn). I think I'll probably buy an extra arduino for experimenting on a more complex design. At such a small price it's quite prudent to have a spare!

Noted and thanks. All wires from here go secretly through the fire surround (but well away from any heat). There's track voltage, turnout voltage from CDU, LED buses but I can always route switch wires for this lower down and clear of busy areas.

No worries.

For what it's worth I've seen twisted 2 core wire available for low low low prices online - something like that in a 24 to 30AWG would probably do the trick.

Beware of going down the rabbit hole ... I started off with a spare Arduino ... and now I have 4 plastic boxed filled with unos, nanos, 3.3v, 5v, pro minis, LCD screens, single, double, quad relays, solid state relays, triacs ... and much more. The curse of Ali Express! #NoRegrets!

An interesting video for those who are not in the subject (like me).

And one possible solution DCC Controlled (PECO) Turntable Project.

1 Like

Hi, @joanne99
Welcome to the forum.

Have you googled;

arduino railway railroad turntable

Tom.. :smiley: :+1: :coffee: :australia:

Thanks, appreciated. I'll have a good look at that tomorrow.

I'm replying to myself here because I'm still not familiar with the interface. I'm now thinking in terms of 3 hall sensors. My Arduino has arrived and initially I read that the software isn't suitable for Windows 7. Persising I found a download for Windows 7 and now have a programme interface. But in the process of download,a number of drivers were offered and I agreed to them all. The Arduino when plugged into the USB now blinks 3 lights on the board in sequence but I can't see any reference to this hardware in control panel. I have a STMicroelectronics STM32 Nucleo-64 Development Board, set up years ago ( I use it for changing loco chip variables in service mode. Is the Arduino using the STM32 port?

Hi, @joanne99

What version of Arduino IDE did you download?
What model Arduino controller did you get?

Tom... :smiley: :+1: :coffee: :australia:

arduino-1.8.15-windows.exe and [Arduino Nano V3.0 Compatible Soldered Headers Mini USB ATmega328P 16MHz 5V]

Hi,
You have the latest version, does it install?
Have you plugged your Nano in?

Tom.. :smiley: :+1: :coffee: :australia: