Esp32 and solar charge system.

Thread Starter

jamesscape2

Joined Mar 5, 2025
7
Hi all,

i need help review this for all possible issues or improvements.
Im still pretty new to this, ive try following all the data sheets as much as possible.

Thanks
James

2.png3.png4.png5.png6.png7.png8.png9.png10.png
 

Attachments

boostbuck

Joined Oct 5, 2017
1,041
For starters, your led current limiting resistors seem too high - R12, R37, R40, R42. Eg R40 is limiting on a 3V3 line, so you are supplying about 25uA to that LED.

And is led D6 is reversed?
 

JohnSan

Joined Sep 15, 2018
124
You need to give more information on what you are trying to do. There are so many mistakes, re- read the data sheets and start again.
I suggest you use a commercially available ESP32 module.
Are you intending to create a pcb for this design?
 

Irving

Joined Jan 30, 2016
5,079
As has been said, many issues, some less problematic than others, however there are some very serious issues with your 12v switching on sheet 8.

For a start the MOSFETs you specify AOD4185 are P-channel, but you are using them as N-channel devices, switching the low side of the load, which appears to be your intent, judging by your drive arrangements. As it stands the load will be permanently powered on through the MOSFET's body diode (at least until it expires in a puff of smoke!).

Even if they were intended to be N-channel this may not work reliably. The MCP23008 GPIO extender is operating off 3.3v, so the maximum output voltage is 3.3v but it could be as low as 2.6v (Vdd-0.7 from datasheet). You are using the BC817 as an emitter follower, so the emitter voltage, and therefore the gate voltage of the MOSFET, will always be 0.6v below the base, i.e. 2.0 - 2.7v. This insufficient to fully turn the MOSFET on as they (or their N-channel equivalent, AOD4186, which is what maybe I think you meant) are not spec'd for a gate voltage <4.5v. We don't know what you are driving, but with a 10A fuse at F3 I'd hazard a guess at something drawing up to 1A? At a gate drive of 2.7v (the threshold voltage where the MOSFET is just turning on) the on resistance will be substantially higher than the spec'd 20milliOhms, maybe over 1 Ohm and there is potential for the MOSFET to overheat.

If you had intended to use the P-channel device, which is a common approach for switching the high-side of the load, then this is a suitable arrangement:

1741287503098.png

Now the MCP23008 is turning on Q2 which pulls the gate of Q1 down to approx 2v, or -10v referenced to the 12v rail, turning Q1 hard on and generating little heat. Although you could leave out the zener D1 and just rely on the R1/R3 voltage divider, 13.2v on the original diagram suggests an automotive connection and so the zener is included as good practice to protect the gate from spikes >+/- 20v which could occur.

I would suggest, if you haven't already done so, breadboarding a substantial part of this project (you don't need to do it all at once) to verify it works as intended.
 

Thread Starter

jamesscape2

Joined Mar 5, 2025
7
For starters, your led current limiting resistors seem too high - R12, R37, R40, R42. Eg R40 is limiting on a 3V3 line, so you are supplying about 25uA to that LED.

And is led D6 is reversed?
D6 is the correct direction, it is in there to only run if the solar is connected backways
 

Thread Starter

jamesscape2

Joined Mar 5, 2025
7
You need to give more information on what you are trying to do. There are so many mistakes, re- read the data sheets and start again.
I suggest you use a commercially available ESP32 module.
Are you intending to create a pcb for this design?
Yes am i am intending, which is why im trying to seek help from more knowledge people.

Ill look at the data sheets again and see what i can figure out.

any chance of a list of thing that are MUST fixes that i can look into first
 

Thread Starter

jamesscape2

Joined Mar 5, 2025
7
As has been said, many issues, some less problematic than others, however there are some very serious issues with your 12v switching on sheet 8.

For a start the MOSFETs you specify AOD4185 are P-channel, but you are using them as N-channel devices, switching the low side of the load, which appears to be your intent, judging by your drive arrangements. As it stands the load will be permanently powered on through the MOSFET's body diode (at least until it expires in a puff of smoke!).

Even if they were intended to be N-channel this may not work reliably. The MCP23008 GPIO extender is operating off 3.3v, so the maximum output voltage is 3.3v but it could be as low as 2.6v (Vdd-0.7 from datasheet). You are using the BC817 as an emitter follower, so the emitter voltage, and therefore the gate voltage of the MOSFET, will always be 0.6v below the base, i.e. 2.0 - 2.7v. This insufficient to fully turn the MOSFET on as they (or their N-channel equivalent, AOD4186, which is what maybe I think you meant) are not spec'd for a gate voltage <4.5v. We don't know what you are driving, but with a 10A fuse at F3 I'd hazard a guess at something drawing up to 1A? At a gate drive of 2.7v (the threshold voltage where the MOSFET is just turning on) the on resistance will be substantially higher than the spec'd 20milliOhms, maybe over 1 Ohm and there is potential for the MOSFET to overheat.

If you had intended to use the P-channel device, which is a common approach for switching the high-side of the load, then this is a suitable arrangement:

View attachment 343897

Now the MCP23008 is turning on Q2 which pulls the gate of Q1 down to approx 2v, or -10v referenced to the 12v rail, turning Q1 hard on and generating little heat. Although you could leave out the zener D1 and just rely on the R1/R3 voltage divider, 13.2v on the original diagram suggests an automotive connection and so the zener is included as good practice to protect the gate from spikes >+/- 20v which could occur.

I would suggest, if you haven't already done so, breadboarding a substantial part of this project (you don't need to do it all at once) to verify it works as intended.
Thanks for the feedback.

ive change my deisgn to look like yours and it makes a lot more sense especailly the diode bit not sure how i didnt realise that.

If u have anything else that is major that i show looka t right away that would be awesome thanks
 

JohnSan

Joined Sep 15, 2018
124
Where is the project description asked for?

Sheet 5. Solar Charge System.
What is this supposed to do?

While connecting a solar panel incorrectly with reverse polarity, you may just get away with lighting LED D5.
But connecting an 18V panel with the CORRECT polarity will likely instantly destroy Q1, Q2 and U7 !
If Q2 blows open circuit, it will probably then blow D7 as well....

Look at the 'protection' diodes in U7 & Q2.

Reading about the CN3767 reveals, it is a poor choice for a charge regulator.
Best use another device.

Sorry, too many issues.
 

Irving

Joined Jan 30, 2016
5,079
Thanks for the feedback.

ive change my deisgn to look like yours and it makes a lot more sense especailly the diode bit not sure how i didnt realise that.

If u have anything else that is major that i show looka t right away that would be awesome thanks
You're welcome. Further to my suggestion, I'd add a 10k resistor from the base of Q2 to ground as well. Why? During reset/power up, and until configured, the GPIO output of the MCP23008 is an input and therefore high impedance. Depending on PCB layout, environment, state before reset, etc. you could get stored energy and/or coupled transients which briefly turn Q2, and therefore Q1, on, which probably would be undesirable.


Other thoughts:

Q1 on sheet 5 is shorting solar supply rail to ground - is this intended? If its intended to switch VSOLAR off then you need another MOSFET as shown in this LTSpice simulation demonstrating VSOLAR traversing from -12v to +12v, for reverse protection while being switched on and off by the logic signal SolarSwitch. I've shown two discrete P-channel MOSFETs here, but several manufacturers do a dual common source P-channel MOSFET in a single casing for exactly this purpose. I'll have another look for other issues when I get a little time.

1741368863220.png
 

Irving

Joined Jan 30, 2016
5,079
While connecting a solar panel incorrectly with reverse polarity, you may just get away with lighting LED D5.
But connecting an 18V panel with the CORRECT polarity will likely instantly destroy Q1, Q2 and U7 !
If Q2 blows open circuit, it will probably then blow D7 as well....

Look at the 'protection' diodes in U7 & Q2.
I'm not sure why you think that? A typical 18v 160W panel produces a maximum of 9A shorted and 23v O/C, the MPPT is typically 8.5A @ 19.5v

Reversed no current flows, forward biased the MOSFET body diode turns on and then the channel enhancement takes over. The dissipation in the MOSFET is around 1.6W, well in spec on an appropriate heatsink.

1741373318606.png
 

JohnSan

Joined Sep 15, 2018
124
I'm not sure why you think that? A typical 18v 160W panel produces a maximum of 9A shorted and 23v O/C, the MPPT is typically 8.5A @ 19.5v

Reversed no current flows, forward biased the MOSFET body diode turns on and then the channel enhancement takes over. The dissipation in the MOSFET is around 1.6W, well in spec on an appropriate heatsink.

I may have been a little dramatic, but.....

Who knows what panel rating is to be connected?
Just another reason that a decent description of what is trying to be achieved on any project is necessary.

U7 - What is it doing? (Also, why U?).
It's reverse diode is permanently conducting current.
What is meant by 'then the channel enhancement will take over'?
The good news is, the diode is rated at 20A on a suitable heatsink.

D7 zener. - No parameter spec. Needs to be rated at ~10amps / 150W continuous for the solar panel suggested.
Anything less and it will be destroyed.
What is it for?

Q2 - AO3400 is configured so its reverse diode is always conducting.
'Solar Switch' input can do nothing.

Q1 - BC807 is rated at 500mA, 460mW, 45V.

Again, because of Q2 reverse diode, Q1 is permanently on.
It's collector current will be in the region of 50 to 100mA.
So power dissipation around 1 to 2 W.
It won't last long, whatever it's suppose to do?

It's the last I'll comment on this.
Too many errors.
 

Thread Starter

jamesscape2

Joined Mar 5, 2025
7
I'm not sure why you think that? A typical 18v 160W panel produces a maximum of 9A shorted and 23v O/C, the MPPT is typically 8.5A @ 19.5v

Reversed no current flows, forward biased the MOSFET body diode turns on and then the channel enhancement takes over. The dissipation in the MOSFET is around 1.6W, well in spec on an appropriate heatsink.

View attachment 343991
Thanks again.

i should have added more details are the start.
most of this solar charger is based from a already manufactroed design
https://dfimg.dfrobot.com/nobody/wiki/f9bd6677060bb55945d67455e79daea6.pdf

im trying to condense a few different boards ive purchased into 1 board. obviously with limited knowledge which is why im here.

Ill defintely attempt to bread board some of this before getting a PCB printed
Q2 face palm obviously needs to be the other way. on your note the the Q2 base i do already have a 100K going to ground. i assuming u recommend a 10K over the 100K then

Ahh i see the Q1 shorting to ground i had R13 in the wrong spot ive move it down so that the collector of the transistor connects directly to the Gate of U7 and then through the R13 to ground
 

Irving

Joined Jan 30, 2016
5,079
I may have been a little dramatic, but.....

Who knows what panel rating is to be connected?
Just another reason that a decent description of what is trying to be achieved on any project is necessary.
I agree the mistakes in the OP diagrams make it harder to understand, especially if you've never seen such circuitry before, but the OP has got it essentially correct despite some silly lapses in basic drafting that a little extra proof reading would have uncovered. This doesn't help his cause as many on this forum will just walk away from such. But we all make mistakes from time to time. I try to give people the benefit of the doubt, once at least :rolleyes: :)

U7 - What is it doing? (Also, why U?).
It's reverse diode is permanently conducting current.
What is meant by 'then the channel enhancement will take over'?
The good news is, the diode is rated at 20A on a suitable heatsink.
1741448245256.png
U7/D7/R13, though incorrectly drawn by the OP and correctly so above, is a standard reverse protection building block that I've use extensively on battery powered projects. Its a little confusing at first if you've not seen it before because the P-channel MOSFET (U7, no idea why 'U' either) appears to be used backwards. And indeed it is! Most people don't appreciate that most modern power MOSFETs are actually bidirectional once turned hard on. In this arrangement, when power first applied initially the body diode conducts. The gate pin is tied to ground via a resistor, so is -ve wrt the source pin. As the source voltage rises towards the drain voltage, the MOSFET turns on bypassing the body diode and the total supply current is now flowing 'backwards' through the MOSFET channel. At this point the voltage drop across the channel is only milliVolts (180mV @ 10A or so) so the body diode is non-conducting, and the dissipation in the MOSFET is around 1.8W, well in spec for that MOSFET assuming enough copper under it.

When the supply is applied in reverse, the body diode blocks and the MOSFET remains off, so no current flows and the circuit is protecting what follows.

D7 zener. - No parameter spec. Needs to be rated at ~10amps / 150W continuous for the solar panel suggested.
Anything less and it will be destroyed.
What is it for?
Again, the incorrect drawing belies its purpose. D7 protects the gate of U7 if the supply voltage rises above 15v by clamping the gate to source - 15v. It carries negligible current eg (supply - 15v)/10k.


Q2 - AO3400 is configured so its reverse diode is always conducting.
'Solar Switch' input can do nothing.

Q1 - BC807 is rated at 500mA, 460mW, 45V.
Agreed, Q2 is drawn upside down. Shown correctly above.

However, this is one area I think is actually wrong, It's purpose is to turn the solar charging off, by shorting gate to source of U7 with Q1, driven by Q2. But as soon as U7 goes off the body diode starts conducting and pulls the LOAD voltage to a diode drop below VSOLAR. I tried an LTSpice simulation of this and it agrees with me. That why I suggested a second MOSFET as per post #9 above.
 

Thread Starter

jamesscape2

Joined Mar 5, 2025
7
Thanks again Irving,

Your feedback has been very helpful.

Is there anything else in the other schematics that i should be looking at?
 

JohnSan

Joined Sep 15, 2018
124
I agree the mistakes in the OP diagrams make it harder to understand, especially if you've never seen such circuitry before, but the OP has got it essentially correct despite some silly lapses in basic drafting that a little extra proof reading would have uncovered. This doesn't help his cause as many on this forum will just walk away from such. But we all make mistakes from time to time. I try to give people the benefit of the doubt, once at least :rolleyes: :)


View attachment 344033
U7/D7/R13, though incorrectly drawn by the OP and correctly so above, is a standard reverse protection building block that I've use extensively on battery powered projects. Its a little confusing at first if you've not seen it before because the P-channel MOSFET (U7, no idea why 'U' either) appears to be used backwards. And indeed it is! Most people don't appreciate that most modern power MOSFETs are actually bidirectional once turned hard on. In this arrangement, when power first applied initially the body diode conducts. The gate pin is tied to ground via a resistor, so is -ve wrt the source pin. As the source voltage rises towards the drain voltage, the MOSFET turns on bypassing the body diode and the total supply current is now flowing 'backwards' through the MOSFET channel. At this point the voltage drop across the channel is only milliVolts (180mV @ 10A or so) so the body diode is non-conducting, and the dissipation in the MOSFET is around 1.8W, well in spec for that MOSFET assuming enough copper under it.

When the supply is applied in reverse, the body diode blocks and the MOSFET remains off, so no current flows and the circuit is protecting what follows.


Again, the incorrect drawing belies its purpose. D7 protects the gate of U7 if the supply voltage rises above 15v by clamping the gate to source - 15v. It carries negligible current eg (supply - 15v)/10k.



Agreed, Q2 is drawn upside down. Shown correctly above.

However, this is one area I think is actually wrong, It's purpose is to turn the solar charging off, by shorting gate to source of U7 with Q1, driven by Q2. But as soon as U7 goes off the body diode starts conducting and pulls the LOAD voltage to a diode drop below VSOLAR. I tried an LTSpice simulation of this and it agrees with me. That why I suggested a second MOSFET as per post #9 above.
Well now, I will add one more comment.

From the recent post of the DFRobot circuit diagram, the real subject being discussed here is the inability of the OP to copy parts of a commercial circuit diagram.

Irvine, you've done a good job of second guessing what was originally intended here.
Hat's off to you.
But I find it a little annoying.
 
Top