Turntable controller: finalised project proposed

Erik84750 Feb 12, 2024

  1. Erik84750

    Erik84750 TrainBoard Member

    351
    141
    12
    Good morning Bob, I just happened to have a peep on the Trainboard forum; I do not get email notifications (or very irreggular) so it is a coincidence to see Sumner's great post, and your reply here above.

    The optical sensor may be placed anywhere it suits you.
    The calibration procedure turns the stepper until the sensor is "blocked". Then a second step takes place: please acknowledge to make the full 360 degree turn: this allows the program to measure the number of steps to make a 360 degree 0 minute 0 seconds turn.
    The resuilts are stored in eeprom.

    Now to Sumner's great comment: he hits "all the right buttons", except his concept and mine differ on the subject of automation :D.

    This stepper controller I also have available, It is, for it's cost, a very performant microstepper controller. Yet the controller I use (and for which, my pcb is pre-equipped) also is a microstepper, with 1/16 step precision. The one proposed by Sumner has 1/32 precision, yet not suitable for pcb mounting. You may however create a 3D design that accomodates this controller.
    I choose not to do so as the A4988 module is such a tiny and highly competent component that I preferred scale over the extra 1/32nd step.

    EDIT: the only visual feedback I allow is that it mentions "calibrating". When calibration is finished the amount of steps is stored in eeprom. I do not think that I have this displayed on the screen.
    If you find that necessary or "nice to have" I will accomodate the program.
     

    Attached Files:

    Last edited: Feb 28, 2024
    BNSF FAN and Sumner like this.
  2. Bob Brockhouse

    Bob Brockhouse TrainBoard Member

    33
    33
    3
    Erik, the calibration procedure was a constant thought, thanks for the clarification. Having not reached
    the point of actually doing it, the question of what to expect still lingered. Given the fact the Eeprom
    receives the count, I visualised that the LCD would display the value that has been written to Eeprom.

    Could be valuable information for spotting / diagnosing errors or for stepper/sensor tuning. I would consider this display a "very nice to have" bordering on a "must have". Adjusting the INO file for this is way beyond my skill so would welcome a revised INO as you see fit. Thoery says we should have a value 200 written to Eeprom for the standard 1.8 degree stepping of 360 degree rotation. The display
    would give the answer.

    Cheers, Bob
     
    BNSF FAN likes this.
  3. Erik84750

    Erik84750 TrainBoard Member

    351
    141
    12
    Hi Bob, thanks for your response. I have the setup complete and ready for use in my "ready-for-use" deposition cabinet.
    We are leaving for a 4-week vacation in our Provence residence next Monday, so most likely during that time I might not be able to do any testing/mod's to my setup. However I might find some time the coming days, in between all our packing and preparations.

    I must add that once calibrated the software allows for one-time manual setting of the turntable for each incioming/outgoing track, with an index number for each settled track.
    All this is fully transparent to the user: you can recall an index number and the turntable automatically turns. In the shortest way possible: an algorithm calculates and performs a CCW or CW rotation whatever is shortest.

    I take your request for a visualisation into account for my next software review.

    EDIT: ok, after a bit of talking to my spouse, we will take my basic electronics gear with me, including the turntable controller. I have all software, 3D designs and pcb designs on Google Drive.
     
    Last edited: Feb 28, 2024
    BNSF FAN and Sumner like this.
  4. Bob Brockhouse

    Bob Brockhouse TrainBoard Member

    33
    33
    3
    Erik, very generous edit indeed. Will have to bide my time and be patient. Meantime, will run the
    calibration as is, and trust the Erik team enjoy their holiday.

    Many thanks, Bob
     
    BNSF FAN and Erik84750 like this.
  5. Erik84750

    Erik84750 TrainBoard Member

    351
    141
    12
    Hi Bob, sorry for the late reply.
    We had arrived fine in our Provence home (early March). A week to get settled and then we left for a week holiday in the Haute Savoie (mountains and snow, hikes etc..).
    Yesterday we arrived back home in our Provence residence, and now picking up on all backwaiting mails, fora etc..

    Re. the calibration procedure now. I does not matter where your indexing "object" is placed. the algorithm first gets the turntable to turn (I think CW) until the sensor is "hit". Then pressing the confirmation stage, then turntable makes a full 360 degree turn to measure the number of steps required.

    There is no visual readout of steps as the calibration proceeds: no need for that.
    After calibration is finished, that is it. Again no need for displaying the number of steps required because the program is fully automatic. A bit like your car: if it is an automatic gears what use is the rev counter?

    But if you insist I can add this in a version specially for you :cool:, but unpublished.
     
    Sumner and BNSF FAN like this.
  6. Bob Brockhouse

    Bob Brockhouse TrainBoard Member

    33
    33
    3

    Thanks Erik for the update, the automatic car analogy makes complete sense. I am in no position to insist
    on anything, just grateful for your work to date. I would however like to see a digital trigger for change of bridge polarity added , when bridge rotates past a certain point. What that point would be is not clear to me
    at this time. An output from the Arduino to a relay feeding the tracks.

    Bob Brockhouse
     
    Last edited: Mar 17, 2024
    Sumner and BNSF FAN like this.
  7. Erik84750

    Erik84750 TrainBoard Member

    351
    141
    12
    Very good idea Bob!
    This is an absolute must-have and which I had not thought of.

    I am in a little group working on a Nextion-based handheld controller; that project is about to be finalised the next few months. so that will free up a lot of time. This "polarity-algorithm" will need some time to get working but I consider it a major requirement.

    But, knowing myself, I might have it done faster, ..I can't promise ;).
     
    BNSF FAN likes this.
  8. Erik84750

    Erik84750 TrainBoard Member

    351
    141
    12
    I have just been checking my software and I think the following will need to be done:
    1. create a new variable that keeps track of the stepper's movements with respect to its original (optical-sensor-calibrated) position.
    2. decide when to change a new digital output
    3. I do not intend to let the user decide where that inversion point will be. That will entail complications and bug-related issues.
    4. rather have this inversion point be decided by the turntable position relative to the optical sensor. In that way the user does have some "say".

    Is that concept feasible Bob?
     
    Sumner and BNSF FAN like this.
  9. Bob Brockhouse

    Bob Brockhouse TrainBoard Member

    33
    33
    3
    Sounds fantastic to me, not knowing if it was actually possible with your project.
    I must give credit to fellow member "Sumnar" for his turntable polarity concept,
    It seemed to me all turntables need this feature as being mandatory.

    Thanks again.
     
    Sumner and BNSF FAN like this.
  10. Erik84750

    Erik84750 TrainBoard Member

    351
    141
    12
    Sure, it is my pleasure to have received this essential requirement "to-do".
     
    Sumner and BNSF FAN like this.
  11. Bob Brockhouse

    Bob Brockhouse TrainBoard Member

    33
    33
    3
    Just a heads up for the auto polarity/phasing for the turntable bridge, came across the attached
    DPDT latching relay module that may be suitable. Runs on 5V supply, triggers on low pulse,
    and can handle more than enough track power for the average home layout. Got this from Ebay
    but guess available from other vendors.

    Bob
     

    Attached Files:

  12. Erik84750

    Erik84750 TrainBoard Member

    351
    141
    12
    Hi Bob, many thanks for that information. I will take that into account with my research on a track polarity proof-of-concept.
    Unfortunately I have been unable to do any work because ten days ago I suffered an acute gallbladderinfection requiring surgery from which I currently recover. I probably will be back-in-business second half of next week, I keep you posted.
    Erik
     
  13. peteGSX

    peteGSX TrainBoard Member

    39
    84
    2
    I've sort of been following along here, but just want to chip in when it comes to polarity reversal, the way we've accomplished this in our DCC-EX EX-Turntable project is by defining an angle from the "home" position at which it inverts the polarity by activating relays, with it switching back again a further 180 degrees around. Not sure if that's helpful or clear but sharing what we did anyway.
     
  14. Sumner

    Sumner TrainBoard Member

    2,846
    6,001
    63
    I use relays....

    [​IMG]
    .... left side above but will change the polarity via...

    [​IMG]

    .... the hand controller when it needs to be. If that gets old I'll spend $34 on a Tam Valley dual frog juicer/auto-reverser that will take care of it.

    Sumner
     
    BNSF FAN, sidney and peteGSX like this.
  15. Sumner

    Sumner TrainBoard Member

    2,846
    6,001
    63
    I think I'm having a hard time getting my head around that. To me it seems if the only track connected to the rest of the layout is the 'in track' (could be more than one) you don't need to reverse polarity on the table if you rotate the table to any other track and drive off forward (you drove on the table forward).

    [​IMG]

    If you want to turn the table around far enough to where you back off the table onto one of the tracks then the polarity needs to change. Also if you go back to the 'in track' or any other track that you can drive from the 'main' onto the table you would have to change the polarity.

    This is making me think that I'll spend the $34 and use the Tam Valley auto-reverser if I find myself with advancing age screwing up. In fact I have a few Hex frog juicers now and think I might not need 2 circuits on one of those

    Sumner
     
    BNSF FAN and sidney like this.
  16. Bob Brockhouse

    Bob Brockhouse TrainBoard Member

    33
    33
    3
    Thanks to peteGSX,
    Your description of bridge polarity/phasing matches my understanding perfectly.
    Just finding it confusing as to when/where the bridge polarity must change. As a
    starting point, every turntable needs a mandatory "home" position. All other
    considerations need that reference point, feel we would all agree.

    The concept of reverting back at 180 degrees makes sense to me, but again not
    clear on what point the first reverse should happen.

    Great to have your input.

    Cheers
     
  17. Erik84750

    Erik84750 TrainBoard Member

    351
    141
    12
    Many thanks to the valuable contributors on this topic. I watch this thread albeit from "a distance" since I still am recovering from surgery and this does take a bit longer than anticipated. At the moment I am restricted to the absolute minimum with regards to physical and mental activities :).
    I see two "trains of thought": a software solution requiring a "home position" as well as an accumulation register to record the CW and CCW movements in order to decide track polarity
    2. a automated semi-mechanical solution using sensor(s) to determine the absolute turntable position in order to decide track polarity.

    An issue I think arises with the first option which is how to remember the latest position after a power down and restart.

    Therefor I am rather inclined to opt for the second solution by (for example) giving the turntable a below-the-board 180 degrees metallic strip and use a Hall-effect sensor for sensing the turntable position. A bit "crude" but anyway foolproof with regards to power down/up turntable absolute position sensing.

    Any thoughts?
     
  18. Sumner

    Sumner TrainBoard Member

    2,846
    6,001
    63
    If you look at the drawing posted above with the track polarity shown you only need to change polarity if the table rotates to a position where the loco backs off of it or goes all the way around so that the loco drives back off the table onto the track it entered from the main line (could be more than one of these tracks).

    As long as it is going forward onto storage tracks from the table, regardless of the angle, there is no polarity change if they are wired like above to match the 'in' track.

    Sumner

    P.S. Take care of yourself and get well....
     
  19. Erik84750

    Erik84750 TrainBoard Member

    351
    141
    12
    Thank you for your kind wishes Sumner.

    In my concept the turntable rotates either, to outgoing tracks, straight through, or reversed. In order to "keep track" of its final position (hence track polarity reversing or not) an accumulating register would have to account for the executed stepper motor steps. ..if a software solution is used.
    After power off, then on, this value would need to be retrieved from eeprom in order to restore track polarity in the correct sense.

    Please keep in mind that my setup, on initialization, a count is made of the number of steps required for a 360 degree rotation.
    From then on the stepper gets instructed either CW (negative steps) or CCW (positive steps). Every movement (rotation) would the be required to add its value (pos or neg) to an accumulating register (in eeprom); so as to keep track of the absolute turntable position. From there it would be decided what the track polarity should be.

    To me this sounds like a huge load of background tasks.
    A simpler method IMHO would be to use a hardware (optical or Hall) turntable absolute position sensing mechanism.
     
  20. Bob Brockhouse

    Bob Brockhouse TrainBoard Member

    33
    33
    3
    Erik,

    The amount of extra coding required would be huge, so would agree an easier mechanical method
    to achieve a seamless change would be ideal.

    To this end,we do have the auto change based on short circuit detection. Lightning fast. I refer to
    the commercial offerings. A DIY version would be good to see if anybody knows of such an animal.
    Feed the turntable bridge with "lead track" polarity, the short detector will change the polarity as
    needed whenever the bridge aligns with a short circuit on any track.

    Maybe not everyone's solution, but simple, quick automatic and invisable. No coding needed.

    Cheers
     

Share This Page