# Switching Led

Discussion in 'General Electronics Chat' started by willeng, Jul 4, 2014.

1. ### willengMember

Joined:
Jul 5, 2012
Messages:
303
Likes:
3
<Code471#>

Last edited: Jan 14, 2016
2. ### KeepItSimpleStupidWell-Known MemberMost Helpful Member

Joined:
Oct 30, 2010
Messages:
9,970
Likes:
1,099
ONLINE
Well, I didn't actually link to a temperature controller, but a "process controller". You still need two things.

1) Something that changes your vacuum and for simplicity let's say 0 to 100%. The standards are typically "voltage", 0-5, 0-10, 0-20 mA and 4-20 mA, "temperature" , "SCR/TRIAC" and "resistance". The quoted terms are being used loosely.

2) Something that measures the variable you want to control. Again 0 to 100%. This is usually a voltage or a current. Usually some y=mx+b magic turns a process input in the form of a "voltage" to a process variable such as pressure or temperature.

Now, you can add a PID controller. Two types generally exist and they are P, PI and PID and "self-tuning" versions of the algorithm.

Simplistically, there is a proportional constant, a Derivative constant and an Integral constant.
kp = Proportional to the error; ki is multiplied by the integral of the error and kd is multipled by the derivative of the error.

Kp basically handles the tightness of the control and contributes to instability and oscillation
Ki tends to make the setpoint and measured value agree
Kd - works on preventing an overshoot.

Proportional as hardware alone could work for you. The only problem is that you can't set the actual value, but you can turn the dial until it works, but you still need (1) and (2).

For now, I'm going to stop here for now, but SCR/TRIAC control needs addressing.

3. ### willengMember

Joined:
Jul 5, 2012
Messages:
303
Likes:
3
KISS,

My mistake about the Process Controller.

I'll have a chew on what you have written & see what I can come up with.

Cheers

Joined:
Jan 12, 1997
Messages:
-
Likes:
0

5. ### MrAlWell-Known MemberMost Helpful Member

Joined:
Sep 7, 2008
Messages:
11,049
Likes:
961
Location:
NJ

Hi,

Generally when you try to control a process you dont have to detect exact levels that exceed set points, all you have to do is detect whether or not the measured variable is above or below one set point. Let me try to explain more here.

First, if you have a measurement that is 'good' between 1.000v and 1.010v and is 'bad' everywhere else, then what this probably means is that you 'increase' the process drive when it is under 1.000v and 'decrease' the process drive when it is over 1.010v, and do nothing when it is between 1.000v and 1.010v.
But this simplifies approximately to increasing the drive when it is under 1.005v and decreasing when it is over 1.005v. That means only one set point not two, and the controller is then simpler.

For example, using an integrator and 1.005v DC reference that would mean that when the measured signal decreased below 1.005v the drive would START to increase little by little, and when the signal increased above 1.005v the drive would start to decrease little by little.
For a purely digital drive this would mean the 'on' time would increase or decrease. For a linear control it would mean the drive would increase more linearly (for a triac this would mean phase control not just turn on and turn off).

What this kind of system boils down to is a control that keeps varying, but it only varies between very small values because although it's always changing the drive that drive only changes by very small almost imperceptible amounts, so it seems like it goes to the set point and stays there.

6. ### KeepItSimpleStupidWell-Known MemberMost Helpful Member

Joined:
Oct 30, 2010
Messages:
9,970
Likes:
1,099
ONLINE

Equation #1 is important and the graph labeled "Now, we have obtained a closed-loop system with no overshoot, fast rise time, and no steady-state error." and the table of what affects what is important.

The point is, that all PID controllers implement that algorithm in some way or another. It can be done in software or hardware.
When implemented in hardware "reset windup" doesn't occur because of the fixed power supplies. In software, you have to limit the reset term to 100%.

With a non-autotuning controller, the usual method was to measure x(t) and keep making step changes and vary the constants,
The integral constant has units of "repeats/min"

==

Slightly back to SCR/TRIAC control. There is a method called phase angle firing, but to work properly it has to be combined with "current limit". A motor load is different than a resistor, so constant triggering over a fraction of a power line cycles occurs, so with this output method it's possible to control your motors. The devices usually map the input (e.g. 4-20 mA) to power.
It may make sense to use one for each motor, but controlled with the same signal.

7. ### willengMember

Joined:
Jul 5, 2012
Messages:
303
Likes:
3
Thanks for the additional information & explanations I will read up on things, it's all very interesting.

I have an idea that I will roughly outline now & post it when finished, I think it may work but we shall see.
It's seems fairly straight forward but I may be barking up the wrong tree & going about it the wrong way?
I would like to try it out if you think it's plausible.

I'll post when done.

Thanks Again

Cheers

8. ### willengMember

Joined:
Jul 5, 2012
Messages:
303
Likes:
3
I have roughly put my idea to a drawing- Attached, sort of hoping I don't embarrass myself to much?

The mention of not having set points & having to move dials etc made me think a little differently about the control unit.

Like mentioned I would like to give it a go if you think it's ok & with some assistance along the way.

Here's hoping?

Cheers

File size:
30.9 KB
Views:
174

Joined:
Oct 30, 2010
Messages:
9,970
Likes:
1,099
ONLINE
10. ### willengMember

Joined:
Jul 5, 2012
Messages:
303
Likes:
3
Kiss,

Is the fault in my Triac circuit due to the fact that it will be randomly firing the Triac instead of it firing at the beginning of each half cycle, zero crossing, synchronised?

Cheers

11. ### KeepItSimpleStupidWell-Known MemberMost Helpful Member

Joined:
Oct 30, 2010
Messages:
9,970
Likes:
1,099
ONLINE
If your randomly firing, your shooting after a moving target - not controlling. Ideally for the same input, you would like the same average voltage over one half cycle at least.

With an inductive load, there is a phase shift and a triac turns off at both zero voltage and ZERO current. Hence, if you trigger some degree after, the zero cross, it turns off at some other, possibly random, zero current cross.

Zero voltage switching eliminates RFI. Random firing is USUALLY used to turn on an inductive load when turning it on to stay. At v(0 degrees) you can have substantial current and that's the general reason to be able to current limit.

So, it would be NICE to trigger so that some average voltage would be produced. e.g. An average Voltage vs firing angle table or lets call it % mains. So, if my setpoint was 50% the RMS mains voltage, that's what I would get. We would assume that the load is predictable. The key is predictable and repeatable, not exact.

In actuality, a Tungsten load requires tweaking as well because cold resistance is like 10-15x less than the hot resistance.

Joined:
Oct 30, 2010
Messages:
9,970
Likes:
1,099
ONLINE
13. ### willengMember

Joined:
Jul 5, 2012
Messages:
303
Likes:
3
Please correct me if I have this or anything wrong as I seem to be lost at the moment.
I understand now that you can basically turn the Triac on anywhere in the half cycle after zero crossing for example 90deg & 270deg & it will turn off when the current is near or at 0 Amps until fired again in the next half cycle.
A zero crossing detector circuit will detect obviously zero crossing but how do you create the delay to fire say at 90 & 270deg, this eludes me unfortunately, I can see how with a micro controller but how do you achieve this with hardware?
I can't seem to find any relevant info on this?

Could someone suggest a small test circuit that I could build so I can control the triac Firing, maybe into a small step down transformer to keep the output voltage low. I can find lots of info on the net about controlling the circuits with a Potentiometer but not pulse control which I want to look at.

Cheers

14. ### MrAlWell-Known MemberMost Helpful Member

Joined:
Sep 7, 2008
Messages:
11,049
Likes:
961
Location:
NJ
Hi again,

We talked about phase control of the triac already and stated that you should not use variable phase control for the traic if you are using an AC motor. That should really only be used for motors with brushes. If your motor does have brushes then maybe it's ok, but a question that comes up is do you really need sub cycle control? It's doubtful because the line goes through zero either every 8.33ms or every 10ms, which is not that long anyway.

The triac can be fired anytime after the zero crossing and yes it will turn off when the CURRENT goes though zero the next time. You have to be careful though that you dont trigger with a delay longer than 1/2 cycle though or else you'll end up with half wave rectification and that's not good. But if you just turn on at the zero crossing and then turn off anytime after that, the motor will probably be ok, so you probably dont need sub cycle phase angle firing.

What's the PLL for, and why is the starter circuit so complex, is that for sub cycle phase angle control? If so, it's still much too complex.

15. ### KeepItSimpleStupidWell-Known MemberMost Helpful Member

Joined:
Oct 30, 2010
Messages:
9,970
Likes:
1,099
ONLINE
True for a RESISTIVE load only. The triac will turn off at zero volts and zero current which may not occur at the same time with an inductive load.

Maybe I have an Ahha moment. You said you had a universal motor, so why not use PWM and DC?

16. ### MrAlWell-Known MemberMost Helpful Member

Joined:
Sep 7, 2008
Messages:
11,049
Likes:
961
Location:
NJ
Hi,

I think before we worry about using PWM or not we should learn whether or not the application really needs that knid of accuracy. From the original posts it sounds like a simple on/off control would be good enough, but of course i'll wait for more info. Also, dont forget that PWM can come in the form of on for 10us and off for 10us, or on for 10 minutes and off for ten minutes. The former would require sub cycle phase control, while the latter would just require turning the triac on and off.

17. ### willengMember

Joined:
Jul 5, 2012
Messages:
303
Likes:
3
Thanks for the replies,

MrAl,
There was a mention of a P, PI or PID controller to control the Vacuum Pressure of the test bench & hold it steady until readings were taken, then it was mentioned that it would be difficult to have Set Reference points with a Hardware only PID setup which I would like. So in light of that I thought that a PLL controller would be easier for myself to build & that way I could in fact have a series of Reference set points (Frequencies) to choose from once calibrated.
The trouble I have is my Triac circuit & my lack of knowledge on phase control which I am attempting to learn more about. I understand the basics but I have much to learn, I am having trouble finding suitable reading material to learn from & the more knowledgeable on this forum don't appear to let much info go so I can build a test circuit to learn from.
At the moment I adjust the motor speed manually via the Triac circuit posted earlier, two such circuits actually, the trouble is setting the same pressure each time a test is made & it is very easy to overshoot the mark then undershoot etc, very time consuming & frustrating sometimes.
The motors are 240V Ac Universal motors, with brushes.

I notice you mentioned a simple on off circuit, this would be ok if the RPM of the motors was the same each time you wanted say 1 Psi vacuum test pressure, the trouble is that when modifications are made to the test pieces placed on the machine & they flow more or less air as a result the RPM of the motors needs to be increased or decreased to set the machine to 1 Psi Vacuum for correct readings to be taken.

EDIT: I may have misunderstood your ON/OFF control, did you mean PSM Pulse Skipping Modulation?

Kiss

Yes I understand about current lag in inductive loads, power factor etc.
My original thought was to rectify the mains hence the PWM on the circuit I proposed with the ? next to it, I thought I would just use suitable Mosfets to deliver the DC power to the motors, DC will have Tighter control.
I am still working on the phase control for the Triac circuit.

I understand that I can buy a Process Controller etc but I am not going to learn anything that way, I have need for several things that I want to control so now is the time to learn.

Cheers

Last edited: Jul 7, 2014
18. ### KeepItSimpleStupidWell-Known MemberMost Helpful Member

Joined:
Oct 30, 2010
Messages:
9,970
Likes:
1,099
ONLINE
The LAG you may understand, but you missed the turn off at zero voltage and zero current which may not be co-incident.

Rectifying the mains won;t necessarily work. You would need 240 VDC with no losses. Your vacuum motors are what HP?

Not sure if regulating voltage squared or voltage would be better.

I can walk you through writing a PID controller on any processor that supports floating point. I just haven't done autotune, The PID loop is nothing more than numerical integration and differentiation.

A auto-tuning process controller, I think is your best option. 1st job find one. Next interface it to read pressure in engineering units. You may or may not need an isolated output.

Well, probably a transformer would be involved to get 240 ish VDC. The good part; is it's easy. I've used this http://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_120539_-1 guy before, so most of the work is done for you.

Now, the triac thing, probably best done with a microprocessor. But would you want to do it with a look-up table without a processor. A/D creates a index to a look-up table for the phase angle of some average voltage, 0-5 is say 0-100% (0-511). Look up value of phase angle or maybe it's a digital divider. That's where you would start firing and you would continue this until the voltage went to zero again.

Even though we might look at it as 0-100% to a phase angle, the "phase angle" could be a time base divider.

19. ### willengMember

Joined:
Jul 5, 2012
Messages:
303
Likes:
3
Not that many will be interested but not having a small suitable Vacuum source I visited a recycling centre today & purchased a neat vacuum machine for bench testing & calibration of my circuit when built.
I purchased it for \$10.00 & it is in perfect working order, the Vacuum pump is a Diaphram type & should serve the purpose well, I will attach a picture if it.
Using this with a Vertical Manometer for verification should give good results

Cheers

File size:
1.3 MB
Views:
117

Joined:
Oct 30, 2010
Messages:
9,970
Likes:
1,099
ONLINE
21. ### willengMember

Joined:
Jul 5, 2012
Messages:
303
Likes:
3
Kiss,
You are correct that I didn't realise about the turn off at zero voltage and zero current , it was not coincidence but was due to a lack of knowledge in this field.
Yes, the Vacuum machine was used at a Hospital for medical purposes- Vacupulse VC100 model, ah Roots Blowers that's interesting.

QUOTE "I can walk you through writing a PID controller on any processor that supports floating point.

I can't say how much I appreciate that offer & would like to take this opportunity to learn, I realise it is the way to go.

I must let you know however that I fumble my way through with electronics as you would have realised by now & have only played with programming.
I started studying electrical engineering although late in my life before my accident & started to toy with the idea of learning to program & have had to abandoned most things.

I did to some success finish a PID project for an Arduino board that I was controlling the speed of a DC motor with a small eddy current brake that I built some time back.

So basically I am a beginner in programming among other things, I have Pickit 3 & another cheap programmer that I never really got into?

I have limited processor chips at hand but do have PIC16F887-I/P, PIC16F876A-I/SP, PIC16F873-04/SP

Do they support Floating Point?

So realising that I am a novice may change your mind about walking me through a PID Control program which I would understand perfectly.
On the other hand I would accept the challenge if you have time?

Obviously I am not sure what circuits I would require for this method?

Cheers