Circuit check - Page 1
Forum section: electronics / beginners

author: Pariston
author_rank: Contributor
timestamp: July 14, 2020, 06:33:24 am
content: Hi,I would really appreciate some electrical engineer to take a look at my circuit. I am a second year student and most likely made some stupid mistakes. Feel free to ask anything that comes to your mind.https://easyeda.com/editor#id=|dfa4e1af68304c6eaf1bb91488e08489|892cd2b274124761828b4d0120da1232

author: Manul
author_rank: Super Contributor
timestamp: July 14, 2020, 10:54:37 am
content: Hello. I think (sorry about that) half of circuit is not good. Did not look everything, but:1. Where is input for U2?2. Why U2 and U3 outputs are connected together???3. Diode D1 will ruin ADC accuracy4. Basically everything is wrong with mosfets5. Consider freewheeling diode for airpump6. Consider a gate series resistor if gate capacitance is more then 100pF

author: Pariston
author_rank: Contributor
timestamp: July 14, 2020, 12:21:53 pm
content: There is no need to apologize. It is better if I feel like a fool now, than later...Replying to your recommendations:1. Sorry i have lost a wire there. It was supposed to be connected to 1.2 volt battery2. U3 is supplying system when system is connected to the power. When power is lost, mcu should receive signal on pin called POWER and enable buck converter to get power from that side(which is basically the reason why i placed D1 there).3. How badly is it going to effect adc reading? ADC is used to measure voltage of the battery, for charging and discharging operations.4. Could you specify how to make these mosfets work properly?I've made changes to the circuit, hope this time it looks a little better.Once again, thank you for your time.

author: Manul
author_rank: Super Contributor
timestamp: July 14, 2020, 01:09:50 pm
content: U2 VBAT is still without power. Your sharing of power still looks suspicious to me, but it requires to dig into datasheets, which I have no time at the moment. Why PA05 now goes to 1.2V? And VDD is connected nowhere. Diode D1 powers analog pin of MCU. What does it have to do with power sharing I can't see. What it will do is change a little its Vfr with temperature (and ADC REF will change), and in general makes ADC reference a little undefined. Usually people do some RC or LC filtering for analog power. In your case, you can just connect to VDD, because you probably do not mind a little noise. Generally gate series resistors should be around 100ohms if you drive mosfets directly from MCU. And as I see you using N-Ch mosfets with a load on source, like a high-side switch. You cannot do that without special high side driver. So look some schematics about N-Ch mosfet driving and try to redesign for low side switching.I see that you are doing everything quickly and making blunders, so my suggestion is to slow down and take your time to check details.

author: Pariston
author_rank: Contributor
timestamp: July 14, 2020, 02:17:37 pm
content: 1. Yes, sorry i accidentally connected battery to CE of U2 and few following problems came from there. It should be solved now.2. VDDANA, VDDIO, VDDOUT and VDDCORE all connected to the same point.3. Function of this diode is following: when power from U3 is lost, mcu is powered from capacitor at VDDANA. Because of diode, point POWER is LOW and mcu knows that there is no power coming from the wall. While receiving power from the capacitor, mcu is gonna turn PA5 high - activate boost converter and work from the battery.4. Now ADC is not connected to the diode, hope ADC reading is going to be accurate this way.You are right, i really feel like i need to take a step back and look at the circuit once again. I will try to study n-channel MOSFET driving today. Also i've picked series gate resistor values from the datasheets of used MOSFET, is it a different requirement when you try to run it from the mcu directly?Thanks again.

author: Manul
author_rank: Super Contributor
timestamp: July 14, 2020, 03:54:04 pm
content: Yeah, I got idea about D1. Still not sure if I like it. About ADC, maybe it is not big deal in your case, but in general series diode will make voltage regulation worse, there will be variation with changing load and temperature. I would suggest to look into possibilities to make power source switching by hardware. I think your U2 is even designed to do that. But you need to investigate how U3 reacts to output being powered while having no input. In my opinion software switching is kinda bad practice, a bit "how you doing". It may be unreliable and your software needs to check very often and that is creating possible limitations for code.There is basically two scenarios for series gate resistors.1. High speed switching / slew rate control / ringing supression.In that case, you care about achieving high speed and low power loss. So you want to charge and discharge gate capacitance quickly with minimal time in linear region. You have a gate driver which can source and sink amps of current. But then there is often a problem with ringing. So series gate resistor limits current a little bit and also reduces the Q factor of formed LC circuit (PCB trace inductance + gate capacitance). There is a lot of science here.2. Switching directly from MCU / reducing capacitive loading on MCU pin / current limitting.Here you probably don't care about speed, because there will be no speed anyway. But you care about capacitive loading on your MCU output pin. Of course it has some internal resistance, and usually you may adjust slew rate by software (increasing this resistance), so current will not be crazy high while driving gate capacitance, but still it is good practice to add some limitting. Because if there is some 300pF of capacitance to drive, current spikes may easily reach 50 - 100mA, and that is probably above allowed current for MCU output even for short time. It will probably survive, but thats not a clean design. MCU output is quite weak and is not designed to deliver high currents.

author: Pariston
author_rank: Contributor
timestamp: July 17, 2020, 02:46:30 pm
content: I've made some changes to the circuit.I still think we need to control power with software due to battery existence. Without consistent readings of battery's voltage, we are unable to charge and discharge it accurately.Also, i believe that we can easily drive mosfets directly from mcu, because we are just using them in a switch mode, and currents are relatively small.I am planning to use RTCC programming with this mcu. Is there anything else i need to add beside crystal to make it function? I've never done this before...Also, i tried ditching this diode beside mcu, but always end up placing it back, tell me if you have an idea about it...If you find some other mistakes in the circuit i would be really happy.Thanks.

author: Manul
author_rank: Super Contributor
timestamp: July 20, 2020, 12:07:25 am
content: Your newest schematic looks more nice. But I immediately see that you stiil have not done studying on mosfets as it was suggested. It is still wrong. You should look for low side switching. I suggest to learn little bit about driving and characteristics of N and P channel mosfets. Try to experiment on a breadboard or run a simulation to get the basics.

author: Pariston
author_rank: Contributor
timestamp: July 20, 2020, 02:56:06 pm
content: Yeah... that was a helpful advice..I had to leave some mosfets on the high side, due to project requirements. It should look better now. Meanwhile i will be checking my passive components values.And thank you for helping me so much...

author: Manul
author_rank: Super Contributor
timestamp: July 20, 2020, 10:06:10 pm
content: Technically speaking, your new mosfet arrangement is correct, but it will blow up immediately, because when you will drive P-Ch mosfet gate to ground, there will be -48V (relative to source) on its gate, which is way above what most mosfets can tolerate. Consider current limiting resistor and zenner diode to limit gate voltage (to lets say 10-15V). Also consider that your P-Ch mosfet will be fast to turn on, but very slow to turn off, because when N-Ch mosfet will turn off, the only thing driving gate low is the gate-source resistor which is really high value.

author: Pariston
author_rank: Contributor
timestamp: July 21, 2020, 01:19:54 pm
content: Should be better now. I don't mind that P channel mosfet will be slow to turn off, as long as it is less than 1 second.I have a question about my fuse down there. If led fails short, worst case scenario, circuit is following: 48.5 Volt - 10.5 ohm resistor (0.5W rated) - fuse - ground (about 4.6A). Fuse SF-0603HI075F-2 is rated for 0.75 A, and breaking capacity of 13A. From the datasheet of this fuse, at 4.6 A, it should take about 0.004 seconds for fuse to fall open. what kind of damage can be done to the circuit and power supply in this time (power supply is rated for 2A), any risk of ignition? Potentiometer is there to have manual control over led current, but there should be a better way to for this...

author: Manul
author_rank: Super Contributor
timestamp: July 21, 2020, 01:47:54 pm
content: Do not put 1k resistor on source, it is wrong. Another thing, 1k resisor will dissipate around 1.4W. Can you explain why you need such a complicated way of switching those LEDs?

author: Pariston
author_rank: Contributor
timestamp: July 21, 2020, 02:03:03 pm
content: Yeah, it is getting ridiculous keeping these leds on the low side... Problem comes from led circuit design. I left them on the low side without thinking, should probably redesign it...Okay. Change of plans. I will redesign led circuit, and use N channel mosfets in this circuit instead.Thanks again, at least circuit is getting better and it makes me happy. Here is a picture of high power led working. Will probably take me a day to change everything..

author: Pariston
author_rank: Contributor
timestamp: July 22, 2020, 02:19:37 pm
content: Okay, now leds are on the high side. Also, here is a basic idea on how circuit works:Circuit is designed for tiny hydroponics system.External controls:At first, I would like to explain all possible ways that person can communicate with a system. There are four tactile switches in total, and all of these have something to do with controlling High Power LED.SW1: responsible for setting how many groups of LEDs are active, which is basically a way to control brightness (yes, there is a reason why we are not just controlling current through the LEDs...). When pressed, activates next group of LEDs. Initially set as LED1 ON others off, but every next touch will activate another FET until all four groups are ON, if you press switch again it will go to initial state (yes, you are not able to turn all LEDs off with this switch).SW2: This is a very important switch which defines how many hours of light, plant is going to receive in a day cycle. Initially system is set as 12 Hours On 12 Hours off (state 1). Once SW2 is pressed, cycle increases by 2 hours, so if you press it first time, it is 14 hours on and 10 hours off(state 2). In total, there are 5 states from 12 to 20 hours, next touch sets it to initial conditions. Note: when cycle is changed, signal led is going to indicate change in cycle. Ex. if changed from state 5 back to state 1, led should blink once, twice from state 1 to state 2 etc..SW3: This switch initializes a moment in time when day cycle begins. Ex. if system is set to 14 hours on & 10 hours off(cycle state 2), and you press SW3 at 8 am, then at 10 pm lights will turn off, until turning back on tomorrow at 8am.SW4: ON/OFF switch.System has two states of operation. We will use "Power" pin to consistently check incoming voltage. State of this pin defines operation of the system.Power Mode ON:Step 1: We turn off BoostCE and pump2, turn on MainFET and pump1. Check voltage with "battery" pin and if battery is charged we turn "charge" pin off. If battery wasn't charged, turn on U5 until charged.Once battery is charged and pump running, it is a regular condition of this system. Mcu consistently checks "Power" and "Battery" pins to keep track of situation.Power mode OFF (goal is to save power without killing a plant):Immediately turn on U2 (supplying mcu from battery). Turn off MainFET and pump1, turn on pump2. Consistently check "battery" pin:At 50% start blinking signal led.At 30% turn off pump2.At 20% turn off BoostCE - shut down(trying not to damage battery itself).Once power is back on, system should recharge battery and work normally.