Author Topic: Arduino stepper motor turntable  (Read 3756 times)

0 Members and 1 Guest are viewing this topic.

kondor

  • Crew
  • *
  • Posts: 29
  • Respect: +4
Arduino stepper motor turntable
« on: June 10, 2016, 08:23:45 AM »
+2
I'm using an Arduino Uno, Easydriver board (stepper motor driver), Honeywell SS441A hall-effect sensor, plus a stepper motor, magnet, and a belt reduction system.  The video shows a proof of concept and test code I wrote.  Feel free to mute the audio, but I left some annotations on the video to try to explain what's happening.

Upon power up the table turns CW to find the home position as it looks for a hall-effect sensor to trip by the magnet mounted on the back of the large pulley.

The table then turns 360 degrees CW using acceleration and deceleration specified in the code, and then steps back CCW through a few positions modeling the table indexing between tracks.  It will use dead-reckoning (so counting the steps) for the indexing of the table.  It looks rather repeatable right now and I'm pretty pleased with the results so far.  This code is just to test out the homing, acceleration, and moving between positions.

Now I have to work on the hardware input and code for track selection, but for me the hard part of this project (learning how to write the code) is done.


wcfn100

  • Crew
  • *
  • Posts: 8796
  • Respect: +1128
    • Chicago Great Western Modeler
Re: Arduino stepper motor turntable
« Reply #1 on: June 10, 2016, 11:48:26 AM »
0
Is that sensor sensitive enough to zero the table?  We used them in a card shuffling machine because they weren't affected by card dust like optical sensors.  But I always though of them as more 'in the area' type sensors.

Regardless though, while you're in the programming mindset, you may want to add some sort of manual zero.

Jason

kondor

  • Crew
  • *
  • Posts: 29
  • Respect: +4
Re: Arduino stepper motor turntable
« Reply #2 on: June 10, 2016, 12:39:12 PM »
0
They should be sensitive enough to zero repeatedly.  I have played with them on my CNC mill and used a dial indicator to check repeatability.  They seem repeatable within 0.0005" unless my memory fails me.

The next step is to move the mockup into the module for some real world testing.  I have some contingency plans such as thinking about an LCD and button interface to address any issues like requiring a zero-offset or tuning index locations, but hopefully I can keep it simple. 

I do appreciate the feedback!

peteski

  • Crew
  • *
  • Posts: 31794
  • Gender: Male
  • Honorary Resident Curmudgeon
  • Respect: +4596
    • Coming (not so) soon...
Re: Arduino stepper motor turntable
« Reply #3 on: June 10, 2016, 02:07:27 PM »
0
A display and either a numeric keypad or a 3-key set (UP, DOWN, ENTER) would be a cool feature. The display would show the desired track selected by the keys, then it would start flashing while the bridge is moving (maybe even show the track numbers as it's passing them) then light up steady when stopped at the selected track.  Then it would also be useful to have a function which turns the bridge 180 degrees (at its current location).
. . . 42 . . .

kondor

  • Crew
  • *
  • Posts: 29
  • Respect: +4
Re: Arduino stepper motor turntable
« Reply #4 on: June 10, 2016, 02:15:16 PM »
0
Peteski,
Chill out! I just learned how to use an Arduino! :D
But yes, that would be very cool.

peteski

  • Crew
  • *
  • Posts: 31794
  • Gender: Male
  • Honorary Resident Curmudgeon
  • Respect: +4596
    • Coming (not so) soon...
Re: Arduino stepper motor turntable
« Reply #5 on: June 10, 2016, 03:00:29 PM »
0
Hey, you learn by doing things.  You'll get there (one routine at a time).  :D  You'll have to design some sort of useful human interface for it (or are you planning for it to be DCC-controlled)?  :trollface:  Either way, you'll have to do something to make it do more than just spinning in circles.  ;)
. . . 42 . . .

kondor

  • Crew
  • *
  • Posts: 29
  • Respect: +4
Re: Arduino stepper motor turntable
« Reply #6 on: June 10, 2016, 03:10:04 PM »
0
Yup, I learned a whole bunch just getting this proto up and running.
I was thinking of using a modified rotary switch to select the position.  Right now my priority is getting it integrated into the module, confirming repeatability, fit, function, and building the table itself.   The turntable is the roadblock keeping me from further progress on my module at this point so I feel like I need to get it in place so I can lay the last few pieces of track, ballast, and start some scratch building. 

You need to come by and check it out!

peteski

  • Crew
  • *
  • Posts: 31794
  • Gender: Male
  • Honorary Resident Curmudgeon
  • Respect: +4596
    • Coming (not so) soon...
Re: Arduino stepper motor turntable
« Reply #7 on: June 10, 2016, 03:16:19 PM »
0
Yup, I learned a whole bunch just getting this proto up and running.
I was thinking of using a modified rotary switch to select the position. 
You need to come by and check it out!

I will one of these weekends . . .    :)

Rotary switch seems so very old-school (especially controlling a high-tech microcomputer circuit), but I'm sure it'll work just fine.
. . . 42 . . .

kondor

  • Crew
  • *
  • Posts: 29
  • Respect: +4
Re: Arduino stepper motor turntable
« Reply #8 on: June 10, 2016, 03:19:52 PM »
0
I like the positive feeling, simplicity, and speed to select position.  Plus, it's easier to integrate it safely to the side of the module for transport.

Xmtrman

  • Crew
  • *
  • Posts: 71
  • Gender: Male
  • Respect: +5
Re: Arduino stepper motor turntable
« Reply #9 on: June 10, 2016, 10:11:33 PM »
0
Cool displays are possible. And yes, it's a touch screen:

https://www.youtube.com/watch?v=oD08cYE42u4

fcwilt

  • Crew
  • *
  • Posts: 35
  • Respect: +3
Re: Arduino stepper motor turntable
« Reply #10 on: June 17, 2016, 01:03:10 PM »
0
Hi,

I modified a Walthers DCC turntable with new Arduino based electronics because I did not care for the limitations of the DCC controller that was included.

When "homing" the bridge (in this case seeking the built-in optical sensor) the code turns the bridge at "max" speed, in the shortest direction, until it detects the sensor.

Then, depending on the initial direction, it turns the bridge CC/CCW past the sensor a few degrees and then seeks the sensor again at "min" speed, always CW.

Using two speeds minimizes the time to find "home" but maximizes accuracy.

Just FYI.

kondor

  • Crew
  • *
  • Posts: 29
  • Respect: +4
Re: Arduino stepper motor turntable
« Reply #11 on: June 17, 2016, 01:29:46 PM »
0
Thanks for the input.  That's a pretty common method for homing on CNC machines in my experience.  I'm homing relatively slow on startup since I'm in no rush to home the device.

Did you end up incorporating any DCC functionality with your Arduino modified table?

railnerd

  • Crew
  • *
  • Posts: 764
  • Gender: Male
  • Respect: +230
Re: Arduino stepper motor turntable
« Reply #12 on: June 17, 2016, 02:08:23 PM »
0
Hi,

I modified a Walthers DCC turntable with new Arduino based electronics because I did not care for the limitations of the DCC controller that was included.

When "homing" the bridge (in this case seeking the built-in optical sensor) the code turns the bridge at "max" speed, in the shortest direction, until it detects the sensor.

Then, depending on the initial direction, it turns the bridge CC/CCW past the sensor a few degrees and then seeks the sensor again at "min" speed, always CW.

Using two speeds minimizes the time to find "home" but maximizes accuracy.

Just FYI.

Do you have pin-out information for the RJ connector for the turntable?   We've been struggling getting our turntable to work reliably with the Walther's electronics.

-Dave

fcwilt

  • Crew
  • *
  • Posts: 35
  • Respect: +3
Re: Arduino stepper motor turntable
« Reply #13 on: June 18, 2016, 11:48:44 AM »
0
Thanks for the input.  That's a pretty common method for homing on CNC machines in my experience.  I'm homing relatively slow on startup since I'm in no rush to home the device.

Did you end up incorporating any DCC functionality with your Arduino modified table?

As I am still using the original Walthers drive mechanism there is new electronics in the bridge and new electronics for the layout mounted controller, both Arduino based.

I replaced the original commutator with a 12 circuit sealed one from Adafruit which as luck would have it was the EXACT same diameter as the "shaft" part of the bridge

Because the turntable is part of a computer automated layout I also added 4 IR "beam-break" sensors on the bridge to more accurately position the engines.

The layout mounted controller provides a number of ways to configure and/or control the turntable:

- a IR sensor which allows controlling the turntable with a IR remote, which is mostly used for configuration.

- a SD card which can be used to save/load the configuration.

- a network connection which is used with a Windows app I wrote to allow configuration and control.

- a LocoNet connection which is used by the layout control software (Train Controller) and allows TC to control the turntable and to receive sensor reports as to the bridge and engine location.