![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| I have a Pic 16F88 controlling a half bridge with a 8khz PWM. It works correctly. I am trying to add some current limiting to this controller. I have installed a ..005 ohm resistor from the low side mosfet source to ground, and I measure the voltage across the resistor. All Ok . My Question is what do I have to do to this signal to make it acceptable to Pic ADC or the comparators. The software for the adc & comparators I can Handle, it is the signal conditioning that has me stumped. SEE SKETCH Your help is greatly appreciated. George | |
| |
| | (permalink) |
| The voltage feedback is not normally fed directly into the PIC for the obvious reason that the PIC's response is simply too SLOW to ofer any form of viable protection. Most of the time, the PIC provides the reference voltage for the current limiting circuit. | |
| |
| | (permalink) |
| I have successfully used a PIC16F873 to control the current of a stepper motor driver in a full bridge circuit. A PIC16F88 can be similarly used. Here are some design tips: 1. Notice that in your circuit, the current through the sense resistor is not ON all the time. The current is pulsed because of the PWM transistor. You have to time the A/D conversion to be synchronous with the PWM signal. Of course, sampling time restrictions of the PIC A/D converter apply. 2. You need to amplify the signal from the sense resistor so that the output voltage of the amplifier ranges from 0 to 5V. You would need a relatively fast amplifier because the voltage is pulsed by the PWM signal. 3. A separate hardware over-current limited portection is required. You can use a comparator to detect an over-current condition and the signal can be used to reset a flip-flop which in turn gates OFF the PWM signal.
__________________ "Having to do with Motion Control" | |
| |
| | (permalink) |
| The PIC is not too slow at all! It will do fine as long as you filter the current to a DC level rather than trying to sample every pulse. Your schematic is wrong for this though. Move R1 between Rsense and C1 and you have the desired lowpass filter. Make the bandwidth of the filter less than the 8KHz PWM freq. Also make R1 less than 2.5k because the PIC accuracy suffers when filter impedance goes above that. 1k would be better if you have a large enough cap handy. However, the problem is that the signal level from a low-ohm resistor will only be a few mV. This is a bit hard to read since the minimum grad of the PIC's 10 bit ADC with a 5V vref is about 5mV. And there is an unpredictable offset error to consider, which may be several codes. But you can still get good results, especially if you only limit high currents thus don't require fine tune control. You can condition the signal with a low offset op amp. If you do this, the 2.5k filter impedance is no longer a limitation either. | |
| |
| | (permalink) |
| is there such a thing as 0.05 ohm resistor? | |
| |
| | (permalink) | |
| Quote:
Unless i got it wrong, and you are using a capacitor to smoothen the voltage. then a resistor wouldnt be needed | ||
| |
| | (permalink) | ||
| Quote:
An 8000Hz filter doesn't "cut off" everything above 8000Hz, it merely smooths it, rolling the frequencies off the higher they get. For this application you would use a filter far lower than 8000Hz, but if it's too low the response time will be slowed down - as with any system like this, it's a compromise between response time and smoothing. Quote:
MicroChip have an application note about using PWM as a D2A, try having a read of it. | |||
| |
| | (permalink) |
| Mind teaching me the calculation? To calculate the C, if im not wrong, im suppose to use this: Xc= 1 / ( 2 x pi x f x c ) but how do i calculate the R? | |
| |
| | (permalink) | |
| Quote:
| ||
| |
| | (permalink) |
| if im not wrong, AC-DC rectifiers also use low-pass filters to smoothen of the waveforms right? ? | |
| |
| | (permalink) | |
| Quote:
| ||
| |
| | (permalink) |
| Argh...im quite lost now. If i want a 8Khz PWM pulse filtered to DC, what formula should i use? I really dont understand how to calculate. | |
| |
| | (permalink) | |
| Quote:
| ||
| |
| | (permalink) |
| Dont really get it taken from microchip notes:: Choosing, the -3 dB point at 4 kHz, and using the relation RC = 1/(2· p·f), we get R = 4 kohm, if C is chosen as 0.01mF: R = 4.0 kohm C = 0.01uF Since the PWM frequency is selected as 20 kHz, the fundamental noise peak to be filtered is at 20 kHz. Now, lets calculate by how many dB the main peak of PWM signal is cut-off at 20 kHz: (dB) 20 kHz = -10·log[1+ (2.pi.f.RC)2] = -14 dB. <=== i seem to get 10db | |
| |