Author Topic: Auxiliary power system with PIC12F675 + CD4053 + LM723  (Read 8665 times)

0 Members and 1 Guest are viewing this topic.

Offline Avelino SampaioTopic starter

  • Frequent Contributor
  • **
  • Posts: 260
  • Country: br
Auxiliary power system with PIC12F675 + CD4053 + LM723
« on: October 03, 2021, 04:24:27 pm »
Hello everyone.

Image 1 - Through the digital input (gp3-pin 4), the PIC will select the operating mode (supply or recharge). When the power supply is cut off, the output voltage of the HP source takes a while to reach the transition level (bit 0) of the gp3 port. I need to find a way to shorten this transition time. Any suggestions to replace the resistor divider (R1 - R2) with something that makes power failure recognition faster?

« Last Edit: October 25, 2021, 08:34:11 am by Avelino Sampaio »
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3036
  • Country: us
Re: Auxiliary power system with PIC12F675 + CD4053 + LM723
« Reply #1 on: October 03, 2021, 04:49:55 pm »
...
When the power supply is cut off, the output voltage of the HP source takes a while to reach the transition level (bit 0) of the gp3 port.
...

How is the power supply being cut off? Are you disconnecting the AC side of the the notebook power supply and leaving the DC end plugged into your circuit or are you unplugging the DC output of the notebook power supply from your circuit?

 

Offline Avelino SampaioTopic starter

  • Frequent Contributor
  • **
  • Posts: 260
  • Country: br
Re: Auxiliary power system with PIC12F675 + CD4053 + LM723
« Reply #2 on: October 03, 2021, 04:58:55 pm »
Ledtester, I am disconnecting the AC side of the power supply and leaving the DC end connected to the circuit.
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3036
  • Country: us
Re: Auxiliary power system with PIC12F675 + CD4053 + LM723
« Reply #3 on: October 03, 2021, 05:14:37 pm »
Note that most notebook power supplies have output capacitors which will continue to feed (decreasing) voltage and current for a while after the AC side is disconnected.

Could that be what you are seeing?

Also, how is the GP3 pin being monitored by the PIC? Are you using a pin-transition interrupt or polling its digital value in a loop or polling its analog value in a loop?
 

Offline Avelino SampaioTopic starter

  • Frequent Contributor
  • **
  • Posts: 260
  • Country: br
Re: Auxiliary power system with PIC12F675 + CD4053 + LM723
« Reply #4 on: October 03, 2021, 06:09:37 pm »
Ledtester, I'm looking up the digital value in a loop.

I verified that the transition from bit 1 to bit 0, from the gp3 port, occurs around 1.50v. Is it safe to work with resistive divider (r1-r2) at 2.0v? Note in the graph that the time was much shorter and at first it serves the project. Would it be an inadequate solution?
« Last Edit: October 06, 2021, 11:33:03 am by Avelino Sampaio »
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3036
  • Country: us
Re: Auxiliary power system with PIC12F675 + CD4053 + LM723
« Reply #5 on: October 03, 2021, 09:23:11 pm »
A couple of observations...

- Generally it is not a good idea to hold a digital signal at an intermediate voltage (one that's between something that's recognized as a LOW vs. a HIGH signal). However, microcontroller GPIO pins are not standard digital inputs so it may not be a problem in this case.

- The the threshold of 1.5V that you measured is probably not guaranteed by Microchip. It could vary from device to device or even pin to pin.

- The 12F675 has an analog comparator. That might be a better way to detect a precise voltage level.
 

Offline Avelino SampaioTopic starter

  • Frequent Contributor
  • **
  • Posts: 260
  • Country: br
Re: Auxiliary power system with PIC12F675 + CD4053 + LM723
« Reply #6 on: October 04, 2021, 12:18:16 pm »
Ledtester, changing the PIC12F code would be complicated for me. I was inclined to incorporate the LM393 comparator but I had an idea on using a pnp transistor. I had to make a small change to the code and it worked as expected. I adjusted p1 so that the transition occurs around 17v.
« Last Edit: October 04, 2021, 12:23:58 pm by Avelino Sampaio »
 

Offline Avelino SampaioTopic starter

  • Frequent Contributor
  • **
  • Posts: 260
  • Country: br
Re: Auxiliary power system with PIC12F675 + CD4053 + LM723
« Reply #7 on: October 05, 2021, 11:26:25 am »
Hi

The project is advancing, see the complete schematic. Replace the containment diode with a P-channel Mosfet, with RDSon=0.06R.



 

Offline Avelino SampaioTopic starter

  • Frequent Contributor
  • **
  • Posts: 260
  • Country: br
Re: Auxiliary power system with PIC12F675 + CD4053 + LM723
« Reply #8 on: October 06, 2021, 10:07:10 am »
Hi

I am providing the "asm" and "hex" files from the PIC12F675.
« Last Edit: October 25, 2021, 08:58:49 am by Avelino Sampaio »
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5898
  • Country: es
Re: Auxiliary power system with PIC12F675 + CD4053 + LM723
« Reply #9 on: October 06, 2021, 09:55:22 pm »
C3 will cause some delay to the response, too.
Instead R1+R2, use a zener, the falling voltage will be detected much faster.
« Last Edit: October 06, 2021, 10:29:34 pm by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline Avelino SampaioTopic starter

  • Frequent Contributor
  • **
  • Posts: 260
  • Country: br
Re: Auxiliary power system with PIC12F675 + CD4053 + LM723
« Reply #10 on: October 07, 2021, 02:00:31 pm »
DavidAlfa,

thank you very much for your cooperation. I implemented and tested the suggested modifications. It worked great!

I will keep C3 as it doesn't affect the transition. In case of power failure, the PIC12F will trigger PAUSE, setting the output of the LM723 to zero. Q6 will go into driving. In sequence, GP1 will trigger Q4, releasing the battery for use.
« Last Edit: October 07, 2021, 02:02:19 pm by Avelino Sampaio »
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5898
  • Country: es
Re: Auxiliary power system with PIC12F675 + CD4053 + LM723
« Reply #11 on: October 07, 2021, 06:04:05 pm »
Edit: Ignore all the following. You're already using the ADC. Just set GP1 as analog and read it too with the ADC.
If you want to trigger the aux power supply at 17.5V, you know you'll have 1.59V.
The ADC will read 325 with 5V VDD, that's your threshold!



The best would be to use the internal comparator, as ledtester suggested.
The comparator can use the internal reference, which has 2 range modes (Excel table attached), and can be adjusted in 16 steps.
Then you only need to read the comparator output flag. 1=input is lowerthan reference, 0= input is higher, that simple!
It's been a lot since I last played with PICs, but PIC16 peripherals are very easy to set up.
Code: [Select]
config:
BSF    GPIO,1             Set GPIO1 as input
BCF    ANSEL,1            Set GPIO1 as analog
MOVLW  B'10000010'        Enable Vref, set high range, internal vref, 1.56V
MOVFW  VRCON
MOVLW  B'00000100'        Cin- to GPIO1, Cin+ to Vref, Cout pin unused
MOVWF  CMCON

scan:
BTFSC CMCON,COUT          Test COUT bit
GOTO  low_detected        If 1, vin is lower than reference (Voltage is dropping)
GOTO  scan                If 0, vin is higher (All ok), do other checks or keep scanning


Then use a resistor divider R1(10K)+R2(1K) and connect it to RA1.
Over 17.2V, the voltage will exceed 1.56V, and the comparator output will be 0.
When it falls below that, it will trigger the comparator and read 1.

You only need to swap GPIO1 and GPIO3 in your code.
« Last Edit: October 07, 2021, 06:14:40 pm by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline Avelino SampaioTopic starter

  • Frequent Contributor
  • **
  • Posts: 260
  • Country: br
Re: Auxiliary power system with PIC12F675 + CD4053 + LM723
« Reply #12 on: October 07, 2021, 06:44:00 pm »
DavidAlfa,

Yes, I initially configured GP3 to use ADC. The problem is that I didn't realize that GP3 is not configurable as an output port. GP3 being a digital input port, I had to use this external circuit with the transistor. The transition system is working very well, for both configurations (pnp and npn) tested.
« Last Edit: November 01, 2021, 07:53:54 am by Avelino Sampaio »
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5898
  • Country: es
Re: Auxiliary power system with PIC12F675 + CD4053 + LM723
« Reply #13 on: October 07, 2021, 08:06:30 pm »
I see. That's what you get with these tight devices!
Avoid these old pics when possible, there're newer, cheaper, much more powerful pics!
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline Avelino SampaioTopic starter

  • Frequent Contributor
  • **
  • Posts: 260
  • Country: br
Re: Auxiliary power system with PIC12F675 + CD4053 + LM723
« Reply #14 on: October 08, 2021, 08:54:15 pm »
DavidAlpha

And to further complicate the situation, I need to implement an alarm system. The PIC12F will disconnect the battery from the load when voltage reaches 11.0v. The alarm must be set to go off at 11.1v. The big question is: how will I implement this alarm while keeping the PIC12F ? Another issue is that the alarm cannot be with continuous sound, as it consumes battery power and will become very irritating. It should ring for 5 seconds at 20 second intervals.
 

Offline Avelino SampaioTopic starter

  • Frequent Contributor
  • **
  • Posts: 260
  • Country: br
Re: Auxiliary power system with PIC12F675 + CD4053 + LM723
« Reply #15 on: October 10, 2021, 11:22:00 am »
Hi

In supply mode (see flowchart), the GP2 port goes to high level (1), blocking the output of the LM723. With the LM723 output blocked, it doesn't matter the voltage value on Pin 5. This brings me the happy news that I will be able to freely use the GP4 and GP5 ports, to configure the alarm. It remains now to draw up a circuit for the alarm and here I accept suggestions.
 

Offline Avelino SampaioTopic starter

  • Frequent Contributor
  • **
  • Posts: 260
  • Country: br
Re: Auxiliary power system with PIC12F675 + CD4053 + LM723
« Reply #16 on: October 10, 2021, 03:20:40 pm »
Hi

I have an Active Buzzer in my stock here, which will make my programming much easier. I will only have to worry about the on/off times (5 seconds ON and 20 seconds off). Now I have to remind myself how to activate and configure the PIC12F's Timer1 using the assembler.

 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5898
  • Country: es
Re: Auxiliary power system with PIC12F675 + CD4053 + LM723
« Reply #17 on: October 10, 2021, 06:53:30 pm »
Why do you keep using the 12F? The low pin count is clearly limiting your project.
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline Avelino SampaioTopic starter

  • Frequent Contributor
  • **
  • Posts: 260
  • Country: br
Re: Auxiliary power system with PIC12F675 + CD4053 + LM723
« Reply #18 on: October 10, 2021, 09:59:30 pm »
DavidAlfa

I have five PIC12F in my stock. It didn't limit the project, because I managed to implement everything I planned. It was just more challenging and as a bonus a little more knowledge gained. I managed to finish programming just now and if everything goes well in tomorrow's tests, I'll post the asm file here.
 

Offline Avelino SampaioTopic starter

  • Frequent Contributor
  • **
  • Posts: 260
  • Country: br
Re: Auxiliary power system with PIC12F675 + CD4053 + LM723
« Reply #19 on: October 11, 2021, 09:58:57 pm »
Hi

I finished rehearsals and programming. Everything working as planned. The updating of the scheme and the programming of the PICF12 follows, with the addition of the alarm.
 

Offline Avelino SampaioTopic starter

  • Frequent Contributor
  • **
  • Posts: 260
  • Country: br
Re: Auxiliary power system with PIC12F675 + CD4053 + LM723
« Reply #20 on: October 17, 2021, 08:07:46 pm »
Hi

The project is coming to an end. I decided to make the pcb like in ancient times (using the pen). It took me 8 hours to attach the modules to the cabinet and wire them together. Tomorrow will be more testing day.
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3036
  • Country: us
Re: Auxiliary power system with PIC12F675 + CD4053 + LM723
« Reply #21 on: October 18, 2021, 01:59:11 am »
Looks nice!

About how you made your PCB...

- what pen did you use?
- could you explain your process of laying out the tracks and transferring them to the pcb? Did you use a CAD / EDA or even a paint program to design the track layout?
 

Offline Avelino SampaioTopic starter

  • Frequent Contributor
  • **
  • Posts: 260
  • Country: br
Re: Auxiliary power system with PIC12F675 + CD4053 + LM723
« Reply #22 on: October 20, 2021, 12:25:18 am »
Hi

Ledtester, I will comment on pcb when I finish testing.

Giving sequences to tests, today was a day of a lot of learning. Testing the design with the values ​​at maximum capacity, I was revealed to have problems with temperatures in various components.

image 1: I made the mistake of placing the MUR460 diode next to the pcb. I was cooking the pcb. The diode reached 90ºc. As you can see in the image, I put a new one far away. The Mosfets also had to be given a small heatsink.

image 2: I was impressed with the temperature of the diode, so I decided to add a heatsink. I managed to get it down to 60ºc.

images 3: When closing the case and testing for about 30 minutes, I noticed the temperature rise by more than 10ºC, in relation to the open case. Today the ambient temperature was 27ºC.

Image 4: There was a risk that the transistor would overtake SOA, so I decided to use the fan. Transitor (tc) dropped to 45ºc. It also helped to minimize the diode temperature.

image 5: Testing with the cabinet closed, with normalized temperatures .
 

Offline Avelino SampaioTopic starter

  • Frequent Contributor
  • **
  • Posts: 260
  • Country: br
Re: Auxiliary power system with PIC12F675 + CD4053 + LM723
« Reply #23 on: October 20, 2021, 10:07:42 am »
Hi

New schematic update and PIC12F programming correction.

1- The red LED did not provide the proper grounding point for the mosfet's drain (Q4 - Q6). A 10k resistor (R22) solved the issue.

2- The regulation of the LM723 became unstable in float mode (low current to the battery). I solved the issue by adding a load with the 220R resistor (R21). With this it was possible to maintain a minimum current (around 70 mA), ensuring stability.

3 - I detected a small error in the programming. I forgot to turn off timer1 when switching to charge mode.
 

Offline Avelino SampaioTopic starter

  • Frequent Contributor
  • **
  • Posts: 260
  • Country: br
Re: Auxiliary power system with PIC12F675 + CD4053 + LM723
« Reply #24 on: October 24, 2021, 04:16:57 pm »
Hi

The fan I had installed had a very loud noise level. I decided to replace it with one with PWM control (4 wires). Resistance values between 1k5 and 2k allows changing the fan rotation (36Hz - 110Hz). I inserted a potentiometer (p3) to adjust the minimum rotation, without harming the transistor cooling.

The project followed the battery manufacturer's recommendation for two-stage charging. See highlighted what guides the manufacturer:

Quote
Constant Voltage Charge in Two Stages
This charging mode is recommended to charge the battery quickly and keep it floating. In the initial charging stage, the battery is charged by a constant current up to a voltage of 2.45 V/element. At this point the load is automatically switched to a constant voltage load. After the constant current charging stage (A~B), the battery is charged by a float voltage of 2.3V/he (B~C). Switching to constant load voltage takes place after the battery reaches 80% charge of its rated capacity. This method is efficient because it minimizes charge time during the initial charge stage and protects the battery from overcharging during the final float charge stage. This charging method cannot be used in applications where the charge and battery are connected in parallel.

Initial load current: 0.25C Amps (maximum)

load voltage
First stage: 2.45 V/he (2.40~2.50 V/he maximum)
Second stage: 2.28 V/he (2.25~2.30 V/he maximum)
Switching: 0.05C Amps (0.04~0.08C Amps)

- I adopted the initial load current value at 0.18C. (0.25C maximum recommended).

- The project does not have ambient temperature compensation. By adopting a "conservative" recharge, I didn't see this need for compensation.

- Note in the table below that switching to float mode takes place within the manufacturer's recommendations (0.04~0.08C Amps).


Hour   Ic       Vbat   
8:001.29       12.195   
8:301.23       12.734   
9:001.23       12.945   
9:301.23       13.170   
10:001.21       13.435   
10:301.15       13.830   
11:000.69       14.290   
11:300.28       14.500   
11:380.23       14.523  
11:380.19       13.731   
11:500.13       13.749   
12:300.08       13.762   
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf