Go Down

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

WilliamK Govinda

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


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

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

CrossRoads

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

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)

CrossRoads

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

Good ideas, thanks, I will play around with it some more soon.  :smiley-mr-green:

Wk

WilliamK Govinda

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.


CrossRoads

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

HA! IT WORKS! "Its Alive! Its Alive!!!"  8) :smiley-mr-green: :D

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

CrossRoads

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.
http://www.analog.com/en/digital-to-analog-converters/da-converters/ad5668/products/product.html
http://www.analog.com/en/digital-to-analog-converters/da-converters/ad5669r/products/product.html

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

Good idea, but for now let me try the PWM output, see what I can cook with just 555 timers. ;-)

Wk

wbajzek

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