Jump to content

Help requested with Arduino automation


TheMonark

Recommended Posts

Hi All:

 

I am a newbie who is starting to build N-scale model using Tomix. I know I am shooting for the stars at the first attempt. However, I want to it be more of a learning experience than a successful experience. I have created a basic design of two track layout where I want to run two trains in opposite direction. Both these tracks converge to a double track station set. I plan to use arduino for the automation. I have decent programming experience in general but arduino per say. 

 

I want to request all of you guys to provide your critique and suggestions on the layout.

 

Planning Notes:

> Both the trains running will have two power cars at each end

> All 4 turnouts are not powered

 

Layout Logic - 

> Train A will always have priority for turnout use

> If Train A reaches Sensor 1, Arduino will check the status of Sensor 2 and 4. If both of these sensors are off, then it will turn on Switch 1 and 2 to allow Train A to move to the station. As soon as Train reaches Sensor 3, it will cut off the power to Feeder 4 thereby stopping the train. Meanwhile, if the Train B reaches Sensor 4, it will be stopped there

> Once the Train A is parked at station, Train will be get the green light on Switch 3 and 4 and will stop near Sensor 2

 

Apologies for any newbie mistakes. 

 

MySecondFinal.jpg

Link to comment

Maybe this was not seen by many.  It should be in the layout sub-forum or maybe the automation sub-forum

Edited by chadbag
Link to comment

I've moved it to the automation subforum as it seems most appropriate.

 

@TheMonark, there a couple of people around who might have some experience with what you're doing but it's a bit of a niche.

 

A more descriptive title might help too, e.g. "Help requested with Arduino automation" or something. A post in the "Welcome" section with a brief introduction will also be a good way of attracting attention.

  • Like 1
Link to comment
3 hours ago, TheMonark said:

No response. Anyways, thanks everyone for reading. I guess I need to figure it out on my own.

 

The heading almost sounds like it is political. 

Link to comment

Monark,

 

squid made a good suggestion on the intro, helps get folks to respond. I changed the title to get more eyeballs. Take a look thru the automation sub forum here as several folks have done similar things. Might try to pm a couple if you have specific questions and strike up a conversation. Most automation with arduino like this is pretty personalized and frankensteined so there are no exact answers or ways to go about it.

 

looks like a good setup to play automation with two trains at once and lots of action at the points.

 

i think you will need to move the sensors back some so that you can slow the trains to a stop not just cut power and make sure then the train is over the sensor when stopped if you want to check on a sensor being occupied later. Im pretty sure the motor shield lets you do a accelleration/deceleration with voltage or pwm change.

 

on the hall sensors one member played with These and the field in the motors didn’t have enough to trip them well so he played with magnets to trip them. Problem is when the train stops the magnets may not be in range of a sensor so may not give you occupancy detection. If you can use small enough magnets (like 4mm dia 1mm thick) you could put several along a car to potentially trip the sensor anywhere along the car. Going to take some experimentation.

 

 

i would definitely suggest you set this up first all loose to play with the trains, sensors, and arduino one step at a time before putting track down or any other major construction or bench work. Maybe a simple foam core base where you just make a waffle of like 1” high foam core strips under the foamcore baseboard. This will give you rigidity of foamcore baseboard as well as an easy way to rout wires under the baseboard and mount sensors. Just poke holes thru where you need to run wires. If the project is mainly to learn about the programming then this will be cheap and easy to modify as you experiment. Foamcore works great with hot glue gun so really quick and easy to mp make and modify. One thing though you can only put down about 18” of glue sticks a time as if longer it will start to set up at the far end as you get to the other. You can get some slower curing sticks or a hotter gun, but keeping it in short sections is the best. Or on longer pieces you can just tack down in a few places then run a fillet of glue at the joint corner to make more solid. You can make amazing things with foamcore and a hot glue gun!

 

start simple get the trains running and accelerating/decelerating under control and programmed. Get the points firing under the shield. Then start playing with what you can get working with Hall effect sensors. Then automation.

 

other option for sensors are photoresistors. These work well to detect if a train is over the sensor and are super tiny and cheap. Easy with arduino just read resistance. I have a nice commercial automated tram controller that was done with a pic system that worked great. It reads the ambient light when powered up so you don’t have to adjust the system to the room light manually. You could even put in a reference sensor totally exposed and one partially covered (as under a train) and readjust as needed if room light changed. Of course if you mount these in a tunnel or heavily shaded area you will need some local lighting to make them work.

 

keep the forum posted on your progress as this is something that more and more folks are getting into and experiences are great to share with everyone.

 

cheers

 

jeff

Link to comment
The Next Station Is...

Be prepared to experiment, test and rework a few times. I think the sensors are going to require the most work, as PWM control via Arduino and motor shields is pretty well documented now. I've made a few, although I've never got round to 'finalising' a design (i.e. I like trying out ideas rather than finishing things!).

 

You might want to consider hacking Tomix's track-based TCS sensors. These are mechanical I believe but could be the most reliable form of sensor, if you're able to make a circuit that hooks it up to an Arduino. It's a project that's been just off the radar of my 'next to do' projects... 

Link to comment

Thanks everyone. I have posted my intro in the Intro thread.

 

@bill937ca. In retrospect, I agree. 😄

 

@cteno4 Thanks for the suggestions. I plan to start slow and experiment with arduino first before making any thing major. Regarding the magnets, I have chosen 3x2mm magnets and plan to place them across the cars for detection.

 

@940-the-next-station-is I was thinking of using TCS sensors, however, my understanding is that they require power from rails to work. My plan requires changing the power in the rails for accelerating, decelerating trains and  stopping trains. So, this might be an issue. Please correct me if i am wrong.

Link to comment

I have a question about  Tomix Feeder Cable 5534. I want to extend the current feeder and connect it to my arduino motor shield. What is the gauge of the wire used in that? Should I used 16 AWG, however, the wire looks quite thin. Any help would be appreciated.

Link to comment

I think they are 22 or 24g wire. 
 

16g is way over kill for playing around with a small loop, 18 or 20 will do you fine. 14 or 16g would be for like a larger buss on a longer layout or if you are doing DCC as they like to pump a lot more amps thru the system.

 

jeff

Link to comment

Hello,

Very interesting project. I look forward to reading your posts.

I have done a lot of Arduino projects on my layout. Although I use current sensing occupancy detectors and a Raspberry Pi to automate the trains, I have made a speed measurement device using an Arduino Nano and these infrared sensors: TCRT5000 from AliExpress. They are very easy to use and can reliably detect the train. They are made of an infrared LED and the matched sensor and their digital output (D0) can directly be connected to any Arduino input pin. They work well in the dark as well as daylight.

I also plan to use Hall sensors for automating my Tomytec busses, but that’s a future project!

Link to comment

Hi All:

 

Need some help with Tomix Turnouts. Do these require change in polarity to switch from one direction to another? My understanding is that they operate on 12V and can be activated with 20-50ms pulse. I would require motor driver with 1A current on each channel to drive them. Please correct me if I am wrong.

Link to comment

Yep just pulse Nd reverse polarity for other direction.
 

A simple cap discharge works great on them to snap well without bounce back. You can use the reverse cap circuit to control with a dpst relay.

 

jeff

  • Thanks 1
Link to comment

Update:

 

I have tested all the parts and they seem to work. Now working on the arduino code to make the whole project work. Should be done in a couple of weeks and will post and update then.

 

Question:

Does anyone have any sense on how to connect Tomix signal (Tomix 5562) to Arduino?

Link to comment

Hello The Monark,

 

I use these signals on my layout, but I don't use the control board (with rail and sensor), only the signal mast with the LEDs.

The signal mast is connected to the control board via a 4-pin connector. This is the pinout for the 3-color signal (Red, Yellow and Green):

 

IMG_1226.thumb.jpg.69ffdc9b8be0a64751e96c51115c44f0.jpg

 

The signal's LEDs can be directly driven by an Arduino. Don't forget the current limiting resistors.

 

Interestingly, the 4- and 5-color signals use the same 4-pin connector. In this case, the pin 4, which is common to all LEDs, is sometimes anode sometimes cathode. Their pinout is described in the following Tomix patent: JPA 2005304825

The following blog (in Japanese, use Chrome or Google translate) describe these signals in detail: http://rtmrw.parallel.jp/investigation/signal-tomix-2/signal-tomx-2.html

 

I plan to work with 4- and 5-color signals in the future, but I have not started experimenting yet!

 

Alternatively, you could try to connect the Arduino to the control board and "simulate" the train activating the sensor. Is it what you want to do?

 

Marc

 

IMG_1225.thumb.jpg.e46e4be97c651fc5d26b30f0276d1fe3.jpg

 

Edited by Madsing
  • Like 1
  • Thanks 1
Link to comment
6 minutes ago, Madsing said:

Hello The Monark,

 

I use these signals on my layout, but I don't use the control board (with rail and sensor), only the signal mast with the LEDs.

The signal mast is connected to the control board via a 4-pin connector. This is the pinout for the 3-color signal (Red, Yellow and Green):

 

IMG_1226.thumb.jpg.69ffdc9b8be0a64751e96c51115c44f0.jpg

 

The signal's LEDs can be directly driven by an Arduino. Don't forget the current limiting resistors.

 

Interestingly, the 4- and 5-color signals use the same 4-pin connector. In this case, the pin 4, which is common to all LEDs, is sometimes anode sometimes cathode. Their pinout is described in the following Tomix patent: JPA 2005304825

The following blog (in Japanese, use Chrome or Google translate) describe these signals in detail: http://rtmrw.parallel.jp/investigation/signal-tomix-2/signal-tomx-2.html

 

I plan to work with 4- and 5-color signals in the future, but I have not started experimenting yet!

 

Alternatively, you could try to connect the Arduino to the control board and "simulate" the train activating the sensor. Is it what you want to do?

 

Marc

 

IMG_1225.thumb.jpg.e46e4be97c651fc5d26b30f0276d1fe3.jpg

 

 

Thanks for the link. This is very helpful. 🙂

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...