Mark Baker Build Log

Then Windows 10 does an upgrade and trashes the machine. Just gotten it back. Luckily backup made an hour before the upgrade. Some PLC building is called for before I throw this laptop out of the window.

I do Modbus for a living, so I am interested to see how this application pans out. RS485 at low speed and short distance should be quite robust. The protocol is quite simple, for this type of application it should be fine, if you have a central controller and multiple slaves.

There are some freeware Modbus tools, they are fairly primitive. Personally I write PC apps in C#, but pretty much any language would work. Following the exact Modbus timing is rather a pain on the PC though. I would use a slightly modified Modbus protocol.

KiCad PCB layout done for two layer PLC board. Very standard. atmega328 chip, Darlington array (ULN2803A) and RS485 TX/RX (SN7516BP). OK I cheated and used the autorouter but it worked. In fact installing freerouter was probably a larger pain than actually doing routing by hand in the first place. I have an arduino with an RS485 shield running a modbus master sketch so rather than using modsim32 I intend to chain a handful of versatile if unexciting PLC slaves to act like targets. These PLCs will live under the baseboard and control semaphore signals, lights etc.

I am using the modbus libraries that are provided for the arduino. I will spy on exactly how they are performing once I have a working skeleton network up and running. Thanks bobc.

I always think these look nice with all the colours. 100% generic and nothing special but still a learning exercise. Squashing everything down to get the PCB fab price down meant a load of itterations. I could squeeze it a bit more getting rid of the last of the DIL devices but I have them in my parts drawer and I am only building a few PLCs.

A couple of LEDs thrown in so I can use them for blink type sketches and also visual feedback. I can flash green for a routine being successful and coded red to show error codes, Quick, dirty and simple way when peering underneath the baseboard wondering why something is not working.

+++ Extra thought I have done a copper pour to get a ground plane for the ground net. 16MHZ is pretty low frequency but this might help in terms of noise etc.

1 Like

That’s good thinking. Really a practice you want to do whenever possible.

Looks great! I like the multi colored showcase, but I’m more of a “3D realistic view” fan myself :slight_smile:

After several iterations the boards and components are on order. More building of the rail baseboards and cases procured for the PLCs.

I am building the PLC on breadboard so I can start on the software and also looking at a version 1.1 with local memory so I can pass down parameters to the PLC over the network. Also a 1220 lithium cell or something similar to keep the parameter memory alive. The idea here is to keep the main software generic and have the parameter storage determine the functionality of the PLC. So on power-up an interrupt will be triggered to get the parameters read into memory configuring the PLC.

The atmel family may be a bit restricted for the expanded version. So possibly may go with ARM (faster, more i/o and still compatible with arduino) but something working now is better than forever changing the goalposts. I have seen too many projects go way over budget caused by customers who want to keep changing their requirements.

2 Likes

Still waiting on PLC pcbs. Components arrived several days ago. Train logic and H bridge board design is complete. I have squashed everything right down but a beefy H bridge is the limiting factor. A power pickup and control board is next on the list. I will probably keep fiddling with the logic board until the PCBs arrive. If they look fine then I will order the next set.

Also been busy building an ELV PSU kit. A very nice bit of equipment except all the instructions are in German. Time to install the Ouino course that I have been putting off for weeks now. Too many things to do as usual. I like building kits as a distraction where I am not messing around trying to find parts.

One lesson learned is soldering a component pin where both sides are on very large copper fills is a real pain. Even using an OKI metcal iron it struggled.

1 Like

PCB for train logic board ordered. Those for the PLC have arrived and I will get a couple built up and fixed to the base board. I have chosen a 5 amp H bridge ( mc33886PVWR2 ) for the train board as overkill perhaps but no harm in being conservative.

I am ordering some enameled copper wire for winding an inductive pickup for the train. I have a loop and board for the track side but have to get sub 10 mm clearance between the train and track coils…

As an experiment it would be interesting to have a number of loops under the track, detect the train position using reed switches and a PLC to activate each loop as the train passes overhead. Winding dozens of coils may be tedious but having charging along the track as well as at stations, signals, halts and passing loops may enable the use of super caps rather than lipo batteries.

Is this a “cost is no issue” kind of thing or a “this is going to charge suuuuper fast” kind of thing?

This is an “is it an interesting thing to do” kind of thing. Cost is as issue but in a one-off is not important. I am not interested in speed but fast charge that a capacitor could provide (unless I have it wrong) could allow me to power the train with frequent top-up and discharging around the track.

Yes, if you’re looking to do fast charge, I would think a supercap is the way to do it!

A new PCB and a pile of components. Brilliant. Apart from a few solder bridges on the atmel chip that I sorted quite quickly all went smoothly… Until… Capacitor size on board 12:06 bag of caps … 08:05. “%£&”^%"&!!! so near. The 22pf oscillator caps are I guess very important so I will have to wait. So many learning opportunities.

No chance of bodging the 0805s into the 1206 spot? I think that should be possible with bit of extra solder (which I know because I’m often in the same spot)

1 Like

Yes but there are tracks between the pads. Not sure I want to risk it. I have ordered parts for the train logic board so added the caps onto that order. Should be about three days. I will start drilling the box to take the PLC and sorting external connectors.

Cool, whatever you’re comfortable with, but this is a common bodge that I would recommend trying at some point. The track should be ok as long as there is soldermask on top of it .

OK. Super caps. First thought is current limiting during charge.

https://www.eetimes.com/document.asp?doc_id=1225624

Also what will the voltage profile be for a moving train over the inductive loops? I will experiment with this first. So waiting for the wire to arrive.

Ahh a nice little bug with kicad and the auto-router. Everything seems fine until an earth ground-plane is used. Then the auto-router assumes that anywhere on the bottom of the board that is not a pad or track is a ground-plane. This leaves vias hanging as isolated islands rather than actual earth connections. Add to this that the ground-plane often has little islands that are isolated and everything is covered by a thick, barely translucent solder mask then finding missing connections gets even messier.

Lesson two is last min changes to the silk screening needs to be double checked to prevent mistakes.

This where I find the 3D view a real help. Most, if not all, of my silk screen issues have been picked up with that view.

True but I tend to see what I expect to see not what is actually there.

OK it needs some tidying up but is getting there.

Beware consistency re ‘GND’ and ‘Earth’. They are not the same and will produce two unconnected nets if you are not careful. Most components are now SMD with the exception of parts that I have a large stock of. Four protected input channels are now implemented using R/C and BAV99s. The numbering is deliberate.

The old board is now working after two small wire mods and lots of swearing. Atmel Studio 6.2 and AVRISP-U from kanda.com is a combination that is reliable. The arduino dev environment with USBtinyISP is clunky and has problems recognising the particular flavour of atmega I am using. An IDE is supposed to help not get in the way.

PCB delivery lead times are terrible, component purchasing either from Farnell or Rapid has too many ‘extras’. This is actually quite frustrating.

So a glacial build is actually progressing even though most of the learning is in getting kicad footprints sorted, ploughing through Atmel Studio and finding a combination of tools etc that actually work.

Next step is to dismantle the second hand train and clean up the motor that is arching all over the place. It looks like it has spent the last 25 years in a swamp.

2 Likes