# DAC to run a 555 Timer [duplicate]

I am trying to create a PWM signal using a POT from 555 Timer to control speed of a 5V DC motor. I have a development board with a C8051F020 microcontroller, a 100K POT and an LCD display. The requirement is to generate PWM signals externally so that the microcontroller is free to do other things that needs to be done for the project. I need to use the DAC from the microcontroller to drive the 555 Timer.

Scenario: The ADC on the micro reads the value from the POT (present on the Dev board). The DAC converts it to an analog value which can be used by the 555 Timer. I cannot directly connect the pot to the Timer.

My understanding is that the ADC and DAC do not have to be physically connected together on the board. Instead the digital values sampled from the ADC can be used by the DAC through software, am I right? So my question: is it possible to connect the DAC of the microcontroller to the input (pin 7) of a 555 Timer with a level converter from 3.3V (DAC) to 5V (Timer) in between?

EDIT 4th Feb 2014

I am using LM741 OPAMP as a comparator. The Timer is configured in an astable mode. For prototyping purpose, the DAC from the microcontroller is replaced with a 100K potentiometer. Since the DAC is supposed to be the reference voltage to the comparator, I found that the LED would always light up (although very dim) because of the capacitor C1 voltage goes from 1/3*Vcc to 2/3*Vcc which is why the LED was dim because the lowest voltage was 1/3*Vcc = 1/3*5 = 1.67V. So I switched the terminals for the comparator and now the reference voltage is C1 (capacitor voltage) as shown in the schematic below. My questions: 1) Is it alright to replace DAC with a potentiometer to represent DAC voltage as the voltage from the POT? 2). Is it wrong to switch the terminals around? I tested it with inverted terminals and the LED completely switched off and glows bright when the DAC voltage (POT) is turned high up. Also tested with the motor. When the DAC is the reference voltage (pin 3 of LM741) then the motor starts up slow and cannot be stopped although the POT is all the way down. And when connected as shown in the schematic, then the motor is stopped in the beginning.

• Yes, why not eliminate the 555 and generate pwm with your development board? Jan 21 '14 at 19:49
• Crap I forgot the mention that, I cannot I need to keep generation of PWM independent of the microcontroller. Thats the requirement Jan 21 '14 at 19:50
• Also I do not think the discharge pin (7) is what you want to be controlling. I could be wrong but you may want to look up the threshold or trigger pins. Jan 21 '14 at 19:52
• How is checking the ADC and setting the DAC that much less expensive than bit-banging PWM? Jan 21 '14 at 19:56
• @IgnacioVazquez-Abrams, what do you mean? Jan 21 '14 at 19:57

One way is to use the voltage on pins 6 & 2 when the 555 is in astable mode. It will go from $0.33 \cdot V_{dd}$ to $0.67 \cdot V_{dd}$ fairly linearly. If you feed that signal into a comparator (with high input impedance so it doesn't load the it too much), inverting input. Feed your DAC input into the converter non-inverting input

The comparator should be powered by supplies that are equal to or greater than the range of the DAC.

simulate this circuit – Schematic created using CircuitLab

The waveform on the capacitor (that goes to the capacitor) looks like the top waveform here:

Whenever the DAC voltage exceeds 2/3 $V_{cc}$, the output of the comparator is always high (100% power). When the DAC output is lower than 1/3 $V_{cc}$, the comparator is always off. At 1/2 $V_{cc}$, the comparator output has a 50% duty cycle at the oscillation frequency of the 555.

Another way is to trigger a 555 with a periodic signal (perhaps from another 555) and feed the DAC output into the control voltage (pin 5) input. In that case, be sure your DAC output does not exceed the supplies of the 555 (high or low).

• Thank you for your answer Spehro. Question 1: The DAC would output an analog voltage. The comparator takes two analog voltages to output one digital signal. How would the comparator create pulses when the output of the timer is not connected? Question 2: I believe the comparator will need to very low response time??? Jan 22 '14 at 19:36
• I'll expand on the first question by editing my reply. Response time will depend on your PWM frequency. Most comparators are pretty fast compared to the kind of PWM frequency you'd use for a motor control. Jan 22 '14 at 19:54
• I get how the comparator output goes high when DAC voltage exceeds 2/3Vcc. But for the comparator to go low the DAC voltage has to be lower than 1/3Vcc and the voltage at the inverting input should be higher than 2/3Vcc right? How do I make sure that the timer output goes high when DAC voltage goes low? Jan 22 '14 at 21:10
• You're only using the comparator output. The timer free-runs at whatever frequency depending on the R1-Rt-C. If you feed a constant 0.5*Vcc to the comparator you get 50% duty cycle. Whenever you feed it less than 2/3*Vcc, you get less than 100%, down to 1/3*Vcc, below which you get 0% duty cycle. Jan 22 '14 at 21:24
• LM339 is open collector. You need a pullup to +5. Feb 4 '14 at 19:50

I cannot I need to keep generation of PWM independent of the microcontroller. Thats the requirement

Why don't you use something like this - it's cheap and reliable and directly takes a 0 to 1V signal and produces PWM at a frequency defined by Rset.

You'll still need a DAC if you are totally sure you are not allowed to put the pot onto the chip above.

• This is great but its expensive than a 555 Timer. Looks so much easier to setup I must say Jan 21 '14 at 21:44
• @DavidNorman it's a college project - what has expence got to do with anything. Anyway, getting rid of the microcontroller and feeding the pot straight to the chip save how much? Yeah, I know you have to use the micro because it's a college/tuition/learning thing BUT you never mentioned expence was a priority or even a factor in your question. OK when folk say "555" there can be an implication that 555 means cheap OR, maybe, that's all they thought of. My suggestion is an idea for you to consider!! Jan 21 '14 at 21:51
• Its a very good suggestion Andy. I asked my supervisor if I can use an arduino and design everything on my own. He said NO, use the Dev board which would save a little money. Each project has got \$20 budget and there are 54 students doing this project. He wants us to use components that we already have sadly Jan 21 '14 at 21:56
• @DavidNorman it's be a real shame if they taught you stuff that was 50 years out of date because of shortages. Try asking him what the department's budget really is!!! Jan 21 '14 at 22:23
• One of the guys did because he is a mature student and has industry experience. The supervisor said he has no idea about the 'real' budget. The supervisor is only a PhD student and he's doing what he's told. This is annoying. Please give me tips on how to connect DAC output to drive a 555 TIMER Jan 21 '14 at 22:28