G4. Calculate Regulator Resistor Values



















We now have two simultaneous equations. The first one can be simplified to:

ROffset   =  R1 x (4.3/1.25 - 1)   =  R1 x 2.44



If we now substitute this into second one we can solve for R1:

1.25 x (1 + (R1 x 2.44 + 1000) / R1) = 9v   =   1.25 x (1 + 2.44 + 1000 / R1)   =   4.3 + 1250 / R1 = 9


Subtracting 4.3 from both sides we get:

1250 / R1   =  9 - 4.3  =  4.7


Rearranging to solve for R1 we get:

R1  = 1250 / 4.7  =  266 Ω


If we now substitute this answer into the first equation we get

ROffset   =    266 x 2.44  =  650 Ω



The box above facilitates this process quickly with real components.

Useful Circuits

D2. LM317 Universal Calculator

We all use these everywhere. I’m constantly placing them hither and thither so got Excel to do the calculations for me for a range of voltages and range of outputs. It’s very useful. You may download it for free by clicking it..

D. Voltage & Current Regulators

Safety

Anything electrical has the potential to do harm. Please act responsibly.

B1. Super Simple Servo System

If you need to control the position of something precisely like the selection of the gear that a model is in or the direction that the steering wheels face then a servo motor and servo control and amplification components are usually required. A long time ago I came up with a cheap closed loop control system for my models. A very good Engineer’s adage is that if it looks good it probably is.

See magazine article here:       MGE100_UniversalServoUsingAStandardDCMotor.pdf

B. Motor Control Systems

B2. Pulse Width Control Motor Control

In case you hadn’t heard: the beauty of PWM if its staggering efficiency. No heat is dissipated in the regulating power component. This is achieved by having this component either full on or full off. By varying the ratio of one to the other the power is varied to the load. The system acts just like a variable resistor only it doesn’t get hot. Using a cheap power FET is so simple that it’s the perfect solution. Please be aware that if used to control models a variable resistor provides no regulation of motor speed so if the motor is loaded it’s speed will drop and you will need to increase the output accordingly.

Here’s the circuit:              MGE101_MotorControlByPWM.pdf

Here’s the circuit layout:  MGE101_MotorControlByPWM_VeroLayout.pdf

B3. Motors & Limit Switches

A practical explanation of how to wire a motor so that it goes so far and stops yet can be brought back.

See explanation here:  MGE102_MotorCircuitWithLimitSwitches.pdf

C1. Split Power Supply For Common Earth Motor Control

Power cannot yet be sent to a motor without wires. They can be distracting to the look of a model so are best hidden. What if you could halve the number in one stroke ? Here’s how:    MGE104_SplitPowerSupply_SuitableForMotorControl.pdf

B4. Dual Speed Common Earth Control Box For Low Current Motor Control

Using power supply B1 below this box offers +9, +5, 0, -5, -9v on a common earth to any of 4 motors at the same time.

Here’s how:    MGE105_UniversalControlBox_SuitableForMotorControl.pdf

C2. A Tiny Circuit To Indicate The Fuse Condition  Of Single Or Split Supply

It’s nice to have a single indicator quickly show the first sign of where a fault lies. That could be tricky with a split supply -it’s easier than you think.

Single rail indicator:   MGE106b_FuseConditionIndicator_SingleRailPowerSupply.pdf

Split rail indicator:      MGE106a_FuseConditionIndicator_SPLITRailPowerSupply.pdf

C. Simple DC Power Supplies For Models

D1. LED Current Regulator

Putting lights on a model brings it to life. Whilst LEDs are not omnidirectional they are cheap, consistent and never ‘blow’. Simply inserting a series resistor will limit their operating current to the correct value from a fixed voltage. But what if you don’t have a fixed voltage. In reality all models are powered down a wire. If the load on that wire varies so will the voltage at the end of it. If battery powered then that terminal voltage will depend on the battery’s condition. Thus your LEDs brightness will vary.

Also it can be a pain having to solder up multiple series resistors everywhere. And if you change your supply voltage bingo you’ve got the pain of changing all those resistors which may be painted in. There surely can’t be a simple answer to this ?

There is a very simple answer: Why not think fixed current ? A LED’s brightness is based upon the current passing through it. The resistance of the P-N junction is very temperature dependent. This is why manufacturers give a range of forward voltages for a given temperature range. If you’re so used to using a voltage regulator the concept of a current regulator can’t be so foreign to you. And where do we find a jolly good current regulator in our every day box of bits ? Yes a transistor ‘collector’  is one. It requires a tiny few components and could even be made variable !


Using this method has one superb advantage: if you are using the same LEDs on a model they will each require the same current to operate them. Aha so why not wire them all in series ! And frankly with a high enough supply voltage you can add more in the chain without having to add any more components nor change the transistor ! Blimey that’s easy.

See circuit explanation:  MGE103_UniversalSmallRegulatorForLEDs.pdf

See Veroboard layout:     MGE103_UniversalSmallRegulatorForLEDs_VERO-LAYOUT.pdf

To make the light output adjustable we therefore need to build an adjustable regulator circuit. The adjustment is normally done with a variable resistor controlling a voltage regulator like the good old LM317 above.


You could just leave it at that. However a fair amount of your variable resistor’s (potentiometer or ‘pot’) adjustment is wasted just getting the circuit up from zero to where 5mA will flow. What one needs is a fixed resistor in series with the pot so that its full range produces useful adjustment. I’m really happy to do the maths for this and I find that often reality comes close to what I’ve calculated but not always and so I have to tweak the values. This is tedious so I found another, quicker way..

Obviously the answer is to prototype the circuit but I found myself leaving bits of breadboard lying about with different favourite prototype circuits on. The answer was a prototype in a box. Here’s the circuit; let’s look how it works..


E11. Regulator

You should recognise our friendly LM317 or LM317L regulator -they are virtually identical electrically. For robustness against short circuits I used the larger 1A TO220 version and bolted it to the metalwork via a mica washer and heat-transfer compound.

E12. Fixed Resistor R1

Across the regulator’s output and the Adjust pin is R1. I’ve included a rotary selector (yellow) so that a number of standard values (120R - 1K) can be switched in. However as there may occasionally be other requirements I’ve included a position for “Other”. This may be connected via two terminals (knurled brass).

E13. Adjust Potentiometer R2

Between the Adjust pin and the negative rail is R2. As in the table above R2 is the  adjustment resistor. It’s external to the box and easily connected via two loudspeaker ‘push-button’ connectors (red and black).

E14. Metering

The whole point in this is to design a circuit that works over the desired range of Output voltages so it seems eminently sensible to include a meter*. This has a micro slide switch* metering to input or output voltage.

It may seem pointless monitoring the Input voltage. However as both the LM317 and LM317L can regulate from 40v if a reasonable amount of current is being drawn then one needs to be mindful of the total power to be dissipated as heat from the device.


P =  Voltage Difference (Input -Output)   x   Output Current

E15. On/Off Switch & Smoothing

I’ve included another micro slide switch* to disconnect all the power whilst I fiddle about. The meter will produce a small amount of RF noise and it is good practice to slug the output with a small reservoir capacitor.

As with all my projects Input and Output are via audio phono (or RCA) jacks which are physically robust and if needed can carry upto 10A.

There is a ‘Power On’ LED with a series resistor which is relatively high so that 40v input could be handled.

It’s all fitted into a small aluminium Eddistone Box*.

E16. Purchasing*

I always get asked for this:

  1. Meter:  GTIWung: Voltmeter DC 0-100 0.28inch   4off £.6.69

  2. Slide Switch:  DPDT/M2 fixing  New Rise: Toggle Switch 2 position 6 pin 5mm   10off £0.88 + £0.81p&p

  3. Eddy Box: Aluminium 112x60x31mm  Lightfuture Store: Diecast Stompbox 1590BB  £5.86 + £2.02p&p.


Everything else was lying around in my storage boxes at home.

E. Regulators For LEDs:  Universal LM317 Prototyping Box

F1. Measuring A LED’s Maximum Current

To use LEDs to their full potential you will need to know the boundaries of your design. If you don’t know the maximum current that a LED can handle then it can be measured. To a stabilised variable power supply connect the following in a series circuit:

     Your unknown LED + 100R resistor + ammeter (with appropriate range eg 0-100mA)


During the test your room should not be brightly lit. With the supply output set to zero steadily increase it. Notice the exact colour of your LED. Keep going but as soon as the colour changes slightly it is over-heating so note the current and turn off immediately. The normal maximum current (let’s call it Imax) for your LED is 80% of this figure. Imax will be in the range 15-35mA. For the examples here I’ll use 24mA.


F2. Measuring A LED’s Forward Voltage

Remove the Ammeter from the circuit. Leave the LED in the circuit but replace the resistor with one calculated in the following way:


R =  20 - 2.5 / Imax  =   17.5 / Imax       (if Imax is in mA then R will be in kilo Ohms)

You are now in a position to design your regulator. Let’s assume that you are using a 12v supply which is a few meters of cable away. Let’s be realistic about cable loss so let’s assume that by the time it arrives VIn is 11.5v. Let’s now calculate the boundaries:


G1. Calculate Maximum Output Voltage That Will Be Available From Our Regulator

Nearly all regulators need 2v - 2.5v to operate so let’s be pessimistic (and allow for a little more cable loss):

VMax =  VIn - 2.5v     =  11.5v  -  2.5v   =  9v


This will be the maximum voltage that will be applied to your LED + dropper R no matter how many are connected in parallel (see below right).



G2. Calculate Size Of Series Dropper Resistor

Now use the following equation:

R =  (VOut- VForward ) /  Imax       =   (9v - 3v) / 24mA   =  250Ω


The nearest preferred value is 270R which just nicely reduces our maximum current a bit.



G3. Calculate The Regulator Minimum Output Voltage

We are aiming to drive a minimum of 5mA to each LED (see end of Section D02.) so this is given by:


VMin =    Imin   x  R   +   VForward      =   5mA x 270  +  3v   =   4.3v

F. Unknown LED:  Measurement Of  a) Maximum Current,  b) Forward Voltage

G. Designing A Regulator Circuit To Match Your LED’s

Universal LM317 Prototyping Box

As an example: if your value of Imax was 26mA then R will be 1.5K. Place this series resistor with this calculated value (chose the nearest preferred value is the accuracy of this component isn’t critical) in the circuit, ie in series with just the LED, and turn your power supply on at 20v. The LED should illuminate at maximum brightness.

Switch your ammeter to measure voltage, in the range 0-10v, and measure the forward voltage (VForward) of the LED. As mentioned before it will be in the range 2.2-3.2v. The guess in this latest calculation was 2.5v and any small error will hardly affect this forward voltage figure (try it by waggling the the power supply a bit -but don’t go mad for obvious reasons). For the examples here I’ll use 3.0v.

E1. LED Circuit Design Criteria

I happen to make a lot of mini regulated power supplies for LEDs and not just for models. All component LEDs (not power LED arrays) have a forward voltage drop of 2.2v - 3.2v. One could therefore supply these devices with the exact voltage that this implies. However manufacturers will always give a range -for good reason: because, as stated above (Section C1) they are current dependent devices. Traditionally if one wants to power several lamps at a time then one wires them in parallel. However LED’s are a bit different, as each one varies very slightly from the next, the current will take the LED of least resistance and so some will naturally be brighter than others. That’s not sensible circuit design.


Worse still is that the conductivity of silicon has a negative temperature coefficient, which is fairly steep, so temperature variations will lead to variations in their conductivity (the inverse of resistance) and therefore brightness again -this can even lead to thermal runaway. If the circuit is used outdoors then temperature naturally varies far, far more than indoors. The solution is simple: by adding a large enough series resistor one swamps out this effect stabilising the whole situation.


E2. Adjustable LED Brightness

I often want to adjust the brightness. I said that LED’s are current driven devices but their brightness in NOT linearly dependent on the current flowing through them. Although they’ll be visible to our very sensitive eyes when looking directly at them useful light output, for illumination of some object or wall, starts, not at zero but from around 5mA and can be increased right up to their maximum design limit. For coloured LEDs this is normally 20mA and for white LEDs 25-30mA.

If you want the original artwork (in MSWord 2008 format for ancient back compatibility):    RegulatorProtypingBox.docx

Our regulator circuit is going to look like this (see left) with the offset resistor shown in yellow.


This means that with the potentiometer set to zero, fully anti-clockwise, it should give out 4.3v. Using the normal equation for an LM317 we get:


VOut =  1.25 x (1 + ROffset/R1)   =  4.3v     [1]


Let’s assume that potentiometer has a range of 0 - 1K. As we turn it clockwise, increasing its value, the output voltage should also increase linearly (see graph right) until we get to 9v.

VOut =  1.25 x (1 + (ROffset + 1000) / R1)  =  9v     [2]


Checking our calculations:

VOut =  1.25 x (1 + 650/266)  =  4.3v


VOut =  1.25 x (1 + (650 + 1000) / 266) )  =  9v

So now we have all the criteria for making our regulator circuit. The box above facilitates this process but let’s look at the painful theory without the box..

A. Simple Switches

A1. Reversing Using A Split Power Supply

By far the simplest arrangement is to power your load either from the upper half or the lower half of a split power supply eg +9 - 0 -9v. If the load is connected to the earth or chassis then only one conductor to the load is necessary.


A2. Reversing Using A Single Power Supply

Most conventional power supplies have one output eg  +9v - 0. In this case a more complicated switch and two wires are required.


A3. Series Parallel Working

Occasionally one requires either full voltage or half the voltage to be supplied to a pair of loads. For this to work evenly then the loads much be equal eg two light bulbs of the same power. Again this is simply arranged. Note that when in series, as power is proportional to the Voltage squared, then the power in each load will be one quarter of full power.

Usefully a simple version of the circuit can easily be put on Veroboard and put into a small box.

WARNING

The tab of the regulator is internally connected to the Output. If your box is earthed  you may want to isolate the tab from the box.

Less Haste - Less Waste

At exhibitions that I’ve attended I have often seen the most incredibly messy control boxes and quite often with the most thundering number of thick wires traveling up and down an umbilical cable. Yet it doesn’t have to be this way. Firstly it’s a waste of copper, secondly a waste of power and frankly plain hard work to find faults in when things go wrong.

Battery Power Is Limited

When your model contains motors that are gaping for power they are even less so when the current that they need goes on a grand tour to the control box and back. Of course one could always use thicker wire in the umbilicalcable but seriously that isn’t curing the problem at cause. If the batteries are in the model this is quite a waste. If motor speed control is required then it’s normal to put on the model a power controller like a switching H-bridge (readily available and cheap from AliExpress or others). With care these can be remotely controlled. However if the motors only need to run forward or back without speed control here’s simpler electromechanical way.

Signals Only Needed

The umbilical control cable should really only signal what the operator requires. Ideally one wire should control one motor (digital control of models works this way but is expensive). A cheaper way is to use the common earth Split Power Supply System with say a 9-0-9v power supply (as in A1 above). However for a battery system that actually starts to get a bit more complicated (here I won’t go any further to explain why maintaining that balance can be tricky and even that doesn’t prevent the larger current going round the houses).

I. Controlling DC Motors Over A Very Limited Umbilical Cable

Unscrambling The Message

For each channel I built a mini circuit board that has an edge connector (one is being tested below). Each plugs into a small motherboard and thus there’s actually very little wiring anywhere. On each circuit board there are two relays that work out what has to be done. RLY1 (orange) works out whether the requirement is to go forward or back (shown feint is an optional LED which illuminates in the latter case). Then, a fraction of a second later RLY2 (blue) says Go !

The Trick

The trick is to ensure that the first, reversing, relay only switches when it really has to and that’s done by the series 5v zener diode ZD1. How:

  1. a)If only 5v is applied then ZD1 blocks the whole voltage and the RLY1 doesn’t. Only RLY2 operates.

  2. b)If 9-12v is applied then ZD1 gets 9or12v less 5v across the diode = 4or7v and the second relay gets: 9 x 70/92 = 6.8v or 12 x 70/92 = 9v. Both relays RLY1 and RLY2 operate.

The Delay Avoids Arcing Damage

Of course RLY2 just has to say Go but together R1 and C1 delay the operation of it by about 0.1 seconds waiting for RLY1 to make up it’s mind. Relays may take different times to operate and this prevents the heavy, inductive motor from starting in one direction and then frantically being told to go in the other direction if RLY1 was slower than RLY2. Not only does this clear demarcation of jobs prevent RLY1 arcing but also possible motor or gearbox damage. Thus relay, motor and gearbox life is significantly improved.

Veroboard Layout

The Veroboard layout is shown to the right. Notable things are:

  1. a)It has been designed for all connections to pass through a 5 pin PCB connector. You obviously don’t have to do this.

  2. b)Do make sure that you cut all 8 tracks marked with a red X.

  3. c)Do get the polarity of the LED, capacitor and zener the right way round. Check also which are your relay NO contacts.

PURCHASING

Relay:  DPDT Schrack 5v DC, 8A

RS: 

CPC:


Relay:  SPDT Songle 5v DC, 10A

Amazon:

Prices: Summer 2024

RY612005 £4.62ea

SW0651    £3.08



12 for £7.58

Large Motors

Using the specified relays allows motors up to 10A to be switched even though the reversing relay is only rated at 8A because this latter never changes with power on it.

Very thin control wire

The worst case current flowing in the control wire is RLY1 + RLY2 +LED:

I= (12-5)/70 + 9.1/70 + (12-2.2)/1000= 100 + 130 + 9.8 240mA



Control Box

In the control box I used a standard 7805 regulator. It’s 1A capacity means that up to 4 motors could be put into reverse (ie when most control current is used) at the same time. In practice it would actually be a very rare occurance and if you did the regulator has overload protection so wont care. Ideally one should remember to decouple the output with a reasonable reservoir capacitor eg 2500u @10v. Frankly I was lazy and didn’t but if you experience relay chatter this could be the reason.

A NOTE ON ALTERNATIVE RELAYS

These relays are massively over specified for the motors that I used. Their coils have coped quite happily with modest amounts over their voltage ratings. However if you know that you are going to use different relays, especially if using a 12v system, then you may have to increase the size of the second relay’s series resistor to 33R so that it gets 12 x 70/103 = 8.1v. You cannot increase this resistor too much because it needs to turn on when 5v is applied. In the latter case it will get only 5 x 70/103 = 3.4v and this may well not be high enough to swing it over properly.

In this case then a reverse biased 5v power zener may be needed in parallel with the relay to bleed off over-voltage. I didn’t happen to need to do this.

Purpose Of D2

At this stage the diode D2 has not been of much use. However it only comes into play when a 12v control voltage is removed. Let’s consider that case. If it were not there, the capacitor being fully charged to 12v would keep its chum RLY2 energised for a moment. In that happy moment RLY1 will be de-energised and drop back to its rest condition. However we said that RLY2 was still energised: thus keeping power applied to the motor. The ultimate result is that the once reversing motor gives a small kick forwards before it is switched off. This isn’t clever and again for the reasons listed above this is not desirable especially with very large motors and heavy gearboxes so D2 prevents this. R2 is just a bleed to ensure that C1 is discharged each time power is removed.

Please Don’t Catch Fire

Finally I’m not laughing (honest) but I have seen someone’s model catch fire when a short circuit developed and the wiring acted as a fuse and ten or twelve meters of glowing wiring filled the exhibition area with toxic smoke. Thus before you start any project, please always fuse each of your models. Fuses are cheap -your time isn’t.


It’s quite easy. Have fun.


Basics download (60k): MGE113_MultiControlOfDCMotors_CircuitDiagram&VeroLayout.pdf

How the finished circuitboard might look with a simple control panel.

The Wonderful Way

Keeping The High Power On The Model

I wanted a very simple control box with SPDT switches to operate all the movements on a fairly complicated crane so devised a way of analogue signaling. The diagram (below) shows the detail of one channel of an extendable system using just one wire per motor –a boon if you have many motors and/or a long cable. Each channel sends 5v to signal “Go Forward” and full power to signal “Go In Reverse”. It is the model that deals with decoding of this and so all the heavy current wiring is kept efficiently there -on the model itself. Here’s the circuit diagram. The Control Box, which contains a single 5v voltage regulator, is so simple it needs no explanation.

H. Simple Ring Squencer For LEDs

H1. Animate Your Life

Sometimes you just need a bit of pazzazz. This circuit keeps all LEDs to be illuminated. They are divided into three groups and each group will be extinguished in sequence so as to appear moving.

1. Three independent amplifiers Without the three capacitors (C1, C2, C3) each circuit channel acts as a high gain Darlington amplifier. The transistors are current operated devices and their behavior is such that the points ①, ③ & ⑤ never go above 2 x 0.6 = 1.2v*.

2. Start Up: Off-On-On When the circuit is first powered a very small current, provided by R2 & R3, sets the second and third channels on. However you will notice that R1† is actually split to make the start up circuit (shown purple). At switch on there’s no voltage across C4 thus no current flows through R1b and the first amplifier can’t switch on giving the Off-On-On state. This isn’t permanent because R1a starts to charge C4. Its rising voltage starts to coax some current through R1b. When this current gets large enough, because of the high gain of the amplifier, suddenly it will switch on and the voltage at point ②, presently pulled high by the LEDs crashes to about 0.3v. Thus, momentarily, all amplifiers are switched on.

3. Next in line However C1 capacitively couples point ② to point ③ and thus this latter also drops to 0.3v. This turns the second amplifier off giving a On-Off-On state.

4. Nothing is forever C1 starts to charge through R2 (their time constant is roughly 0.6 sec). As C1 charges the voltage at point ③ rises. Eventually when that voltage reaches 1.2v it is enough to switch the second amplifier on.

5. Next in line  If this second amplifier (T3/T4) suddenly turns on point ④ will drop to 0.3v and C2 will rob the third amplifier (T5/T6) of its base current through R3 and therefore turn the third amplifier off. The state is now On-On-Off. Of course, just as before, C2 now starts to charge. The voltage at point ⑤ rises until suddenly the third amplifier turns on.

  1. 6.Ring Oscillator Can you see because point A is connected back to the start each amplifier will turn off then on in sequence around the ring. The process continues indefinitely and if you have laid the groups of LEDs in contiguous sequence then a dead spot will appear to move onwards in sequence.


Complete circuit explanation (80k download): MGE115_SimpleRingSquencerForLEDs.pdf   

And Vero layout (140k download):                      MGE115_SimpleRingSquencerForLEDs_VeroLayout.jpg  (needs start circuit added)

H2. How It Works

H3 Components

   Transistors




   Capacitors


   D1 & R4



   C5 & Fuse


Any small signal NPN transistor can be used for T1, T3 & T5 and likewise the others. However it is likely that you will have many LED’s connected to each channel. With suitable LED series resistors you should aim for equal brightness at about 10mA/LED for all colours -except yellow and white LEDs that often need 15-20mA to give similar brightness. As I only had 8 LEDs per channel, that’s 8 x 10mA = 80mA. Thus I was able to use BC107s for these latter as they can switch a healthy 200mA.

Each time a channel turns off these will be charged to the supply voltage less 1.2v*. Therefore they should be 16v or 25v types. Incorrect polarity causes tantalum ones to explode.

Optional D1 protects everything from accidental polarity reversal if you have hidden wiring. D2 discharges C4 at switch off –it can be any small signal diode. Resistor R4 is there to complete the discharge path via D1. It is optional -another load in your installation may perform the same task. If your installation is battery powered then don’t include it.

This can be any reservoir capacitor to stop flickering.  By default you always include a fuse in your circuits don’t you ?

Complete circuit explanation (80k download): MGE115_SimpleRingSquencerForLEDs.pdf   

And Vero layout (140k download):                      MGE115_SimpleRingSquencerForLEDs_VeroLayout.jpg  (needs start circuit added)

D3. If You Really Want To Squeeze It All In

I saw a beautiful Christmas ornament but it was only available in a battery powered version. I replaced the battery box with a much smaller version measuring roughly 2¼ 1⅜ x ⅝”.

It is fed by an old mobile phone charger, which I have plenty of, but most put out 7.5v so a regulator is needed. The 10 turn pot gives an adjustment of 0.6v/turn. So many of these use non-standard wiring colours that I included a series diode just in case I made a mistake in future.

The LM317 is capable of regulating 1.5A but do bother calculate the power dissipation. Mine produces 2W of heat so I superglued a metal plate on the outside. Beware the LM317 connects this to the output !   On the layout below the power flow is from bottom to top. The terminal posts are Vero pins on Veroboard superglued to the box.

58mm

35mm

5K

15mm

Purchasing

All the components are commonly available. The box is from AliExpress @ 0.65ea: Instrument Project Box, Grey

Advice

Build it from the bottom outwards. This is a tiny project so use the minimum solder possible otherwise you end up being Mr Blobby !