04. Train crossing (part 2) - Automated barrier

Hi,


So, you successfully finished your LED Traffic Lights, nice!

Lets move up a scale and get into the automated barrier.

 

This second part is more complex yet still doable. 

* Read document to the end before ordering your parts!

 

# Train crossing (part 2) - Automated barrier

For the barriers I try to make my own, but soon found myself with no acceptable product, so I bought myself a already finished product from Auhagen (https://www.auhagen-shop.de) and Modelismo Artesanal (https://www.modelismoartesanal.pt/). Noch (https://www.noch.com) and Busch (https://www.busch-model.info/) has some pretty good finishes but weren't available at the time.

From Auhagen

 from Noch

from Busch

from Modelismo Artesanal
from Modelismo Artesanal



From finished product I could get wight into business. But first the material I needed.


Material:


9g servos

* 2x micro servos - don't buy continuous rotating servo, just standard 180º servos. I bough SG90 servos but latter I found that actually the MG90S all metal gears is way more stable.

 

 

  

 

iR sensor



    * 3x iR sensors - found that TCRT5000 fitted my design.

    

 

 

wire Jumpers



 

 * wire jumpers female to female for pyboard interconnection




buzzer

    * 1x buzzer -  found these 1.5V to 30Vdc 12mA from Loudity on my local Electronic store pretty cool. Buy 2x just in case.

 

 

 

K-Line sheet

* 1x sheet of K-line - 3mm will be fine for the electronics apparatus. Also used 3mm hard cardboard on a latter model.





Step 1 - Build the Electronics support.

Cut a square piece of K-line sheet, the the size of the crossing. This will be used to attach and connect all the electronics below the train crossing.

Make space to include one or two tracks as desired. Remember if you use 2x tracks you will need to increase your iR sensors from 3x to 4x (code is ready for up to 4x iR sensors)

Cut the holes for the servo actuator and iR sensor. Test with servos more less in place directly bellow the barrier actuator but slight deviated with the barrier pendulum.

When testing the servo actuator I found that best moves slight diagonally from barrier pendulum, not straight in line, since the barrier moves diagonally just like the servo arm.

K-line for Electronics support with holes needed


 

To interconnect the Servo to the barrier pendulum I used a paper clip that I bended and cut to my desire.

 

Step 2 - Glue the Servos to the lower part of the K-line sheet with the paper clip in place. It's best this way because space is not abundant to work. The pendulum of the Auhagen set already has a hole to insert a paper clip, no need to drill. I made some servo supports to screw the servo in place, so I don't have to glue the servo to the K-line, giving me some space to manoeuvre.
After all fits right in place you can add slight glue to servo onto the K-line so it doesn't move sideways.

* * *

testing...

For this you need to connect all Electronics to the pyboard with the SW loaded in the Micropython board and all the apparatus in the K-line.

Obs. You can use previously adapted USB charger to power your MicroPython project.

Connect everything like bellow:


 

to test use the iR sensor, or press the 'USR' switch on the pyboard 

The remaining two or three iR sensor you will install on the remaining track to detect train before entering and after leaving either side of the St. Andrews Crossing. Pyboard has one dedicated entry for each iR sensor, you can connect up to four. 

Apparatus under Train Crossing

* * *

Pyboard Software:

Revert to Micro Python SW section on this blog to understand the Python code or simply download latest version below for your St. Andrews Crossing.

* * *

Video from the final product

 
 

MB

 

 --> 04/2024

Design flaws and corrections

 After intensive testing some corrections to HW and SW were needed.

HW 

- replaced original servos for a better all metal gear. Original ones had some type of glitch and unstable movement. So... replaced the plastic SG90 by all metal gear MG90S, witch is a better upgraded version of the SG90. Best found that Servos operate at 6Vdc, so I bought a L7806CV voltage regulators for micropython supply.

L7806CV                                              MG90S                 

- The iR sensors were connected to 3.3V from micropython as stated in vendor documentation. 'Kinda' burned a couple with 5V until I realize the mistake. So... Re-wiring was needed, and diagram above was updated.

 

 SW

- reshaped SW to allow 4x iR sensors individual input and not in series connection. Now, all iR sensors have a separate input on micropython. Also added an external config.txt file for servo adjustment without the need to tamper with main code.

config.txt
    closed_1,xx -> closed position for servo1
    closed_2,xx -> closed position for servo2
    open_1,xx   -> opened position for servo1
    open_2,xx   -> opened position for servo2

  download and upload these two files below to pyboard

 main.py

 config.txt


New Design with kit from modelismoartesanal.pt
 


Comments

Popular posts from this blog

07. Train crossing available for order V3.0

06. Automated Wind Mill