Arduino Forum

Using Arduino => General Electronics => Topic started by: surepic on Oct 09, 2018, 01:57 am

Title: 555 IC as servo driver
Post by: surepic on Oct 09, 2018, 01:57 am
Has anyone here experience with making 555ic work with servo motor ?
2 days I cant make servo work properly with my schematics. Proteus and fastlab simulations show that it must work but in reality it isnt working as expected.

Tried ready schematics from 555-timer.com but again non of them work properly.

Can attach my schematics which are working in fastlab and proteus if that will help.

On output I`m getting 49-52hz with 9-12% duty cycle as per simulations which should make shaft of the motor to turn +90 degrees. if duty cycle is reduced to 4-5% its suppose to turn -90%. problem is with -90%. its either not turning or turning very slow.

thanks
Title: Re: 555 IC as servo driver
Post by: wvmarle on Oct 09, 2018, 02:26 am
Can attach my schematics which are working in fastlab and proteus if that will help.
Now what do you think yourself? Will it be useful or not to show the schematic you're talking about?

At 276 posts you should know the answer...
Title: Re: 555 IC as servo driver
Post by: surepic on Oct 09, 2018, 02:47 am
Sorry, here are 3 pdf files attached. they all are working in proteus.

purpose of this project is to run servo +90 and 0degrees or +90 and -90degress.

I didnt draw in the schematic because didnt get into that point yet feedback will be tactile type button/switch on the other end of motor arm. Ideally I want to make this project on 556 timer i.e. 2x555ics in one package. that way I can get feedback from that tactile buttons. if arm is at +90 degrees then pushbutton will cut one 555IC from power same time leaving other 555 to operate, and if opposite side button is clicked then same story but with another 555IC.

so same output must go to comparator/mosfet circuit then to motor.
Title: Re: 555 IC as servo driver
Post by: CrossRoads on Oct 09, 2018, 03:46 am
I think the pulse widths might be too wide.
9% of 50Hz would be 1.8mS
12% od 50Hz would be 2.4mS.

You want 1 mS to 2mS for -90 to +90,
so I think you'd be mostly to one end with the %s you are showing.
Title: Re: 555 IC as servo driver
Post by: surepic on Oct 09, 2018, 03:54 am
But dont this servos have pretty wide permissible range ? Over 2ms is they count same as 2ms and below 1ms is same as 1ms.

One of my pdfs is showing that. I took 80ohm resistor out and it didnt affect servo it was moving to the same direction with same slow speed. I just drew another one in fastlab this one looks promising freq variation is within 5hz and duty cycle can be varied manually from 0.1 to 20%! Will attach this schematic too.

update:schematics attached in jpg . 20%,10% and 5% duty cycle. within 5hz frequency deviation.

2 diodes, 20kpot ,0.1u capacitors ceramic.
Title: Re: 555 IC as servo driver
Post by: CrossRoads on Oct 09, 2018, 04:18 am
I've only used the Servo.h library and read the specs on common servos.
50Hz and 1-2mS wide are the usual frequency & range.

Simulations, I don't do that. Only real hardware.
Title: Re: 555 IC as servo driver
Post by: wvmarle on Oct 09, 2018, 04:24 am
Try connecting a scope and see what you really get out.

My approach to the circuit would be using two 555s. One astable, the second monostable. The astable for the frequency, triggering the monostable for the actual pulse length. That allows you to adjust both independently.

I don't recognize the way you wired it, have to study your circuits in more detail.
Title: Re: 555 IC as servo driver
Post by: surepic on Oct 09, 2018, 05:08 am
as per my calculations:

R1=2.2kohm
C1=10uf

R2:270ohm=2ms

R2:120ohm=1ms

R2:190ohm=1.5ms
Title: Re: 555 IC as servo driver
Post by: wvmarle on Oct 09, 2018, 05:11 am
Note that those diodes will throw off the actual timing.

You will have to measure the pulse length you get to know for sure - either by connecting a scope, or connecting it to an Arduino and read the pulses (to measure length and frequency).
Title: Re: 555 IC as servo driver
Post by: surepic on Oct 09, 2018, 05:50 am
forgot to mention I have only 1n4007 diodes but I know they are slower than 1n4148 can this make any issues ? Will test with arduino tomorrow.
Title: Re: 555 IC as servo driver
Post by: wvmarle on Oct 09, 2018, 06:07 am
It's the voltage drop over the diodes that will affect it most. That affects the voltages at the timing cap and the trigger pin. Trig works at 1/3 Vcc and 2/3 Vcc which is 1.7V and 3.3V, the 0.5-0.7V drop over the diode is a lot compared to those voltages.\

Did you (try to) measure the pulse you actually get already?
Title: Re: 555 IC as servo driver
Post by: ReverseEMF on Oct 09, 2018, 06:16 am
Just posting these photos, from the OP, so they can be seen:

(http://forum.arduino.cc/index.php?action=dlattach;topic=572521.0;attach=277176)

(http://forum.arduino.cc/index.php?action=dlattach;topic=572521.0;attach=277178)

(http://forum.arduino.cc/index.php?action=dlattach;topic=572521.0;attach=277180)
Title: Re: 555 IC as servo driver
Post by: surepic on Oct 09, 2018, 06:33 am
Did you (try to) measure the pulse you actually get already?
No i didnt was concentrated on datasheet too long. Tomorrow will measure the frequency and pulse length with arduino and will update. Then second question arises what are professional hardware simulators for ? I even chose exact models of what I`m using except servo motor model. There is scope too inside proteus I checked the pulse length and frequency with it but when its time to do in real world everything needs to be rechecked again. I`m thinking of resistor and capacitor tolerances too now. IF they will be off 5% thats enough to shift the pulse.
Title: Re: 555 IC as servo driver
Post by: wvmarle on Oct 09, 2018, 06:39 am
Lots of real world variance.
I don't know how well they take the diodes into account - that's definitely a tricky one.
Tolerance of the parts indeed, resistors often <1% but caps can be 10% or more, especially electrolytics.
Internal resistance of the 555's pins.
Internal resistance of the capacitors (ESR).
Stray resistance & capacitance of the wires (though that's usually small enough to ignore, it's usually in the order of a few mΩ and a few pF).
Title: Re: 555 IC as servo driver
Post by: ReverseEMF on Oct 09, 2018, 06:42 am
Lots of real world variance.
...
Tolerance of the parts indeed, resistors often <1% but caps can be 10% or more, especially electrolytics.
And, potentiometers can be 20% and even 30%!
Title: Re: 555 IC as servo driver
Post by: ReverseEMF on Oct 09, 2018, 06:46 am
Check this out: 

  http://www.seattlerobotics.org/encoder/200210/servoex/ServoExcerciser.htm (http://www.seattlerobotics.org/encoder/200210/servoex/ServoExcerciser.htm)
Title: Re: 555 IC as servo driver
Post by: wvmarle on Oct 09, 2018, 06:54 am
That's pretty much what I had in mind.

Saves a whole lot of balancing frequency/pulse length (those are linked if using a single 555).
Title: Re: 555 IC as servo driver
Post by: surepic on Oct 09, 2018, 07:01 am
Thanks for the link. As was mentioned in one of my posts 556 was in my mind if this option will fail I wasnt thinking of monovibrator mode as wvmarle suggested I was thinkinf of adjusting one 555 for 1ms pulse and second 555 for 2ms pulse with fixed resistors. though monovibrator approach is interesting too one for frequency second one for duty cycle. Purpose is to make 1 device which can turn motor arm to +90 and -90 depending what circuit will be triggered. Price,size and power consumption of circuit matters in my case.
Title: Re: 555 IC as servo driver
Post by: wvmarle on Oct 09, 2018, 07:10 am
So there's no Arduino or other MCU in the mix? Because that'd be the cheapest option.

Otherwise as you want two 555s anyway, go for that circuit in #15. A transistor allows you to switch on/off a resistor based on an external signal, changing the pulse time (so two resistors in parallel - one with the transistor in series - so if the transistor is off you have high resistance, if on you have the resistors effectively in parallel and a low resistance).
Title: Re: 555 IC as servo driver
Post by: Grumpy_Mike on Oct 09, 2018, 08:47 am
But dont this servos have pretty wide permissible range ? Over 2ms is they count same as 2ms and below 1ms is same as 1ms.
No that is not how servos work, not the ones I have seen anyway.

I used a 555 as a pen lift servo control in a drawing machine. However the noise made it too jittery to use in the finished project.
Title: Re: 555 IC as servo driver
Post by: surepic on Oct 09, 2018, 12:45 pm
Mike i noticed that noise too while experimenting, via arduino its kinda smoother.

Wvmarle how via mcu is cheaper?
555 timer is 5cents.
Title: Re: 555 IC as servo driver
Post by: wvmarle on Oct 09, 2018, 12:58 pm
If there's an MCU in the mix already, using it doesn't cost anything extra, making it cheaper than adding the 555. That's why. It's an Arduino forum after all here!
Title: Re: 555 IC as servo driver
Post by: Paul__B on Oct 09, 2018, 01:27 pm
forgot to mention I have only 1n4007 diodes but I know they are slower than 1n4148 can this make any issues?
Insignificant at 50 Hz.
Title: Re: 555 IC as servo driver
Post by: ReverseEMF on Oct 09, 2018, 06:25 pm
Mike i noticed that noise too while experimenting, via arduino its kinda smoother.

Wvmarle how via mcu is cheaper?
555 timer is 5cents.
Yeah, I puzzled over that, too, but then realized two things:

:smiley-lol: :smiley-lol: :smiley-lol: :smiley-lol: :smiley-lol: :smiley-lol: :smiley-lol: :smiley-lol: :smiley-lol: :smiley-lol: :smiley-lol: :smiley-lol: :smiley-lol: :smiley-lol: :smiley-lol: :smiley-lol: :smiley-lol: :smiley-lol: :smiley-lol: :smiley-lol: :smiley-lol: :smiley-lol: :smiley-lol: :smiley-lol: :smiley-lol: :smiley-lol: :smiley-lol: :smiley-lol: :smiley-lol:
Title: Re: 555 IC as servo driver
Post by: Grumpy_Mike on Oct 09, 2018, 06:54 pm
Mike i noticed that noise too while experimenting, via arduino its kinda smoother.
Well the noise I am talking about is electrical noise which manifests its self as jitter. This is due to noise on the supply line to the 555 timer. And as I had other servos in the circuit it would have taken a lot of filtering out. This was because I was working on a Raspberry Pi and it only has sufficient hardware to drive two servos. I wanted a third for a pen lift.
Title: Re: 555 IC as servo driver
Post by: Grumpy_Mike on Oct 09, 2018, 07:00 pm
This is the NE555 circuit I used:-
(https://forum.arduino.cc/index.php?action=dlattach;topic=572521.0;attach=277262)
Title: Re: 555 IC as servo driver
Post by: surepic on Oct 09, 2018, 07:20 pm
Well, if this idea wont work then i will put arduino nano or micro and will forget about 555 forever :-))

Mike why you were driving servo via fet instead of mosfet? Isnt it more efficient in this shcematic to use mosfet? Something like 2n7000?
Title: Re: 555 IC as servo driver
Post by: Grumpy_Mike on Oct 09, 2018, 09:42 pm
Quote
Mike why you were driving servo via fet instead of mosfet?
I wasn't, i was using a transistor. I use an NPN transistor to invert the signal and a PNP to switch between the two pulse widths.

Quote
Isnt it more efficient in this shcematic to use mosfet?
No.
You are not providing the the servo with any power, you are just creating a control signal. No need at all for a FET of any description.
Title: Re: 555 IC as servo driver
Post by: BabyGeezer on Oct 10, 2018, 03:22 am
This is the NE555 circuit I used:-
(https://forum.arduino.cc/index.php?action=dlattach;topic=572521.0;attach=277262)
i'm assuming the whole bottom line connects to GND ?
Title: Re: 555 IC as servo driver
Post by: surepic on Oct 10, 2018, 04:33 am
yes
i'm assuming the whole bottom line connects to GND ?
yes
Title: Re: 555 IC as servo driver
Post by: surepic on Oct 14, 2018, 05:47 am
ReverseEMF +1 for great link.

I built exact same circuit without any modifications of capacitors or resistors, luckily even have 47K pot.

But I`m not getting duty cycle below 2ms.

50hz its holding perfectly tested with freqmeasure library.

duty cycle I`m taking via pulseIn() on HIGH

(http://www.seattlerobotics.org/encoder/200210/servoex/schematic.gif)
this is image for schematic from same website.

and attached is printscreen how its holding 50hz.

why I cant get short duty cycles ? resistors that I used are 20% tolerant but each measured with multimeter before putting on the board to be sure they all have right values.

calculations for duty cycle from that website.

Code: [Select]

The formula used is as follow:

t= 1.1RaC

Ra is the total of R4 and R3. So, the minimum pulse time when R4 is set to 0, is:

t= 1.1 x 8200 x 0.0000001

t= 0.902 ms

Note that this minimum pulse width time is longer than the trigger pulse to ensure that the pulse width generator doesn't constantly generate0.65ms pulses one after the other, but at a steady +- 50Hz interval.

WhenR4 is set to maximum, the time is

t= 1.1 x 18200x 0.0000001

t= 2.002 ms


Title: Re: 555 IC as servo driver
Post by: wvmarle on Oct 14, 2018, 06:00 am
So what duty cycles do you get for different settings of that pot? And different values of the timing cap and resistor?

Are you using ceramic or film type caps for the timing?
Title: Re: 555 IC as servo driver
Post by: surepic on Oct 14, 2018, 06:09 am
Im using 2x555ics not 556. All caps are ceramic 103,104 and 224k

Problem is with second 555ic circuitry cos first one is generating 50hz picture attached.

10k pot one side 1900-2000us returned from pulsein(), fully turned to opposite side veryhigh values didnt even noted them.

Didnt change values for capacitor and resistor because of calculations by that guy are right it "must" produce 1ms duty cycle when fully off.
Title: Re: 555 IC as servo driver
Post by: wvmarle on Oct 14, 2018, 11:59 am
To get a stable output frequency, use film capacitors (not polarised). Ceramic capacitors are not good for timing, very unstable, the numbers in your screen shot (which you should simply have posted as text) show it's drifting. Polyester film type is normally good enough.

It it doesn't react.to the pot I suspect your wiring is wrong there. Take it out, measure the resistance with your multimeter, see if it behaves the way you expect.
Title: Re: 555 IC as servo driver
Post by: surepic on Oct 14, 2018, 03:29 pm
Initially installed polyester capacitor forgot to mention both 220nf caps are popyester 630v.

Frequency in screenshot is stable i i took a shot right when i adjusted to 50.8hz after that screen was scrolling with 50.8hz .

It does react to the pot but minimum value is not less than 1.9-2ms . If pot turned the opposite side i am getting very high duty cycles.

Will replace pot with fixed resistor see what will happen.

I suspect breadboard connection and resistance of wires. I had issue with wires on esp8266 circuit and solved only soldering them.
Title: Re: 555 IC as servo driver
Post by: wvmarle on Oct 14, 2018, 03:37 pm
Breadboards can cause problems indeed with connections. In your case I'd suspect the pot itself, though.
Title: Re: 555 IC as servo driver
Post by: Grumpy_Mike on Oct 14, 2018, 03:38 pm
Just change R3 to a lower value, say 1K.
Title: Re: 555 IC as servo driver
Post by: wvmarle on Oct 14, 2018, 03:52 pm
That would do the job - but doesn't explain the very high duty cycles. That shows an unexpectedly high resistance in the pot, and why I suspect something is wrong with that pot.
Title: Re: 555 IC as servo driver
Post by: surepic on Oct 14, 2018, 04:17 pm
Wvmarle you are right its pot/board connection. I have to press it down to get low values when released its giving very high resistance. Pot is working when outside the board.
Second as i mebtioned i installed 2x220nf on each 555. But schematic asks for second 555 only 100nf. Cant explain how i come up with 220 on board instead of 100 :-).

Will change the pot to resistor anyway i need 3 positions 1ms 1.5 and 2ms.
Title: Re: 555 IC as servo driver
Post by: wvmarle on Oct 14, 2018, 05:27 pm
2x220 nF in series is equivalent to 110 nF... sometimes have to go with what you happen to have on hand :-)
Title: Re: 555 IC as servo driver
Post by: surepic on Oct 14, 2018, 08:17 pm
values for R4 if someone will be interested in building this circuit:

measured right from pot and rechecked with resistors after that.

1ms 4K9
1.5ms 10K1
2.0ms 13k

tolerances of my resistors are 20% so I assume you can round values if using silver or gold stripe(band) resistors.

value for R2 16K2.
Thanks everybody for participating in this discussion.
Title: Re: 555 IC as servo driver
Post by: Grumpy_Mike on Oct 14, 2018, 10:37 pm
Quote
tolerances of my resistors are 20% so I assume you can round values if using silver or gold stripe(band) resistors.
I have not seen silver and gold bands on resistors for about 40 years. The widest tolerance you can get these days is 5% ( old gold band ) with 1% resistors being a fraction of a cent more expensive.

Anyway because there is a pot in the circuit it doesn't matter. Only with R1 might it matter a bit, but not much.

Title: Re: 555 IC as servo driver
Post by: ReverseEMF on Oct 15, 2018, 03:12 am
Well, if this idea wont work then i will put arduino nano or micro and will forget about 555 forever :-))

Mike why you were driving servo via fet instead of mosfet? Isnt it more efficient in this shcematic to use mosfet? Something like 2n7000?
I'll take a stab: first I'll assume you mean bi-polar when you wrote fet.  If so, then:
Based on the 4k7 pull-up, that servo doesn't require much current to drive it, thus bipolar vs MOSFET is trivial, since power loss is trivial.
BTW: a 2N7000 is not a good choice for 5V switching.  More like 2N7002, or even VN2222LLG
Title: Re: 555 IC as servo driver
Post by: surepic on Oct 16, 2018, 02:52 pm
Now i need to switch whole circuit from 3.3v 20ma gpio. Current consumption for the circuit with motor is approximately 550ma-560ma 5v.

Any suggestions what transistor/mosfet to use?
Title: Re: 555 IC as servo driver
Post by: ReverseEMF on Oct 16, 2018, 04:45 pm
Now i need to switch whole circuit from 3.3v 20ma gpio. Current consumption for the circuit with motor is approximately 550ma-560ma 5v.

Any suggestions what transistor/mosfet to use?
When you say 550mA-560mA, are you talking average current, peak current, or ???  
And, when you say "motor", are you still talking about a Servo, or is it an actual morot?  And if so, what kind of motor?  Typical brushes included DC motor, or something more exotic?
And will there be any PWM involved?  Or, is it just a strait ON for awhile, OFF for awhile?
And, I guess the ultimate, qualifying question is: when you say "whole circuit", do you mean that same circuit, but controlled from a 3.3V port, rather than a 5.0V port.  And, will the rest of the "whole circuit" be powered at 5V?  In which case, is this a question of voltage translation?

Why am I confused?  Because there are two opposing hints


In other words, are we disregarding that apparent settled upon circuitry, or is this a question about how to drive the settled upon circuitry?  Or, is this a whole new question?
Title: Re: 555 IC as servo driver
Post by: surepic on Oct 16, 2018, 07:44 pm
Servo motor with peak current 550ma. No pwm 555s are generating pwm with help of your link.
I want straight on and off. Whole circuit i mean the last image i attached i.e. pwm generating circuit from 5v plus servo motor attached. All together 560ma peak powered from 5v.
Control of switching circuit on and off should be done via 30ma max 3.3v input.
Title: Re: 555 IC as servo driver
Post by: ReverseEMF on Oct 17, 2018, 03:50 am
I've used the IRLD120PB for such things:

https://www.mouser.com/ProductDetail/Vishay-Siliconix/IRLD120PBF?qs=%2fha2pyFadujOh%252b7d2C091uf69VLTw1mgY3tcpVBXgxXgUh90UwujEQ%3d%3d (http://"https://www.mouser.com/ProductDetail/Vishay-Siliconix/IRLD120PBF?qs=%2fha2pyFadujOh%2b7d2C091uf69VLTw1mgY3tcpVBXgxXgUh90UwujEQ%3d%3d")\