Step 5CALIBRATION
const v_out as byte=12 'output voltage to determine off-time, 5 USB, 12 Firewire
const v_ref as float=2.5 '2.5 for MCP1525, 1.72 for my stabistor, ~2.7 for a zener.
const supply_ratio as float=5.54 'supply ratio multiplier, calibrate for better accuracy
const osc_freq as float=4 'oscillator frequency
const L_Ipeak as float=170 'coil uH * coil amps continuous (680*0.25=170, round down)
const fb_value as word=447 'output voltage set point
These values can be found at the top of the firmware code. Find the values and set as follows:
V_out
This is the output voltage we want to achieve. This variable will NOT change the output voltage on its own. This value is used to determine the amount of time the inductor requires to fully discharge. It is an enhancement made to the USB firmware that was ported to the firewire version. Enter 12, that is our firewire target voltage (or 5 for USB). See the Firmware:Changes:Step6 for complete details of this addition.
v_ref
This is the voltage reference of the ADC. This is needed to determine the actual supply voltage and calculate the inductor coil charge time. Enter 2.5 for the MCP1525, or measure the exact voltage. For a zener or stabistor reference, measure the exact voltage:
1.WITHOUT THE PIC INSERTED - Connect a wire from ground (socket PIN8) to socket pin 5. This prevents the inductor and transistor from heating while the power is on, but PIC is not inserted.
2.Insert batteries/turn on power.
3.Using a multimeter measure the voltage between the PIC voltage reference pin (socket PIN6) and ground (socket pin8). My exact value was 1.7 volts for the stabistor, and 2.5 volts for the MSP1525.
4.Enter this value as the v_ref constant in the firmware.
supply_ratio
The supply voltage divider consists of a 100K and 22K resistor. Theoretically the feedback should equal the supply voltage divided by 5.58 (see Table 1. Supply Voltage Feedback Network Calculations). In practice, resistors have various tolerances and are not exact values. To find the exact feedback ratio:
4.Measure the supply voltage (Supply V) between socket pin 1 and ground (socket pin 8), or between the battery terminals.
5.Measure the supply feedback voltage (SFB V) between socket pin 3 and ground (socket pin 8).
6.Divide Supply V by SFB V to get an exact ratio. You can also use "Table 2. Supply Voltage Feedback Calibration".
7.Enter this value as the supply_FB constant in the firmware.
osc_freq
Simply the oscillator frequency. The 12F683 internal 8Mhz oscillator is divided by 2, a safe operating speed to about 2.5 volts.
8.Enter a value of 4.
L_Ipeak
Multiply the inductor coil uH by the maximum continuous amps to get this value. In the example the 22r684C is a 680uH coil with a rating of 0.25 amps continuous. 680*0.25=170 (round to lower integer if needed). Multiplying the value here eliminates one 32 bit floating point variable and calculation that would otherwise have to be done on the PIC. This value is calculated in "Table 3: Coil Calculations".
9.Multiply the inductor coil uH by the maximum continuous amps: 680uH coil with a rating of 0.25 amps continuous =170 (use next lowest integer – 170).
10. Enter this value as the L_Ipeak constant in the firmware.
fb_value
This is the actual integer value the PIC will use to determine if the high voltage output is above or below the desired level. We need to calculate this because we don't have a trimmer resistor for fine adjustment.
11.Use Table 4 to determine the ratio between the output and feedback voltage. (11.0)
12.Next, enter this ratio and your exact voltage reference in "Table 5. High Voltage Feedback ADC Set Value" to determine the fb_value. (447 with a 2.5 volt reference).
13.After you program the PIC, test the output voltage. You may need to make minor adjustments to the feedback set value and recompile the firmware until you get exactly 12 volts output.
Because of this calibration, the transistor and inductor should never become warm. Nor should you hear a ringing sound from the inductor coil. Both of these conditions indicate a calibration error. Check the data log in the EEPROM to help determine where your problem might be.
| « Previous Step | Download PDFView All Steps | Next Step » |
![]() |
Add Comment
|










































