Toto's Traversers

Discussion in 'Workshop Benches' started by paul_l, May 6, 2017.

  1. paul_l

    paul_l Staff Member Administrator

    Messages:
    9,423
    Likes Received:
    5,370
    Joined:
    Dec 5, 2015
    There here - I ordered 4 of the wee fella's (I do have three traversers - so far).


    With a screen size of approx 60 x 40 mm.

    It's an arduino shield that will sit on top of either a Uno or Mega.


    and notice the microSD card slot at the base, I have a few idea's for this.

    Paul
     
  2. Toto

    Toto I'm best ignored Staff Member Founder Administrator

    Messages:
    15,419
    Likes Received:
    3,842
    Joined:
    Dec 5, 2017
    Does it buy pints ?
     
  3. paul_l

    paul_l Staff Member Administrator

    Messages:
    9,423
    Likes Received:
    5,370
    Joined:
    Dec 5, 2015
    Not now the bank accounts empty :facepalm:

    But maybe by Friday ...........

    Paul
     
  4. paul_l

    paul_l Staff Member Administrator

    Messages:
    9,423
    Likes Received:
    5,370
    Joined:
    Dec 5, 2015
    Wow 4 years later .................

    Life goes on and like most of the Bosses jobs list you can only punt them into the long grass for so long before it bites you in the ****.

    My local club's new N gauge has had a few issues so will not be ready for the Clubs exhibition in October - so I've been asked to bring Another Bridge - oh :facepalm:

    A few transport repairs carried out - stored vertically for 4 years in a spare room infront of a set of wardrobes was probably not the best idea. But then I only got planning permission for a couple of weeks :whatever:.

    Apart from it not working Toto's other main gripe was he didn't like using the DCC controller and or JMRI to control the traverser, he wanted more local control.

    I tried to fix the existing program - coffee costs were mounting and I was getting knowhere.

    Time to cut my losses - and start from scratch - looked at the sketch, and thought Forget that.

    So I looked through the multiple versions to try and find one that I could follow - 4 years ago is pre-covid when I actually worked for a living and had some idea of what I was doing, definately older and not wiser.

    Found one that I hope is similar to the version installed on the Mk2 traverser.

    Stripped out all the DCC code - definately commited now - some would it was due years ago.

    The intension was to make as few alteration to the board design as possible as that worked on the MK2 without issue.

    Plan 1

    Small form factor operating panel (may even be portable rather than fixed)
    Oled display for showing status and track selection
    Rotary encoder switch to choose between tracks, then press the knob to select the track.

    The rotary switch has 5 connections - +ve, -ve, Switch, Data B (or DT) and Data A (or CLK).


    Got the above to work, however was too sensitive, to move the track by one you needed to mid notch, and when added to the main program (sketch), it never picked up the changes.
    Further research, recommended using 2 interupts, which on the uno / nano is ports 0, 1, 2 & 3 - Damn. Ports 0 & 1 are the serial connection, so already in use, and port 2 is connected to the Opto-isolator for the DCC decoding routines. If I was making this again then I may do it Rotary switch only, but I aint touching that side of the board as it works.

    Plan 2

    Small form factor operating panel (may even be portable rather than fixed)
    Oled display for showing status and track selection
    Push buttons to toggle between tracts and another to select the track to move to.

    Now I have used 3 push buttons
    1- Left hand Button - decrement track value
    2 - Middle Button - Select track to move to
    3 - Right hand Button - increment track value

    As I only have 4 tracks and currently only one end of the traverser is in use, then a single button would have been sufficient - just three clicks away from any track. However I am wanting to keep the design flexible and easily transferable to a bigger project - you never know.

    The OLED screen is an I2C device - just four wires +ve, -ve, SCL (Clock) & SDA (Data)

    Ok first change, my homing pin was using D18 (A4) - it was convinient, but D18 is the I2C SDA pin, so a move to D14 (A0)
    Final list is ..........................

    D4 - Output Big Easy Driver (DR) Direction
    D5 - Output Big Easy Driver (ST) Step
    D6 - Output Big Easy Driver (EN) Enable
    D7 - LED output
    D8 - LED output
    D14- Home Switch (A0)
    D15- Push button - (A1)
    D17- Push button Select (A2)
    D16- Push button + (A3)
    D18- SDA I2C for Oled Screen (A4)
    D19- SCL I2C for Oled Screen (A5)

    Now I would like to say it twas a doddle, but shear incompitance and ignorance prevailed

    Everything was programmed in and not producing complie errors - eventually :facepalm:

    But nowt appeared to happen.
    I could see the inputs on screen, but no matter how many times I pressed the buttons the state didn't change.

    The answer was only three lines lower, but I had added so many serial.Print statements to try and fault find the issue I couldn't see it.....:hammer:

    pinMode (pb1,INPUT);
    pinMode (pb2,INPUT);
    pinMode (pb3,INPUT);


    pinMode(home_switch, INPUT_PULLUP);

    I hadn't added the INPUT_PULLUP to the definition of the pushbuttons, just as an input. The effect is the pullup option puts 5V via a high resistor to the input, so it is held at 5V (or VCC which should be 5V or near as damit). The switch will ground it when pressed. I was getting spurious readings / values as the voltage fluctuated above 0.
    The downside is the logic is then reversed - when the switch is open (not pressed) then the inut is HIGH (1), when the switch is pressed - closed then the input is LOW or 0.

    So we know have

    pinMode (pb1,INPUT_PULLUP);
    pinMode (pb2,INPUT_PULLUP);
    pinMode (pb3,INPUT_PULLUP);



    pinMode(home_switch, INPUT_PULLUP);

    Next up what do with the results

    pb1State = digitalRead(pb1); // Reads the "current" state of the pb1 - Decrement counter
    pb3State = digitalRead(pb3); // Reads the "current" state of the pb3 - Increment counter
    pb2State = digitalRead(pb2); // Reads the "current" state of the pb2 Select

    if (pb1State == 0 && pb3State==1){
    counter=counter -1;
    if (counter < 1) counter =4;{}
    }
    if (pb3State == 0){counter=counter+1;
    if (counter > 4) counter =1;{}
    }

    oledDisplayCounterValue();
    if (pb2State==0){
    NewPosition = counter;
    Serial.print("Move to Position: ");
    Serial.println(NewPosition);
    oledDisplayMoveToText();

    Anything that starts with oled.........

    Are seperate routines (something else I've needed to learn :whatever:) for displaying values on the oled display

    The versions are still having effects on the program especially the enable/disable outputs,

    pinMode(StepperEnable,OUTPUT); //Set pin D6 for output
    digitalWrite(StepperEnable, HIGH); // Turn off stepper outputs until needed

    Everytime I try and use this from the original program, I get to use it once as either HIGH (disable) or LOW (enable), but then I cant change the value so the stepper out is either permanently off or on.
    There are newer commands

    stepper1.disableOutputs();

    but I can't get it to work either.

    However I now have a working traverser

    and the dongle looks like this


    Just need design and print a cover, oh and make another for the other traverser.

    Paul
     
    pjd, Andy_Sollis and Rob Pulham like this.
  5. paul_l

    paul_l Staff Member Administrator

    Messages:
    9,423
    Likes Received:
    5,370
    Joined:
    Dec 5, 2015
    To refine the ugly cable connection on the left, I have just ordered up these

    upload_2023-9-17_14-23-35.png

    6 x ethernet sockets, as I used an ethernet cable to create existing cable extension cable for the dongle it should do.
    I will need to bell out the connectons to make sure the wire hookups align, but hey I have a crimping tool so can make up a custom cable if required.

    Paul
     
    pjd, Andy_Sollis and Rob Pulham like this.
  6. Andy_Sollis

    Andy_Sollis Staff Member Moderator

    Messages:
    3,514
    Likes Received:
    3,301
    Joined:
    Aug 4, 2018
    It's all go.. ! great to see some progress again. Tom's gone very quiet, is he joining you ? (Bit far to volunteer some help sadly)
     
  7. Gary

    Gary Wants more time for modelling.... Staff Member Administrator

    Messages:
    7,127
    Likes Received:
    3,602
    Joined:
    Dec 5, 2015
    Bugger all that electro-wizardry, I'd go for a manual traverser ! At least the only thing that could go wrong would depend on how much you drank the night before... :facepalm:

    Cheers, Gary.
     
    Andy_Sollis and Walkingthedog like this.
  8. paul_l

    paul_l Staff Member Administrator

    Messages:
    9,423
    Likes Received:
    5,370
    Joined:
    Dec 5, 2015
    That's a common problem - often exacerbated by Toto's curry selection.

    The bit I like about the DCC control, is when there are only 2 of you operating, the fiddle yard(s) can be setup with 3 trains each, and one person can operate the layout on thier own.

    The MK2 traverser, just powered it up and worked first time - I'm as shocked as anyone.

    Paul
     
    Last edited: Sep 20, 2023 at 10:14 AM
    Gary and York Paul like this.
  9. Gary

    Gary Wants more time for modelling.... Staff Member Administrator

    Messages:
    7,127
    Likes Received:
    3,602
    Joined:
    Dec 5, 2015
    Yes, we all know about Toto's curry selection... I shared a room with him.... :avatar::avatar:

    Cheers, Gary.
     
    Andy_Sollis likes this.

Share This Page