Switching 555 Timer on and off

Hi there!

I'm going to send messages over an (IR) LED. The bits are 600 or 1200us long. This switching will be done in the Arduino, no problem. But between the Arduino and the LED (the MOSFET driving it, respectively) I want to put a 555 timer circuit (there will be lots of interrupts, and I always wanted to use a 555 ;) ), pulsing the LED with 56KHz.

So the output of the Arduino will (de)activate the 555. But how is this done best? Should I switch the Vcc, the Reset, the trigger of the 555?

Thanks!

Edit: Heres the datasheet: http://www.freshney.org/electronics/downloads/ts555.pdf

GoingForGold:
So the output of the Arduino will (de)activate the 555. But how is this done best? Should I switch the Vcc, the Reset, the trigger of the 555?

That rather depends on the circuit you’re going to build with the 555…which is still a secret.

Sorry, I thought this was clear.

I want to use a simple astable circuit which oscillates with 56KHz. Like the second one on this page: http://www.technologystudent.com/elec1/5555.htm.

The output drives a MOSFET, which switches the LED on an off.

Now I'm looking for a way to rapidly switch on and off the whole timer circuit. The Arduino makes an output high for 600us, and the LED should be pulsing with 56KHz during this time. The Arduino makes it's output low and the 555 should stop the oscillating.

Hold the 555 in reset using one of the Arduino digital output pins when you don’t want it to oscillate. Check the 555 datasheet for details.

GoingForGold: Sorry, I thought this was clear.

The point is the 555 needs to be stopped in a state where the LED is off, and that depends on how its wired up. Give the circuit diagram so this can be determined, or at least explain whether the 555 out pin should be high or low to turn the LED off...

What voltage is the 555 running from?

good point! The output should be connected to the gate of a N MOSFET. LED is between Vin and Source. Thanks!

Leave the 555 running all the time and use the arduino digital output to turn on/off the 555 output using a transistor/ssr

Did I not answer this before? Why add extra unnecessary complexity? Your data bits are extremely long in microsecond terms; I am sure you could use a timer to define them and another to generate 56 kHz, if not simply poll the microsecond clock. That is easily within the ambit of the MCU, what else do you need to do simultaneously that is so complex as to prevent this?

Riva: Leave the 555 running all the time and use the arduino digital output to turn on/off the 555 output using a transistor/ssr

I'm starting to wonder why you don't just generate the 56KHz signal directly from an Arduino pin. I'm sure it's capable of it.

That way you can just stop sending the signal.

To paraphrase President Kennedy "We choose to ... toggle the 555 output ...not because they are easy, but because they are hard, because that goal will serve to organize and measure the best of our energies and skills, because that challenge is one that we are willing to accept, one we are unwilling to postpone, and one which we intend to win."

LED is between Vin and Source.

Don't forget current limit resistor, or your LED won't last long.

CrossRoads: To paraphrase President Kennedy

And look what happened to him!

Yes - had a whole Space Center named after him.

You guys are great! ;) Thanks!

Paul__B, The other thread was basically another question, so this is why I started this thread.

I have a lot to think about, thanks. I don't want to let the Arduino produce the pulse, because it also has to deal with several interrupts. With every interrupt there will be some calculations, and I'm afraid this will mess up the pulse, making it useless for the receiver. And since the moment of transmission is relevant, I do not want to have it sent multiple times.

Or is this no problem after all? Of course, I wont use any delay()s.

Thanks a lot!

GoingForGold: I have a lot to think about, thanks. I don't want to let the Arduino produce the pulse, because it also has to deal with several interrupts. With every interrupt there will be some calculations, and I'm afraid this will mess up the pulse, making it useless for the receiver. And since the moment of transmission is relevant, I do not want to have it sent multiple times.

Or is this no problem after all? Of course, I wont use any delay()s.

You can generate the signal in hardware, it uses no CPU.

If you have enough time left over to toggle a 555 timer then you have enough time to turn the signal on/off.

I have a lot to think about, thanks. I don’t want to let the Arduino produce the pulse, because it also has to deal with several interrupts. With every interrupt there will be some calculations, and I’m afraid this will mess up the pulse, making it useless for the receiver. And since the moment of transmission is relevant, I do not want to have it sent multiple times.

When using bit-banging PWM, it will be affected by interrupts and create jitter, but I don’t believe this will be the case when using hardware PWM.

There is some code provided here. It looks like if we use 1 / (1/16MHz * 286) = 55.944KHz , this would be quite close to the 56KHz needed. How to create a 38 Khz pulse with arduino using timer or PWM?

You may also find this link interesting: Serial comm using IR

I don’t think the 555 is needed - note that the 555 would normally generate a 50% duty cycle and this would only allow you to pulse at 2x the continuous current rating of the IR LED, which would be far lower than its peak current rating.

Actually, it takes some horsing around to get 50% duty cycle on a 555 timer.

FYI, if you pull the !Reset line low (it is active low, hence the ! or invert symbol), then the output will go low. So you'd have to wire it accordingly.

I agree with the suggestion to use something like the tone() library.

GoingForGold: I don't want to let the Arduino produce the pulse, because it also has to deal with several interrupts. With every interrupt there will be some calculations, and I'm afraid this will mess up the pulse, making it useless for the receiver.

That troubles me. Since you have not actually explained to us what else you are proposing to do, we cannot definitively pontificate on this, but interrupts involving "some calculations" sounds like a fundamental design misunderstanding in the overall use of interrupts.

Ok guys, you got me. I gave the timing by the MCU a shot. But I did not find a efficient way to pulse it with 56KHz. How would you go about it? The "standard" way with an if statement, checkig the micros, won't work because of the "low" resolution of only 4 micros. One period is 17.86, rounding it to the 4 micros equals a frequency of 62.5KHz.

Is there a good timer library which can accomplish this easily you could recommend me?

I'm using some IR as well. Ken Shirriff has written a nice library for sending and receiving IR. Contained in this library is a function which sets one of the PWM pins to the desired frequency.

IR library: https://www.google.nl/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&uact=8&ved=0CDYQFjAB&url=https%3A%2F%2Fgithub.com%2Fshirriff%2FArduino-IRremote&ei=-SN3U5ygCsjqPPHfgPgK&usg=AFQjCNGA-he6iltj8SbqXXSXoST2PzwvjA&bvm=bv.66917471,d.ZWU

"You do not wish to bang your bits @ 56 kHz" is what I've been told when I started out with IR signals.

About PWM: as soon as you have the PWM set to a certain frequency, it will - AFAIK - not take up any cpu time to keep pulsing.

However: you will need a timer to generate the PWM, for instance 2. This timer will then not be available for other purposes. (Note: not entirely true, you can still hook an interrupt to it, but you are bound by the frequency set for your PWM)

The library uses another timer (timer 1) for sending and receiving IR.

The only timer left is timer 0, which is used by the Arduino core for millis(), delay() and such.

Cheers,

Jack