digital power supply
12/05/1909 VERY IMPORTANT CORRECTION!
contained resistance value R1 12k 1w in the power board is actually 330ohm 1/4w
2/12/2010 - Publication of source code and compiled
http://www .4shared.com/file/ea9rNJEZ/DigitalPowerSupply-src.html
Description This project is based on modifications of Osvaldo Valdorros (see forum thread TodoPic ) To supply elektor magazine's number 260.
The source has the following characteristics
• Input voltage: 220VAC
• Output voltage: 0 to 25VDC with a current of 0 to 2.5A.
• Regulation Accuracy
• Gross: 1V / 100mA
• Fine: 100mv / 3mA
• Using the Microchip PIC 16F877A microcontroller available for use, leaving 10 ports.
• Adjustment by means of buttons and mechanical or optical encoder.
• controlled ventilation according to current consumption.
• Reading the current consumption, indicating over current visual and auditory.
• Preset Memory (2.5, 3, 3.3, 5, 9 and 12 Volts at 0.5A, 1A and 2.5A).
• Control ventilation temperature reading.
• Power lines separate control circuit of the power.
• Information for all values \u200b\u200bthrough 16x2 LCD with contrast control and backlight.
• Control and RS232 communication with PC or other control board.
• Code written in C SDCC compiler. Thanks
Fully Valdorros grateful to Osvaldo to create this source and share with the community.
A special appreciation to the members of the Forum uControl - The best internet forum for fans of electronics, for their help in my career to build this source in a very short time. License
This documentation is available under the Creative Commons ( Attribution-Share Alike 3.0 Unported )
Objective
A power supply is one of the most used tools in an electronic laboratory exist in the market of various types, with fixed voltage adjustable in analog form, switching power supplies (such as PCs) that provide varying voltages (12V, -12V, 5V,-5V) with high amperage.
The idea of \u200b\u200bthis power supply is an analog source that is controlled / regulated by the microcontroller for easy assembly, inexpensive, feature rich with possibilities for expansion. Restrictions
design
Since heat dissipation 25V 4A 3 or some components can compromise with forced ventilation must be controlled by temperature and consumption.
external power lines should be separated from the control, it reduces any voltage drops due to the use of ventilation, the LCD backlight and other devices.
To facilitate PCBs building will be designed to a face without bridges without impeding the use of lower-cost methods such as heat toner transfer.
The weight of two transformers more consumer electronics that can carry the source has an important weight (3kg in my case), which is why you use a 3mm aluminum housing.
programming language must be C because it is easy to understand for the vast majority of people, but with assembler routines when required execution efficiency.
The compiler should be free and unlimited in the generation of HEX file for PIC.
The code should be well commented in each of its phases to facilitate the work you want to adapt to their needs. Hardware
The circuit consists of two parts, an analog pass transistor, operational LM324N, transformers, controller 7805, control inputs and outputs.
The control part consists of the microcontroller, LCD, buzzer, ICSP connector, and connectors and encoder input buttons if you choose to use. Part
analog regulator circuit is dominated by LM324N component, an operational Quadruple gives us the possibility of a maximum voltage of 32V and the use of low tolerance resistors (in my case I use 5%, but 1% is recommended).
circuit divided it into sections for better understanding and analysis
Power Stage

In this source the control stage (digital part) is the most elaborate, and the analog is classical control with the addition of short circuit provided by T1, T2, T3 (BC547) and landing 0.51ohm resistors based power transistors Q1 .. 3.
voltage regulation operation would be the case, the constant current source consisting of D4, D5, R5, Q4 and R1 2mA provides the basis of the darlington. The reference of these transistors is controlled by operating the control.

is done with the voltage divider formed by R13, R14 and R17, but as reading is affected by the current supplied and falls in resistance Rs (shunt resistance, the 10 1ohm resistors in parallel) when the output should be 25v, it will 25.25v, which is why it is used IC1D is an inverting amplifier, if consumption of 2.5A for example, shows a drop of 0.25V at the ends of the Rs .
As I said, IC1D then uses it to make such correction, then we see that this is the formula:
Vo = - (R18 / (R19 + R20)) * Vin if Vin
then as we said is
Vo = 0.25V - (10k/40k) * 0.25-Vo = 0.0625V
(remember this numerillo)
Ok, the potential between the reference-0.0625v 25.25vy gives 25.3125v, then the output of the resistive divider formed by R13, R14 and R17 have:
Vo = Vi * (R17 / (R17 + R13 + R14) = 5.0625v
as the LM324 amplifier has a reference mass from -0.0625 through the diode D9.
voltage at 5V is ready to enter the
IC1A
IC1A comparator receives the output of the voltage divider and compares the selected voltage as
Vo = Vs + if V1> V2 Vo = Vs
where V1 Thus < V2
regulates the output voltage (or short if the voltage exceeds the desired value).
current regulation

The same is with the flow, following our example, if consumption of 2.5A, would the non-inverting input of operational since
0.25vy Vo = (1 + 19k/1k) * 0.25 = 5V
And the output goes to the inverting input of IC1C and same thing happens in IC1A, ie regulating the reference transistors or cut if they exceed the maximum preselected. ------------------------
encoder Analysis
Encoder for continuous rotation with three output pins.
Two-channel gray code output (http://es.wikipedia.org/wiki/Código_Gray).
11.10 generates three binary sequences, 00, 01 for each rotation.
two-bit Gray Code
01
11 00 10
The encoder has three terminals, one is common, and other digital outputs are generated by the device's internal contacts.
generates the following sequence AB Canal
State.2 Status1 0 0 0 1
State4 State3 January 1 1 0
Clockwise ->
00 01 November 10, 2000
<- Rotación en sentido antihorario
PIC Connection to Terminal the media is going to mass and the other two are connected each to a resistance of at least 1k pullup to VCC.

Chuck McManis and publication "Quadratrack: Using Rotary Mechanical Encoders" is the original author of the reading of the encoder Valdorros ASM code.
URL: http://www.mcmanis.com/chuck/robotics/projects/lab-x3/quadratrak.html
Quoting the author:
1khz For a break from the TMR0 4MHZ a system to do This code (in ASM):
, * * * * * *
; * Operations
BANK 1, * * * * * *
BSF STATUS, RP0; September
Bank 1 MOVLW B'0000010' ; Set TMR0 prescaler to 8
MOVWF OPTION_REG ; Store it in the OPTION register
CLRF TRISB ; B all outputs
BSF TRISB,QUAD_A ; Except for Quadrature inputs
BSF TRISB,QUAD_B
; * * * * * * * * * * *
; * BANK 0 Operations *
; * * * * * * * * * * *
CLRF STATUS ; Back to BANK 0
BSF INTCON, T0IE ; Enable Timer 0 to interrupt
BCF INTCON, T0IF ; Reset interrupt flag
BSF INTCON, GIE ; Enable interrupts
Luego el servicio de interrupción debería ser:
; Interrupt Service Routine Pre-amble, save state,
; reset status to BANK 0
INTR_PRE:
MOVWF TMP_W ; Copy W to temp register
SWAPF STATUS,W ; Swap Status and move to W
MOVWF TMP_STATUS ; Copy STATUS to a temp
CLRF STATUS ; Force Bank 0
;
; State is saved, and we've expended 3 Tcy plus the
; 3 Tcy (4 worst case) of interrupt latency for a total
; of 6(7) Tcy.
;
; Now loop through until we've satisfied all the
;pending interrupts.
;
ISR_0:
; ... test bit to see if it is set
BTFSS INTCON,T0IF ; Timeer0 Overflow?
GOTO ISR_1 ; No, check next thing.
;
; Else process Timer 0 Overflow Interrupt
;
BCF INTCON, T0IF ; Clear interrupt
MOVLW D'133' ; Reset 1khz counter
MOVWF TMR0 ; Store it.
CALL QUAD_STATE ; Check Quadrature Encoders.
GOTO ISR_1 ; Nope, keep counting
ISR_1:
;
; Exit the interrupt service routine.
; This involves recovering W and STATUS and then
; returning. Note that putting STATUS back
; automatically pops the bank back as well.
; This takes 6 Tcy for a total overhead of 12 Tcy for sync
; interrupts and 13 Tcy for async interrupts.
;
INTR_POST:
SWAPF TMP_STATUS,W ; Pull Status Back Into
W MOVWF STATUS; Store it in TMP_W SWAPF
status, F; Prepare To Be restored
W SWAPF TMP_W, W; Restore it
RETFIE
As you can see, first reload TMR0 interruption to ensure ratio of ticks (and also this is the first interruption verified!)
then checks the status of the encoder in the call to QUAD_STATE:
;
; QUAD
State;
; A quadrature encoder traverse a couple of states
; When it is rotating These are:
; 00 01 V MOVLW high QUAD_STATE
MOVWF PCLATH
MOVF QUAD_ACT,W ; Get button state
ADDWF PCL,F ; Indirect jump
RETURN ; 00 -> 00
GOTO DEC_COUNT ; 00 -> 01 -1
GOTO INC_COUNT ; 00 -> 10 +1
RETURN ; 00 -> 11
GOTO INC_COUNT ; 01 -> 00 +1
RETURN ; 01 -> 01
RETURN ; 01 -> 10
GOTO DEC_COUNT ; 01 -> 11 -1
GOTO DEC_COUNT ; 10 -> 00 -1
RETURN ; 10 -> 01
RETURN ; 10 -> 10
GOTO INC_COUNT ; 10 -> 11 +1
RETURN ; 11 -> 00
GOTO INC_COUNT ; 11 -> 01 +1
GOTO DEC_COUNT ; 11 -> 10 -1
RETURN ; 11 -> 11
INC_COUNT:
INCF COUNT,F
MOVLW D'201'
SUBWF COUNT,W
BTFSS STATUS,Z
RETURN
DECF COUNT,F
RETURN
DEC_COUNT
DECF COUNT,F
MOVLW H'FF'
SUBWF COUNT,W
BTFSS STATUS,Z
RETURN
INCF COUNT,F
RETURN
Front view
Rear View
After typing a lot, I have programmed and working 100% the control of the digital supply. Reading
On the one hand we have the voltmeter down, the LCD above the right a serial communication program where I can communicate with the source.

MultiBoard Here you can see their friends working together modules, PICkit 2 clone reloaded, FT232 RS232 to USB Conversion to control from the PC, LCD supply, power plate, etc.

USAR_PULSADORES
The compiler used is the SDCC
, a free compiler that I use from a text editor called ConTEXT
Well, this is the control board, is screwed on the front.
is important to see that the model with ground plane will also add more area marked to help acid attack.
After 4 hours we laburo running the control board, a further added Valdorros source is that it has ICSP connection to avoid taking the bus, which has the strange habit of ignoring to enter or leave the 40 pin sockets.
16x2 LCD pin is welded to the back of the pcb. Do not weld until you know everything works ok, or it will cost you quite the "desoldadita."
starting
use a 10k NTC
NTC
Resistencia de 470 OHM
This component is the control board, as I put it together this way:
would lack the white front panel with black lettering on the back I still have the RS232 connector.
source operating Videos:
Here you can find everything you need to make the video. contained resistance value R1 12k 1w in the power board is actually 330ohm 1/4w
0 comments:
Post a Comment