Pages: [1] 2   Go Down
 Author Topic: 555 Timer as a Square Osc?  (Read 2289 times) 0 Members and 1 Guest are viewing this topic.
Brazil
Offline
God Member
Karma: 1
Posts: 615
Wusik Dot Com
 « on: May 23, 2011, 03:36:07 pm » Bigger Smaller Reset

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
 Logged

Netherlands
Offline
Tesla Member
Karma: 90
Posts: 9393
In theory there is no difference between theory and practice, however in practice there are many...
 « Reply #1 on: May 23, 2011, 04:06:34 pm » Bigger Smaller Reset

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

 Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

Brazil
Offline
God Member
Karma: 1
Posts: 615
Wusik Dot Com
 « Reply #2 on: May 23, 2011, 04:10:20 pm » Bigger Smaller Reset

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
 Logged

Global Moderator
Boston area, metrowest
Offline
Brattain Member
Karma: 243
Posts: 16508
Available for Design & Build services
 « Reply #3 on: May 23, 2011, 04:15:28 pm » Bigger Smaller Reset

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 ...
 Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17

Netherlands
Offline
Tesla Member
Karma: 90
Posts: 9393
In theory there is no difference between theory and practice, however in practice there are many...
 « Reply #4 on: May 23, 2011, 04:30:10 pm » Bigger Smaller Reset

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.
 Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

Global Moderator
Boston area, metrowest
Offline
Brattain Member
Karma: 243
Posts: 16508
Available for Design & Build services
 « Reply #5 on: May 23, 2011, 06:59:29 pm » Bigger Smaller Reset

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!
 Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17

Brazil
Offline
God Member
Karma: 1
Posts: 615
Wusik Dot Com
 « Reply #6 on: May 23, 2011, 08:38:54 pm » Bigger Smaller Reset

Good ideas, thanks, I will play around with it some more soon.

Wk
 Logged

Brazil
Offline
God Member
Karma: 1
Posts: 615
Wusik Dot Com
 « Reply #7 on: May 25, 2011, 08:52:18 pm » Bigger Smaller Reset

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.
 Logged

Brazil
Offline
God Member
Karma: 1
Posts: 615
Wusik Dot Com
 « Reply #8 on: May 25, 2011, 08:52:58 pm » Bigger Smaller Reset

And here's a very nice picture of the 55 inner workings:

 Logged

Global Moderator
Boston area, metrowest
Offline
Brattain Member
Karma: 243
Posts: 16508
Available for Design & Build services
 « Reply #9 on: May 25, 2011, 10:02:32 pm » Bigger Smaller Reset

 Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17

Brazil
Offline
God Member
Karma: 1
Posts: 615
Wusik Dot Com
 « Reply #10 on: May 26, 2011, 05:14:29 am » Bigger Smaller Reset

Strange, works for me, just tested it out again.

Wk
 Logged

Brazil
Offline
God Member
Karma: 1
Posts: 615
Wusik Dot Com
 « Reply #11 on: May 27, 2011, 11:51:20 am » Bigger Smaller Reset

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
 Logged

Global Moderator
Boston area, metrowest
Offline
Brattain Member
Karma: 243
Posts: 16508
Available for Design & Build services
 « Reply #12 on: May 27, 2011, 12:13:21 pm » Bigger Smaller Reset

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!"
 Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17

Brazil
Offline
God Member
Karma: 1
Posts: 615
Wusik Dot Com
 « Reply #13 on: May 27, 2011, 12:19:58 pm » Bigger Smaller Reset

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

Wk
 Logged

Offline
Newbie
Karma: 0
Posts: 1
 « Reply #14 on: February 06, 2013, 12:28:25 pm » Bigger Smaller Reset

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.
 Logged

 Pages: [1] 2   Go Up