Mark Baker Build Log


#1

Hi. I have had electronics as a hobby since about 1972. Qualified as an EE in 1989 but never touched it since. I am now retired and want to rediscover this hobby and fill in my time constructivly. Especially with an eye on model railway electronics.


#2

Welcome Mark. It will be interesting to see what you come up with!


#3

Thanks for the supportive comment.

Well ‘Shine On’ project PCB is ordered. KiCad is fairly straight forward if a bit weird on occasions. Several components missing from the 3D view (LEDs and the header). These were also missing from the CvPcb tool until I got a footprint. I have messed around downloading libraries and trying to associate them to CvPcb but no real progress. Maybe a reinstall of KiCad may fix this Not bad for the first afternoon on Contextual Electronics. Looking forward to many more.


#4

My project is:-

To come up with a low-cost control system for model railways. Currently DCC is super expensive and with modern electronics I believe this expense can be avoided and even if the wheel is being reinvented this can still be a learning exercise.

This is a large project so would have to be approached step by step with proof of concept breadboarding and then a layout test. Plenty to do but incrementally. Now I am hammering track down onto a cork bed placed on 1.5m by 1.2m baseboard. A DC linear PSU is built but I may build another one with a few unusual changes!!!

Summary of thoughts.

**

Power and communication.

**

Rail tracks to carry DC (any polarity) throughout the layout. Preferably using a linear supply to avoid transmitted noise and interference with signalling.

Communications could be.

  1. Differential signalling on top of the DC sent along the track. This would be stripped off the power rail on each train and at each intelligent node (think point controller etc). Using an existing protocol. First thought is modbus to put a veneer of standardisation into the mix. https://www.schneider-electric.co.uk/en/faqs/FA168406/ . I can see degradation of signal quality being a challenge caused by track LCR. Also, how to modulate the power rail? Feed in a signal into an external reference voltage pin on a linear variable regulator? Lots of ideas and areas to play with.

  2. Infra-red. Increasing the processing power in each node and setting up a mesh style network, so packets can be routed between points outside of line of sight. Reflections may be both useful and a nuisance. Physically simple but the software is going to be a substantial challenge. Should be immune to electrical interference and produce none. I must design for remote controls that use infra-red. They could be controllers as well as a source of interference.

  3. WIFI. I believe there is an Australian group working on this. This is a very noisy environment in my house I am not convinced that it is going to be viable but cheap enough to experiment.

Control

Maybe a central controller keeping a firmware-based map of the layout. User control is moderated by what is scale or track appropriate. Some built in rules would be needed.

Or a mesh of nodes that on bootup/reset talk to their neighbours and use a rule set to create a part map of the total layout. How to differentiate between connected and switched (from a rail point of view) out track is going to be an issue. At this point I suspect I may need central mapping and self-discovery to work together.

Each node runs the same code but with appropriate attributes. A point controller does not have an associated velocity but will have an off/on state with itself and as needed its twin on an adjacent track. As a train approaches a road crossing all the appropriate nodes individually go through the correct sequences. A person may decide to swap trains from a siding with one on the main track but having given the command the individual trains handle the movements and switching. So even if nodes are independent there may still need to be a hierarchy.

To begin with a simple loop is sufficient and I am at the breadboarding stage for each of the signalling options let alone controllers.

FIRST CHALLANGE. :slight_smile:

Looking at power option 1. Modulation of DC power for differential signalling. Signal degradation on a track loop at each point of the track. High frequency/broadband Interference from power pickup on each train.


#5

Hi Mark, A nice break down of the ideas. While reading this I was thinking of the Miniatur Wunderland, Hamburg. I have yet to visit there, though I think I would prefer a tour of behind the scenes. Other options for communication could be RF other than Wifi or Bluetooth. There are some neat RF modules coming available probably driven by the Internet of Things.


#6

Yes, was going to ask if this was going to be coupled in with a transformer or maybe just a capacitor. But the fact that it’s modbus (a very legit standard) is a cool idea too.


#7

Well not so much coupled in but part of the power rail. A linear supply with the voltage reference coming from a summing opamp. Two inputs provide the voltage mid-point at 14v (12v ish after the diode bridges in the trains have their double drop). One input only would give the low of 2v down, two the 14v and three 16v, i.e. 2v up. I may go for higher voltages to use LDO regulators on the train and rely on inertia and the short duration of the pulses to hide the fact that the power rail is bouncing around.

The train will use an H bridge for motor control, a diode bridge for power pickup, something from Atmel to control everything and ‘a.n.other’ circuit to strip out the data, store it and then kick off an interrupt. Best to get the first bit working.

I will have to revisit op amps from the bottom up which is fine. Also, the ‘Current Sink or Swim’ project should provide useful additional thoughts and skills to make informed progress. Fun, fun fun…

Of course these ideas could all be impractical but in a way that is not important at this stage.

Info links (will append when found).
http://www.skillbank.co.uk/psu/index.htm


#8

Yep, piece by piece is the best way to take things! Looking forward to seeing more of this project.


#9


#10

A very simple circuit that simulated ok. The pulse would be generated from a microcontroller to modulate the power supply. As the data would be sent as voltage excursions around the average required 12v and combined with physical inertia of the trains there should be no noticeable changes in train performance when data is sent. Currently the simple controller provided functions like a light dimmer and produces dreadful waveforms so chopping around the dc does not worry me at all.

Building this on a soldered breadboard has been a time sink and pinouts of the tip3055 (not 2n3055) and the lm317 makes for a real mess in terms of layout. Trying KiCad is all well and good but footprints have also been a pain.

The circuit is very simple but why complicate? I have left off the toroid transformer, diode bridge, fuses and reservoir capacitors for clarity. There would be a trimmer at the junction of R3 and R4. LTSpice does not seem to cater for these. A crowbar might be an idea, but the trains may survive 16v, I will need to check. Short circuit protection is more of a potential issue. I have simulated the microcontroller crashing and starting at the voltages are just in the expected range so looks ok.

I have taken a 040 train apart and the room in there is very restricted. Maybe the tender will be the best place for the circuit, or I could put everything into a two carriage DMU which will be much roomier.
I will look at the train controller, H bridge and software just to have a break from the PSU. Also I am currently reading up on Modbus RTU.


#11

Just having a play with some track and I2C. This is a bit of a diversion but gets me away from the computer screen.


#12

Add a bit of noise. Not enough it seems.

The interesting bit will be to see how clean the signal is that can be picked up from the train wheels. I have a battery operated OWON 100MHZ scope which I use for high voltages. It is portable but not that portable. Shame.


#13

Some kind person has developed full modbus master/slave RTU libraries for the arduino which is nice of them. Makes life significantly simpler. This means writing code…I hate this bit as I am spectacularly awful at software.

As modbus appears to be applicable independantly of the method used to build the network I will develop using this protocol. I have a gtronics.net dev board and will use this to create both the controller and slave (train/PLC) on the same board using a simple link for the track. I can then replace this link with RS485 transceivers.

Going forward I can model various PLCs and build up the controller software. Implementation I will leave until I have a clearer understanding of what I can do with modbus and how it will fit in the model environment.


#14

Ordering a USB to RS485 converter so I can connect my pc to a PLC slave and use ComDebug (Windmill Software Ltd) software to run and debug the communications. Worth a look and a cheap way to make my PC talk RS485. CommDebug is free but Windmill may be worth getting if I can see sufficient need.

That is the easy bit. I will need to build the PLC which will just be an arduino acting as a points controller. Sufficient meat there to get most of the headaches out of the woodwork. RS485 even in simplex usually needs three wires which is fine for the fixed PLCs but not for the trains. It is possible to use only two over short distances with limitations caused by electrical noise interfering with the system.Or two rails could be used for unbalanced signalling at low speed but the usual control handshaking then becomes an issue. Also a pair of rails is not exactly ‘twisted pair’.


#15

Just to clarify (for myself and others), this has been attempted before: passing the data over the power rails to a train?

One thing to note about RS485 is that the protocol is quite similar to CAN bus, with different physical implementations (CAN has fewer wires and tugs down on the line like i2c, as far as I recall). That might be another avenue of investigation.


#16

Getting power to the train is something I am struggling with now. Even to the extent of saying why use the rails for power? Wireless charging kits are out there (and ordered) so I could charge at stations, sidings and passing loops. I am thinking wireless to avoid making fiddley charging contacts. I don’t think this reduces authenticity as a steam train model would not use electrified rails anyway. Dave Jones found one etrain. A hybrid train had a one month trial out of the station I used to commute from. https://www.birmingham.ac.uk/university/colleges/eps/news/college/2015/01/Are-low-carbon-battery-powered-trains-the-future-.aspx

Using the rails only for signalling enables alternatives to be more easily implemented as in wireless etc. For now, though this is off the table. I know my thoughts look unfocused and rambling as in a way they are. I am reading up about modbus RTU and RS485 etc, so the project is increasing my knowledge which is the whole point though I am determined it will get somewhere in the end.


#17

The rails are better suited for distributing power than they are signals. In fact, for your application it may even be better to distribute AC power. Noise on power rails is more easily filtered out to the point where it has no detrimental effect, the same is not true when it comes to signals. And there will be plenty of noise. Depending on the size of your planned layout, the rails would likely have severe limitations in terms of signal frequencies and not scale well to large layouts. And as you’ve noticed, there isn’t a lot of room in those locomotives for a lot of electronics never mind a sufficiently sized battery.

I think a better approach would be to use the rails for distributing power throughout the layout to supply not only the locomotives but also track switches and signals if you plan to go that far. Communications can then be handled with any number of low power RF technologies. You could even stream video from the locomotive.


#18

Thanks for your thoughts. For fixed assets I will provide power and signals via multi twisted core cable under the baseboards. If I am taking signals to a points controller then I might as well take power.

Using low power RF is an option though the spectrum is a bit busy, so the receivers would have to be attenuated and transmitters taken to the max to give me the best chance of getting data through. I can have low bit rates so even if the rails are far from perfect it might still be usable. In the real world 19th C clock signals were sent down the lines to synchronise railway time with Greenwich. How they did it with such basic technology is something I must look up some time. Either way I will keep playing. Thank you again for your input, it is appreciated and noted.


#19

That is far from the case. There are several unlicensed bands where you would find plenty of bandwidth.

They used telegraph wires to synchronize railway clocks, before that they physically transported a clock around on the first train each day.


#20

I have been the proverbial duck. Feet kicking away but quiet on the surface. I have been using some Udemy courses which at £11.99 each (special offer) offer good value for money. So, I am half way through a Modbus course and starting one on programming an Arduino to be a Modbus master and slave. Modscan32 and Modsim32 look useful but are expensive for what they are. I only have a limited licence. Virtual serial port is useful but expensive. I have a pair of pc notebooks and usb to rs485 adapters, so I can just run both using a short cable link.

With many situations throw money at a problem and it is much easier. I have the IDE for windows forms so maybe could produce a rudimental Modcan32/Modsim32 clone but where do you stop? There is an Udemy course to do just that. Hmmmmm…

Currently I can build a number of PLCs in small plastic boxes to live under the baseboard. I will use 9 pin D type connectors simply as they are robust and will take the two pairs of rs485 and ground that I will use for the fixed assets. I will use DIL switches to hard code the unit IDs. Old school but simple.
The track needs fixing down. Small nails are out as are 6.5mm 0 size screws. Now it is 9.3mm 0 screws using a 1mm pilot hole. Finishing this is going to take a few hours.

Sending signals along the track has not been an issue. RS485 is supposed to have a range of 4000 metres so even using tracks 4 metres is no issue at all.

For the train I have got hold of a British Rail Class 50 which has loads of internal space. Wireless charging works though a 1cm separation limit is challenging and I will have to experiment with winding my own rx coils to make them more ‘model friendly’. The output is a solid 5v at 500ma (checked on a programmable load) and the board appears to have a boost converter on it, so I may see if I can re-engineer up to 9v. even at 200ma this will be fine.

I have downloaded a few SCADA applications and will look at these later in terms of network visualisation and control. Something to play with later.