# NE555 question

Discussion in 'General Electronics Chat' started by pmaegerman, Apr 9, 2011.

1. ### pmaegerman Thread Starter New Member

Apr 9, 2011
3
0
i am a beginner in electronics, trying hard and in need for an advice.
I have built a simple infrared remote with an Arduino and a library written by someone else.
I am very happy with it but thinking to build the same with a 555 IC, as a personal exercise (reading Make:electronics).
I am hesitating about the circuit, would I need one or two 555s and also calculation for the resistances and capacitors, I thought I would ask fro some guidance.
I have found the following information and I am a little confused by the mix of frequency and ms. :

Num. of pulses 16 / Tolerance 9 - 22
Burst frequency 32700 Hz / Tolerance 29800 - 35500 Hz
Delay 7.33 ms / Tolerance 7.0 - 7.7 ms

Thank you in advance

2. ### Wendy Moderator

Mar 24, 2008
21,012
2,745
Frequency is number of cycles per second (hz). It can also be expressed as time, in this case milliseconds (ms), by expressing how many ms it takes for one cycle to occur.

It sounds like they are trying to express digital information however. How many pulses is how many cycles. I design a lot with the 555, it would be easy to have two 555 chips make 16 cycles (square waves) and stop.

If you could get a picture of the waveforms that would help.

3. ### pmaegerman Thread Starter New Member

Apr 9, 2011
3
0
Well, I got the information from this site : http://www.doc-diy.net/photo/rc-1_hacked/index.php
There are oscilloscope screenshots, and there seems to be a pattern, thus my idea for the 555, I thought the timings would be enough, could you explain me how the waveforms help you ? As I said i am trying hard to learn by myself

And here below the C code that makes it work with the Arduino, I didn't want to just reverse engineer it, I would like to elaborate on the 555 and be able to map the concepts, hoping to create a bridge between my programmer mind and the electronics.
Thank you for your time

void wait(unsigned int time){
unsigned long start = micros();
while(micros()-start<=time){
}
}

void high(unsigned int time, int freq, int pinLED){
int pause = (1000/freq/2)-4;
unsigned long start = micros();
while(micros()-start<=time){
digitalWrite(pinLED,HIGH);
delayMicroseconds(pause);
digitalWrite(pinLED,LOW);
delayMicroseconds(pause);
}
}
Canon::Canon(int pin)
{
pinMode(pin, OUTPUT);
_pin = pin;
_freq = 33;
}

void Canon::shutterNow()
{
high(480,_freq,_pin);
wait(7330);
high(480,_freq,_pin);
}

4. ### Wendy Moderator

Mar 24, 2008
21,012
2,745
This reminds me of when I tried (and succeeded) in analyzing my garage door open coding. It was very basic, it used a 16 bit word, but 6 bitswere suppressed (held at ground). The suppressed bits formed a framing area, and the other 10 bits were encoded by using 25% (for a 0) and 75% (for a 1) duty cycle. It was relatively simple.

I can not make heads or tails of those waveforms. If I was sitting in front of a scope with the remote in hand I could do the necessary experiments to wrap my head around them.

The waveforms themselves are easily reproduced, but I need more in the way of context. If you can draw them out and explain what the function was I might be able to help. Square waves are easy to draw on graph paper, it is how I did it for the garage door opener.

I need more information, or if you understand it, context in what I'm seeing.

5. ### THE_RB AAC Fanatic!

Feb 11, 2008
5,435
1,309
The information seems to be explained completely enough on that web page. The Canon remote sends 2 "bursts" of pulses, and the 2 camera functions are selected simply by the time delay between the 2 bursts;
7.33mS = camera function 1
5.36mS = camera function 2

Each "burst" is 16 pulses at 32700 Hz.

You could do it with 555 timers but I think you might need 3 of them. A PIC or other micro would be the best option and pretty trivial to write the code.

6. ### Wendy Moderator

Mar 24, 2008
21,012
2,745
Agreed.

The fundamental frequency of the burst is 32.76Khz. 16 bits for each burst, and the burst is the same.

The delay between the bursts is the difference between the two commands.

Is that what you were saying?

Paraphrasing the statements is one way of making sure I think what I heard is what you think you said...

7. ### hgmjr Moderator

Jan 28, 2005
9,030
215
Code ( (Unknown Language)):
1.
2. void wait(unsigned int time){
3.    unsigned long start = micros();
4.
5.    while(micros()-start<=time){
6.    }
7. }
8.
9. void high(unsigned int time, int freq, int pinLED){
10.    int pause = (1000/freq/2)-4;
11.    unsigned long start = micros();
12.
13.    while(micros()-start<=time){
14.       digitalWrite(pinLED,HIGH);
15.       delayMicroseconds(pause);
16.       digitalWrite(pinLED,LOW);
17.       delayMicroseconds(pause);
18.    }
19. }
20.
21. Canon::Canon(int pin)
22. {
23.    pinMode(pin, OUTPUT);
24.    _pin = pin;
25.    _freq = 33;
26. }
27.
28. void Canon::shutterNow(){
29.    high(480,_freq,_pin);
30.    wait(7330);
31.    high(480,_freq,_pin);
32. }
33.
34.
Added code tags for clarity...

hgmjr

8. ### THE_RB AAC Fanatic!

Feb 11, 2008
5,435
1,309
And there I was thinking I had paraphrased the website to make it absolutely clear.

Yep that seems to be correct.

The big question of course is can the transmitter be continuously cycled, as that only requires two 555 timers, one to make the 32kHz carrier and the other to gate the carrier on/off (with the desired off period).

I have a feeling it might. The logical way to structure the reciever would be to detect burst 1 and window detect the low period until the start of burst 2.

If it does not accept continuous bursts you would have to add a third 555 monostable to one-shot gate the entire process.

9. ### Wendy Moderator

Mar 24, 2008
21,012
2,745
I'm not sure how I would do it at the moment, 3 timers sounds about right. Jpanhalt had a fairly interesting circuit for a 555 32.737Khz crystal oscillator on another thread. I can buy these crystals for under 40¢ nowdays, so it was interesting.

It might be easier to use a crystal oscillator and a counter instead of all 555s too.

10. ### THE_RB AAC Fanatic!

Feb 11, 2008
5,435
1,309
Good point. The 32kHz frequency may not be that critical, as I *assume* the receiver would just use a standard 3pin IR detector and they have a tolerance of at least a couple percent around the ideal carrier frequency.

Would you really use 3 timers? I would use a 8pin PIC with internal RC osc (good for about 1 percent freq accuracy) and generate the pulses and delays in code. Total parts count; PIC, 2 buttons, LED, 1 resistor.

11. ### Wendy Moderator

Mar 24, 2008
21,012
2,745
I'm older school than you, hardware wise. I bought an Arduino from BG Micro not too long ago, but still have yet to power it up. A µC is a good way to go with this project, but I'm letting the design perculate in the back of my skull for timers.

To be honest I would probably use CMOS logic and generate it with counters, but 555s might work too. Being analog, if the digital input were fussy at all it might be a problem. I thought about using them for the garage door opener, but never got around to it. So many projects, so little time.

I visit your website now and again, it is really well done. Eventually I'm going to try to pick your brains about some of your projects.

12. ### pmaegerman Thread Starter New Member

Apr 9, 2011
3
0
I have to admit I didn't manage to have this working, I think it's still out of my league right now, I'll give it a try later when feeling more confident.
In the meantime, I have learned to program Attiny13 microcontrollers, they cost 1,5\$, have 1kb flash memory and 6 I/O pins, which is enough to program 1 input button and 1 output led.
This might be cheaper at the end, and makes my life really easier for now
Anyway it's good to check different options, and I have learned a lot about 555s in the meantime.
And I definitely keep this project in the fridge for later.
Thank you.
Philippe

13. ### THE_RB AAC Fanatic!

Feb 11, 2008
5,435
1,309
Thanks for the nice words Bill, it means a lot to me. I've seen you do some impressive stuff here too but for some reason I was under the impression you did software too?

Didn't you do a software program for stripboard circuit design or am I confused?

Anyway if you did want to dive in to PICs I'm sure there are a ton of people here (including myself) that would bend over backwards to help you quickly get up to speed.

To pmaegerman- Sorry to hear you gave up. If you did want to do it with the ATtiny it would be very easy in C code.