Welcome to the forum   
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Share
Options
View
Go to last post in this topic Go to first unread post in this topic
Offline GaryTrooper  
#1 Posted : 03 November 2018 05:46:45(UTC)
GaryTrooper

United States   
Joined: 26/01/2018(UTC)
Posts: 191
Location: Hailey, Idaho
I do know Marklin M track solenoids can be operated on DC. I just felt like driving them with AC. This was the first successful trial.

G - LGB
O - Lionel and MTH
HO - Marklin
N - Mix of manufacturers mostly Kato
thanks 8 users liked this useful post by GaryTrooper
Offline GaryTrooper  
#2 Posted : 22 November 2018 03:56:23(UTC)
GaryTrooper

United States   
Joined: 26/01/2018(UTC)
Posts: 191
Location: Hailey, Idaho
20181121_174612~2.jpg

Arduino Due control of 13 switches and 12 Signals.
G - LGB
O - Lionel and MTH
HO - Marklin
N - Mix of manufacturers mostly Kato
thanks 7 users liked this useful post by GaryTrooper
Offline GaryTrooper  
#3 Posted : 26 November 2018 00:49:46(UTC)
GaryTrooper

United States   
Joined: 26/01/2018(UTC)
Posts: 191
Location: Hailey, Idaho


Control bugs worked out today which includes a reset button for setting the switches and signals into the "all trains parked" positions.




G - LGB
O - Lionel and MTH
HO - Marklin
N - Mix of manufacturers mostly Kato
thanks 5 users liked this useful post by GaryTrooper
Offline GaryTrooper  
#4 Posted : 30 November 2018 04:14:11(UTC)
GaryTrooper

United States   
Joined: 26/01/2018(UTC)
Posts: 191
Location: Hailey, Idaho




Refining the controls with the addition of "run" and "park" routines for 12 sidings. The next step will be to add feedback so the trains can consecutively trigger each other.
G - LGB
O - Lionel and MTH
HO - Marklin
N - Mix of manufacturers mostly Kato
thanks 2 users liked this useful post by GaryTrooper
Offline GaryTrooper  
#5 Posted : 09 December 2018 18:14:26(UTC)
GaryTrooper

United States   
Joined: 26/01/2018(UTC)
Posts: 191
Location: Hailey, Idaho
Today the AC to DC optoisolator circuit bugs were worked between the Marklin ~17 VAC input and the Arduino analog inputs. I chose to use the analog inputs to maximize the digital in/out pins for output control. Now the system is capable of feedback for knowing where the trains are.

If anyone wants to see the Arduino code or the Processing code let me know and I'll post it. I'm sure there are skilled programmers out there who could greatly streamline my patchwork of simple code routines.

G - LGB
O - Lionel and MTH
HO - Marklin
N - Mix of manufacturers mostly Kato
thanks 3 users liked this useful post by GaryTrooper
Offline GaryTrooper  
#6 Posted : 26 January 2019 16:34:33(UTC)
GaryTrooper

United States   
Joined: 26/01/2018(UTC)
Posts: 191
Location: Hailey, Idaho
velpicjoincollage20190126_082354.jpg

I finally added feedback sensors. Now the trains can sequentially trigger each other to run.
G - LGB
O - Lionel and MTH
HO - Marklin
N - Mix of manufacturers mostly Kato
thanks 3 users liked this useful post by GaryTrooper
Offline GaryTrooper  
#7 Posted : 29 January 2019 02:21:31(UTC)
GaryTrooper

United States   
Joined: 26/01/2018(UTC)
Posts: 191
Location: Hailey, Idaho


Coded a few sequential trains. Several more to go. Soon it will be time to continue on level two.
G - LGB
O - Lionel and MTH
HO - Marklin
N - Mix of manufacturers mostly Kato
thanks 3 users liked this useful post by GaryTrooper
Offline GaryTrooper  
#8 Posted : 18 February 2019 23:11:08(UTC)
GaryTrooper

United States   
Joined: 26/01/2018(UTC)
Posts: 191
Location: Hailey, Idaho


12 train control with sequential operation maxes out the Arduino Due. The 12 train sequence is now becoming more and more reliable. Just a few more grade and sensor tweaks are needed before moving up a level.
G - LGB
O - Lionel and MTH
HO - Marklin
N - Mix of manufacturers mostly Kato
Offline DaleSchultz  
#9 Posted : 19 February 2019 00:38:11(UTC)
DaleSchultz


Joined: 10/02/2006(UTC)
Posts: 3,161
so you are controlling the turnouts, but are the trains being controlled digitally or are you switching track current on and off using the Duo?

For the turnouts are you using MOSFETs or simple relays?
Dale
Intellibox + own software, K-Track
My current layout: https://cabin-layout.mixmox.com
Arrival and Departure signs: https://remotesign.mixmox.com
Offline GaryTrooper  
#10 Posted : 19 February 2019 02:42:59(UTC)
GaryTrooper

United States   
Joined: 26/01/2018(UTC)
Posts: 191
Location: Hailey, Idaho
Originally Posted by: DaleSchultz Go to Quoted Post
so you are controlling the turnouts, but are the trains being controlled digitally or are you switching track current on and off using the Duo?

For the turnouts are you using MOSFETs or simple relays?



I'm not controlling track voltage with the Arduino. Only the signals and turnouts. I'm running the locomotives using analog, directly from the transformers. Some day I may convert the locomotives to digital but there are many and I want to get the layout built up.

The turnouts and signals are AC driven using TRIACs controled by the Arduino.
G - LGB
O - Lionel and MTH
HO - Marklin
N - Mix of manufacturers mostly Kato
thanks 2 users liked this useful post by GaryTrooper
Offline GaryTrooper  
#11 Posted : 24 March 2019 22:08:11(UTC)
GaryTrooper

United States   
Joined: 26/01/2018(UTC)
Posts: 191
Location: Hailey, Idaho
velpicjoincollage20190324_125934.jpg

I've been replacing the homemade track sensors with the old style contact tracks. The old style contact track is a much better solution.
G - LGB
O - Lionel and MTH
HO - Marklin
N - Mix of manufacturers mostly Kato
Offline DaleSchultz  
#12 Posted : 10 August 2019 21:50:08(UTC)
DaleSchultz


Joined: 10/02/2006(UTC)
Posts: 3,161
what optoisolator are you using ?
would you share your circuit showing track switching -> to GPIO pin input?
Dale
Intellibox + own software, K-Track
My current layout: https://cabin-layout.mixmox.com
Arrival and Departure signs: https://remotesign.mixmox.com
Offline GaryTrooper  
#13 Posted : 11 August 2019 03:19:22(UTC)
GaryTrooper

United States   
Joined: 26/01/2018(UTC)
Posts: 191
Location: Hailey, Idaho
Originally Posted by: DaleSchultz Go to Quoted Post
what optoisolator are you using ?
would you share your circuit showing track switching -> to GPIO pin input?


Here are photos of the sensor circuit, data, and parts. Take a look. It should describe the circuit pretty well. Let me know if you have any questions. I'll try to answer as best I can.

Screenshot_20190810-190919_Drive~2.jpg

Screenshot_20190810-183350_Photos~2.jpg

20190810_182427~2.jpg

Regards,

Gary
G - LGB
O - Lionel and MTH
HO - Marklin
N - Mix of manufacturers mostly Kato
Offline DaleSchultz  
#14 Posted : 11 August 2019 03:33:42(UTC)
DaleSchultz


Joined: 10/02/2006(UTC)
Posts: 3,161
great info, thanks, yes a couple of questions...

The data sheet says to install a 0.1μF capacitor between pins 5 and 8. I don't see it on your diagram - why? (You have 10μF between 5 and 6 though)

Why not invert the signal in the code instead of inverting the signal with a second chip? (Perhaps I don't understand what it does.)

Your contact track puzzles me a bit. It shows AC power going to the inputs of the optocoupler, but normally we isolate one side of a section of the running rail and simply ground that by running an axle onto the section, so I am looking to detect connection to ground. I guess I could simply run a few volts to ground to create enough current in the input side of the opto.

Dale
Intellibox + own software, K-Track
My current layout: https://cabin-layout.mixmox.com
Arrival and Departure signs: https://remotesign.mixmox.com
Offline GaryTrooper  
#15 Posted : 11 August 2019 04:01:58(UTC)
GaryTrooper

United States   
Joined: 26/01/2018(UTC)
Posts: 191
Location: Hailey, Idaho
Originally Posted by: DaleSchultz Go to Quoted Post
great info, thanks, yes a couple of questions...

The data sheet says to install a 0.1μF capacitor between pins 5 and 8. I don't see it on your diagram - why? (You have 10μF between 5 and 6 though)

Why not invert the signal in the code instead of inverting the signal with a second chip? (Perhaps I don't understand what it does.)

Your contact track puzzles me a bit. It shows AC power going to the inputs of the optocoupler, but normally we isolate one side of a section of the running rail and simply ground that by running an axle onto the section, so I am looking to detect connection to ground. I guess I could simply run a few volts to ground to create enough current in the input side of the opto.



I found that a 10 uF capacitors works better than 0.1 uF. It provides better debounce (for lack of a better term) due to less sensitivity. The circuit works if the capacitor is connected across pins 5 and 6 or across pins 5 and 8. It was easier to build the homemade circuit board using pins 5 and 6.

It is possible to invert the logic in code rather than a chip yes, but the output of the optoisolator will not drive the input of the Arduino. I needed a chip to drive the input of the Arduino. A hex inverter has the most number of logic gates in one chip.

The old style contact tract is shown in the schematic as a switch. The contact track does complete the AC portion of the circuit when the wheels and axle roll over the contact track, making a connection between the insulated rail and the non-insulated rail. I do generally think of the M track metal base as a "ground bus" even though its AC.

Edited by user 11 August 2019 07:39:48(UTC)  | Reason: Not specified

G - LGB
O - Lionel and MTH
HO - Marklin
N - Mix of manufacturers mostly Kato
thanks 1 user liked this useful post by GaryTrooper
Offline tiono  
#16 Posted : 11 August 2019 13:34:07(UTC)
tiono

United States   
Joined: 09/02/2010(UTC)
Posts: 224
Originally Posted by: GaryTrooper Go to Quoted Post

It is possible to invert the logic in code rather than a chip yes, but the output of the optoisolator will not drive the input of the Arduino. I needed a chip to drive the input of the Arduino. A hex inverter has the most number of logic gates in one chip.


According to datasheet; the optoisolator use open-collector output.
It can drive the input of Arduino directly without additional chip. Simply by configuring the input to use internal pull-up resistor.
Inside the Arduino setup, use: pinMode( input_pin, INPUT_PULLUP);


thanks 1 user liked this useful post by tiono
Offline GaryTrooper  
#17 Posted : 11 August 2019 14:30:40(UTC)
GaryTrooper

United States   
Joined: 26/01/2018(UTC)
Posts: 191
Location: Hailey, Idaho
Thanks, I'll try pinMode( input_pin, INPUT_PULLUP) on the next project.

Gary
G - LGB
O - Lionel and MTH
HO - Marklin
N - Mix of manufacturers mostly Kato
thanks 1 user liked this useful post by GaryTrooper
Offline GaryTrooper  
#18 Posted : 09 December 2019 00:57:30(UTC)
GaryTrooper

United States   
Joined: 26/01/2018(UTC)
Posts: 191
Location: Hailey, Idaho
Originally Posted by: tiono Go to Quoted Post
Originally Posted by: GaryTrooper Go to Quoted Post

It is possible to invert the logic in code rather than a chip yes, but the output of the optoisolator will not drive the input of the Arduino. I needed a chip to drive the input of the Arduino. A hex inverter has the most number of logic gates in one chip.


According to datasheet; the optoisolator use open-collector output.
It can drive the input of Arduino directly without additional chip. Simply by configuring the input to use internal pull-up resistor.
Inside the Arduino setup, use: pinMode( input_pin, INPUT_PULLUP);




So I'm back into the Arduio to add some controls to the layout and I realized that I didn't give complete information during the last conversation. All of the input signals are employing the analog input pins as all the digital pins are being used for output signals. That's why the use of the gated chip before the input pins. Is there code for pulling up, or down an analog input pin? I'm guessing no as that would defeat the purpose of the analog input pin.

Thanks,

Gary
G - LGB
O - Lionel and MTH
HO - Marklin
N - Mix of manufacturers mostly Kato
Users browsing this topic
OceanSpiders 2.0
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

| Powered by YAF.NET | YAF.NET © 2003-2019, Yet Another Forum.NET
This page was generated in 0.583 seconds.