Jump to content
 

DCC Controlled (PECO) Turntable Project using a Arduino Uno


Recommended Posts

Hi Brian,

 

not sure why you can’t use a screw drive like this.

 

https://uk-m.banggood.com/400mm-Stroke-Actuator-CNC-Linear-Motion-Lead-Screw-Slide-Stage-with-42-Stepper-Motor-p-1162135.html?gmcCountry=GB&currency=GBP&cur_warehouse=CN&createTmp=1&ID=224&utm_source=googleshopping&utm_medium=cpc_bgcs&utm_content=garman&utm_campaign=ssc-gbg-summersale-all&utm_design=152&ad_id=358675083520&gclid=EAIaIQobChMIxZ_3qcbU4wIVVeDtCh1-vgq5EAQYAyABEgIjUfD_BwE

 

it might be bigger than you need, but I’m sure other models are available.

 

two of these under your traverser, driven by separate motor drivers, but kept in sync would do the trick, I think.  I can post the sketch on here when I log on on the computer - I can’t do it from my iPad.

 

i think you’d find it much easier than using toothed belts, particularly as the weight that you will be moving (hence the inertia) is significant.

 

hth

Simon

 

Ps - more here.  The overall length appears to be about 150mm more than the useful travel.

 

https://www.ebay.co.uk/itm/Lead-Screw-CNC-Linear-Slide-Stroke-200mm-500mm-Long-42-Actuator-Stepper-Motor/162559820666?hash=item25d952037a&var&_trkparms=ispr%3D1&enc=AQAEAAADEKvsXIZtBqdkfsZsMtzFbFsbX3WcW5fmB%2Fx7ZbaZTyexLsHItljxQSGtwxg1ydzQ%2BbuR54dOsVYG1JgDrCVdvVFutrEQuCMCQUgVXe3FTpBWn8PXPbQXHLbJdUmM1uNeGfu%2BjHK5UAWQIJAq%2FkvidBcxEMv8UtBCxoOHcAduW550HJqAGT7Q2xAVqSqUfUfq5JrCJ%2FJz8od83sH%2Bw7rOrYyxfnvgFU2hPD7Bf5WY6s9JBS1w0GbzBfCCuD2XfNngpJX2XzU1tfB2mUav4zKKtOoAmMAwXWlsNpSJ%2BAzxVXzl2TdSQh2Cidzc1nB6F%2FF7J5fpg%2BiuT9HKk91ys0hT%2BCJIANxd0QlvnCQJ%2FowNj6Kbksh2M6kzpVv4XS6pGDGwhWSW4rGW0e7W9sfKy3acvO%2Fuc82ZOGw91%2FB%2BBo%2BDtWcBqVfPIZQ%2BxmLZXgE%2BW%2Fy%2Bh88ccmczXr8Qeg6hMwlaRiZsDVt4Qes5nFrp5MIha1bdg5L8n5eFb2B3QbWj6mpMtMuXasFAyQLdzK757sTyAiDHfIEdl%2FpSvaWS%2FzToeMx0hvit2PViepczXL9awBoonrTYw8PbTTFuPqfxTw50K1k5LJyn3x%2FQ6JQw3MNzKb1hV6MSNKilHfKwpGc9fLBx3H2Dc1m1eNBs%2B0LcmgcBrPL39R1KQxpLS7T%2BDaRmTRgwj62hhyGuPGdXNDQpD0cOdnzYTkAMlBCyEdYR10ZJTV3Sid2BI%2Ft4jzqX%2FDjDU%2Bojg7sDLl64K4OZxi8E%2F66n%2FHuCJqn1678kqGz2IyQgte39Ru9RYsRZfYfa%2BF88gqMKWBUOv2B2Hf3BW6s93LbS28EssHTvkB%2Fp51taRgmcFujaTgccfFyD2n822J9iOTOqvPsu0aTr4w79Ix7RCKZacs3Uj42Gok9GJcKWZ740utgmCmj8l%2Boj7IOJiDNXSvW7h5%2B62dxhMXyl%2F5PwIoqxTSzP%2Bd92Nj%2B61htL4PNMTdhK0dbUU3dabqeHo3G%2FzGf7jl90p8T09wAzeYoJ9vempTW9Gm9fQA6cIdsAzXNmxj0%3D&checksum=162559820666c5cf6fdd179c47818637d9f4642e3056

Edited by Simond
Link to post
Share on other sites

On 30/04/2019 at 17:28, bigal10 said:

Help !!!

 

I've got as far as Step 4 on Ray's first page, and i'm struggling.

 

I have Uno, and Adafruit Motor Shield V2.3 and wired that to 5v, Grnd, I/o 2 and I/o 3 as per Ray's diags, ... I have not wired Reset, it didn't seem neccesary?

 

I've got the Stepper Test to work fine, and I've made the DCC Decoder board, (on BreadBoard) following the diagram and Ray's photo, and all i get on the serial monitor is four rows ending in zero....

 

I've double checked all the bits on my breadboard using my multi meter, and all the connections seem to be ok, all giving full responses as far as i can detect, my Sprog is sending instruction to a loco on my small length of track, which is connected to the breadboard, but all i'm getting is scrolling rows of zeros on the serial monitor.

 

I suspect i've got the libraries and/or scripts in the wrong folders, or i'm missing bits of libraries. - for example where on earth should 'Wire.h' be? i can't find anywhere on my PC...

 

Any suggestions, anyone?

I could add a photo of this temp setup if required.

 

Regards,

 

Alan.

 

Did you get an answer to your questions ?

Link to post
Share on other sites

2 hours ago, Simond said:

Hi Brian,

 

not sure why you can’t use a screw drive like this.

 

https://uk-m.banggood.com/400mm-Stroke-Actuator-CNC-Linear-Motion-Lead-Screw-Slide-Stage-with-42-Stepper-Motor-p-1162135.html

 

it might be bigger than you need, but I’m sure other models are available.

 

two of these under your traverser, driven by separate motor drivers, but kept in sync would do the trick, I think.  I can post the sketch on here when I log on on the computer - I can’t do it from my iPad.

 

i think you’d find it much easier than using toothed belts, particularly as the weight that you will be moving (hence the inertia) is significant.

 

hth

Simon

 

Ps - more here.  The overall length appears to be about 150mm more than the useful travel.

 

https://www.ebay.co.uk/itm/Lead-Screw-CNC-Linear-Slide-Stroke-200mm-500mm-Long-42-Actuator-Stepper

 

Simon,

Thanks for the pointers to those screws, I will do some more research. 

It looks like I have about 110mm in which to fit the stepper motor, join and support bearing. 

 

Thanks 

Brian

Link to post
Share on other sites

48 minutes ago, ianjeffery said:

i would probably steer clear of belts too. I have a Z table on my laser cutter that uses belts, and the first thing that would happen is it will skip a tooth and then you are all out of sync.

 

I have replied to your email. 

 

here is a shaky video of one i built for a guy in Italy... sorry for the breathing noises!!!!

 

 

Thanks Ian,

 

Yes I think good advice to steer clear of belts. Let’s see what we can find to fit in about 110mm. 

 

Cheers

 

Brian

Link to post
Share on other sites

My laser is belt x & y, but the mirror head probably weighs less than 250g, it’s direct drive off a small cog on the motor shaft.  Same for our 3D printer at work.

 

but a traverser is a big, heavy thing...

 

atb

simon

 

(btw, the traverser sketch is not DCC, I’m sure it’s easy to add/adapt)

 

 

Link to post
Share on other sites

On 30/04/2019 at 17:28, bigal10 said:

Help !!!

 

I've got as far as Step 4 on Ray's first page, and i'm struggling.

 

I have Uno, and Adafruit Motor Shield V2.3 and wired that to 5v, Grnd, I/o 2 and I/o 3 as per Ray's diags, ... I have not wired Reset, it didn't seem neccesary?

 

I've got the Stepper Test to work fine, and I've made the DCC Decoder board, (on BreadBoard) following the diagram and Ray's photo, and all i get on the serial monitor is four rows ending in zero....

 

I've double checked all the bits on my breadboard using my multi meter, and all the connections seem to be ok, all giving full responses as far as i can detect, my Sprog is sending instruction to a loco on my small length of track, which is connected to the breadboard, but all i'm getting is scrolling rows of zeros on the serial monitor.

 

I suspect i've got the libraries and/or scripts in the wrong folders, or i'm missing bits of libraries. - for example where on earth should 'Wire.h' be? i can't find anywhere on my PC...

 

Any suggestions, anyone?

I could add a photo of this temp setup if required.

 

Regards,

 

Alan.

 

Did you get an answer to your questions ?

Link to post
Share on other sites

On 27/07/2019 at 19:56, Simond said:

My laser is belt x & y, but the mirror head probably weighs less than 250g, it’s direct drive off a small cog on the motor shaft.  Same for our 3D printer at work.

 

but a traverser is a big, heavy thing...

 

(btw, the traverser sketch is not DCC, I’m sure it’s easy to add/adapt)

 

Thanks Simon,

 

I built the traverser over the last couple of days. 

IMG_2038.JPG.ed91d60e0771a6072795371917ee0d8e.JPG

 

Bit more work to be done. But very happy I have no droop when fully extended and the drawer runners give enough travel. Need to add walls to the traverser, and more bracing to the baseboard.

 

After lots of discussion with Ian I have ordered 2 of these. Because the lead screw is attached to the stepper motor it looks like it will fit and I can get the travel I require.image.png.b16d10b1fa178402c47802eb54b15037.png

 

Also ordered the Nano and DCC TT shield and a few other bits from Ian. 

 

Will let everyone know how I go setting up the hardware.

 

Cheers

 

Brian

  • Like 1
Link to post
Share on other sites

On 27/07/2019 at 18:45, ianjeffery said:

i would probably steer clear of belts too. I have a Z table on my laser cutter that uses belts, and the first thing that would happen is it will skip a tooth and then you are all out of sync.

 

I have replied to your email. 

 

here is a shaky video of one i built for a guy in Italy... sorry for the breathing noises!!!!

 

 

Thanks for all your help Ian. Hopefully I can get this baby rocking and rolling in O Gauge. 

 

Cheers

 

Brian

Link to post
Share on other sites

  • 7 months later...

Hello.  I have been following this topic as well for a while.  I have the electronics all built, and they work well.  I do have a question though.  I am using a stepper online nema 17 motor, and have a Usongshine Stepper Motor Driver TB6600.  I would prefer to use the TB6600 driver over the adafruit one.  However I have no idea how to modify the code to keep everything else the same except use a different driver.

Link to post
Share on other sites

  • 2 weeks later...
  1. Hi. I've just returned to this thread because my turntable and Arduino have stopped working. They haven't been used for a long time, and seem to have lost the programming, so I stripped out the turntable and brought it back into the house so I can go back to square one. The other problem was that my PC crashed last year, and I've lost all the information. What I'm after is the sketch for a 4 road turntable with the power being turned off from the motor please?

Simon

Link to post
Share on other sites

Simon-

 

Take a look at previous pages on this thread.  To rebuild on what you had it would be helpful to know what you did.  Did you use a hall effect sensor?  Did you follow the original posts for inputs?  Also same question for driver.  Did you use the Adafruit driver or did you use something else?

 

Let me know if you aren't able to find what you need.  I think you can find everything just searching this thread from the beginning.

 

-Eric

Link to post
Share on other sites

Hi Eric, I used everything that was suggested on the 1st page of this link, plus a DCC interface from Ian Jeffery.  I am using the hall effect sensor and the Adafruit driver. I went through all 27 pages of the thread yesterday, but failed to find the sketch that I needed, so I was hoping someone might have it. I did come across the 7 road sketch, but I don't think this cut the power to the motor. My turntable will be infrequently used, so I don't want the  continuous whine.

 

Cheers, Simon

Link to post
Share on other sites

Simon-

 

Take a look at my earlier posts or on page 7- luce001 posted some nice modifications to my code for a 4 track table with release.  He also added an OLED LED display, but you could just comment out that code if you don't want it.  It is a rather nice solution.  Haven't read this thread in a while.  fun to see what people have done with it.  I am really happy with mine.  Made two tables to date, looking to make two more drives for the local club.  I will post my updated code using some simpler drive modules once I build rev 2.  Best of luck.

 

Talk soon

-Eric

Link to post
Share on other sites

On 25/03/2020 at 23:27, Estreetcar said:

Simon-

 

Take a look at my earlier posts or on page 7- luce001 posted some nice modifications to my code for a 4 track table with release.  He also added an OLED LED display, but you could just comment out that code if you don't want it.  It is a rather nice solution.  Haven't read this thread in a while.  fun to see what people have done with it.  I am really happy with mine.  Made two tables to date, looking to make two more drives for the local club.  I will post my updated code using some simpler drive modules once I build rev 2.  Best of luck.

 

Talk soon

-Eric

 

Hi Eric, I have now downloaded the sketch from luce001 and it works fine, but I'm having problems with the u8glib file. There doesn't seem to be one available as it is no longer supported. Is there a sketch with the newer u8g2 file in that you know of please?

Simon

Link to post
Share on other sites

Simon-

I haven't used the OLED display described in luce001's sketch, but I think there are some good examples on the arduino forums.  What display are you using?  I would search for info on the specific display and relate it back into the code replacing what luce001 did with the new code.  Sorry to not be a better help.  I used a continuous turn 10k pot and panel with a printed label (see photo) for my main interface.  I also have a JMRI virtual panel and allow for DCC inputs.  I tend to use the analog knob and buttons most as it is just easier.  The more I automate, the more I like having the simple interface options when it is just me.  

 

-Eric

TT Controls.jpg

  • Like 1
  • Round of applause 1
Link to post
Share on other sites

  • 2 weeks later...

Hi Guys,

 

This project is fantastic, thanks to Ray and everyone else contributing to this!

 

I am getting ready to buy in the components. I see that 'Mouser' has a lot of the items. If I may, can I run some of my parts by you to check they are correct? There are a few options, especially with the UNO and resistors/optocoupler.

 

They seem to stock the stepper motor:

https://www.mouser.co.uk/ProductDetail/SparkFun/ROB-09238?qs=WyAARYrbSnaueIRDnnTgzg%3D%3D&vip=1&gclid=EAIaIQobChMIsf-fhZLe6AIVh-7tCh1qpw3nEAQYAiABEgIMMfD_BwE

 

and also the Adafruit shield:

https://www.mouser.co.uk/ProductDetail/Adafruit/1438?qs=sGAEpiMZZMsyTxkJnMM1W3%2BtWAOcl2tMPyrwboxW6%2BB2Jyl4YjkR%2Fg%3D%3D

 

But there are many options for the Arduino UNO, would this work?

https://www.mouser.co.uk/ProductDetail/Arduino/A000073?qs=sGAEpiMZZMuRQRjHmt4ZIaX9Ks%2FmeRGc

 

Would someone be so kind to find the correct resistors/diodes/optocoupler on mouser for me? I really don't want to make a mistake :D

 

 

Hall Effect Sensor (RS370-6896) / OPB716Z Sensor

Opto Isolator 6N137 (RS671-1359)

10k resistors x 2

1K resistor x2

IN4148 diode x 1

 

Would neodymium magnets work to trigger the hall effect sensor?

 

Really looking forward to testing this. It will be used to drive a Peco N Gauge TT.

Link to post
Share on other sites

As I said above, I am new to this so can someone explain please.

Looking at the data sheet on the motor it seems to say that each step on the motor turns the shaft 1.8 degrees??

 

Given a direct drive to the (00 Gauge) turntable at approx 350mm diameter, this seems to give steps of approx 5mm at the edge.

 

I feel that I must be missing something.

Link to post
Share on other sites

  • RMweb Gold

Hi Barry,

 

You could "micro step" the motor to achieve smaller steps than the 1.8 degrees built in... but I wouldn't recommend it - even if the electronics and software supports it.

No, don't drive the turntable directly! Gear it down so that you get the resolution (at the rail tips) that is required.

If you want to position the rails to within 0.1mm then that is the resolution you require. 5mm you say, then to achieve 0.1mm you will have to have a gear reduction of 5/0.1 = 50:1 Of course, the top speed of the turntable (with an already slow stepper) will be 50 times slower.

 

I would, however, recommend using "micro stepping" to make the rotation smoother and quieter.

 

 

Kev.

Edited by SHMD
Link to post
Share on other sites

  • 4 months later...
On 17/04/2018 at 09:37, ianjeffery said:

Just a quick update on this...

 

I'm currently working on a touch screen interface to supplement the DCC control.

 

dccinterface touchscreen small

 Any update on this Ian? I’d be really interested.

 

 

 

on a side note has anyone worked on a sketch to be able to program the roads into the eeprom memory via a keypad?

Link to post
Share on other sites

  • 4 weeks later...
On 12/11/2013 at 14:52, tender said:

There have been many threads/posts relating to motorising/controlling turntables, utilising DC motors, Stepper Motors, gears, gearboxes, toothed belts, meccano etc. all with varying degrees of complexity to get the correct indexing of the bridge deck. None of these (that I could find) also incorporated DCC control.

This series of posts will describe the construction of a simple DCC controlled turntable utilising a stepper motor directly connected to the turntable shaft (no gearboxes, gears, belts) and an ARDUINO microcontroller programmed to do all the hard stuff.

This project is ongoing (working prototype complete), comes in good faith, but no guarantees.

(The software could be modified to operate from a rotary switch if DCC operation not required)

Part 1: The Bits

Components required for this project. (Plus approx. cost)

ARDUINO UNO microcontroller                   (eBay) £16
ADAFRUIT Motor Shield V2                        (eBay) £16
Stepper Motor (SM-42BYG011-25)            (eBay) £16
Hall Effect Sensor (RS370-6896)                           £5
Magnet (RS189-5512)                                           £6
Bellows Coupling (RS693-2467)                            £17
Opto Isolator 6N137 (RS671-1359)                       £2
2 off 10k resistors
1 off 1K resistor
1 off IN4148 diode
4 off Rubber mountings (Farnell 1466996)           £3

                                            Sub Total (Approx.)  £81

Plus a Turntable of choice. (PECO OO LK55)     £39

                                                                   Total £120

Shopping around could save a few pounds.

 

Part 2 to follow - Turntable Hardware (stepper motor/sensor mounting) Construction.

 

YouTube video of working prototype.

 

http://www.youtube.com/watch?v=mxuCFwfOU5s

(any erratic behaviour is due to the YouTube link)

 

A PC and SPROG II Interface were used to generate the DCC commands but any DCC controller would suffice.

Ray.


I’m a latecomer to this, but using the arduino and Peco turn table deck.

 

id been having some issues with the control, but thanks to reading on here I now have it sorted. 
I’ve opted for push button location, but I’ve also decided to add the reset location at the start.. went to look for the Hall effect sensor, only RS do it and it’s now £14.50! 
 

now if I need to, I will buy one of those, but wondered if anyone had used anything less expensive ? Same thing different brand etc? 
 

andy 

Link to post
Share on other sites

  • RMweb Premium
1 hour ago, andysollis1 said:


I’m a latecomer to this, but using the arduino and Peco turn table deck.

 

id been having some issues with the control, but thanks to reading on here I now have it sorted. 
I’ve opted for push button location, but I’ve also decided to add the reset location at the start.. went to look for the Hall effect sensor, only RS do it and it’s now £14.50! 
 

now if I need to, I will buy one of those, but wondered if anyone had used anything less expensive ? Same thing different brand etc? 
 

andy 

Buy on Aliexpress, you will find Hall effect devices at a fraction of the price.

https://www.aliexpress.com/item/32785165326.html

https://www.aliexpress.com/item/32295739566.html

 

The OH49 is linear, the OH3144 is digital

 

The OPB716Z Sensor mentioned a few posts back alongside an RS part number for a Hall device is not a Hall effect device, it is an opto device.

Edited by melmerby
  • Friendly/supportive 1
Link to post
Share on other sites

17 minutes ago, melmerby said:

Buy on Aliexpress, you will find Hall effect devices at a fraction of the price.

https://www.aliexpress.com/item/32785165326.html

https://www.aliexpress.com/item/32295739566.html

 

The OH49 is linear, the OH3144 is digital

 

The OPB716Z Sensor mentioned a few posts back alongside an RS part number for a Hall device is not a Hall effect device, it is an opto device.

Oh.. um.. so which would be better? The liner or the digital?

 

I would have automatically thought doing what we’re doing with the Arduino that I’d want Digital? 
 

and looking at that, I see one vast difference. No coloured wires.. (that’s not a problem! :yahoo:)

 

but which was which unless I’ve missed that in the description? (Ignore that, just checked again and found that the links are the opposite way to which you wrote them down... best get my order in!! :-) )

Edited by andysollis1
Link to post
Share on other sites

  • RMweb Premium
Just now, andysollis1 said:

Oh.. um.. so which would be better? The liner or the digital?

 

I would have automatically thought doing what we’re doing with the Arduino that I’d want Digital? 

The RS one is digital, so I would use a digital one.
I've bought some of each and have experimented with them, not however for a turntable detent.

When you bring a magnet close to a linear one the output changes in sympathy with the closeness of the magnet, with a digital one it will trigger on once the magnetic strength reaches a certain level and off again as it decreases

 

AliExpress are good for components for Arduino projects.

e.g. Uno R3 clone = less than £2.

https://www.aliexpress.com/item/32556087234.html?algo_pvid=4df34ef1-5e85-4f28-a6fa-b01c264463b2&algo_expid=4df34ef1-5e85-4f28-a6fa-b01c264463b2-11&btsid=0b0a0ae216020832378767117ea997&ws_ab_test=searchweb0_0,searchweb201602_,searchweb201603_

 

I've had a few of them and Nanos and haven't had a dud yet.

  • Informative/Useful 1
Link to post
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

×
×
  • Create New...