# 555 timer to control a servo with 2 variable positions

If possible, I'd like a circuit with a 555 timer, 2 potentiometers and I want to control the circuit with 1 digital input (5V / 0V).

With the 2 potentiometers, I want to fine tune two fixed positions. With a digital input line (coming from an CMOS NAND gate) I want to steer the motor to one of these two positions.

Is such a circuit even possible with a 555 timer?

And if so, how would it look like?

__________________________________

Background:

I know that a uController is cheaper and better.
I can program attiny chips, but the people for who I am developing for cannot.
They can solder a circuit, and that's it. That is why I am also "researching" an analog solution.

• Comments are not for extended discussion; this conversation has been moved to chat. Commented Sep 10, 2020 at 13:18

Here is an analog solution using two separate astable oscillators, based on a single package of 6 x Schmitt inverters. The same concept may be used using 2 x 555s - but at probably higher cost as gating is still needed.

This has the advantage that the frequency and mark-space ratio of each oscillator are able to be adjusted completely independently.

• A single 'glitch' at each transition as the oscillators are not synchronised,

• Accuracy of timing without calibration depends on gate hysteresis which is more variable than may be tolerable in some applications.

simulate this circuit – Schematic created using CircuitLab

NOT3 and NOT2 form independent astable oscillators.
Considering NOT3 - When the output is high capacitor C1 charges via R1 and when the output is low the capacitor discharges via R1 in parallel with R3 + D2 in series.
If desired an additional diode can be added in series with R1 with opposite polarity to D2 so that charge and discharge paths are then wholly independent.
If calibration is acceptable (2 or more trim-pots) then accuracy may be tolerable depending on how critical the application is.

R5, R6 and D3 form a "gate".
When NOT1 output is low, diode D3 clamps the R4-R5 junction and prevents NOT3 signal reaching NOT4 input. When NOT1 output is high D3 is reverse biased and NOT3 can drive NOT4 input.

As shown the R6 & R8 resistor values are problematic due to loading and Schmitt trigger levels. As 6 gates total are available a final circuit could use say 2 extra gates to overcome this issue. As this is a demonstration of concept I've not worked on this detail.

Costs:

What product volume is anticipated?

A 74HC14 costs from around $US0.04 in thousands in China. An LM555 / NE555 costs less than a cent more (or 3.8655c/5000 from one source). 1N4148 diodes cost from around$0.005/1000+
100 nF mylar capacitor maybe $0.03 Panasonic SMD trimpot from about$0.035
(Aluminium electrolytic from about $0.005 but accuracy rather low) So the cost of two trimpots would probably tend to dominate component cost. . • Realistically, one should not build this Commented Sep 10, 2020 at 1:40 • @ChrisStratton Maybe :-). I wanted to provide an alternative analogue non-555 path. Quite likely the biggest deficiency is the very loose Scmitt threshold voltage limits. Calibration addresses this at the expense of pots and setup time. There are still of course temperature etc issues. Knowing the requirements more accurately would help. A 3 cent microcontroller would do the job well. US 2.2342 cents at 200 quantity :-). A 32 kHz 10 ppm crystal adds$US0.03/1000s . Commented Sep 10, 2020 at 1:55
• An MCU doesn't preclude pots. The problem with this circuit is not only its sensitivity but the number and diversity of components, which drive up build cost/time. The asker's train layout likely needs enough of them to be annoying to build, but not enough to justify automated manufacture. Commented Sep 10, 2020 at 1:56

The diagram below shows an (untested) example of a circuit which may achieve your aims.
(The somewhat non standard 555 pin layout is the schematic editors idea.)

Apart from the 2 potentiometers and switching transistors operation is standard 555 astable.
The timing capacitor Ct charges via either Rchg1 or Rchg2 (see below) in series with Rdis until the capacitor voltage reaches 2/3 Vcc. The capacitor is then discharged via Rdis and the discharge pin until the capacitor voltage falls to 1/3 Vcc.

simulate this circuit – Schematic created using CircuitLab

When the control input is low transistor Q1 is turned on via R5, and when required the capacitor can charge via Q1 Rchg1 and Rdis.
When the control input is high Q3 is turned on via R8, turning Q2 on via R7 which then allows Rchg2 to charge C1.

The charge times are thus settable via the two pots.
The discharge time is set in both modes by Rdis.
This has the effect of providing an invariant part cycle and a variable remainder. While this allows the mark-space ratio to be varied as desired it causes the frequency to alter with mark-space variation. Whether this is acceptable depends on your requirements.

While the discharge time could also be made selectable this requires more circuitry as Rdis is floating relative to ground and Vcc. While this is not technically hard the degree of complexity is unlikely to make it warranted.

A similar result could be obtained with an eg \$US3 Arduino and NOTHING else if ratios are set in software. If variable ratios are required this could be achieved with two potentiometers or a few switches (eg up, down, channel select).

If an analog "555 type" solution is essential for some reason, using two astable circuits and switching between the outputs would require two ICs but less overall complexity.

if I had to do this with analog circuitry I'd probably use a package of CD40106 / 74HC14 hex Schmitt inverters or similar to implement two oscillators and switched output.

• Realistically, one should not build this Commented Sep 10, 2020 at 1:40