|
|
View previous topic :: View next topic |
Author |
Message |
Jester009
Joined: 11 Sep 2007 Posts: 7
|
Current controlling with PIC? |
Posted: Tue Sep 11, 2007 7:12 am |
|
|
Hi,
Can PIC be used for alternating current controlling? Any ideas.... |
|
|
Ttelmah Guest
|
|
Posted: Tue Sep 11, 2007 7:37 am |
|
|
This is really a basic electronics question, rather than a PIC question....
You can control 'current', in at heart, two ways. The first is to adjust the voltage into a load, the second, is to change the resistance of the load itself. The latter can be done in a number of ways (for AC, varying the saturation in a transformer for example), however normally changing the voltage is the more common control. You then have the question of whether this needs to be on a 'per cycle' basis, or as an average over longer times. So you get solutions like thyristor switching, where parts of the individual AC cycles, are turned off, while for accurate control of smaller signals, digital pots are used.
There are literally dozens of possible solutions (waveform synthesis, MOSFET control of transformer taps, etc. etc.), and most can be controlled by a PIC. Which solution will work for you, will depend on the nature of the load, the nature of the signal, how fast/accurate control needs to be, etc. etc..
Best Wishes |
|
|
Jester009
Joined: 11 Sep 2007 Posts: 7
|
|
Posted: Tue Sep 11, 2007 7:54 am |
|
|
Thanks a lot for the detailed explanation, Ttelmah.
I have no control over the load. I need to generate a pure sinusoidal waveform (say 5A) and have to ensure that the same waveform is applied after the load is connected. (i.e. 5A) And variation of the current is desired through a user interface in the computer, within the range. (0-5A) Can u suggest me an arrangement to achieve this?
I must admit that I'm a NOOB when it comes to electronics :( |
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
|
Ttelmah Guest
|
|
Posted: Tue Sep 11, 2007 8:52 am |
|
|
Seriously, this is probably not going to be a 'NOOB' project. You don't say what maximum voltage is involved, but significant power may be involved, and possibly safety issues as well.
What is the source of the waveform?. What frequency is involved?. How 'pure' is 'pure'. What range of control is needed?.
Best Wishes |
|
|
Jester009
Joined: 11 Sep 2007 Posts: 7
|
Thanks for replying... |
Posted: Tue Sep 11, 2007 9:20 am |
|
|
Thanks for replying...
This is used to test relays. (like numerical overcurrent relays) So the load will be the relay. What I have to do is to apply currents and measure the tripping time. So it needs a sinusoidal waveform which has very less noise.
Ttelmah, I don't have a very clear idea about the voltage involved Does the voltage range matter when controlling current? As I said I'm a NOOB in this area The frequency is 50Hz and the range of the current is 0-5A.
treitmey, triacs cause spikes in the waveform as i know. So is it possible to use it for this application??
It would be great at least to know where to start...
PS: thanks for the warning and the links treitmey, Going through them now... |
|
|
Ttelmah Guest
|
|
Posted: Tue Sep 11, 2007 9:48 am |
|
|
It is voltage that causes current to flow. To control current, with a load you can't change, you have to control the applied voltage. For relay testing, you don't need high purity (in the 'audio' sense, of tiny fractions THD), so this makes things easier. Now the problem is, that if these are 'mains operated' relays, the control system, would have to control up to 5A, at 110v RMS (assuming you are in the US), which could easily kill (many times over...).
Assuming however, that these are 'low voltage' relays, at perhaps 24v max, then I'd suggest getting an audio amplifier, that is rated to deliver the maximum required power (so if these are 24v AC relays, drawing 5A - big relays...), then something in the order of a 150W amplifier, rated to deliver it's output into 8 ohm, and designed to also be able to operate into lower impedances as well. Then Build an audio signal source, at the required frequency, to drive this, and put a digital potentiometer, controlled by the PIC, in the feed from this to the amplifier. In the output, a small resistor (perhaps 0.1R), can then be used to detect the output current (using a differential amplifier), and this can be fed back to the PIC, which then just needs a simple control loop, turning the pot up/down, according to the current specified, and the current being measured.
This makes the design relatively simple, since the main 'work', is being done by the off the shelf amplifier.
Best Wishes |
|
|
Jester009
Joined: 11 Sep 2007 Posts: 7
|
|
Posted: Tue Sep 11, 2007 10:42 am |
|
|
Ttelmah,
Thanks a lot for the design. I don't have an in depth understanding about it but I put it in a block diagram. (Caz I'm more comfortable with pictures)
Here it is. Please correct me if I have gotten anything wrong.
Audio Signal Source - http://wiredworld.tripod.com/tronics/signal_source.html
Searched for audio amplifiers but they seem kinda expensive any examples?
When choosing digital pots which kind should I choose? They have a lot of veriety in this page - http://www.maxim-ic.com/products/digi_pot/
When considering the PIC 16F877 should be able to perform this isn't it?
I'm sorry may be I'm asking too much... I'm kinda desperate caz I have a very little knowledge in this area. |
|
|
Ttelmah Guest
|
|
Posted: Tue Sep 11, 2007 12:31 pm |
|
|
You need a resistor across the differential amplifier in the block diagram, but otherwise 'spot on'. You will need to choose the digital pot to handle the voltage range required required by the amplifier input, and give the accuracy you need over this range.
Remember that if you are providing the supplies yourself, and putting this in your own unit, you only need an amplifier 'board' or 'module', not a complete boxed amplifier. Brings the cost down a _lot_.
Best Wishes |
|
|
libor
Joined: 14 Dec 2004 Posts: 288 Location: Hungary
|
4-20mA output |
Posted: Wed Sep 12, 2007 2:14 am |
|
|
(let me add a question to this already offtopic, but related hw thread, i did not dare to start one :-)
In a project I need to output 4-20mA. What do you suggest ? a PIC using a PWM output to control voltage on the current loop ? a separate DAC ic doing this ? or a digital potentiometer will do ?
Do I need a current measuring feedback going into az ADC pin to control the voltage output with the PIC ? ..or is there a simple open-loop voltage to current converter circuit with no feedback required ?
I would like to have a simple (too much precision is not required) solution. Is the 5V supply enough for the max 20mA output range? ...but how do I know what resistor value will be used in the receiving-end device, can I assume that max. 250 Ohms will be used, so the 5V supply is enough ?
Googling for solutions I have also found also some expensive SPI bus --> 4-20mA loop transducers ICs. ? should I go this way ? |
|
|
Ttelmah Guest
|
|
Posted: Wed Sep 12, 2007 3:03 am |
|
|
You need to know a lot more about the loop you will be driving. Some systems use isolation at the 'driving' end, others isolation at the 'receiver', while some require isolation at both ends. The latter is obviously the safest, but also the most expensive. The question also arises of where the power is to come from?.
Yes, you need current feedback. The whole 'point' about the current loop, is that it can work with a huge range of different load resistances, making feedback essential.
Driving a loop really accurately, can get very expensive. However it is possible to drive a loop quite 'reasonably', with the integrated output of a PWM. Have a look on the Siemens site, for their application note 54, which shows methods of both driving and receiving 4to20mA loops, with isolation. The version shown in Figure 6, works well, with the addition of an integrator capacitor, driven off a PWM on a PIC.
Best Wishes |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
AC Relay testing |
Posted: Wed Sep 12, 2007 7:43 am |
|
|
I can think of a couple of easier ways to test relays. If you are only testing a few for R&D use try a manual variac (McMaster.com 6994k14). If you must automate the process there are motor driven variacs too.
But if you are doing large scale screening of lots of relays you probably only need a few set voltages at which the relay will pass or fail. Then I would use a tapped transformer, or a couple of variacs, with SSRs (solid state relays) to select the voltage in use. SSRs will give you precise timing relative to the AC waveform.
Synthesizing your own AC waveform seems like the hard way to do it. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
Jester009
Joined: 11 Sep 2007 Posts: 7
|
|
Posted: Wed Sep 12, 2007 10:04 am |
|
|
Hi Ttelmah,
I decided to go ahead with the design you suggested. The help you gave me is invaluable. Thanks a lot I'm really grateful to you.
I have few more questions. The audio amplifier is a Class D amplifier is it? I'm going to build the following circuit for the signal source
Code: |
http://wiredworld.tripod.com/tronics/signal_source.html |
What will be the output of this circuit? PWM? Can you please give me a brief description how the whole thing works? I'm still unclear on the digital pot and the diff amp. But I'm reading more about them...
I know I'm asking a lot from you, but I don't have any other way to turn
For SherpaDoug,
Thanks a lot for the reply. I have to come up with an unit which can test various relays. User must be able to select the current from an interface in the computer. |
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Wed Sep 12, 2007 1:36 pm |
|
|
If I was doing this porject I would buy something like this..
http://www.oselectronics.com/ose_p16.htm
Replace the pot that controls the voltage with a digital pot.
Then have the PIC adjust the digial pot,.. and it could also determine
when the relay tripped... and that corresponding voltage. and resulting current. V=IR |
|
|
Ttelmah Guest
|
|
Posted: Wed Sep 12, 2007 5:19 pm |
|
|
Seriously, you need to choose your signal source, to match what you want to test. If (for instance), these relays are designed for aircraft applications running at 400Hz, then this is what you need the oscillator to produce. If they are designed to run of mains AC, then you will need 60 or 50Hz. AC main waveforms are normally basically sinusoidal (though a look at some wth a scope, will often 'amaze' at how distorted they can become.
The oscillator you show (can you get to 8038, this has been obsolete for some years?...), can produce sinusoidal, triangular, and square wave outputs. The latter has the biggest peak to peak output, and needs to be significantly attenuated, if you want to use all three. The triangle is also bigger than the sinusoidal output, but not by so much. The sinusoid, is relatively impure, but will probably be fine for your application.
Do you have an oscilloscope?. If not, setting the sine wave up to give reasonable purity will be hard. If you do, then take this one step at a time. Build the oscillator, get this working, before trying to approach the harder work of the power part.
You are working with sinusoidal signals. You need a class A, AB, or B amplifier.
You can regulate power with PWM, using a class D amplifier, but you will not then be synthesising the enviroment that the relays are designed to work in.
If the relays are to be tested with _DC_, then a simple PWM, just using a switching FET can be used. Alternatively, using high switching frequencies, you can synthesise an AC waveform, by varying a PWM envelope, and using a class D driver. This however is then becomeing a complex project, which needs knowledge of switching design. It'll be more power efficient, but a lot me complex...
Best Wishes |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|