SSR control. 5v Logic to PWM conversion. - Page 1
Forum section: electronics / projects

author: aqibi2000
author_rank: Regular Contributor
timestamp: February 21, 2013, 11:06:06 pm
content: Hi all this is one of first posts here. %-BI am looking for a method to convert a 5V logic signal to a PWM signal for an SSR.The 5V logic is from the PID controller.I don't want to have to result to a PIC or AVR , nor the OSPID that's my only real criteria.I have come up with an Electro-Mechanical solution:5v logic drives a servo which would adjust a potentiometer (which adjusts the duty cycle on a simple 555 timer circuit - which will drive the SSR - and in order to return back to the Zero state there's a spring.) Crude right?All help will be verily appreciated.

author: Marco
author_rank: Super Contributor
timestamp: February 21, 2013, 11:22:24 pm
content: What do you mean 5 volt logic? Does the PID controller already ouput some type of PWM? (It would have to to drive a servo.)

author: aqibi2000
author_rank: Regular Contributor
timestamp: February 21, 2013, 11:34:03 pm
content: 5v logic - which is enough to turn on a transistor. The servo's signal wire will be disconnected and when energised it would simply turn entirely to one side (twist the potentiometer), then when the logic signal is no longer present because it's no longer energised the spring will have enough force to be able to pull it all the way back.A normal Temperature PID controller is what I am referring to btw. It on the output side has a 5v output.Thanks Marco

author: Marco
author_rank: Super Contributor
timestamp: February 22, 2013, 12:07:49 am
content: Just put the PWM signal on the high side input of the SSR and connect the low side input to ground through a NPN transistor or n-MOSFET connected with a base/gate resistor to the logic output (assuming the logic output is push/pull).

author: aqibi2000
author_rank: Regular Contributor
timestamp: February 22, 2013, 12:16:48 am
content: I understand that, that's how to wire the SSR to the PID controller. But I was asking other methods to convert the 5v to a PWM signal using components.

author: Marco
author_rank: Super Contributor
timestamp: February 22, 2013, 12:26:38 am
content: Trying to determine what you really want is like pulling teeth ...Do you want to put a PWM signal with one duty cycle on the SSR when the output is high and a PWM signal with another duty cycle on the SSR when the output is low then?PS. generally you don't connect a SSR like I said, generally the high side is simply connected to power, not to a PWM signal ... do you really understand what I meant when I said "Just put the PWM signal on the high side input of the SSR"? I meant take the output of say a 555 circuit and put it on the high side ...

author: aqibi2000
author_rank: Regular Contributor
timestamp: February 22, 2013, 01:23:12 am
content: Sorry I will try and elucidate.I'm not trying to have PWM at a single duty cycle. That can easily be archived with a N channel (gate is 5v from the PID) mosfet driving a 555 PWM circuit connected to the SSR respectively.I am trying to attain a PWM signal to alter in sync with the 5V logic as the input into a circuit. For example when the 5v pulses at 0.5 second on and off pulses it's actually (very slow PWM =50% duty cycle) Hence I want to speed this up into an actual 50% duty cycle at a higher frequency so the powered element does not visually appear on for 0.5 seconds the off 0.5 second, it would run at 50% power via pwm.Actually the high side isn't necessarily connected to the SSR, in the method you state. An SSR can be regulated with a PWM signal hence it can run at 50% power with 50% pwm signal that is it's primary purpose. Otherwise if you simply wanted to turn something on and off you could use a regular relay, although contacts do deteriorate. That's is vastly the reason of using an SSR, I come from a background of BGA rework, so solid-state-relays are always used in this manner. Hence this is attained by joining pin 3 from a PWM 555 circuit to the + on the SSR whilst grounding the SSR - and the 555 circuit's ground together.

author: fcb
author_rank: Super Contributor
timestamp: February 22, 2013, 01:32:42 am
content: So your trying to take a SLOW PWM (say 1Hz) and turn it into a FAST PWM (say 100Hz) and preserving the DUTYCYCLE?

author: aqibi2000
author_rank: Regular Contributor
timestamp: February 22, 2013, 01:46:38 am
content: YesThanks for your patience

author: Marco
author_rank: Super Contributor
timestamp: February 22, 2013, 02:16:08 am
content: Your servo approach wouldn't actually do that unless some type of friction would introduce a large time constant ...The naive approach would be to low pass the controller output and use the low passed result as an input for a PWM circuit ... but that would have a very slow response time (as would the servo+friction approach).You can certainly create an analog circuit for what you want with an instant response to a change in duty cycle of the controller, but I think it would have a fair amount of components unless there is some really smart way to do it which I'm not seeing. You need to integrate the on time of each output pulse (ie. put a constant current into a capacitor) and on the trailing edge sample and hold the result. this gives you a signal you can use to drive the input of something like a SG3525 to generate your higher frequency PWM signal.A microcontroller approach would have a far lower component count AFAICS.

author: TerminalJack505
author_rank: Super Contributor
timestamp: February 22, 2013, 05:58:33 am
content: Is the input signal exactly 1Hz? If so then you can create a 1.024kHz signal with the same duty cycle by using a 4.194304Mhz (222) oscillator to feed into a divide-by-1024 counter. (You enable the counter when you see the positive-going edge of the input signal.) The divide-by-1024 counter then clocks a 12-bit counter. When you see the negative-going edge of the input signal you then register the 12-bit counter and clear it, getting it ready for the next cycle. The registered 12-bits can then be used with another counter (12-bits) and a digital comparator to generate the output signal.This will only work if the input signal is 1Hz and has a duty cycle between 1% and 99%. It will be more complicated otherwise.

author: hlavac
author_rank: Frequent Contributor
timestamp: February 22, 2013, 05:42:52 pm
content: This project looks somewhat funny - are you into steampunk or something?Servo, electromechanics to drive SSR???You must be very rich to use all this complex, expensive and unreliable stuff to do work of a 50c microcontroller...

author: aqibi2000
author_rank: Regular Contributor
timestamp: February 22, 2013, 08:20:54 pm
content: Quote from: TerminalJack505 on February 22, 2013, 05:58:33 amWell said I agree, I do have my crazy moments. I could just buy the OSPid with essentially has PWM output from a PIDhttp://www.ospid.com/blog/nevertheless that removes the learning behind this all.Marco - that's why I selected a servo rather than a DC motor because there is a lot of friction when pulling it back with the spring hence this will introduce the large time constant. ThanksIs the input signal exactly 1Hz? If so then you can create a 1.024kHz signal with the same duty cycle by using a 4.194304Mhz (222) oscillator to feed into a divide-by-1024 counter. (You enable the counter when you see the positive-going edge of the input signal.) The divide-by-1024 counter then clocks a 12-bit counter. When you see the negative-going edge of the input signal you then register the 12-bit counter and clear it, getting it ready for the next cycle. The registered 12-bits can then be used with another counter (12-bits) and a digital comparator to generate the output signal.This will only work if the input signal is 1Hz and has a duty cycle between 1% and 99%. It will be more complicated otherwise.That's exactly what I was looking for -

author: hlavac
author_rank: Frequent Contributor
timestamp: February 22, 2013, 09:28:22 pm
content: Just use a small avr or pic.You can have arbitrary input PWM frequency, just measure time (count clocks with timer with enough bits, i.e. hardware timer extended software to 32bits or so) between positive edge and negative edge (Ton), and between positive edges (Ttotal).Then multiply Ton with your maximum PWM value, then divide it by Ttotal.Load resulting PWM value into PWM unit and have it output your PWM at desired output frequency until a new input value becomes available.If you want to be fancy you could do some interpolation of the output PWM value to make the changes smooth instead of abrupt steps if your input PWM frequency is much lower than output one.

author: TerminalJack505
author_rank: Super Contributor
timestamp: February 22, 2013, 11:47:18 pm
content: Here's an outline of what I'm thinking. I changed the 12-bit counters to 8-bit to reduce components.If you're doing this as a learning experience then you would indeed learn something from this project. The 'controller' would have to be a simple state machine so that's where there real complication would be. To control the counter shown (74HC590) the state machine would need three states: "Enable counter", "Stop counter & register count", and "Clear counter." You might be able to implement this particular state machine with just two ICs.There's the potential of a glitch on the output once every 1024 cycles when the upper counter's count is registered. If that's a problem then you will need to add some additional complexity to fix that. Also, as I mentioned earlier, the design can't handle 0% or 100% duty cycles.