Regarding 555 timer pwm control

Thread Starter

Jesper0123

Joined Aug 24, 2017
16
Hi!
I'll try to make this as concise as possible.

I'm tasked with creating a robot arm (for educational purposes), where each joint is controlled by a single servo. At first I planned controlling it with an Arduino, but now I realise I would rather control each servo with a pot- controlled 555-timer circuit. Having searched the web i've encounterd numerous circuit designs that i've tried, but none of them worked as well as the Arduino controlled counterpart did.

If i'm correct, I need the 555 timer circuit to do the following:
Provide a stable 50 hz frequency
Be able to vary its duty cycle between 2.5%-12.5% (0.5ms - 2.5ms) for servo control

I read somewhere that a single 555 (in a astable configuration) could output a variable duty cycle by using diodes and a potentiometer; but turning the pot would inevitably have some effect on the output frequency. The digital servos I use seems to have an issue with this, as they shake alot (but still turn).

Would using two 555 timers (one acts as a fixed freq. oscillator and the other changes the "on"-duration of the signal) work for what I intend to do? and if so does anyone have experience or know of any resources on this subject.
 

Alec_t

Joined Sep 17, 2013
15,118
Welcome to AAC!
A correctly configured single 555 can give you the pulse widths you want without any significant change in pulse frequency.
 

wayneh

Joined Sep 9, 2010
18,104
There are also other simple ways to generate a PWM signal without a 555, and some offer a wider range of duty cycle, at a fixed frequency, than you can obtain with a 555 circuit. See here, for instance. Lots of ways to skin a cat.

In fact, I just learned about this IC from a new member in this thread.
 

Thread Starter

Jesper0123

Joined Aug 24, 2017
16
Welcome to AAC!
A correctly configured single 555 can give you the pulse widths you want without any significant change in pulse frequency.
Thanks!
How would one configure such a 555 timer circuit? I attatched one of the circuits I tried, but it didn't work that well. The servo jitters back and forth but still responds when turning the potentiometer (the total range of rotation seems to be about 40 degrees).
 

Attachments

Thread Starter

Jesper0123

Joined Aug 24, 2017
16
There are also other simple ways to generate a PWM signal without a 555, and some offer a wider range of duty cycle, at a fixed frequency, than you can obtain with a 555 circuit. See here, for instance. Lots of ways to skin a cat.

In fact, I just learned about this IC from a new member in this thread.
I will have to look into that. I'm still very new to electronics and haven't used op amps before. The circuit SgtWookie attached seems like a good starting point but would need modification as they mentioned that its output frequency is around 150hz.

Does output the voltage of the signal matter if its only used for determining servo position? Lastly (not sure how to put this, bear with me) does the servo draw its current from Vcc through GND or does the Op-amp have to provide the current for the servo?
 

Alec_t

Joined Sep 17, 2013
15,118
How would one configure such a 555 timer circuit?
Like this:
ServoPulser.PNG
Bear in mind that the output voltage from pin 3 of the standard (not the CMOS version) 555 is always a volt or more below the supply voltage but needs to be above some threshold for the servo to respond correctly.
 

Thread Starter

Jesper0123

Joined Aug 24, 2017
16
I built the circuit on a breadboard today, but it only worked with the analog servo (which is continuous) in one direction. I was able to slow it down but not make it go the other direction. Also when I measured the voltage between pin 3 and the 0v rail my dmm read about 0.7V, while it measured 4.3-4,7 across pin 3 and the 5v rail when I turned the potentiometer. Something is wrong, but I don't know what it is right now.
I'll report back tomorrow
 

wayneh

Joined Sep 9, 2010
18,104
I will have to look into that. I'm still very new to electronics and haven't used op amps before. The circuit SgtWookie attached seems like a good starting point but would need modification as they mentioned that its output frequency is around 150hz.
It would be easy to change that. You need 50Hz, right? If I get time today I'll draw out a simulation.
Does output the voltage of the signal matter if its only used for determining servo position?
I'm sure the servo can accept some range of voltage and the signal it receives needs to be within that range. I've never used such a servo and cannot say more than "read the data sheet".

In fact, I'm confused about what sort of signal you need for your servo. It would help us if you could pin down the details.
Lastly (not sure how to put this, bear with me) does the servo draw its current from Vcc through GND or does the Op-amp have to provide the current for the servo?
The former. Once again, the servo probably has a specification for the current it will draw from the signal, and it's probably not much.
 

Thread Starter

Jesper0123

Joined Aug 24, 2017
16
I'm sorry I put my question the wrong way. I just wondered whether or not a servo draws its current from the op-amp (or 555) or just from the voltage source (if I would have to take that into consideration if I were to design such a circuit myself).

The servo itself is just an ordinary digital servo with about 160 degrees of rotation. I could not find the datasheet but it's this one.
https://hobbyking.com/en_us/turnigy...ot-servo-13kg-0-14sec-58g.html?___store=en_us

The signal needs to be a stable 50hz square wave (with an amplitude of 5-6v I suppose) that has a dutycycle that's variable between 2,5% to 12,5%. The trouble is that i've yet to make a circuit works well enough to use in my project. However, the circuit Alec_T listed might do the trick, but have I some troubleshooting to do as I probably messed up.
 

crutschow

Joined Mar 14, 2008
38,503
I was able to slow it down but not make it go the other direction.
To make it go in the other direction you need to reverse the leads (polarity).
If you need to do that in the robot arm then you can drive the servo through an H-bridge to provide polarity reversal under logic control.
 

wayneh

Joined Sep 9, 2010
18,104
I'm sorry I put my question the wrong way. I just wondered whether or not a servo draws its current from the op-amp (or 555) or just from the voltage source (if I would have to take that into consideration if I were to design such a circuit myself).

The servo itself is just an ordinary digital servo with about 160 degrees of rotation. I could not find the datasheet but it's this one.
https://hobbyking.com/en_us/turnigy...ot-servo-13kg-0-14sec-58g.html?___store=en_us

The signal needs to be a stable 50hz square wave (with an amplitude of 5-6v I suppose) that has a dutycycle that's variable between 2,5% to 12,5%. The trouble is that i've yet to make a circuit works well enough to use in my project. However, the circuit Alec_T listed might do the trick, but have I some troubleshooting to do as I probably messed up.
OK well here's a version of the op-amp version from that old thread. Works the same. All I needed to change was tripling the value of the resistor feeding C1. That dropped the frequency to 50Hz. I also used a different op-amp because it was convenient. You'll want to use one that can output to the bottom power rail. Let me know if you would like the simulation file to play with in LTspice (free simulator software).

Since you need only a narrow range of duty cycle, I'd set up the pot and resistors so that you get that range from the entire rotation range of the pot.

Screen Shot 2017-08-25 at 11.33.16 AM.png
 

Thread Starter

Jesper0123

Joined Aug 24, 2017
16
Alec_T I've double checked all the component values and their placement and it seems everything on the breadboard is in working order. Much like before I only got the larger continuous rotation servo to work on 5v. Since the other servos didn't even move I figured it might've been the voltage on pin 3 being too low, so I increased the supply voltage to 6v just to see what would happen. Now the digital servo moves, but only when the pot is between 10K omhs and 5.5k omhs, otherwise it doesn't move. Also, when it moves it does so in a random way (but always back and forth)
 

Alec_t

Joined Sep 17, 2013
15,118
The servo has three input wires. Do you have all three connected to the correct respective points on the breadboarded circuit?
Breadboards (particularly cheap ones) are notorious for making poor connections, which may account for erratic results.
If the servo movement is insufficient, try changing the value of R2 by 50% or so either way.
 
Last edited:

Thread Starter

Jesper0123

Joined Aug 24, 2017
16
Yes I had all three connected. I don't know if it makes an actual difference, but I had to connect two caps in parallel in order to get the desired capacitance at c1 (150nF). I will try changing the value of R2 and see if it works.
 

Thread Starter

Jesper0123

Joined Aug 24, 2017
16
Tried a 2.7k, 1.8k, 8.4k and 5.1k ohm resistor in place of R2. The higher values did not work (8.2k) or work as well as the lower values. However the pot still gave no control over servo movement just like earlier. The servo sweeps back and forth in a random manner.
 

Alec_t

Joined Sep 17, 2013
15,118
However the pot still gave no control over servo movement just like earlier.
If all the connections are good and the component values are all as specified and the 555 is good then I can't explain that. If you had access to an oscilloscope you could check the pin 3 output.
 

wayneh

Joined Sep 9, 2010
18,104
I'd also make sure to run separate (off board) power connections to the servo. Typical breadboards and hookup wire cannot handle much current. You may have "ground" shifting all around at the servo, causing the PWM signal to be compromised.
 
Top