555 PWM Adjust Duty Without Changing Frequency *Closed* - Page 1
Forum section: electronics / beginners

author: Kippre7790
author_rank: Contributor
timestamp: February 21, 2020, 01:09:01 pm
content: This thread has been closed as I have reopened a new thread dealing with the entire project. I will not be looking here after this point. head to the link below to follow the thread:https://www.eevblog.com/forum/projects/diy-variable-multi-output-power-supply-project/Hello, I am trying to use a 555 timer to create a pulsed output. the problem is that I want to change the width of the pulse based in an analog voltage input without changing the frequency it's set for. From my slim experience with 555's pin 5 is a control pin, and when I put a resistor of some value to ground it does lower the duty (all the way to 0%) but also lowers the frequency and can slow down to almost half the target frequency.I came across this circuit online that is really simple in its construction and works almost perfectly. current flows at one resistance to charge the battery and flows through another to discharge. But it uses a POT to adjust the width, Problem is I need it to adjust with a voltage and not with a turn of a knob which would be easy normally but it uses all three pins which just made me go nuts to try and figure out how to do this with say transistors or something. (spent hours working on it and got nowhere)So I need a simple circuit that based on an analog voltage will gradually "turn" the resistance/flow up on one line and down on the other. I tried using mosfets and it worked well in simulation but I don't know if it would work in real life and I don't know much if anything about fets and have tried to stay away because of lack of explanation or understanding on how exactly they work. (yes they're voltage controlled and all... but a transistor is easy, it's just the current on the base multiplied by its beta/gain, which is a simple stat to find on any transistor.If there is a completely different way to make the whole circuit to get what I want I'm game for that too!

author: paulca
author_rank: Super Contributor
timestamp: February 21, 2020, 01:30:58 pm
content: I think you can use two 555s. One set to create pulses at the right frequency that trigger the second to generate the pulse of the correct width. As the second does not care about the off time, only the control voltage is needed to set the pulse length.It might have been Ben Eater's clock I seen this in.

author: Ian.M
author_rank: Super Contributor
timestamp: February 21, 2020, 01:38:48 pm
content: Yes. Use two 555 chips (or one 556), one 555 as a fixed frequency oscillator producing a narrow low-going pulse, the other as a monostable with an on time adjusted by its CV input, triggered from the other's pulse output.

author: Kippre7790
author_rank: Contributor
timestamp: February 21, 2020, 01:56:31 pm
content: well crap, never thought to use a monostable 555...should work just fine, will let you know if it works for me.

author: brucehoult
author_rank: Super Contributor
timestamp: February 21, 2020, 01:57:21 pm
content: Quote from: Kippre7790 on February 21, 2020, 01:09:01 pmThat completely different way would be to use a small microcontroller such as the ATtiny25/45/85 in an 8 pin DIP package. There are 6 I/O pins which can be configured as all digital input or output (including PWM), and up to 4 analog inputs with 1024 different levels and up to 15k samples per second. Runs by default at 1 MHz, or up to 20 MHz at higher voltage/current. They have 2, 4, or 8 KB of program space, and 128, 256, or 512 bytes each of RAM and EEPROM.Here is 10 ATtiny25 for $14.76 on Amazon.https://www.amazon.com/ATMEL-ATTINY25-20PU-ATTINY-20MHZ-pieces/dp/B00MMYSK86Maybe you can find cheaper, but to be honest I just go for the 85 because they cost basically the same for four times the capacity.Your task will require one analog input, one PWM output, and just a few lines of program code.

author: Kippre7790
author_rank: Contributor
timestamp: February 21, 2020, 02:00:34 pm
content: Thanks but I tend to like to keep the microcontroller-ism to a low and using discrete where I can cause I don't have much need for a microcontroller that would cost the same price for the entre circuit lol... but definitely thought that was going to be the way I needed to go at the end of yesterday.THX!

author: Kippre7790
author_rank: Contributor
timestamp: February 21, 2020, 03:12:49 pm
content: the monostable worked for what I need thanks for the help.anyone have an understanding of mosfets they can explain the gritty details of how they work?

author: tooki
author_rank: Super Contributor
timestamp: February 21, 2020, 03:21:31 pm
content: Quote from: Kippre7790 on February 21, 2020, 02:00:34 pmA 555 timer costs more than a tiny MCU, never mind two 555s...

author: Zero999
author_rank: Super Contributor
timestamp: February 21, 2020, 04:03:41 pm
content: Quote from: tooki on February 21, 2020, 03:21:31 pmNo one would use two 555 timers, unless it was just a prototype. They'd use the NE556, dual timer IC of course.I don't think cost is the prime consideration, but if it was, it depends on the quantity. In small quantities a microcontroller tends to be cheaper, but in larger quantities the NE556 is cheaper. The NE556 also has the advantage of being able to be run directly from 9V, with no additional voltage regulator and allows the use of a cheaper, non-logic level MOSFET.Reference: a search on Digi-Key, 555 timer vs MCU, sorted cheapest to most expensive.https://www.digikey.co.uk/products/en/integrated-circuits-ics/clock-timing-programmable-timers-and-oscillators/689/page/2?k=555&ColumnSort=1000009https://www.digikey.co.uk/products/en/integrated-circuits-ics/embedded-microcontrollers/685?FV=-8%7C685&quantity=0&ColumnSort=1000011&page=1&pageSize=25Anyway, it seems like the original poster wants to avoid programmable parts for whatever reason, so it's a moot point.Quote from: Kippre7790 on February 21, 2020, 01:09:01 pmHow about using a comparator IC, such as the LM393?Here's an example schematic I drew awhile ago. Pot1 controls the frequency and Pot2, the duty cycle. If you don't want to adjust the frequency, replace Pot1 with a short and if you want voltage control, remove, R5, R6 and the Pot2 and connect the voltage source to U1B's +input. The values of R1 and the two R2s, alter both the input voltage range and the frequency, which you haven't specified.

author: pwlps
author_rank: Frequent Contributor
timestamp: February 21, 2020, 04:34:52 pm
content: Yet another approach to voltage-controlled PWM, without any 555 : an asynchronous sigma-delta modulator.I was using it in this project:https://www.eevblog.com/forum/projects/simple-lifi-transmitting-audio-signal-with-a-led/msg2282771/#msg2282771

author: brucehoult
author_rank: Super Contributor
timestamp: February 21, 2020, 09:22:51 pm
content: Quote from: Zero999 on February 21, 2020, 04:03:41 pmAssuming amateur small quantity use, the lowest price*minQty for through hole chips who have them in stock (no six or eight week lead time) is £0.10966*2900 = £318.88. A lifetime supply :-)QuoteHere: £0.42000*1 = £0.42 for a PIC10F200. Or £0.44000*1 = £0.44 for an ATTiny12V.The unit cost is a bit higher, but the total cost is much more reasonable :-) Even after buying a cheap Arduino to program it. And don't forget the 555 will always need a bunch of external components, which aren't free, while the AVR (at least) may need zero external components if you are happy to work at between 1.8 V and 5.5 V and don't need a lot of output current.

author: Zero999
author_rank: Super Contributor
timestamp: February 21, 2020, 10:07:59 pm
content: Quote from: brucehoult on February 21, 2020, 09:22:51 pmI stuffed up on the search. I sorted by quantity available, rather than price and should have selected dual 555, to get the 556.https://www.digikey.co.uk/products/en/integrated-circuits-ics/clock-timing-programmable-timers-and-oscillators/689?k=555&k=&pkeyword=555&sv=0&pv183=243487&sf=1&FV=-8%7C689&quantity=&ColumnSort=1000011&page=1&pageSize=25QuoteNeither of those parts are suitable here because they lack an ADC. You've forgotten the original poster wants voltage controlled PWM.I do agree though, for small quantities, an MCU can work out cheaper and if you read my post again you'll find I didn't dispute that.Quote from: Zero999 on February 21, 2020, 04:03:41 pmQuoteThe MCU will also require other components in this instance, since the supply voltage is 9V, it will require a voltage regulator, whist the NE556 will run directly off 9V. There are some MCUs with a built-in regulator, but they're not the cheapest.And why are we even having this discussion? I doubt the tiny difference in cost is an issue here. The original poster obviously doesn't want to use programmable parts. I can only guess at why. Perhaps they might not want to have to learn to write code, or they might already know how and want to learn something new?

author: tooki
author_rank: Super Contributor
timestamp: February 21, 2020, 11:48:44 pm
content: Quote from: Zero999 on February 21, 2020, 10:07:59 pmYou keep saying that the OP’s motivation for avoiding MCUs is a mystery, despite the fact that they explained it: the mistaken belief that MCU circuits are more expensive than discrete ones.Quote from: Kippre7790 on February 21, 2020, 02:00:34 pm

author: Zero999
author_rank: Super Contributor
timestamp: February 22, 2020, 11:08:15 am
content: Quote from: tooki on February 21, 2020, 11:48:44 pmI admit, I did overlook that post, but he said the cost is the same, which appears to be true in this case, looking at the price of MCUs which have an ADC and the cost of a voltage regulator, so it doesn't make much sense either way.Anyway, I say forget the price. He should just use whatever solution he feels most comfortable, or will get the most enjoyment out of.

author: tooki
author_rank: Super Contributor
timestamp: February 22, 2020, 11:32:36 am
content: I will grant, I hadn't considered the cost of the regulator. When DIYing it, it adds up. This is a kind of thing where a cheap Arduino nano clone for $1 often ends up being the cheapest way to go, since it costs far less than just the components on it!!If this actually is just a voltage-controlled PWM, then I'd also suggest looking ata circuitwhich I used recently to make a high-frequency LED dimmer:https://www.eevblog.com/forum/projects/9vdc-5vdc-smps-for-driving-leds/msg2912008/#msg2912008It uses an LM393 and works beautifully, uses a voltage input to vary the duty cycle, and is much better at very low duty cycles than any 555 PWM circuit I tried.

author: Ian.M
author_rank: Super Contributor
timestamp: February 22, 2020, 12:36:41 pm
content: Apart from pre-built modules like the Arduino Nano, there are some MCUs with built-in voltage regulators that can run from a wide supply voltage range, and with the ADC and PWM capability needed for this application. e.g.PIC12HV615, so all you'd need is a dropper resistor (its got a shunt regulator), and a decoupling cap, + the control voltage source and power PWM output device e.g a pot and logic level MOSFET as others have suggested.Quantity costings look reasonable - 1000 off is $0.66 USD + $0.06 per unit programming fee if you want to treat it as a custom part that can be shipped direct to your assembler. Whether or not that's competitive against a jellybean dual comparator or 556 clone, depends on how much it helps you minimise the BOM, cost of placed passives, and board area savings, which are mostly design specific.If you've already got a PIC toolchain, including a HV programmer, and experience with it, it would be worth a play with even for a one-off. OTOH if you don't its not going to be cost-effective unless you can justify the investment of significant time and a little money getting 'into' PICs for other purposes.

author: Wimberleytech
author_rank: Super Contributor
timestamp: February 22, 2020, 01:54:28 pm
content: Quote from: Kippre7790 on February 21, 2020, 03:12:49 pmYes I can.It is a four-terminal device with the static characteristics illustrated by these two figures.Take a look and ask further questions.

author: Kippre7790
author_rank: Contributor
timestamp: February 24, 2020, 03:41:05 pm
content: Ok, hit another wall with the dual 555 circuit. Yes I could use a 556 but I have a bunch of 555's. I could use a microcontroller, they aren't that big of a deal but I haven't got into the microcontroller side at all yet and don't really care to do the code side.So I'm running the first 555 (Freq timer) at about 5-10khz and the second 555 (Pulse width timer) is set for a 10%-50% modulation but it doesn't go lower than 25%, at first I thought it might be because the first timer's pulse width was at 75% ON (because the trigger pin on the second 555 only triggers when there is a OFF voltage)so I played around with the first 555's astable resistors to get a larger/smaller pulse width and it didn't do anything worth while on the output of the second timer. I messed with the pulse width resistor on the second 555 as well as lowered the cap which only changed the resistance of adjust POT I needed.This is for a buck circuit to bring mains 120v down to 50v-60v DC that can be adjusted down to say 12v-5v so I have a wide range of adjustment for my first power supply, anyone have a better way of doing this? I could have just made a linear power supply but I don't know what I might need to power in the future and so I want it to be able to handle a lot of power and be efficient at doing it. It started out that I wanted to power a 30V 1A LED but I ended up thinking "hell if I'm just going to make a switched supply it shouldn't be to hard to make it adjustable and use it as a power supply. Then just linearly regulate the output so it's still a pretty clean power output..." That was a can of worms. I could buy a buck IC but I thought "If I'm going to do that I might as well just buy some buck boosters from China and be done with it cause i'll never learn..." so here I am...Any suggestions on how to do this better?

author: schmitt trigger
author_rank: Super Contributor
timestamp: February 24, 2020, 04:26:34 pm
content: The pulse width of the astable 555 has to be very narrow, because a monostable 555 output will not go down narrower than its triggering pulse.A way to circumvent this is to capacitively couple the output of the first 555 to the triggering of the second. A 0.001 to 0.01 uf coupling cap plus a 10k resistor to Vcc does the trick.

author: Kippre7790
author_rank: Contributor
timestamp: February 24, 2020, 05:19:47 pm
content: Thanks that will work I think, is it true that different 555 packages have different frequency maximums? I have the DIP-8's and at 10khz it's not bad but I would like to run it at like 50khz to give me better power control. Is that too much to ask for?

author: Zero999
author_rank: Super Contributor
timestamp: February 24, 2020, 10:09:39 pm
content: Quote from: tooki on February 22, 2020, 11:32:36 amThat's very similar to the circuit I posted previously.Quote from: Kippre7790 on February 24, 2020, 05:19:47 pmThe package doesn't matter, but there are different variants of the 555 timer. The CMOS versions, such as the ICM7775, TS555 and LCM555 are faster, than the traditional TTL NE555 and LM555.The ordinary NE555 timer is capable of up to 100kHz, but that's only with a duty cycle of 50%. The minimum pulse length will be around 50µs, which will limit the minimum/maximum frequency and much lower or higher duty cycles.http://www.ti.com/lit/ds/symlink/ne555.pdfhttp://www.ti.com/lit/ds/symlink/lmc555.pdfWhat are you PWMing? There normally isn't any need for such high frequencies and you'll get a greater PWM range, at lower frequencies.

author: Kippre7790
author_rank: Contributor
timestamp: February 25, 2020, 02:55:16 pm
content: I am using it for a power supply and the faster I run it the smaller inductor I need due to the nature of the inductor. But also the faster I run it the more "wiggle room" I have with the pulse width because the inductor needs "X" time period to build up current if you get what I am saying.If I run a slower PWM yes I can get much more out of the PWM but then my inductor is on for too long and too much power will go through and will overvolt on startup or after a dead short or something.Here is a block diagram of how I wanted the unit setup. This is my first big project that adds a lot of new concepts that I am learning as I go along so any help and suggestions on how to work through it would be greatly appreciated.Perhaps I should start a new thread?

author: schmitt trigger
author_rank: Super Contributor
timestamp: February 25, 2020, 03:20:17 pm
content: IMHO, if you want to discuss such a large project thoroughly, it would be best to start another thread with the appropriate thread name and focus.That may attract more commenters, than a beginners thread which only discusses the 555's characteristics.

author: Ian.M
author_rank: Super Contributor
timestamp: February 25, 2020, 07:42:14 pm
content: That block diagram + your description in reply #17 sounds unsafe. For a general purpose PSU, you *NEED* transformer isolation, and so far there's no evidence that your design has any.Designing a safe isolated switching PSU is *NOT* a good project for a novice or even an experienced engineer without considerable experience with custom transformer design and construction. 48V isolated switching PSUs are commonly used in telecoms applications so decent high current ones can be found used at relatively affordable prices. If you can tweak the output up just over 10%, you can get 53V, which allows enough headroom for a 0-50V PSU design.If the AC accessory output is for a mains voltage element iron with a grounded shaft and bit, that part is OK if you either isolate the TRIAC phase angle firing circuit and any zero crossing detection circuit, or are careful to use a control pot with a plastic shaft and a grounded bush. OTOH I wouldn't be happy if its for general low voltage AC use.Rather than cluttering up the forum repeating what you have already described, you can edit the thread title on your first post to be more appropriate to the project, + add links in your first post to your replies #17 and #21 where you describe what you actually are trying to do.

author: Kippre7790
author_rank: Contributor
timestamp: February 25, 2020, 08:01:31 pm
content: Thanks for the concern. I have reopened a new thread to discuss the larger project, I will be watching that one from here on out. it can be found here:https://www.eevblog.com/forum/projects/diy-variable-multi-output-power-supply-project/To further your conversation though, yes it would be isolated, just never got that far yet. was still at the theory stage of things.the iron is grounded and yes that was a worry of mine as well and I would watch out for that kind of stuff. it would not be running high power stuff just a generic soldering iron.