Go Down

### Topic: 555 Timer as a Square Osc? (Read 8503 times)previous topic - next topic

#### WilliamK Govinda

##### May 23, 2011, 10:36 pm
I was doing some tests with a NE555 Timer today, and was wondering if I could control frequency and pwm-duty from 2 arduino PWM outputs? Just curious, as I have no clue on how. I did manage to get pwm-duty working, by replacing the resistor with pwm from pin 3, and it works. But I can't figure out how to handle the frequency...

http://en.wikipedia.org/wiki/555_timer

Wk

#### robtillaart

#1
##### May 23, 2011, 11:06 pm

Replace R1 and R2 with potmeters P1 and P2 and you should be able to change the frequency on pin 3. But be aware that the frequency depends on both potmeters.

With P2 you can change the LOW and HIGH timing :   high = ln(2) * (P1 + P2) * C;
with P1 you can change the LOW timing : low = ln(2) * P2 * C;

wavelength = high + low = ln(2) + (P1 + 2*P2) *C; => so freq = 1/ wavelength = 1 / (ln(2) * (P1 + 2 * P2) * C);

The way to work is:
first make LOW timing correct with P1 , then adjust HIGH timing with P2.

Note that the HIGH time >= LOW time. ==> dutycycle is allways > 50%

Hopes this helps,
Rob

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

#### WilliamK Govinda

#2
##### May 23, 2011, 11:10 pm
Thanks, but I think I'm lost. You mean Potentiometers? Sure, I did that, works great. BUT, I want to use the Arduino PWM to control that. Imagine using MIDI messages to fire up multiple 555 timers? ;-)

Wk

#3
##### May 23, 2011, 11:15 pm
I would think there's a way to use a digital pin to enable/disable the 555 to output a frequency, or not.
Maybe triangle wave instead with some post-filtering to get a cleaner tone out of it.
Gotta read the data sheet ...
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

#### robtillaart

#4
##### May 23, 2011, 11:30 pm
Quote
You mean Potentiometers?

yes,

What do you think of using two I2C potentiometers for R1 and R2 - http://arduino.cc/en/Tutorial/DigitalPotentiometer -

(no electronic expert disclaimer)
Dont know how to do it with PWM, my intuition states that the bistable schema should be used and you need one PWM to set and another ot reset the outgoing pulse.
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

#5
##### May 24, 2011, 01:59 am
I was just reading a 555 datasheet. If you set up the 555 as an astable multivibrator, than the output should oscillate at the frequency set by 2 resistors and a capacitor when Reset is High, and not when Reset is Low.

Thus I suppose if you had a shift register driving the reset lines of eight 555 timers (or their multple-part per package variations), then you could control 8 tones at once. I don't know how much lag that would be, perhaps using SPI to shift out would be needed.

See a data sheet like National Semiconductor, which has a graph to give an idea of values to use, or you can plug the formula into an excel spreadsheet, pick the frequency and a couple values, solve for the others.

Take the 555 outputs, add them together using an op amp, add low pass filter to keep high frequency switching noise out.  Pass on to your sound system.
Make one of the parts some kind of tunable part to dial the frequency in. Could likely do that with a digital potentiometer, use the arduino to measure it and make it autotuning!
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

#### WilliamK Govinda

#6
##### May 24, 2011, 03:38 am
Good ideas, thanks, I will play around with it some more soon.

Wk

#### WilliamK Govinda

#7
##### May 26, 2011, 03:52 am
Oh, check this out:

http://www.electronics-tutorials.ws/waveforms/555_timer.html

Looks like I can setup things up and just use Pin 5 to modify the frequency, will test that out tomorrow. ;-)

Quote
Pin 5. ?    Control Voltage, This pin controls the timing of the by overriding the 2/3Vcc level of the voltage divider network. By applying a voltage to this pin the width of the output signal can be varied independently of the RC timing network. When not used it is connected to ground via a 10nF capacitor to eliminate any noise.

#### WilliamK Govinda

#8
##### May 26, 2011, 03:52 am
And here's a very nice picture of the 55 inner workings:

#9
##### May 26, 2011, 05:02 am
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

#### WilliamK Govinda

#10
##### May 26, 2011, 12:14 pm
Strange, works for me, just tested it out again.

Wk

#### WilliamK Govinda

#11
##### May 27, 2011, 06:51 pm
HA! IT WORKS! "Its Alive! Its Alive!!!"

All I did was add voltage to Pin 5, using a Potentiometer, and it works. When I get some time I will use a filtered PWM output to control more than 1x 555 at the same time. I'm sure I will get some lush sounds. ;-)

BTW: check this out!

http://www.getlofi.com/?p=518

#12
##### May 27, 2011, 07:13 pm
Heck, you don't need to tie up PWM pins if all you need is a static voltage - get one of the octal DACs that Analog Devices makes, think you talk to them via SPI (or I2C), can get a lot more control in frequency than you'll get with the 255 steps that PWM offers.

Will definitely make this thought from my earlier post possible!
"Make one of the parts some kind of tunable part to dial the frequency in. Could likely do that with a digital potentiometer, use the arduino to measure it and make it autotuning!"
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

#### WilliamK Govinda

#13
##### May 27, 2011, 07:19 pm
Good idea, but for now let me try the PWM output, see what I can cook with just 555 timers. ;-)

Wk

#### wbajzek

#14
##### Feb 06, 2013, 06:28 pm
Did you ever get this working? I am trying to do the same thing right now, but haven't made much progress with it yet.

Go Up