Jump to content
RMweb
 

Erik84750

Members
  • Posts

    19
  • Joined

  • Last visited

Posts posted by Erik84750

  1. Hi,

     

    after a few days of testing I want to present to you my version of a full automatic bi-directional auto-reverser. The drawing is based on a drawing by Dutch-Master who of course is given due credit in the attached drawing.

    The drawing I made with Adobe Illustrator, I am not too proficient with that program, it took me 6 hours to have it done.

     

    I decided not to include frog powering (see Dutch-Master diagram above) because that is part of the switch command hardware.

     

    Design constraints:

     

    1. create a full automatic autoreversing controller

    2. for bi-directional use

    3. with no stopping of the loco/train

    4. without use of short-circuit detection (IMO this is a rather crude way of automating a project). But if you definitely want to use short-circuit detection then this is also allowed, just make sure that proper HIGH or LOW signals are given.

    5. with the use of any type of sensor (optical, inductive, capacitive, reed-relay, .. just anything that 100% reliably detects a loco above or underneath it), with preferably (but not necessarily: I just need to change the code a bit) a LOW signal when nothing is detected and a HIGH signal when detection occurs

    6. cheap (I used for testing a ATtiny85 (1.5EUR), and 3 LDR's (1EUR for 20) and a 1EUR DPDT relay (4-pole must be used if the optional tracks are cut): total cost less then 5EUR in hardware.

    7. reliable: it all depends on the sensors used; the software is foolproof and thoroughly tested.

    8. any type of Atmega controller can be used: Arduino, Pro-Mini, ATtinyxx, etc..

    9. 5V power supply for relay, sensors, controller

    10. Must be able to be used for nested reversing loops, sequenced reversing loop, multiple reversing loops, etc..

     

    If needed I can program the controller for you, just send me 2 units: one for return programmed and one to cover postage; just pm me.

     

    The ATtiny I used has following connections (see also the code):

    PB0 = LDR1 (the one inside the loop)

    PB1 = LDRa

    PB2 = LDRb

    PB3 = Relay output (EDIT: beware: a controller supplies a max of about 10 to 20mA safely per output: use a high impedance relay http:// https://www.aliexpress.com/item/Smart-Electronics-5V-1-One-Channel-Relay-Module-Low-level-for-SCM-Household-Appliance-Control-For/32707870640.html?spm=2114.01010208.3.15.PhUyWN&ws_ab_test=searchweb0_0,searchweb201602_1_10152_10065_10151_10068_436_10136_10137_10157_10060_10138_10155_10062_10156_10154_10056_10055_10054_10059_10099_10103_10102_10096_10147_10052_10053_10142_10107_10050_10051_10084_10083_10080_10082_10081_10177_10110_10111_10112_10113_10114_10181_10037_10183_10182_10032_10078_10079_10077_10073_10070_10123,searchweb201603_2,ppcSwitch_5&btsid=e12d5bc7-2fcb-4393-a7f1-962add4c8dd9&algo_expid=80f49ff8-c3f2-46e0-b17d-58936f8fd807-2&algo_pvid=80f49ff8-c3f2-46e0-b17d-58936f8fd807  which in turn drives the power relay).

     

    Make sure you cut the trace to the LED connected to PB1 or the voltage divider used for the LDR will not work properly. But best of all is to use an LDR driving a comparator, no need for calibration.

     

    This is the controller I use: https://www.aliexpress.com/item/Free-shipping-GY-Digispark-kickstarter-miniature-minimal-development-board-TINY85-module-for-Arduino-usb/2053597206.html?spm=2114.01010208.3.230.SkLJ9m&ws_ab_test=searchweb0_0,searchweb201602_1_10152_10065_10151_10068_436_10136_10137_10157_10060_10138_10155_10062_10156_10154_10056_10055_10054_10059_10099_10103_10102_10096_10147_10052_10053_10142_10107_10050_10051_10084_10083_10080_10082_10081_10177_10110_10111_10112_10113_10114_10181_10037_10183_10182_10032_10078_10079_10077_10073_10070_10123,searchweb201603_2,ppcSwitch_5&btsid=f75f8d6b-a1bc-412f-bc15-ba5dbc74f73a&algo_expid=544ddd38-f756-42e3-8ad3-7dd445f0e91d-29&algo_pvid=544ddd38-f756-42e3-8ad3-7dd445f0e91d

     

    Sensors of any shape, type, price can be found on that site. So far I have ordered 450+ items from them and just a few never arrived for which I got my money back.

     

    My code (actually the code has just 4 read lines and 4 command lines, so fairly easy to read):

    const byte Relay = 3;
    const byte LDRa = 1;
    const byte LDRb = 2;
    const byte LDR1 = 0;
    boolean A = LOW;
    void setup() {
      pinMode(Relay, OUTPUT); //setting the pin mode to Output
      digitalWrite(Relay, LOW);
    }
    
    void loop() {
      int stateLDRa = digitalRead(LDRa);
      int stateLDRb = digitalRead(LDRb);
      int stateLDR1 = digitalRead(LDR1);
      int stateRelay = digitalRead(Relay);
      if (stateLDRa == HIGH && stateLDR1 == LOW && stateLDRb == LOW)  //condition 1; clockwise
      { digitalWrite(Relay, HIGH);
        A = HIGH;
      }
      if (stateLDRa == LOW && stateLDR1 == HIGH && stateLDRb == LOW && A == HIGH) //condition 2; clockwise
      { digitalWrite(Relay, LOW);
      }
      if (stateLDRa == LOW && stateLDR1 == LOW && stateLDRb == HIGH) //condition 3; clockwise and counterclockwise: set relay low
      { digitalWrite(Relay, LOW);
        A = LOW;
      }
      if (stateLDRa == LOW && stateLDR1 == HIGH && stateLDRb == LOW && A == LOW)  //condition 4; counterclockwise: set relay high
      { digitalWrite(Relay, HIGH);
      }
    }
    

    Any feedback is more than welcome!

    Rgds,

    Erik

    post-31782-0-05708800-1493909763_thumb.jpg

  2. For example if you have a solenoid point motor you can connect a twin coil DPDT latching relay in parallel with the solenoid coils to provide the DPDT polarity switching, or use a Peco PL15 auxilliary switch. As for the photocell activation you can use something that works in parallel with the solenoid activation pushbuttons to provide a wired OR function.

     

    Suzie x

    Right!

     

    You are very smart! Thks,

    Erik

  3. If using the photocell approach it is often best to link the polarity switching to the point, and use the photocells to switch the point to align it with the oncoming train.

    Hi Suzie, can you plse explain what you mean by "polarity switch"? Do you mean a switch (for example DPDT) that is connected to the switch activation?

     

    And if I understand you correctly you mean to use the photocells to allign the switch for the outgoing loco? If so, I would have to insert an "or" function if I also want to allign the switch manually for incoming loco's?

  4. Yes!

     

    Dutch Master has shown the ultimate way to wire things if you are likely to run an incorrectly set point, but there is no real need to do that unless you have dead sections on the frogs of all your other points too. If you study Dutch Master's diagram you will see that the brown wire and the blue wire are always the same polarity so the lower pole of the switch is unnecessary, and if you wire the inner rail of the loop all the way to the frog with no insulated joiners eliminating the dead sections the third pole down is not required either.

     

    Suzie x

    Thank you! What a clear explanation. I studied Dutch Master's diagram in detail now and with his and your help it all cleared up for me.

     

    Meanwhile this morning I did the test with a DPDT switch throwing phases around (ie switching rail connections to the booster) on the fly and what my seem like common sense to you was a revelation for me: loco keeps moving in the same direction whatever the phases connected between booster and rails.

     

    So this morning too I decided to solve the loop control with a little controller, three photoresistor cells and a DPDT or if using Dutch Master advice 4PDT relay:

     

    One cell on each leg of the loop after the switch but before any gap (photocells A and B) and one cell inside of the loop (photocell number 1). When cell A detects a loco the loop track power is alligned to that of the A part (left and right tracks are electrically alligned). When cell A is cleared again the polarity gets reversed. Photocell 1 detects the loco and prevents cell B (when the loco exits the loop) from switching again. Cell B is cleared after the loco exits the loop and leaves further down the track. The software routine is ready to start over again, from either side.

     

    One ATtiny85 (EUR1 delivered home from AliExpress), 3 photoresistors (EUR1 for ten pcs), and a 5V powered 10A DPDT relay (EUR1), and half an hour of programming and testing. Could be done with an Arduino or Pro Mini too but they are a bit overkill here.

     

    I posted the same question on two French fora and one American forum: the French either did not really understand what it was about, talked a lot but I could not get working answers and the American forum used the purchasing option for commercial products.

    I still have to find a Belgian forum :sungum:

     

    Thanks a lot everyone for your help!

    Erik

  5. There is a simple way of doing this - DCC or analogue. On the assumption that the layout is as the diagram above, gap both rails on the loop side of the point and feed through a DPDT switch (centre off, if required to isolate the section). Centre terminals to the power supply, cross wire the outer terminals and supply the track from one of the outer sets of terminals. Mark one setting "in", the other "out". The "in" setting should have the loop polarities as the incoming line, the "out" will reverse as for outgoing.

     

    Drive the train in. Stop before the exit. Switch point (manually or electrically) and switch DPDT to "out". Drive train out.

     

    It isn't automatic and you need to be able to see the train to stop in the right place. It does not have the expense and complexities above, but it is simple and will work.....

    In my opinion no need for center off DPDT: reasonable quality (even Chinese) regular DPDT switches do the job. The construction of a DPDT is such that no overlapping contacts occur.

     

    And the loco does not need to be stopped: you can do it on-the-fly.

  6. Here's the basic diagram for a return loop:

     

    attachicon.gifkeerlus-2.jpg

     

    Can be used in clock- and anti-clock-wise directions, trains stop automagically (if loco-hauled, or power pickup only from the front car) and will only continue when you change the point and does all the necessary polarity switching required. Point motors with 4 sets of contacts are not quite common in the UK, but available from Herkat/Bemo (Germany) and Fulgurex (Switzerland, needs extra contacts but these screw on easily) or use extra relays instead.

    Hi, so it is not as simple as I thought.

     

    But looking at your diagram I see that the gaps are not identical (same place on both sides of the track) for both rails. For example the first part in the curve at the switch, at the bottom, is always connected to "black", yet when the poles of the relay are thrown, the upper part of the track in this curve also is connected to "black". So no traction there?

     

    Also orange is either connected to "red" or to nothing, while grey is connected to nothing or to "black": what is the purpose?

     

    I do not yet understand the benefit of using the 4-pole relay: if the contacts are thrown both tracks switch poles except for the orange and grey rails. Something I miss?

  7. Most layouts do not need an auto-reverse module to control the polarity of the reverse loop, it can be done simply with a switch (like a Peco PL15 for example) attached to the point that controls entry to the reverse loop.

     

    Do you have a track plan of what you want to do yet?

    If I understand this well: a DCC layout with a reversing loop which has a powered switch only needs a double pole double throw DPDT relay connected to the switch powerleads for the autoreversing to work?

     

    In other words: (rails before the switch: A and B, rails after the switch and in the loop: X and Y, DCC booster connected to tracks A and B) the switch is set to "pass straight" and the DPDT relay connects rails before and after in correct phasing (A to X and B to Y). the loco continues in the loop, you set the switch to "pass curved", and the DPDT relay gets thrown to the other pole: rail A to rail Y and rail B to rail X.

     

    Is it as simple as that?

     

    Erik

×
×
  • Create New...