Author Topic: Working towards low-cost 'Control' systems  (Read 2737 times)

0 Members and 1 Guest are viewing this topic.

Offline IanT

Working towards low-cost 'Control' systems
« on: September 16, 2015, 10:30:46 AM »
This seemed to be the best place to start a new topic in this area.

My proposal is that we (that is anyone else who is interested) develop a low-cost 'common' hardware platform that is capable of supporting sophisticated on-board control systems using standard electronic & software components.

Any interest?

 8)

Regards,

IanT
Nothing's ever Easy - At least the first time around.

Offline Peaky 556

Re: Working towards low-cost 'Control' systems
« Reply #1 on: September 16, 2015, 04:55:32 PM »
Ian
This all sounds very exciting, but even your introduction is way above my head!
My expectation of a control system is an out of the box R/C package with another commercial electronic speed controller to link into this (plug and play style).
If I wanted another function such as brakes or to start the glow plug engine it would be a case of a servo operating a physical switch or rotating a pot.
Are you able to give some examples of what you are talking about?
 :-\ Tim

Online Doddy

Re: Working towards low-cost 'Control' systems
« Reply #2 on: September 16, 2015, 06:08:28 PM »
This seemed to be the best place to start a new topic in this area.

My proposal is that we (that is anyone else who is interested) develop a low-cost 'common' hardware platform that is capable of supporting sophisticated on-board control systems using standard electronic & software components.

Any interest?

 8)

Regards,

IanT


YES  8)  COUNT ME IN!

My application requirement is right here . . .


http://lakes-pages.com/gauge3.co.uk/G3Forum/index.php?topic=1585.msg10101#msg10101
« Last Edit: September 16, 2015, 07:13:51 PM by John Candy »
"You don't know what you don't know"

Offline IanT

Re: Working towards low-cost 'Control' systems
« Reply #3 on: September 16, 2015, 07:15:56 PM »
That's quite a large question you've asked there Tim. I'm still in the process of learning & exploring all this stuff myself but I'll try to give you a kind of longer term 'vision' of the sort of thing that should certainly be possible in theory (given an investment of time and maybe some expert help in one or two areas).

The first thing to state is that this unit will be a "systems" level controller, probably all on a single chip, although it's quite possible to have multiple controllers talk to each other if required. This systems controller would manage and monitor all engine activity and be capable of comprehensive external communication (via Wi-Fi, Infra-red, XXG radio links).

So for instance, apart from a motor control that could emulate any kind of full size behaviour, the engine could also read (and act on) external signals, whilst also being fully controllable from a remote controller (dedicated hand-held, mobile phone, tablet or laptop).

Doddy would no doubt like to attach an SD card that could provide him with huge storage (32/64Gb) for sound and other effects and which could also be used as a data recording device if required (engine performance for instance?). A video camera in the cab could be linked to the 'remote' and show a drivers eye view of the track and signals. The same controller could communicate with the track 'signalling' systems to request right of way, access to track and numerous other functions. Given a Wi-Fi link to the internet a 'Driver' could be anywhere - physically at the track (or on another continent).

Fantasy? Well maybe - but really our imaginations (and mine can run pretty wild!) will be the limit as to what can be done but all of the (underlying) technology that I've basically described here is already available and being used in other hobby areas of mechatronics (such as robotics & drones) right now.

The key is to understand that the majority of this functionality is "soft" - not some bit of commercial kit - but simply lots of code that can be downloaded, modified and shared as needed.

The initial challenge is to make some basic decisions as to what hardware platforms and software to use. I've already spent some time doing this and I'm happy to share how I arrived where I currently am (PIC32/Chipkit/Arduino etc) in my thinking. Others may have different ideas and that's good too. I'm always very happy to borrow, plagiarise and copy other peoples great ideas!

Alternatively......(for the non-nerdies)

Eventually - you should be able to buy a small circuit board; install it in your engine with any required servos, power drivers, sensors; then hook it up to your laptop (via USB) and download your chosen controller 'options' from a list. By the way - this will not be confined to just electric motive power, there is absolutely no reason why much of this functionality cannot be applied to live steam too - just a slightly different set of options at the 'physical' interface layer.

:-)

Regards,

IanT

PS Still awaiting UPS to deliver my new 'toys' - it's interesting because I ordered on a Distributors 'UK' website (and paid in sterling inc. VAT) and it's been shipped directly from the US. Small world these days.

 
Nothing's ever Easy - At least the first time around.

Offline cabbage

Re: Working towards low-cost 'Control' systems
« Reply #4 on: September 16, 2015, 07:44:09 PM »
OK.....

The questions we have to ask ourselves are these:

1:How much power in the form of Volts and Amperes do we require to feed our motors.
2:What sort of electrical power supply do we envisage using.
3:What is the maximum expected dimension of any part.
4:How many are we going to need.

I do as most people know come from a computer system background although my first degree was Chemistry.

So, let me answer the questions above...

(1) I would say that most of our motor systems are based either on 12V SLA or 14.4V NiMH race packs. Thus the discharge curves are very different, (I will ignore Lithium systems for the time being).  An SLA will deliver 45% of it total energy in one hour in a gentle fall whilst NiMH will deliver 90% then fall off the cliff edge. G1MRA use a std of 24V -which is logical for 2 rail pickup but a little high for onboard electronics. A std of either 15V or 12V would be more in keeping I believe for the PCBs that would have to be built. Most PCB tracks will take 3A or more with "thick layer" plating or solder dipping. This would seem to presuppose a power rating of 36 to 45Watts which could be "stacked" as a multiple of this.

(2) Errmmm... Here I seem to tread on dangerous ice... For ease of thinking there are two systems. One uses a battery and the other uses an IC engine of some form. The former produces a smoothed supply either via a Vreg or from a Current Dump of a huge battery. This is very common. The other uses the IC engine to turn a dynamo or alternator the former producing raw DC and the latter 3 phase AC. In the case of the DC dynamo it has to be smoothed -either via std capacitor surge bank (aka ripple bank) and a Vreg or the DC is "dumped" into the large charge/discharge capacity of a battery. In the case of the alternator a 3 phase rectifier produces a multiphased DC and this is then smoothed out with a surge bank and Vreg.

(3) The answer is alarmingly -not very big at all.... If I take what would have been my std power FET the IRF620, which can take 15A without bothering then it requires a small 4cm sq heat sink. If we go a simple "H" drive and produce the Mark Space from a NE555 then I think it all might fit with no trouble on a std Euro Card.

(4) This is the main problem. I don't think that there is the market for even a small PCB run. What I would propose is that we produce the circuit based on a Euro Card but use the type of card called a prototyping card. This has solder "rings" that you join together either with a soldering iron and solder OR as I think would be better and easier for the majority of builders - a felt tipped PEN. The pen has conductive ink. I will admit that Some of the components may need soldering in, (sockets etc), but it does work.

Well that is my entry to the discussion document. Feel free to add more or throw it in the bin!

Arduino is cute and simple -but I wouldn't trust it in a real world application. I would say that a Raspberry Pi would be a better bet.

regards

ralph


Offline IanT

Re: Working towards low-cost 'Control' systems
« Reply #5 on: September 16, 2015, 09:14:33 PM »
Hi Ralph,

I'm not sure that there is a direct relationship between the power system required for the 'motive' side of things and any control elements. Indeed they could (and maybe should) be quite separate.

There are many potential form factors to choose from. You mention 'Euro' board but the Arduino form factor (and its associated 'Shields') are also a possibility. Diligent produce several very useful PIC32 boards based on this form factor and they are not that expensive.

In fact I was assuming that a very small board size would be quite useful for G3 use and it might simply depend on what space was available in the actual model anyway - so flexibility to custom even the form factor would be useful.

As regards PCB production, I don't think that would be a problem in practice. I know that MERG members routinely use various PCB design tools and that there are commercial organisations that will produce just about any PCB design you desire at "reasonable" cost (I'm not sure what "reasonable" is - but it sounds OK). I believe the minimum order size is typically 10 items, which doesn't sound an impossible requirement. I will admit to being mainly a sleeping member of MERG thus far, partly because much of their work is directed at 2-rail (DCC, CBus etc) but I am fortunate to have a local group that meets monthly quite near to me (<15 miles) and I've been meaning to go over and say "Hallo" (programming joke intended).

Anecdotally - I understand someone in this local group recently developed a PCB board design that interested other members and by the next meeting, they had produced PCBs for everyone and were able to build and test them. That sounds like some quite useful contacts to have.

With regards to Raspberry Pi - this is an ARM based board, essentially designed to run/develop Linux (although Windows 10 is also now available for it). It is undoubtedly a very powerful computer but it is entirely unsuited for the kind of embedded control use that I envisage. Whilst the Pi does have some GPIO pins, it's capability to connect to the real world is very limited in practice.

There is a very big difference between a device designed for "embedded" control use and one for general computing. Suffice to say that there is a PIC32-based board already available (the Chipkit Pi) which was designed specifically to help link the RPI to the real world.

At the risk of really sending Mike to sleep again, that tiny £3 (28 pin) PIC32 family member (that I mentioned earlier) has the following specification:

General
A 50 MHz / 83 DMIPS, 32-bit RISC CPU with 0.5 mA/MHz current consumption
Two I2S/SPI modules for Codec and serial communications
Peripheral Pin Select (PPS) functionality
Parallel Master Port (PMP) for graphics interfaces
Charge Time Measurement Unit (CTMU) : Supports mTouchTM Capacitive touch buttons
Provides high-resolution time measurement (1 ns)
On-chip temperature measurement capability; Temperature Range - 40°C to 105°C

Microcontroller Features;
Operating voltage range of 2.3V to 3.6V
Up to 128KB Flash memory (plus an additional 3 KB of Boot Flash)
Up to 32K SRAM memory
1.65 DMIPS/MHz (Dhrystone 2.1) performance
MIPS32® M4K® core with MIPS16e® mode for up to 40% smaller code size
Pin-compatible with most Microchip 16-bit devices
Multiple power management modes
Configurable WDT with on-chip Low-Power RC oscillator for reliable operation

Peripheral Features
Up to 4 channels of hardware DMA with automatic data size detection
Two UART and I2C™ modules
Separate PLLs for CPU and USB clocks
Hardware Real-Time Clock and Calendar (RTCC)
Five 16-bit Timers/Counters (two 16-bit pairs combine to create two 32-bit timers)
Five Capture inputs and Five Compare/PWM outputs

Audio Interface Features
Data communication: I2S, LJ, RJ, DSP modes
Control interface: SPI and I2C™
Master clock: Generation of fractional clock frequencies
Can be synchronized with USB clock
Can be tuned in run-time

Analog Features
Up to 13-channel, 10-bit ADC
Three Analog Comparators
Charge Time Measurement Unit (CTMU)

Debug Features
Four programming and debugging Interfaces
IEEE Standard 1149.2 compatible (JTAG) boundary scan

All of that capability is on just one 28 pin chip and it's been specifically designed to control stuff! Other PIC32 family members have even more capability (512Kb Flash memory and 128kb SRAM, 80MIPS, CAN controllers and more) but these are surface mount technology. I have had one as a development platform for a little while now and "cute" ?  Well maybe but "simple" it definitely is not. I used to work on 16 & 18 bit mini computers that only had a fraction of the processing & peripheral power that these little beasts possess....

Regards,

IanT
Nothing's ever Easy - At least the first time around.

Offline Peaky 556

Re: Working towards low-cost 'Control' systems
« Reply #6 on: September 16, 2015, 09:44:08 PM »
Ahh, you've owned up to a computing background then Ian, which is why I only understand every tenth word from you (and Ralph)! I am definitely a mere 'clanky', not a 'sparkie'...

A system that offers real-time video feedback from camera in the cab, along with data such as speed, acceleration, and maybe IC engine speed etc, would be terrific!

Bring it on, I'll watch from the sidelines with interest.

 :D Tim

Offline IanT

Re: Working towards low-cost 'Control' systems
« Reply #7 on: September 17, 2015, 12:28:09 AM »
Well DEC 16 and 18 bit minis - that was a long, long time ago Tim.

It's going to take a lot of work to get up to speed on this but it is much better than just watching telly!

Regards,

IanT

 
Nothing's ever Easy - At least the first time around.

Offline cabbage

Re: Working towards low-cost 'Control' systems
« Reply #8 on: September 17, 2015, 07:03:39 AM »
IanT

I think that you have got lost in what the technology can do rather than what it should do. Yes modern systems are vastly more powerful (Moores Law etc). But what is it that you want it to do?

If I have B0-B0 loco with an on board battery.

I want it to go forwards and backwards.
   The loco to start and stop easily -either linearly or exponentially.
   The loco to use low frequency PWM for initial traction increasing to high    frequency for economical      running.
   The horns to sound at stop and change of direction and switch off.
   The sound of the IC engine to vary as the speed varies.

I want the lights to change ends
   I want the lights to show certain combinations.
   I want the rear tail lights to go out when no running light engine.

I would also like
   A battery monitor.
   Video feed.
   etc…..

From my background at Siemens the above would be called "The Rich Picture". What everyone now needs to do is add what they see as required into the list of "The Rich Picture". Once that is produced then standard methodology will produce the working requirements for the system THEN design can begin.

Tim,

I would have you now that there is also a lot of "Clanky" "Sloppy" "Drilly" and "Gurgle" in the production and installation of liquid cooled computer systems. The cabinets were 42U high 1m square and had a point loading of 18metric tonnes per sq metre. Each cabinet (typically) drew 15kW they were also internally "gas flowed" to ensure even distribution of coolant….

regards

ralph

Offline AllWight

Re: Working towards low-cost 'Control' systems
« Reply #9 on: September 17, 2015, 08:39:23 AM »
How about a control system using bell codes for ordering of tea or coffee with or without sugar, with or without custard creams and an emergency bellcode for the jaffa cakes. You could use your iPad system for this but be warned it may iniate the iNag response system.

Additionally the use of young kids to automatically change the points if its too far away, likewise the use of the kiddies as servants will iniate the "iDont want to" system response.

Good luck with taking over the world Ian

Mark

Offline IanT

Re: Working towards low-cost 'Control' systems
« Reply #10 on: September 17, 2015, 09:17:14 AM »
Ralph - Yes, I do understand this but I was asked about 'potential' and tried to give a longer-term vision of what could be 'possible' - based on what is already being done elsewhere. My immediate objectives are to just control some simple functions on my own locomotives. I've stated that this is very much a learning experience for me and I obviously have to start somewhere.

Referring back to your earlier post - I would like some help in terms of 'power' systems (e.g. converting control level signals to suitable power levels (H-bridges etc). The Raspberry Pi could certainly be used as a Wi-Fi 'hub' and internet bridge but my immediate needs are all "on-board".   

The whole point of doing this work - is to be able to manage the underlying costs involved and to make sure that we end up with work that is specifically designed to meet our (G3) needs and that can be freely shared.

Looking at what MERG have already achieved (in terms of railway control systems) I very much doubt any RM enthusiast would choose a commercial control system these days unless they wanted an 'out-the-box' solution that was both expensive and proprietary in nature. In fact I believe that all of the leading edge work in this area of railway modelling is in fact being done by "amateurs" now.

Mark. Well I guess I can take a ribbing in good grace and if you (eventually) do decide that you might like to use some of our 'chippery' in your engines, then I'm sure you will be very welcome to do so. :-)

Regards

IanT
Nothing's ever Easy - At least the first time around.

Offline AllWight

Re: Working towards low-cost 'Control' systems
« Reply #11 on: September 17, 2015, 10:53:51 AM »
Sorry Ian

I am still just getting to grips with a long piece of string and two cups as a form of communication

 ;D

Mark

Offline cabbage

Re: Working towards low-cost 'Control' systems
« Reply #12 on: September 17, 2015, 11:08:38 AM »
"H" drive is actually very simple! You need a suitable set of transistors (grabs first pair to mind) BD140 and BD139 and if you feed the sides from two parts of a NOT Gate such as a 74C14 you will get fwd and reverse. Main power PWM control can be done via a NAND Gate or an 555/566 feeding an IRF620 but you would really need a relay for fwd/rev -as these things can be BRUTAL in the current switching dept.

One of the things I have always wondered about are the merits of Pulse Width AMPLITUDE Modulation i.e. slicing up a rising sine wave rather than a constant voltage square wave?

regards

ralph

Offline IanT

Re: Working towards low-cost 'Control' systems
« Reply #13 on: September 17, 2015, 02:31:18 PM »
Well Mark - we could try to replace the string with high tensile wire (to improve your range) and I've heard that tin-cans provide a better high frequency audio response than cups - but I'll have to check the internet to see if there is a more modern approach to intercoms available these days...??    ;)

As usual with your posts Ralph - whilst I understand the general idea (of PWA) I have no idea what the practical pros and cons might be - although I'd be very happy to learn more.   

My new goodies finally arrived this morning and I was lucky as we saw the UPS truck turn into our road as we were driving out of it. I had to park the car on the main road and run back to catch him. So I have now have some new 'capabilities' that need to be learnt and absorbed. It promises to be a pretty steep learning curve too - as I'm several decades behind in my technical knowledge.

In case anyone is worried that I'm planning to bury the Forum in masses of computer 'stuff' then please don't be. I simply think that if one or two of us are working in this area - then it makes sense to try and use a common hardware platform and development tools if possible. Hopefully, we can update everyone with our progress from time to time, which is quite likely to be painfully slow (at least when I am involved).

Regards,

IanT
Nothing's ever Easy - At least the first time around.

Online Gavin_B

Re: Working towards low-cost 'Control' systems
« Reply #14 on: September 17, 2015, 08:38:30 PM »
One of the things I have always wondered about are the merits of Pulse Width AMPLITUDE Modulation i.e. slicing up a rising sine wave rather than a constant voltage square wave

I have tried this and it works well.  I borrowed the idea from here.
http://www.berryjam.eu/2015/04/driving-bldc-gimbals-at-super-slow-speeds-with-arduino/

Works well and drives brushless motors very slowly

G