1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Switching Led

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

  1. willeng

    willeng Member

    Joined:
    Jul 5, 2012
    Messages:
    303
    Likes:
    3
    Sorry again for the double post but.

    Is it possible that within the PID loop that an up/down counter be used to add or subtract to the variation to keep things stable?

    Don't ask me how to do it just yet though, just a thought?
     
    Last edited: Jul 14, 2014
  2. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,917
    Likes:
    1,097
    I'm thinking out loud too, but we are on the same page. I presented a commercial module that has this line voltage compensation and it must be for a reason.

    ===

    EDIT: Just found this: http://www.rotwang.co.uk/projects/triac.html Posting before I read it all.
     
    Last edited: Jul 14, 2014
  3. willeng

    willeng Member

    Joined:
    Jul 5, 2012
    Messages:
    303
    Likes:
    3
    Yes I saw that site before, the mention of Bluetooth put me off, I'm about 100yrs behind with all these gadjets.
    All I know about Bluetooth is that it sounds like a Dentist is required ha!
     
  4. dave

    Dave New Member

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


     
  5. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,917
    Likes:
    1,097

    But, it's exactly what we've been talking about since almost day 1. V^2 stuff and constantly pulsing the triac rather than just turning it on. He probably also has a better zero cross detector and code.
     
  6. willeng

    willeng Member

    Joined:
    Jul 5, 2012
    Messages:
    303
    Likes:
    3
    I had another look, I see there is a H11AA1M Opto coupler used which I don't have, can I use the 4N25 to replace it which I do have.

    Do you mean use this circuit & modify the code for a PID controller?

    He only has set levels of power which I can do now.

    Not sure about the circuits, that heat sink wouldn't take 25A that the Triac is rated at.

    Cheers
     
    Last edited: Jul 14, 2014
  7. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,917
    Likes:
    1,097
    See code: http://www.rotwang.co.uk/docs/triac_control.ino

    and: http://www.ditutor.com/integrals/integral_sin_squared.html

    and

    /*
    * Auto generated table of % power to timer count.
    *
    * Uses http://www.ditutor.com/integrals/integral_sin_squared.html
    * curve to divide the power into even bins.
    */

    static int power_lut_50Hz[100] = {
    0, 1161, 1472, 1694, 1872, 2022, 2155, 2277, 2388, 2494,
    2594, 2683, 2772, 2855, 2933, 3011, 3088, 3161, 3233, 3299,
    3366, 3433, 3494, 3555, 3616, 3677, 3738, 3794, 3855, 3911,
    3966, 4022, 4077, 4133, 4183, 4238, 4288, 4344, 4394, 4444,
    4500, 4550, 4600, 4650, 4700, 4750, 4800, 4850, 4900, 4949,
    5000, 5055, 5105, 5155, 5205, 5255, 5305, 5355, 5405, 5455,
    5505, 5561, 5611, 5661, 5716, 5766, 5822, 5872, 5927, 5983,
    6038, 6094, 6150, 6211, 6266, 6327, 6388, 6450, 6511, 6572,
    6638, 6705, 6772, 6844, 6916, 6994, 7072, 7149, 7233, 7322,
    7411, 7511, 7616, 7727, 7850, 7983, 8133, 8311, 8533, 8844,
    };

    You can do that already?

    ==

    Yea, the heat sink look small. Reading, he says that his zero crossing pulse isn't centered which causes minor issues.

    So, he has a 0-100% power index to time in "count or ticks" to fire the triac.

    ==

    Combine his code and "possibly better hardware", your's even, with PID.
    Line voltage compensation would be harder, and not worked out yet.

    Even he mentions chopping DC as an alternate choice.

    ==

    If you go to uk.mouser.com and search for UAA2016PG and read the datasheet. I don't know exactly what to make of it, BUT it centers the zero cross.
     
  8. Reloadron

    Reloadron Well-Known Member Most Helpful Member

    Joined:
    Dec 23, 2009
    Messages:
    6,778
    Likes:
    281
    Location:
    Cleveland, Ohio USA
    OK, I may be way off base with this and KISS has been doing a great job explaining things. Looking back at post #16 and #21 with a focus on post number 21 I don't see where you really want to vary the pump motor speed. That will not really get you anything that I can see or understand.

    Generally when we want a vacuum we use a vacuum pump to "pull" a vacuum. The basic vacuum pump is called a "Roughing Pump".
    "A roughing pump is any vacuum pump (typically mechanical) used to initially evacuate a vacuum system, as a first stage towards achieving high vacuum or ultra high vacuum. The term "roughing pump" derives from the vacuum range it works in, "rough vacuum", above 1x10-3 torr. Pumps that operate in the high vacuum ranges typically don't operate or operate inefficiently at atmospheric pressures, whereas pumps that work efficiently at atmospheric pressure usually can't produce a vacuum lower than approximately 1x10-3 torr.

    One consideration for choosing a roughing pump is whether the pump uses lubricating oil that's exposed to the vacuum. This concern of "hydrocarbon backstreaming" where pump oil as a gas makes its way into the vacuum chamber, has led to oil-free pump designs on the market".
    From our friends at Wiki.

    What you have are roughing pumps as you are not getting into milli torr pressures. Roughing pumps are generally connected to a vacuum tank and the size of the tank is determined by how much vacuum you need to maintain. The vacuum tank is in turn piped (using piping suitable for vacuum) to a vacuum manifold. There is a valve between the vacuum manifold and that valve is used to maintain a pressure in the vacuum manifold. The roughing pumps in a vacuum system just run. In high vacuum systems following the roughing pump there is generally a Turbine Pump but you are not getting anywhere near where you have or need that. A Google of "Roughing Pumps" will bring up dozens of hits on the subject.

    So what you really want to do, to my way of thinking, is control the vacuum in a vacuum manifold. This is normally done using a valve. My guess is before now you were manually controlling vacuum using a manually operated valve and now you want to automate this process. I don't see changing pump motor speed as a solution to maintaining vacuum pressure as a solution. Having worked over the years with vacuum systems maintaining vacuum pressures simply isn't done by controlling a roughing pump's motor speed. It doesn't work that way. You throttle a valve on a vacuum tank feeding a vacuum manifold.

    All of this is simply my take on the subject. It is simply my opinion as to what to control and I as in just me does not see pump motor speed as a solution and I haven't a clue if your existing pumps will even take well to motor speed control.

    Ron
     
  9. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,917
    Likes:
    1,097
    I have extensive vacuum experience too and yea, we typically let the pump do it's thing and the choice of pump(s) is used to determine the range. the rough pump can do 50 millitorr minimum depending on model.

    The roots blower was a funky one. http://www.cutes.com.tw/root's-blower.htm I never really got into hat one. We only has one of them.

    But in general, you usually let the pump do it'd thing and you introduce gas via a leak valve or mass flow controller and throttle the inlet. So, the pressure controller is controlling the throttle valve which controls pressure. I used it with turbo pumps and cryo pumps. I think we had a system that used it with a big roughing pump and one with the roots blower.
     
    Last edited: Jul 14, 2014
  10. willeng

    willeng Member

    Joined:
    Jul 5, 2012
    Messages:
    303
    Likes:
    3
    Ok If you recommend to go this way, I'm in, obviously I don't really understand the math & need a working example of it for reference & also an explanation (In Lay mans) terms on the code.
    No, if I could do that already I wouldn't be a pain in the butt like I am now!

    I saw his code was not PID control & thought otherwise of it & disregarded it without KNOWING what benefits it may have.
    The other reason is that I don't take to much notice of the internet, it's full of rubbish & not knowing if things are correct or not through lack of experience I tend to look past things that maybe I shouldn't.

    So as I see that code, it is just for pre setting a certain percentage of power to be delivered & not PID, much like I set the pre existing potentiometers to a certain value, not automatically controlled so to speak. He does it electronically where I do it manually at the moment. Much the same thing really.

    With the zero crossing not being centred, this just means Zero Phase Inaccuracy, doesn't it??

    EDIT: Do we add PID control to this to automate it which is what I prefer?
    Cheers
     
  11. Reloadron

    Reloadron Well-Known Member Most Helpful Member

    Joined:
    Dec 23, 2009
    Messages:
    6,778
    Likes:
    281
    Location:
    Cleveland, Ohio USA
    Yeah, the gas is typically helium and used as you mention for helium leak detection or in general leak detection. I have just never seen pump speed control used in a vacuum system to control the pressure. I am not saying it won't work, just that I don't see it as a viable way to do it which means little. I would go about it as you mentioned and I mentioned rather than the motor speed route.

    Ron
     
  12. willeng

    willeng Member

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

    When I first built this Flow Test Bench some 30yrs ago I built hand controlled variable valves to set either the Vacuum pressure or Positive pressure which the machine is capable of.
    The problem with this method is that the Universal Vacuum motors are all running at maximum speed at all times & they tend to get hot even though they are of bypass type & some cooling is always available to them.

    When I changed to controlling the motor speed manually via two triac circuits the motors lasted four times as long which is good, because of the nature of the testing where variable test pieces are to be tested the pressure needs to altered many times during a single test session.
    Due to various reasons an automated control would certainly help me out & varying the motor speed is really the only answer.

    Cheers
     
  13. willeng

    willeng Member

    Joined:
    Jul 5, 2012
    Messages:
    303
    Likes:
    3
    To explain better, not that it is needed though.

    This is not what I test but just an example only.

    Just say we have an open tube on the test bench & it is 4" in diameter, we set the vacuum pressure at say 1 psi then take a reading of the flow capability of this tube.
    Then we place something on top of this 4" tube that has a 3" hole in it, obviously the vacuum pressure will increase & needs to be adjusted again to 1 psi.
    Same again if we go to a 2" dia hole etc.
    Each time a variable test piece is altered the pressure needs to re corrected either up or down, I would like this to be automated where I can vary the test pieces either smaller or larger & the machine will automatically correct back to say the 1 psi or to whatever set point I set.

    Cheers
     
  14. Reloadron

    Reloadron Well-Known Member Most Helpful Member

    Joined:
    Dec 23, 2009
    Messages:
    6,778
    Likes:
    281
    Location:
    Cleveland, Ohio USA

    Thanks for the more detailed explanation. Then as it works I guess motor speed control is the way to go for you in this case. I was just curious about it and again thanks for the explanation. I understand how you are using pressure to measure flow across an orifice plate.

    Ron
     
  15. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,917
    Likes:
    1,097
    It looks like you have sort of a wind tunnel, which, I think is different.

    ==

    Yea, your smarter than the average bear. The Yogi Bear show.

    Yes.

    PS: The OP, stands for Original Poster. don't mean to be disrespectful.

    Remember, the proportional term in PID? Proportional to what? It means "loosely" if we apply 2x/4x power to a fixed resistance it gets proportionally hotter given fixed resistance, if we give it 2x/4x voltage it doesn't get proportionally hotter.

    So we like our measured variable to be "loosely" proportional to the controlled variable at least for low measured input differences (e.g. pressure). This difference in % is called the proportional band. Could be like 10%.

    Back to this vacuum motor thingy, I can't say vacuum is proportial to voltage, nor can I say it's proportional to power. In a DC motor speed control can be implemented by controlling Vm = V(bemf) - I*Ra where Vm is V motor. V(bemf) is V back electromotive force, Im is I motor and Ra is the resistance of the armature.
    The vacuum could be proportional to RPM. The same way, a DC motor can be used as a tachometer. Im drops to zero and the voltage is proportional to speed.

    So, MAYBE, V is a better choice. If you have 12 and 24 VDC and your motor will rotate at that speed, see what the vacuum, current. voltage is at those nominal voltages or any two DC voltages. Two car batteries, for instance. Voltage measured at the motor.

    Because you have a Universal motor and don't have TRMS meter.

    I'll come back to some of the other issues in post #89
     
  16. willeng

    willeng Member

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

    No not a wind tunnel, it's used for flow measurements of intake manifolds, exhausts etc among many other things. I am building a wind tunnel as well for a 1/12th scale model of the bike I want to run at the salt flats but that's further down the track.

    In the proposed code I see the look up table if I have the name correct goes from 0 to 8844 which obviously I don't understand at this point in time.
    Is it possible to just go from 0 to 100 or less for simplicity?

    I still want to learn why it goes from 0 to 8844 but not sure why is has to, each one of these steps is just instantaneous voltage, current or power in one half of a phase cycle is it not?

    Buggered if I know?

    Cheers
     
  17. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,917
    Likes:
    1,097
    Code (text):

    }

    /*
    * Auto generated table of % power to timer count.
    *
    * Uses http://www.ditutor.com/integrals/integral_sin_squared.html
    * curve to divide the power into even bins.
    */

    static int power_lut_50Hz[100] = {
    0, 1161, 1472, 1694, 1872, 2022, 2155, 2277, 2388, 2494,
    2594, 2683, 2772, 2855, 2933, 3011, 3088, 3161, 3233, 3299,
    3366, 3433, 3494, 3555, 3616, 3677, 3738, 3794, 3855, 3911,
    3966, 4022, 4077, 4133, 4183, 4238, 4288, 4344, 4394, 4444,
    4500, 4550, 4600, 4650, 4700, 4750, 4800, 4850, 4900, 4949,
    5000, 5055, 5105, 5155, 5205, 5255, 5305, 5355, 5405, 5455,
    5505, 5561, 5611, 5661, 5716, 5766, 5822, 5872, 5927, 5983,
    6038, 6094, 6150, 6211, 6266, 6327, 6388, 6450, 6511, 6572,
    6638, 6705, 6772, 6844, 6916, 6994, 7072, 7149, 7233, 7322,
    7411, 7511, 7616, 7727, 7850, 7983, 8133, 8311, 8533, 8844,
    };

    int percent_to_count(int percent)
    {
    if (percent == 100)
    return 0;
    if (percent == 0)
    return 10000;
    return power_lut_50Hz[100 - percent];
    }
     

    hey, I think his code is messed up.

    There is 20,000 count per 1/2 cycle and 10000 us. At 0%, he returns 10000 which, I think, is in units on uS where he really wants counts.

    And I don;t like =100; Probable should use >=100 means 100 and <=0 should be 0.

    So, yea, I think the 8844 entry should be 10,000 ticks, which makes the other entries WRONG?

    He may have made a 1/2 cycle mistake. The 100% power is for one 1/2 cycle. It's probably easy making mistakes going from 0 to PI and/or the radian frequency of 2*PI*f. e.g. ωt then to ticks.

    He does, I think, have the right idea, but the math is wrong. The RMS voltage value of a single 1/2 cycle, I think is 120 V.

    I think he forgot the ω and you have to square the entire v(t) for 1 half cycle.

    e.g. This http://www.wolframalpha.com/input/?i=integral of( (340 * sin (t*2*PI*50))^2) dt from 0 to (1/50)/2

    is the integral you want.

    at 0 time, you get 100% of 578
    so you need the values of t where the integral evaluates to n/100 * 578 for n = 0 to 100

    Put another way, you want the times to start that give you 100%, 99%, ... 1%, 0% of the 578. Then convert to ticks, where 10,000 us is 0.10 sec and 20,000 ticks.

    Now, convert to ticks. The 0.010 seconds is right for a 1/2 cycle, but it has to ultimately be converted to ticks.

    I'm not sure if I'm right either.

    Yoou turn it on at 50% of the peak and you get 50% power. e.g. http://www.wolframalpha.com/input/?i=integral of( (340 * sin (t*2*PI*50))^2) dt from .005 to 0.01

    They are the easy ones.

    A hard one, using successive approximation.

    10%: http://www.wolframalpha.com/input/?i=integral of( (340 * sin (t*2*PI*50))^2) dt from .00741 to 0.01

    so, that's 100%, 50%, 10%, 0% V^2. 90% is algebra.
     
    Last edited: Jul 14, 2014
  18. willeng

    willeng Member

    Joined:
    Jul 5, 2012
    Messages:
    303
    Likes:
    3
    Sorry for the delay.

    The whole area has been without mains power for most of yesterday & late into the night so I took the opportunity to go & get a TRMS meter to try to help the situation somewhat, I also tried to get some different components for things but no luck there as usual?

    I will go back & read the last post as I haven't had time as yet.

    The TRMS meter is a cheaper import type, no manufacturing country named but I think you'll know where from so it should be accurate to within +- 200V or so ha!

    I retested things & will attach the results, the TRMS meter was more stable but I still couldn't get exact readings due to small variations, I used a different Clamp Meter this time for the current with much better resolution.

    I'll have a read of what has been posted & get back to you.
    Thanks again for the replies, much appreciated

    Cheers
     

    Attached Files:

  19. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,917
    Likes:
    1,097
    Missed Ya! Nice re-graph! So it looks like V^2 it is, ignoring power factor stuff. Power is pretty linear.

    1% may not be good enough, so just think linear interpolation, so you could ask for 93.25%. Easy enough.

    I hope you can ride through what I posted. I'm a intuitive kind of guy, but math isn't my specialty.

    I have some ideas on voltage compensation, but they will wait until you get through the other post. So, far, there are three commonalities:
    1. Increase the voltage by 10% using a buck/boost transformer.
    2. Make the assumption that the input voltage is sinusoidal.
    3. Measure the mains. (ideas fermenting).
     
  20. willeng

    willeng Member

    Joined:
    Jul 5, 2012
    Messages:
    303
    Likes:
    3
    May be a stupid idea?

    What about a small step down transformer dedicated for this purpose only, could we use a fairly simple LIGHT to VOLTAGE circuit where say X LED Brightness = X voltage output to be sensed by the Arduino?
    As the mains vary so will the light intensity & voltage output from a set reference point.

    Not sure it makes sense now I have written it?

    ????
     
  21. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,917
    Likes:
    1,097
    No, not stupid. However, I was thinking on the lines of a track/hold detector of a stepped down mains per 1/2 cycle. The mains for control purposes (low current) would be stepped down after 10% was added from a boost transformer. Then the FUN starts.
     
    Last edited: Jul 15, 2014

Share This Page