Jump to content

My attempt at basic signals


Drunkenclam

Recommended Posts

Drunkenclam

I'd like to point out at the start of this that I am certainly no expert. But I read tutorials and modify what I see for my own purposes. I'm sure others with more knowledge and skill would do it another or better way.

 

So I saw these 2 and 3 aspect signals whiilst browsing YJA. (I have now also seen the on ebay as well)

Pre wired with common anode. So I ordered a couple of sets.

signal.thumb.jpg.0b3e3a0db24386d64c3efe5e8bd5d875.jpg

 

First I set one up on the bread board with a hall effect sensor to detect the magnetic field of the train motor passing over to trigger the sensor and an arduino uno with a basic program to trigger the light pattern.

signal code.txt

 

I did run into a little problem in that some of the pins didn't like being set low to drive the LED and had to do a little swapping around.

Here's the first sucessful attempt.

 

 

 

Edited by Drunkenclam
spelling
  • Like 4
Link to comment
Drunkenclam

Next I tried it with a sensor and test track with different trains This had limited success, (otherwise know as a failure)  This is also in another thread from last year.

 

But putting small earth magnets on the bottom of the train cured this issue.

 

 

Edited by Drunkenclam
  • Like 5
Link to comment
Drunkenclam

My original idea is to use the 3 aspect signals on the main lines with the simple red, yellow, green done by a time delay and the 2 aspect signal on my single track local lines. showing if the line or station platforms are blocked. red or green.

If I want to to do this I want it a lot neater than this. Like a circuit board with the arduino on it and I just need to connect the signals and track sensors. Then change the arduino progam to suit locations. For this I want a custom board. Now in all my years repairing auto doors I have seen some badly designed boards (from a user point of view) with limited connections and power to run all the sensors. Like having to try to squueze 8 wires in a terminal meant for 1 or 2. So taking this into account I wanted each sensor and signal to have its own power connection.

 

The program I use for circuit board design is a free program called Kicad.

You start by designing the schematic of your project.

Then you assign a circuit board footprint to your components (here it is very easy to make a mistake)

Next you place all the components and try to route the connections.

(the old version of Kicad had an auto route function, but for some reason it was removed on the latest version. But they do link you to another program that will do it for you. called free routing)

 

Here is an image of the schematic. Its a little over the top, But I hope in future it might make life easier if something unexpected crops up

The top LH is a voltage regulator with AC/DC input power up to 30V. being converted to a 5V DC supply.

The block of  identical components is the connections for each of the 6 track sensors. This includes a jumper connected to the sesnor input that can pull the signal either high or low.

Then the main part in the middle is the output for 7 LEDS spilt of 3 connections with a current resistor in place. This is driven by a darlington array thats controlled by the arduino nano.

Although probably not needed for this. It helps reduce the power load on the arduino. It also removes the strange glitch I was getting when trying to give a low signal to switch the LED on.

scheme.thumb.jpg.9b6c722347a40125d14e385c0a99086d.jpg

 

After running it through the auto route and moving componnets around, trying to make it as small as I could. (reduces production costs), then remembering to put some mounting holes in it. I have the finished design.

I added graphics to the board to assist in wiring and connections. Those with a keen eye will spot. That I labelled the signal outputs as + R G Y This was on purpose so I only need a 3 pin plug for the 2 aspect signal.

 

1937270558_siganlboard.thumb.jpg.bda2d5fd5f1babe43487aa78a94827b0.jpg

 

During this stage lock down happened. Although I was still out working. Overtime plummetted and so did my pay packet.

 

Edited by Drunkenclam
spelling
  • Like 2
Link to comment
Drunkenclam

So I sent the pcb designs as generated by Kicad off to a manafacturer in China and they were made in about 3 days. 2 weeks later they arrive at my door.

They have a minimum order of 5 boards. I now wished I ordered 6. But I'll be safe in case this doesn't work. (from past experience its easy to make and miss a silly mistake)

 

20200603_083245_resized.thumb.jpg.b7035def6a28325a10f5217283935b23.jpg

 

Now I have them, I now find slight issues. First is I designed these to have the same socket and connectors we have on our equipment at work. Then I found out who expensive they are. taking into account I'll need 30 3 pin sockets. 5 2 pin sockets and 10 6 pin sockets. These don't come with plugs either, so they need to be ordered. Lucky for me I already had the power barrel jack and screw connectors at home. So there is some saving there.

 

Next is that jumper per sensor that pulls the sensor signal high or low. To save space. i went for the 1.27mm pitch pins. Now I see them. I don't know if I'm skilled enough to solder that close togehter,

 

DSC00713.thumb.JPG.1661672295d63f612bc994ef71fd39c2.JPG

 

But I have started putting components on the boards. All the resistors and diodes are on. I'm waiting on delivery of the darlington arrays and bridge rectifer. (I hope today)

 

DSC00708.thumb.JPG.f3beddac9029024dd81cbdc6774b3393.JPG

 

In the mean time. I have started putting sensors in track. For stationary trains in the station. I have used a photo reflector instead of the hall sensor. These need a current limting resistor. But I can squeeze that and the sensor under the track.

 

DSC00712.thumb.JPG.fdde64dddcd6c1816208f8e68722d63c.JPG

 

 

DSC00711.thumb.JPG.eec640b1214063cda71c3dbf3132e019.JPG

 

And of course the hall sensors and 3 aspect signals. I'm still umming about painting the sensors a dark grey.

 

DSC00709.thumb.JPG.1e44e5d418edf320f82298f8bd9612be.JPG

 

DSC00710.thumb.JPG.a2a5861b7f52e0ccf994c9646a0b518e.JPG

 

Edited by Drunkenclam
  • Like 4
Link to comment

Well done. That’s what Arduinos are made for! And it’s so good that we can now get PCBs manufactured in a few days for a few dollars...😀

  • Like 1
Link to comment

DClam,

 

I know you are deep into the project but a Raspberry PI with JMRI will move you ahead by leaps and bounds. You can load it with JMRI

and use the GPIO pins to drive the LEDS. JMRI has its signaling logic built in and you can make the association to the GPIO pins via

a sensor table. From there you can build your graphical display of your layout in Panel Pro. 

 

 

 

Inobu

 

  • Like 2
Link to comment

 

On 6/27/2020 at 8:07 PM, Drunkenclam said:

I'd like to point out at the start of this that I am certainly no expert. But I read tutorials and modify what I see for my own purposes. I'm sure others with more knowledge and skill would do it another or better way.

 

So I saw these 2 and 3 aspect signals whiilst browsing YJA. (I have now also seen the on ebay as well)

Pre wired with common anode. So I ordered a couple of sets.

 

 

First I set one up on the bread board with a hall effect sensor to detect the magnetic field of the train motor passing over to trigger the sensor and an arduino uno with a basic program to trigger the light pattern.

signal code.txt 2.14 kB · 1 download

 

I did run into a little problem in that some of the pins didn't like being set low to drive the LED and had to do a little swapping around.

Here's the first sucessful attempt.

 

 

 

Great project! Working signals give something special to a layout.

Btw, nice "signal code" using millis()

 

On 6/27/2020 at 8:25 PM, Drunkenclam said:

Next I tried it with a sensor and test track with different trains This had limited success, (otherwise know as a failure)  This is also in another thread from last year

 

But putting small earth magnets on the bottom of the train cured this issue.

 

 

 

earth magnets is the way to go... they solve all "magnetic problems" in projects... hahaha

 

On 6/27/2020 at 9:54 PM, Drunkenclam said:

So I sent the pcb designs as generated by Kicad off to a manafacturer in China and they were made in about 3 days. 2 weeks later they arrive at my door.

They have a minimum order of 5 boards. I now wished I ordered 6. But I'll be safe in case this doesn't work. (from past experience its easy to make and miss a silly mistake)

 

20200603_083245_resized.thumb.jpg.b7035def6a28325a10f5217283935b23.jpg

 

Now I have them, I now find slight issues. First is I designed these to have the same socket and connectors we have on our equipment at work. Then I found out who expensive they are. taking into account I'll need 30 3 pin sockets. 5 2 pin sockets and 10 6 pin sockets. These don't come with plugs either, so they need to be ordered. Lucky for me I already had the power barrel jack and screw connectors at home. So there is some saving there.

 

Next is that jumper per sensor that pulls the sensor signal high or low. To save space. i went for the 1.27mm pitch pins. Now I see them. I don't know if I'm skilled enough to solder that close togehter,

 

DSC00713.thumb.JPG.1661672295d63f612bc994ef71fd39c2.JPG

 

But I have started putting components on the boards. All the resistors and diodes are on. I'm waiting on delivery of the darlington arrays and bridge rectifer. (I hope today)

 

DSC00708.thumb.JPG.f3beddac9029024dd81cbdc6774b3393.JPG

 

In the mean time. I have started putting sensors in track. For stationary trains in the station. I have used a photo reflector instead of the hall sensor. These need a current limting resistor. But I can squeeze that and the sensor under the track.

 

DSC00712.thumb.JPG.fdde64dddcd6c1816208f8e68722d63c.JPG

 

 

DSC00711.thumb.JPG.eec640b1214063cda71c3dbf3132e019.JPG

 

And of course the hall sensors and 3 aspect signals. I'm still umming about painting the sensors a dark grey.

 

DSC00709.thumb.JPG.1e44e5d418edf320f82298f8bd9612be.JPG

 

DSC00710.thumb.JPG.a2a5861b7f52e0ccf994c9646a0b518e.JPG

 

 

Nice design of boards.

I was working on my signals lately (until I got busy at work and purchased a new board game and borrowed some videogames...) and an idea is to use the hall sensors as "to detect the entry and exit of a train on each track section. That is, a sensor at the entry and another at the exit.

 

In that way , signals do not be just timed but it will really show if a train is in that section of the track. Later you could work your way to implement a bit of interlocking among signals and points.

 

I made a test and it works (i.e. sensing the entering and exit of the train in a track section)

hall NX.txt

 

This draft example only shows how hall sensors work with a counter so the above can be achieved.

 

I think I will come back to work on my project. Those last pictures of the signal next to the tracks are looking good.

 

Cheers,

  • Like 1
Link to comment

I was being interrupted while writing my last post so I forgot to ask: what sensor model are you using?

 

This because I tested the 3144 hall sensors placed under Tomix track and they work without the need of cutting/modifying the track.

To activate the sensors, I use earth magnets attached under a train.

 

Cheers,

 

1377888249_hallNX.thumb.jpg.beae6e3dd3b8317f222b9e12b555d7be.jpg

  • Like 1
Link to comment
Drunkenclam

I'm using the A3213 omipolar sensors. It's useful to know they read through the track. Although I think they look cool being viable 😁

 I will also be using the sensors to check if the single sections of track are clear or occupied. Which will be fun coding. 

  • Like 1
Link to comment
Drunkenclam

A few little parts turned up. So got a little.done. but did find a big boo-boo on my part. It seemed that when I did my plan for the bridge rectifer to convert to DC. I put down the wrong footprint. As the pins don't line up. Something to do with a dil-4 footprint but the component fits a dil-6 with no middle pins. As a stop gap. I got some dil 6 sockets and soldered the middle pins to one end and can plug the component straight in. 

 

So if I get some more made. I'll alter the footprint. Change the plug and socket connectors for screw terminals the add 2 optocouplers so if blocking can send a signal to the next/previous board.

20200707_153432_resized(1).thumb.jpg.2f7f1cb993d8b6f9489ab69b2d3b33f2.jpg

 

 

 

  • Like 1
Link to comment

Well. I had a clear out of some things on ebay and spent some of the money on components. 

So all boards now built. Just got to finish off putting the sensors to track and start the coding. 

 

20200825_164242_resized.thumb.jpg.b3bc8e5a0fcbb04d280062de59a5aed4.jpg

 

20200825_180209_resized.thumb.jpg.c292c2ca2ee670469aed881773597248.jpg

  • Like 7
Link to comment

Finally got my nano clone to work. Lots of articles online about installing or updating the bootloader. But they all seem to miss a step. But got my one and only nano (at the moment) to accept a sketch. I went for the easy one of the time delay 3 aspect signal. Running off a 12vdc power supply. I'll get a few more nanos and start the more complex code of the single branch line to the station with 2 platforms.

 

 

  • Like 5
Link to comment

In the above video. I duplicated the code with a 1 or 2 suffix to enable 2 channels.

 

3ASIGx2.txt

 

This made the code rather bulky and messy. So I rewrote it using the array function. Which shortens it. If any of you can see any improvements, Please let me know. But be kind 😄

 

3ASIGx2ver2.txt

 

I had fixed the board to the underside of the layout and connected it up to the sensors and signals already in place.

For my shame. I haven't run any trains in quite a while. So I only cleaned on set of rails for testing. To top it off, I couldn't find where I put my magnets. So what you see here is just the magnetic field from the motor in car 6 causing the signal to change. If I put a magnet in every other car/ Then the delay sequence doesn't start till the last magnet has gone by. Here it starts to change whilst the train is still going through. Also my station isn't long enough for the full 11 cars. So this is just for effect 😄

 

 

 

  • Like 3
Link to comment
On 9/14/2020 at 4:08 AM, Drunkenclam said:

 I couldn't find where I put my magnets. So what you see here is just the magnetic field from the motor in car 6 causing the signal to change. If I put a magnet in every other car/ Then the delay sequence doesn't start till the last magnet has gone by. Here it starts to change whilst the train is still going through. 

 

Perhaps you can place the magnet on each end of the train. Then, you can modify the code so after a sensor is activated, that sensor is disable for some period of time, this to prevent picking up the motor's field or the magnet at the other end of the train. You can calculate or find the "disabling time" by checking how many seconds your longest train take to fully pass the signal.

  • Like 1
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...