Total Pageviews

Showing posts with label automatic system. Show all posts
Showing posts with label automatic system. Show all posts

Sunday, March 27, 2022

Arduino automatic model train (2)

original article 1 and article 2

   I updated the schematic and sketch (software/program) for automatic model train. 

Schematic is

and program wrote by me is controlled_model_train_3a.ino (base sketch was presented in previous article + adjust part from Doz's article Arduino Astronomical Clock (or Arduino Pond Pump Controller!)).

   Using menu, we can change:

- language (english/romanian language), but each can put local language instead romanian, my native language.

- succession of read the sensors, to activate sensor in movement direction

- maximum speed (PWM: 200..255)

- minimum speed (PWM: 25..150), usual 105 i minimum for real motor, 25 is best for leds

- step for speed (PWM: 2..20)


   After system is powered, after welcome messages, you will see STOP! and red led flashing

until is push button from encoder:

- short push: enter in normal mode, in pause

- long push, until a star appear, enter in adjusting menu:

    Steps in menu mode (adjust by encoder rotation+ enter value by pushing value, menu jump to next level):
- language selection, values: 0 - english, 1 - romanian language

- direction ( adjust as display direction to be as in reality):
- order of proximity sensor activation (must be same as direction... if locomotive go forward, sensor from front of locomotive must be activate, etc), value is 0 - normal or 1 - inverse (schematic use just 2 sensors)
- maximum speed (PWM), from 200 to 255 (because maximum PWM at usual Arduino is 255)
- minimum speed (PWM), from 25 to 150, for DC motor typical is 105
- step for speed (PWM), from 2 to 20
After pushing the burton, system enter in normal function, so on display is STOP!
After a short push of button, on display is PAUSE (value changed previousin menu).
Speed increase 
until maximum
proximity sensor from front is actuated and speed decrease
until zero... a little pause
speed increase in backward direction
until maximum
When locomotive in backward movement actuate sensor from back side, speed decrease
untill 0.. pause.. speed increase to forward movement, etc....

    If on display movement is to forward and locomotive goes to backward (upper white leds indicate the direction, also bicolor led: red for backward and white for forward direction)
it need to change the direction ( if is 0 change to 1, if is 1 change to 0)
   After that, it need to check order of proximity sensors... if locomotive goes forward, sensor from front must be actuated... so, you remove locomotive from rail, put finger in front of correct sensor and if BRAKE message apear on display, sensors are correctly choose, if NOT enter in menu and change value for position sensor, if was 0 change to 1 and was 1 change to 0.
    I uploaded Arduino automatic model train (5) video with steps described upper:
Also you can watch  Arduino automatic model train (4) video 

Thursday, March 3, 2022

Arduino automatic model train

original article

   As a noobie with the model train system and because I haven't too much free space for test with big railways, I search for an automatic model train system, where it used IR module for define frake momment (stop position is not instant, as in rea case, if push brake pedal and car stop is after few meters).

    First I found the video I Made an Automated Model Train With An Arduino! where it used direct control (DC voltage with normal or reversed polarity). I tested manually the functionality of the system with my adapted sketch as in video Automatic Model Train (test)

After that, I found article Back-and-forth train control by Arduino with IR sensor

with PWM control for speed, so I adapt the sketch (my sketch) and made a first test with push a carriage push by me, to see how system work, as in video Automatic Model Train (test 2)
   Finally, I added L298 H-bridge module as in schematic
    First video is Arduino automatic model train

and second (with an oscilloscope on railway power) is Arduino automatic model train (2)


5-March-2022
    After I clean and greased an old Fleischmann 1966 as in movie 1966 Fleischmann 1306 Shunter: O&K MV9 - Bringing it back to life I make a new video named Fleischmann 1966 on Arduino automatic model train.
   PS: Improved sketch is controlled_model_train_1b.ino where it used for start PWM at 105 (aprox. 40%) not 0, remain maximum at 255 from 255 (100%). This mode to start the loco is useful for old DC motor.
   In next image you can see how automatic system for control the train ("loco") works:
   If train go forward, speed is constant, at maximum, if IR module 2 is actuated, speed decrease slow until train stop. After a small pause, train go backward, with speed increase from zero to maximum, and than IR module 1 is actuated, speed decrease slow to until train stop. Again, after a small pause, train go forward and cycle is repeated, as in next image: