-1
\$\begingroup\$

simply, the circuit is a 38KHz signal generator for an IR remote project. the output signal should be gated by an MCU according to IR timing intervals recorded earlier. the design with the 4148 diode is for duty cycle control.

schematic

simulate this circuit – Schematic created using CircuitLab

first, I tried the left section (simple gating) alone. it worked but the timings were a little (up to 30 us) offset in randomly both directions.

-- I deduced the problem may be that the gated signal, may start at any point of wave, not essentially at a low to high transition.

then, I used the right hand section to override trigger/threshold. so when the input gating signal is low, the threshold is kept high, the capacitor stays charged and output (and IRLED) is forced low. when the Gate signal goes high, the reverse story happens.

the problem is, the timings are a lot more (up to milliseconds) distorted in this case. so here are the obvious questions :

  1. is the deduced idea of bad behavior correct ?
  2. is the suggested solution correct ?
  3. in case of "NO" for the previous questions, is there any idea how to do that on a 555 (or similar one chip, general purpose oscillator) ?

the output signals out of MCU are correct. can't use mcu for 38khz signal generation.

\$\endgroup\$
  • \$\begingroup\$ You have a microcontroller already there. Why not use a timer in the controller to generate the 38kHz signal? Start up is then clearly defined, and you have less finicky analog hardware to fiddle with. \$\endgroup\$ – JRE Aug 16 at 8:13
  • \$\begingroup\$ I would free run the 555 and then gate the clock; this can be done with quite a simple circuit. \$\endgroup\$ – Peter Smith Aug 16 at 8:14
  • \$\begingroup\$ @JRE it's a constraint. \$\endgroup\$ – Tirdad Sadri Nejad Aug 16 at 8:15
  • \$\begingroup\$ @PeterSmith that's exactly what I did at first. (Its written just after the circuit image.) \$\endgroup\$ – Tirdad Sadri Nejad Aug 16 at 8:17
  • 1
    \$\begingroup\$ The timer on your controller doesn't need an output. The timer only has to trigger an interrupt routine. The interrupt routine can then drive the outputs as needed. \$\endgroup\$ – JRE Aug 16 at 18:39
1
\$\begingroup\$

Since you must use the 555, and a simple gate circuit isn't adequate (the IR burst must always start with a low to high transition,) then you need to synchronize the gate with the 555 state.

Your microcontroller has other inputs. Use one to detect the state of the 555.

Now, when the controller needs to turn on the IR burst, it first checks the state of the 555 and waits for the 555 to go low. Then the controller turns on the gate.

Depending on how fast the controller is, you may need to use interrupts to detect the state and switch fast enough to meet other timing requirements.


The gating could also be done in discrete logic (and gates, flip flops, and such,) but you have the controller there already. Whether you'd rather write more software or build more hardware is your choice.


Alternatively, try some of the reset circuits for the 555 given on this linked site.

Ideally, you would pull the RESET pin low to stop the oscillator then let it go high to start again.

Apparently, though, the 555 reset pin is somewhat buggy so that it is neccessary to use alternative methods to get the desired function.

Or just, you know, generate your IR signal directly in your controller like any reasonable engineer would instead of lashing a 555 circuit together and trying to brow beat it into functioning.

Maybe the assignment is just that: a lesson in just how ugly it is to mix discrete analog circuits with microcontrollers.

\$\endgroup\$
1
\$\begingroup\$

Suggestion: Connect the gate signal into the 555's reset pin, so that the 555 is in a known state every time the gate goes high.

The gate doesn't even need to connect to the transistor it can be omitted, with the LED driven directly by the 555 output (though I would add a resistor).

The output is low if reset is low, so your gate off condition means that there is no output if the gate is low.

\$\endgroup\$
  • \$\begingroup\$ In the reset the cap is chqrged. The charged cap, ensures the low to high transition, but only after a full LOW half cycle because the threshold pin is kept high. So we have an offset of half cycle and the problem exists. \$\endgroup\$ – Tirdad Sadri Nejad Aug 16 at 11:28
0
\$\begingroup\$

In general these days by the time you have bought and assembled a 555 and all of its external components it is cheaper to buy a 8 bit 8 pin microcontroller to do a function like this. If you have to use a 555...

  1. Yes
  2. This will charge the capacitor above Vthreshold which will force the output low for the first half cycle.
  3. Use the reset pin of the 555 as a gate. When reset the output is low so discharge is discharging the capacitor during reset. Vtrigger will be low so this will result in the 555 output going high immediately on reset going high. This needs no external components and should give predictable behavior.

Don't forget the decoupling capacitor on Vcc.

\$\endgroup\$
  • \$\begingroup\$ The charged cap, ensures the low to high transition, but only after a full LOW half cycle because the threshold pins is kept high. So we have an offset of half cycle and the problem exiats. Is it true ? \$\endgroup\$ – Tirdad Sadri Nejad Aug 16 at 9:46
  • \$\begingroup\$ Sorry my description of operation was wrong capacitor is discharged during reset. \$\endgroup\$ – RoyC Aug 16 at 20:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.