Jump to content
 

DCC Controlled (PECO) Turntable Project using a Arduino Uno


Recommended Posts

looking at a new idea last night... instead of a physical controller, what about a web interface - so the controller connects to your wifi ( or ad-hoc wifi if you are at a train show ) and you interact with the turntable using your phone/tablet/computer. means you can have the controller far away ( these a re small, those are far away! ) but controll it anywhere.... 

 

and configure it anywhere too.

 

image.png.e9f388b8cc8709d0b92ae50795e8ea3f.png

  • Like 2
Link to post
Share on other sites

remember to interlock it such that it will not accept a command whilst the loco on the bridge is moving.  The potential for locos falling off is otherwise high, particularly if you can't see the TT easily from the operating position

 

atb

Simon

  • Like 1
Link to post
Share on other sites

  • 3 months later...
On 07/10/2021 at 20:07, ianjeffery said:

looking at a new idea last night... instead of a physical controller, what about a web interface - so the controller connects to your wifi ( or ad-hoc wifi if you are at a train show ) and you interact with the turntable using your phone/tablet/computer. means you can have the controller far away ( these a re small, those are far away! ) but controll it anywhere.... 

 

and configure it anywhere too.

 

image.png.e9f388b8cc8709d0b92ae50795e8ea3f.png

 

You can have both, on my Traverser I have a physical interface, and DCC input so I have the Arduino to look for both inputs. With DCC you can then setup any of the table/phone/computer apps to call the track. It is also locked out whilst it is moving. 

 

cheers

Brian

Link to post
Share on other sites

  • 10 months later...

Hi Allan.  I’ve just discovered this Article on the rmweb website.  The slight technical issue I have is that I cannot access any of the images, so have no idea on some of the construction techniques. Can you help?

Edited by nikkib
Link to post
Share on other sites

  • 2 weeks later...
  • RMweb Gold
On 26/11/2022 at 15:23, nikkib said:

Hi Allan.  I’ve just discovered this Article on the rmweb website.  The slight technical issue I have is that I cannot access any of the images, so have no idea on some of the construction techniques. Can you help?

 

Unfortunately all the photographs on the forum were lost a while ago with a forum crash.    It will require all of those photographs on every forum thread to be re-uploaded by the originators.   An impossible task (particularly as a good number of posters are no longer with us) which is a dreadful shame as many threads are "mostly pointless" (no pun intended) without the photographs!  

 

Maybe in this particular case the original poster will be able to oblige?

 

Alan (another one)

Link to post
Share on other sites

Sore point - most of the history of my last 12 years of modelling was in the lost pictures

 

I do not keep the photos I post so if they’re gone, they’re gone.  
 

I can take further photos of my turntable and the associated arduino-gubbins if that would help, though it’s installed…

Link to post
Share on other sites

  • 2 weeks later...
  • 1 month later...
  • RMweb Gold

Good evening folk. Back in 2017 Ray (Tender) and Ian Jeffery gave up a great deal of time to help me set up my stepper motor driven turntable running off an Arduino and Adafruit motor shield. It has worked faultlessly since then until a couple of days ago when one of the power supply wires became disconnect at the ESU Switch Pilot. I reconnected it but now the turntable will work through the initialising routine as it always has at power up but will not respond to any DCC commands. Can I just connect up my MacBook to the Arduino, removing the jumper link on the motor shield and power supply to the Arduino and connecting it to the motor shield and run the DCC test sketch to restore normal operations?

After all this time of faultless operation thanks to the help I received, I was completely thrown when it failed and I cannot reason why that power interruption should be any different to me shutting down the layout in the normal way.

 

Sorry to have to come back for help after all this time, nearly six years, but I am at your mercy with this stuff.

 

Regards

 

Geoff

Link to post
Share on other sites

  • RMweb Gold

Me again folk. I took the plunge and having found the sketch I used to programme my turntable I hooked my Mac Book and uploaded the sketch. the turntable worked fine, just as it has for the last five years plus but only while the computer is connected. If I revert to the normal arrangements with the power to the Arduino and the jumper link in place it will not respond to a DCC command.

I could really do with some advice about how to proceed to restore the situation to normal please.

 

Regards

 

Geoff

Link to post
Share on other sites

Geoff,

 

when you say it works as it has over the last few years, am I right to think that with the Mac connected, the DCC works, via your normal ESU DCC controller, but, if you disconnect only the computer, and put in the power jumper, it does not function?

 

Are you sure there is a ground connection for both signal and power to the Arduino?

 

I presume the Arduino on-board power led is lit in both cases?

Link to post
Share on other sites

  • RMweb Gold

Essentially yes. None of the wiring has been changed save for reconnecting the power wire from the ESU Switch Pilot which became disconnected. With the Mac connected via the USB port and the power supply from the ESU Switch Pilot connected to the Adafruit Motor Shield with the power jumper removed the unit goes through its initial set up rotations and stops at the sensor  position and will then respond to the commands sent from my Digitrax throttles. If I disconnect the Mac and transfer the power connection from the ESU Switch Pilot to the Arduino power jack and replace the jumper on the Motor Shield the unit will again go through its initial set up rotations but will not respond to the DCC commands from my Digitrax throttles. What I don't understand is why the accidental disconnection of one of the power wires should appear any different from the normal shutting down of the layout in terms of the power supply to the Arduino. When I discovered the disconnected wire I first reconnected it to the wrong position on the Switch Pilot, putting it in a feedback connection. It is a jumble of wires down there under the railway and the printing on the Switch Pilot connections is not easy to see, old eyes and poor light. I will try again tomorrow evening and check the on board power led on the Arduio. Certainly there is a led on on the Motor Shield in both instances.

 

Thank you for picking up on this Simon.

 

Geoff

Link to post
Share on other sites

  • RMweb Premium

I suppose if this project was being done now, the TMC2208 would be a better motor driver, than the Adafruit shield.

Its much smaller & cheaper and you could use a Nano instead of a Uno, also a lot cheaper.

It needs just three wires fron the Arduino: Enable, Step & Direction.

It is also a silent drive stepper motor driver, the one I have used for my traverser means the stepper motor is almost silent when operating.

Link to post
Share on other sites

  • RMweb Gold

Simond,

I have just powered up the turntable in its normal configuration with the jumper link in place and power to the Arduino jack. There is both a yellow led and a green led on, solid, on the Arduino and a green led on the Adafruit Motor shield. Once again the turntable went through its initialising rotations and stopped at the sensor but did not respond to switch commands from my Digitrax throttle.

I have checked through all the wiring and it all appears to be intact. The Switch Pilot is putting out 8.8 volts and I checked between the output A terminal and the feedback terminal which I mistakenly connected the loose wire to initially and I measured less than 1 volt. The wire which had become disconnected is normally connected to the COMMON terminal.

IMG_2080.jpg.b90060eec3a191f4f27e280ea795bd01.jpg

 

IMG_2081.jpg.4829fb324b0ed6556ec3847601608436.jpg

 

IMG_2082.jpg.5055d37c5d0be9fc3a6a763678cb8f46.jpg

This image shows the DCC interface board. The white wire has never been connected. It may be the reset connection which has been talked about way back in this thread.

IMG_2083.jpg.87e45df6184362bc2bc0b1c03f536911.jpg

 

IMG_2084.jpg.44f4412b72a7f068fc69f341d854e717.jpg

The empty jack socket is the one I use when the Mac book is connected to the USB port. It connects power to the Adafruit Motor Shield.

Please excuse my mares nest wiring.

 

Regards.

Geoff

Link to post
Share on other sites

Geoff, 

 

mare’s nest…. Or snake pit!

 

I have no experience of the Adafruit shield, or the DCC interface, so I’m not going to be a huge help here, I fear.


the key things are that you must have are power to all boards, and a common ground.  that, and the signals getting from the DCC to the Arduino to the stepper.
 

My suspicion is that somehow, when you power the Arduino up using the Mac, it is somehow powering something else, which is not being powered when you use the power Jack.    
 

it’s initialising, so the Arduino and stepper driver must be powered up, so I reckon you need to look to check that the DCC interface is doing what it ought.

 

hth

Simon

 

Link to post
Share on other sites

  • RMweb Gold

Thank you Simon. I will read through the thread from way back to see if I can find any guidance. There is a connection to ground on the Adafruit Motor Shield from the DCC interface board and the Adafruit is stacked onto the Arduino so presumably the ground is carried through.

 

Regards.

 

Geoff

Link to post
Share on other sites

  • RMweb Gold

Simond, I thought I would just keep you up to date with the latest developments. I decided to power up the turntable in reverse, so to speak, by leaving the jumper plug in but connecting the power supply to the Adafruit Motor Shield. Again the turntable went through the normal start up routine but didn't respond to any DCC commands. I then decided to remove the jumper plug and leaving the power connected to the Adafruit Motor Shield I connected the USB cable between the Arduino and my Mac Book but didn't fire up the Mac Book, not even open it up. Lo and behold the turntable started up as normal and also responded to DCC commands! It seems like witchcraft to me.

Does that indicate something has failed on the Arduino I wonder?

 

Regards

 

Geoff

  • Like 1
Link to post
Share on other sites

  • RMweb Gold

Thank you for your reply Simon.

 

As far as I can see there is only one external ground connection and that is between the DCC interface and the Motor Shield. I can check those connections are good but after that I guess it could be some component failure, presumably on the Arduino board.

 

Regards

 

Geoff

Link to post
Share on other sites

  • RMweb Premium

 

The daughter board I assume is the DCC optocoupler (6N137). Why are there so many wires?

On my Arduino projects I only have 5:

opto.jpg.43c3ea5c7695255a19adc29deede1f56.jpg

 

DCC from system, 2 wires on right.

Power, ground and DCC signal to Arduino on left.

Link to post
Share on other sites

  • RMweb Gold

The DCC interface board was built using a circuit diagram posted by Ray (Tender) if I remember correctly. There are three wires from the Hall Effect sensor, two from the DCC accessory bus, two to I/O connections on the motor shield, two to 5v and ground on the motor shield and the white wire, which doesn't connect to anywhere and which I believe is available for a reset connection which I have never used. So, four to the motor shield, three to the sensor, two to the DCC bus and the white wire, ten in all.

 

GeoffIMG_4580.jpg.8ff7e1d56add0891f3fd3959dc1f0789.jpgIMG_0634.jpg.4c6e6ce2bea8ab88c5042b54cb53bfaf.jpgIMG_2081.jpg.5d4ec42e08b3707e1a5ef41d9a070c4c.jpg

Link to post
Share on other sites

  • RMweb Gold
On 15/05/2015 at 21:02, gz3xzf said:

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

ARDUINO UNO microcontroller                                                          (PiHut) £20
ADAFRUIT Motor Shield V2                                                                  (PiHut) £17
Stepper Motor (SM-42BYG011-25)                                                     (PiHut) £14.30
Hall Effect Sensor (RS370-6896)                                                                    £5.67
Magnet (RS189-5512)                                                                                       £6.38
Bellows Coupling (RS693-2467)                                                                    £20.51
Opto Isolator 6N137 (RS671-1359)                                                                £2.14
2 off 10k resistors                                                                                               £0.65
1 off 1K resistor                                                                                                   £0.34
1 off IN4148 diode In-stock
4 off Rubber mountings (RS720-3293)                                                          £6.74

Above is the list of components used in this project. It can be found way back on about page 13 of the thread.

 

Geoff

Link to post
Share on other sites

  • RMweb Gold

Simon, I checked the integrity of the ground connection between the DCC interface board and the motor shield with a continuity meter and it is sound. I also checked the mechanical integrity of all the connections to the motor shield and the DCC interface board and all seem good. As an experiment I fitted the jumper plug and left the usb cable plugged into the Arduino but not connected to the mac book and powered up the turntable. Of course it just went through its set up rotations but didn't respond to any DCC commands.

In the absence of the circuit diagram for the DCC interface board, lost in the great hosting company failure, I am stuck unless Ray (tender) see these posts and can repost the circuit diagram.

For the time being I will just have to take my mac book up to the railway and connect it up to use the turntable.

 

Regards.

 

Geoff

Link to post
Share on other sites

So, it works correctly with the laptop plugged in, but not if it isn’t.  
 

have you tried using a usb charger in place of the laptop?  
 

If it still works properly like that, you could perhaps live with it, they’re only a fiver, but I’d still want to know why the power supply that it used to function with isn’t powering everything now.  Have you perhaps blown a component?

Link to post
Share on other sites

  • RMweb Premium

OK. So it's got two circuits on it.

The opto circuit is not part of anything else, it just converts the DCC signal into a logic level for the Arduino and provides the necessary isolation.

image.png.7e8be4749983e9d7b8e7b061314588e1.png

 

The Hall effect device will not be in that circuit, it must be separate.

 

What voltage do you put into the Arduino power jack? (needs to be greater than 7v), less than 6 and the Arduino won't operate properly.

What voltage do you put into the motor board?

 

Unfortunately I don't have a ADAFruit board to check, Mine's a Velleman one which is quite differen!

Link to post
Share on other sites

  • RMweb Gold

Both the Arduino and the motor shield are supplied with 8.8 volts from an ESU Switchpilot using the jumper plug on the motor shield to share the power. This arrangement has worked, and still does, for the last 5+ years. It would seem that when I reconnected the detached power wire on the Switch Pilot which had caused the original failure to operate,  initially into the wrong connection, a feedback circuit rather than the common, something on one of the boards may have been damaged. I have subsequently checked and there does not seem to be any voltage on the feed back connection on the Switch pilot but who knows what may have occurred in the few minutes it was connected like that.

Simon suggests that somehow a  ground connection has been lost and when I connect the usb socket on the Arduino to my Mac Book that ground connection is made good allowing the turntable to operate correctly in response to DCC commands. In that situation the power supply is connected through the motor shield and the jumper plug to the Arduino. Under normal operation, without the Mac Book connection, the Arduino power socket would be used with the jumper plug powering the motor shield.

Looking again at my DCC interface board, the ground wire on the onto isolator is connected to the ground point on the motor shield through the blue wire. Perhaps I need to check the integrity of that connection.

 

Regards.

 

Geoff

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...