Jump to content
 

Using R/C servos on layouts


Guest baldrick25

Recommended Posts

Guest baldrick25

Radio Control model servos offer a useful way of easily automating the operation of points, multiway points crossovers and added signalling (mechanical and colour light).

Lets start by looking at a typical servo. The one I have used is the Tower Pro 9G Best Mini Micro Servo SG90 , a long and complicated name for something costing £3 or less from UK stockists , and cheaper still in bulk and from Hong Kong suppliers, complete with 'horns' as the pierced arms as called.

They need typically 3.5Volts to a maximum of 6Volts, with a power supply needs of 650mA whilst moving or stalled, a couple of mA once they have finished moving. Typically they have a rotation of 180degrees of the shaft, and move in minute , but finite steps in between- like a stepper motor.

How are they controlled. Each servo has three connections , a black lead for the common supply and control, a red lead for the positive supply, and a white lead for control. They have a micro-controller built in and respond to a specific pulse or pattern of pulses. They need to have a control signal normally zero but 50HZ ( 50 times a second) , a square wave pulse of 1-5mS. This is easily generated for components costing a couple of pounds , and anyone with electronics know how and scrap box , will almost certainly have them in the 'spares' box. See the last image.

 

PICT0462a.jpg

 

What you see in the images is a working model just to demonstrate the principles- not necessarily how it would be added to a layout as I will describe later. Looking at the image above the servo is bottom centre, the electronics is on the right , and some switches to be wired into the points instead of the usual Peco switch. A spare servo is shown in the image below, bottom left showing the wiring and a selection of horns.

The image above shows the servo at its most clockwise ( electronically selected) stop , there is more mechanical movement which is reserved for later signalling.

 

PICT0463a.jpg

 

This image shows the servo having moved one ( electronic ) stop anti-clockwise and one direction of the three way point has changed to give the centre lane. The servo is connected to the point with 22SWG ( about 0.5mm ) piano wire with an omega* loop near the point and used as a microswitch operator .

*Whats an omega loop- Its that horseshoe shaped loop which acts as a 'spring' so the point is operated , but not forced.

 

PICT0464a.jpg

 

This image shows another electronic step anticlockwise and now we have selected the lower track.

 

PICT0468a.jpg

 

A view from a different angle , just to make things clear. The sharp eyed will note that the power supply seems to be on the test rig, that's just a spare to show what I am using - there is another plugged in the workbench below. The servo floating around is just to show what they look like before being installed.

 

PICT0466a.jpg

 

Finally the elctronics board, which uses two 555 timer I/Cs ( you could use a single 556 , but I couldn't find one when I built that circuit). The part of the circuit on the left of the board is just the power supply and 5Volt regulator. Yes I use 5Volts , not the maximum of 6Volts , there is still lots of mechanical power output. The two potentimeters , the top one sets it to about 50HZ ( not critical and totally un-necessary I found after I built them) and the bottom one sets the electronic steps.

Now how does the prctical version differ ?

Well its all built under the baseboard, so nothing is visible except the points. The servo is mounted with the horn next to the baseboard , so the operating piano wires can be run in tubing ( recommended- what I did in this lash up was just to use ceramic bead guides with a dab of hot melt adhesive) The switches are mounted on a plastic plate with elongated holes so they can be adjusted ( here they are just stuck with a bit of twinstick) Other switches are added as required and used in conjunction with the signalling set up.

I mentioned an unused 'stop' anticlockwise , this I used to operate a small shunting signal (mechanically operated ) to allow access to the siding.

 

If there is enough interest let me know with some feed back here , I can take this further and add a copy of the circuit diagram , and some ideas of how to control it manually , and via some electronic interlocking etc, as I did.

I can also add part 2 ( given time) , with 2 points on a crossover ( single servo operated) and signalling and then some other options for using servos instead of point motors. A least they are more prototypical compared to the 'bang' of solenoid type operation.

I hope your interest has been aroused. Thanks for bearing with me. (Plaese don't comment on teh spelling , I blame it on the spell-checker ( me) - and so-what about the grammar)

Feel free to add your own ideas on using R/C servos on your layout or comments.

Link to post
Share on other sites

I, for one, welcome articles about using servos. They are such versatile little things and usually so much smaller and quieter than alternatives like Tortoises, even if mounting and linkages do require a bit more work. There have been several topics here and on previous RMWeb incarnations about using servos for turnouts, signals and other applications (just type servo into the search box). Quite a few of us are using the MERG Servo4 controllers to set rotation speeds and end stops, both with and without DCC. Someone, perhaps Stephen (Bertiedog) published a 555 based circuit at some point, but different approaches are always welcome.

 

What I find particularly interesting about your approach is the way you use a single servo with help from omega loops to provide sequential control of several functions. Do you have a solution to stopping at each intermediate point, or is it all done by eye? I'll be particularly interested to see your solution to driving a crossover as I'm about to do the same myself.

 

Nick

Link to post
Share on other sites

Guest baldrick25
What I find particularly interesting about your approach is the way you use a single servo with help from omega loops to provide sequential control of several functions. Do you have a solution to stopping at each intermediate point, or is it all done by eye? I'll be particularly interested to see your solution to driving a crossover as I'm about to do the same myself.

What I do to set the number of stops is this.

On the electronics board you can see the pot at the bottom of the board, I replace that with a 4066 quad bilateral switch and 4 multiturn trimpots. They are wired to be SW1 for the first adjustable mechanical position, SW1+SW2 for the second postion , SW1 + SW2 +SW3 for the third , and so on for the fourth 'stop'.

Thats what I do for manual postioning, but the layout is also computer controlled ( Self build , not DCC and thru the RS232 port) , then the 4066 is just straight wired one pot per switch, selectable via software.

I did consider using optoisolators , but as that would put a semiconductor junction in the sense diode or transistor into a timing circuit of the 555 , I took the view it would not be stable enough.

That little electronics board is just a test board I keep , so any problems on the layout , unplug the servo and reconnect to the test board , then its just a tweak of that pot to see what needs adjusting.

I also use multi microswitches and stick with things like V3's as they are so reliable ( and sealed relatively) . A little trick I do is solder a little washer to the piano wire at a suitable place, on the point side of the omega loop, then cut a slot in the microswitch operator. What I do then is put one switch (unoperated) one side of the washer , and one the other side of the washer which is operated. As such the operating force is 'subtractive' not 'additive'. It takes less mechanical force to operate two switches back-to-back than one on its own. I stick with a light action 3A version as well.

If I need more than 4 stops on the servo then I found I need an extra omega loop , together with some 'physical' stops, which limit the wire travel to things like (lower quadrant) signals . Let the omega loop take the starin - not the signal.

I also try to keep the servo as close as possible to the points controlled , but with piano wire operation there is a degree of flexibity to avoid other things under the baseboard.

Last point this time , on the electronics I use a small rechargeable Ni-Cad to operate the servos on the layout , and the power pack acts as a charger . Between the battery pack and the servo circuit is an NPN darlington transistor , with the base connected to the charger supply ( via circuitry obviously) so when I cut the power to the layout, the servo ciruitry is automatically isolated. As soon as the Ni-Cads start charging next time , then its power up the servos.

One Ni-Cad pack drives 5 or six servos in close proximity to one another.

Link to post
Share on other sites

Guest baldrick25
You can put me down for a copy, as the ones I ordered months ago just have not arrived... Very disapointed so I'm looking for a new board.

 

I presume thats a request for a circuit diagram. That will take a couple of days due to 'other jobs' that need to be done, then I need a repair to the scanner which has gone Kaput now its needed!! Typical. I will do the 555 and 556 circuit, which incedentally works with all the 555s I can dig up- those shown are the IPA7555 CMOS version.

Link to post
Share on other sites

I posted a bit about my servo solution on this thread with a few pictures:-

 

Servo mechanism for level crossing

 

I prefer to use a microcontroller solution rather than go analogue because the reduced component count reduces cost and complexity and the circuit is easily repeatable without any calibration. I suspect that temperature stability is better too - the biggest problem being in the servo itself. A microcontroller can easily give out a pulse with 10 bit resolution giving a smooth thousand steps when travelling from end to end. most analogue solutions just run the servo flat out as fast as it can go.

 

Using a microcontroller makes it easy to operate a relay rather than adding a microswitch. I have the relay set to change at mid-travel when operating a point.

 

Using a microcontroller also makes DCC interfacing easy.

 

The cost of servos is sufficiently low that there is no reason not to use a seperate one for each function. Using a single servo for a three way point or single slip is rather novel though! But having to maintain a complex linkage is asking for trouble in my book. Electronics is easy mechanics is hard. servos are now cheaper than solenoids (servo £3, solenoid £5.25) - the difference in price covers the extra cost of the electronics and, a relay is cheaper than a PL15 switch.

 

One of the most important things that I found with using servos is that they use a high peak current (0.9A in the ones that I had) which causes spikes in the power supply if things are not decoupled properly. You need a good 1A supply, or possibly a bigger one if operating more than one servo at a time. I shy away from using rechargeable batteries in a permanent installation because of the maintenance issue. A 7805 1A regulator does a good job but you do need good wiring and you need good decoupling capacitors. It is easy for the current drawn by one servo to cause another one to judder if decoupling is inadequate.

 

 

 

 

 

Link to post
Share on other sites

Guest baldrick25

Interesting comments Suzie, particularly the power supply side of things. I make sure ( since it was drilled into me during aprenticeships times) that I use the Central Earth Point method of wiring. It does increase the amount of cable , but avoids any interaction between power circuits. CEP for those not familiar is where all the common returns are taken back to a single connection point , rather than "daisy chaining" from one to another in a random fashion.

I opted for Ni-Cads because I can use one small transformer , the size of that shown in the images , which feeds up to 60mA to each "pak", but the servo operating spike of 600mA for a tenth of a second is kept 'locally' to the NiCAd and servo circuit , an area not much bigger than the PCB.

Working from a nominal 9V supply similar to that shown in the diagram , the 5V reg ( 7805) doesn't need any heatsinking, cycling it as fast as I can ( very unprototypical), its just warm.

I use nearly 90 degrees of travel for 4 steps or movements of the points , some 20 degrees movement per stop, so repeatability and long term stability is not a problem, together with good quality semi-sealed multiturn pots in the timing circuit.

Finally I keep the piano wire link as close as possible to the pivot point of the servo, to get maximum mechanical advantage, consistent with getting enough movement. I agree that 'good practice' with the point rodding is essential, thats why I said use steel 'wire in tube' construction, and keep the linkages as short as possible.

Link to post
Share on other sites

The nature of servos with the 3-pin connector makes it quite easy to put a 100n ceramic capacitor close to the black and red wires of the servo which does the job. The microcontroller needs decoupling as well but less so.

 

Common earth point will not always help when you have high current spikes because as well as the current in the black wire the same current is in the red wire and this can induce an unwanted signal in to adjacent circuits. While servos have analogue electronics inside them they are esentially digital devices that respond to pulse width and are not too worried about any offset voltages that might creep in due to poor common 0V connections as would be a problem with an anologue environment. If using a common earth point it is vital that you also have a common 5V point as well. It is more important to keep the tracks and wiring to the red and black wires close together so that the radiated magnetic and electrostatic field from the current spike is cancelled out.

 

Small 'wall wart' 5V regulated power supplies are quite easily available now which can make life a lot easier, but good decoupling does reduce the size of the power supply solution. I prefer to keep the power supply standard so generate the 5V locally using a 7805 from the power that is available on the baseboard (either DCC track supply or auxilliary 18V DC or 16V AC).

 

I prefer to use the full 180 degrees available from the servo, it reduces the effect of any potential drift caused by temperature in the servo.

 

 

 

 

Crikey I am probably frightening people now. It really is not that complicated to use servos, especially if using a ready made control circuit like the MERG or a Zimo decoder where all of this has been taken in to account already. You only have to worry if designing your own control electronics. If you are a little wary of using microcontrollers, servo control can be very straightforward so makes a very good way to try it out. Microcontrollers only cost a pound or so nowadays and a programmer can be had for a tenner so the cost of trying it out is very small. If you are keen one of the larger microcontrollers could control a dozen servos - the potential for saving money is huge.

 

Here is a typical circuit, it really is that simple. Voltage can be anything from 4.5v to 6V either from batteries or from a regulated supply. A pack of four NiMh cells will give 4.8V and last all day on one charge:-

 

post-7495-127668735347.gif

 

The switch can be replaced with an open collector type output from a DCC accessory decoder (eg MERG) if required.

 

 

Link to post
Share on other sites

if mounting and linkages do require a bit more work. There have been several topics here and on previous RMWeb incarnations about using servos for turnouts, ... Someone, perhaps Stephen (Bertiedog) published a 555 based circuit at some point, but different approaches are always welcome.

http://www.rmweb.co.uk/forum/viewtopic.php?f=88&t=49041

 

still not working - one of those things where spending more time on it than the end result could possibly justify.... perhaps one day to be returned to.

Link to post
Share on other sites

I stopped that slow motion motor thread because of lack of access during the forum changes, but can continue, several of the slow motion versions have been built in the meantime, but I am also interested in the electronics to control servos and would like the complete circuit. I have used simple control circuits for direct control, such as level crossings etc.

 

PIC's are OK, but what about programming, interfaces to the computer etc., it adds to cost and complexity for most users. If inexperienced in electronics, it is not easy to test a home made programmer and even be sure it is functioning, needing test probes and extra test gear, again this all has to be built, or purchased, and 100% working to do the next tests.

 

Stephen.

Link to post
Share on other sites

Stephen

 

PIC programmers are not expensive to buy ready made. You might like to buy a USB one from Farnell, Rapid or direct from Microchip which comes complete with a 20-pin PIC16F690 and a development board here:-

 

PICkit2 starter kit at Farnell

 

PICkit2 at Microchip

 

PICkit2 at Rapid

 

It has everything you need to fully develop a servo project - you will just need to solder a servo connector (3-pin 0.1" single inline header) and possibly a power connector to the development board!

 

You will need to be able to write the code of course, or you can always nab a spotty teenager to do it for you. This is realistically the only thing that is going to prevent you creating a successful microcontroller based servo project. There is some sample code provided in the starter kit that will make a basis for your own work.

 

It is swings and roundabouts of course, but the reduced component count and flexibility of software makes the PIC based version the best option for a new project.

 

It is a shame that the price of the starter kits has gone up a bit, presumably due to the poor exchange rate, but the PICkit2 starter kit was £9.99 about a year ago direct from Microchip.

 

The 16F690 chip supplied with the starter kit is part or a family (Microchip call them the low pin count family) which includes smaller chips that may be more suitable. The 12F683 is only 8-pin and the 16F684 is 14-pin. The smaller chips are pin compatible with the larger chips and can be plugged into the 20-pin socket for programming.

 

Since the circuitry surrounding microcontrollers is really simple, fault finding is usually restricted to checking the power supply with a meter and debugging the software. Microchip supply a complete software development environment on a CD with the programmer and it is available as a free download. You can test your code in a simulator on your PC before you buy anything if you are really keen.

 

It is not like the olden days when you had to make your own test equipment, write your own developer tools, build a hardware debug environment. Things have moved on a lot in the last fifteen years.

 

 

 

 

 

Link to post
Share on other sites

Guest baldrick25

Or buy the MERG kit for 4 servos for £4.50

 

PLUS £18 for membership , just for the privilege.....

Link to post
Share on other sites

Guest baldrick25

A quick circuit diagram - sorry its a pencil drawing , and sorry its a digital camera image- the scanner has jacked , and I wasn't paying £90 in Maplins this afternoon...

 

PICT0469a.jpg

 

Hope its clear- I will try and improve it in the next few days but there seems to be a few interested in 'giving it a try'.

 

I have a bit more of a circuit to draw and post and that is the part around the pot marked as "servo position adjust ", and that is a 4 position switch network to give 4 distinct presettable positions . Only three positions are needed for this 3way point application, so I used the extra one for a signal.

The circuit was the one shown in the above images , except I used 2x 555 I/C . The veroboard is 9 holes by 25 holes, and that's lots of room to work with , using standard components. I have built them much smaller by using SMD's , such that they fitted on the side of the servo itself.. No point though really!

The 47Kohm pot sets the frequency and for some servos needs to be 50HZ. The servo specified has much improved electronics inside and will appear to make no difference. Its not critical . If you don;t have an oscilliscope or frequency counter ,just set it mid travel and don't worry about it.

The bit of ciruitry to the right of the dotted line is only needed if you are using a mains derived power supply. If you are using batteries or Nicads just connect to the GND and +5V rails. The LED is just a vissible indication that its powered up.

The servo is 'hot pluggable' , ie connect or disconnect with power applied is no problem. The servo connection is three square pins on a 0.1inch pitch pinched off an old computer circuit board.

Possibly the only thing that will cause problems is the mechanics of the linkages, so I will do a piece next week on some of the 'best practice' methods , mainly acqired from working with R/C planes , when mistakes are costly.

Any problems , post them and I will try and deal with them.

My spares box was refilled today with another 10 servo's , and the 556's should be here tomorrow. This weekend is gonna be busy...

Link to post
Share on other sites

It is a shame that the price of the starter kits has gone up a bit, presumably due to the poor exchange rate, but the PICkit2 starter kit was £9.99 about a year ago direct from Microchip.

 

Or keep your eyes on the electronic magazines. I got a PICkit2 about 18 months ago for (IIRC) £10 including postage as a special offer through one of the magazines.

 

Adrian

Link to post
Share on other sites

Just another vote for the MERG servo board. Very easy to build and use plus a choice of software. The difficult part is the mechanical linkage - the electronics is very straightforward. I now have a bouncing semaphore and 2 ground discs all controlled via DCC/Railroad & Co using one servo driver board.

 

Julian

Link to post
Share on other sites

PLUS £18 for membership , just for the privilege.....

 

So you would expect to use your local club's facilities without becoming a member?

 

Perhaps MERG should consider make their products available at higher prices for non members. How about a 50% premium?

 

Jol (not a MERG member - yet).

Link to post
Share on other sites

Guest baldrick25
So you would expect to use your local club's facilities without becoming a member?

This wasn't intended to turn out in a flame war about MERG membership.

There are lots of members on here who give , without charge , or even a thought of a charge, of their vast knowledge and experience in this forum and the charge is absolute zero.

My experience of MERG was simply they are there just for the fund raising and a very 'holier-than-thou' attitude. Its time they learned to come clean on just what they stand for.

Link to post
Share on other sites

This wasn't intended to turn out in a flame war about MERG membership.

There are lots of members on here who give , without charge , or even a thought of a charge, of their vast knowledge and experience in this forum and the charge is absolute zero.

My experience of MERG was simply they are there just for the fund raising and a very 'holier-than-thou' attitude. Its time they learned to come clean on just what they stand for.

 

There is a considerable difference between offering information and advice on a web forum, etc. compared to the financial investment required to produce pcb's, kits, etc. and to carry stock to meet membership requirements. Several other Societies have "stores" and only supply their members. MERG isn't unusual in adopting such a policy.

 

I know several MERG members and can't say that I have experienced the attitude that you have described.

 

Jol

Link to post
Share on other sites

I think that people are being a little unfair about MERG. The designs are posted on the web and are freely available to view and download including the code. If you want to buy a kit you need to be a member, but the kits are sold at far less than a commercial price. I heard that they even pass on the quantity discounts they get on buying in bulk.

 

The Servo4 is here:-

 

MERG Servo4 zipfile

 

If you are too tight to join, download the package, etch your own PCB, program your own PIC, source your own components and then see if you have saved the membership! You have a choice.

Link to post
Share on other sites

This wasn't intended to turn out in a flame war about MERG membership.

There are lots of members on here who give , without charge , or even a thought of a charge, of their vast knowledge and experience in this forum and the charge is absolute zero.

My experience of MERG was simply they are there just for the fund raising and a very 'holier-than-thou' attitude. Its time they learned to come clean on just what they stand for.

It's very easy to make comment like that when hiding behind a forum alias.

 

A lot the MERG designs are available at zero cost, just look at their website where you will find schematics, PCB layouts, PIC programs, etc., available for download for all the DCC kits.

 

My understanding is that MERG is not allowed to sell to non-members due to taxation rules.

 

You get out what you put in, so to speak. A lot of very hard work goes onto the kit production and distribution. It's certainly not done simply to raise funds, or for an easy ride.

 

Andrew Crosland

Link to post
Share on other sites

The cost of servos is sufficiently low that there is no reason not to use a seperate one for each function. Using a single servo for a three way point or single slip is rather novel though!

The problem is that the omega loops will be in compression, more so as the servo moves anti-clockwise in this example, and the servo will be fighting against them. This can lead to noise form the servos and a much higher power consumption than expected. One solution is turn off the control pulses once the servo reaches the desired position. The friction in the servo gear train is enough to hold it in place.

 

Andrew Crosland

Link to post
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...