Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Automotive Generator Universal Digital Voltage Regulator

Status
Not open for further replies.
You mentioned a choke; are you thinking pure inductance would be more appropriate than a ferrite bead?
A ferrite bead creates a low value inductor; a wound choke can be much higher value. You are dealing with KHz rather than MHz range, so a proportionally higher value choke is likely appropriate.

The impedance can be high enough that the high frequency content never passes through it, with little effect on the DC power.
The series resistor reduces the chance of it resonating with the regulator caps and causing a problem itself..

However, a series schottky diode would prevent the regulator input being pulled down by noise on B+; but could pass positive spikes, so a low value resistor as well is probably still needed to limit their effect.

I did not mention a diode as I thought the regulator input may be a bit close to limits with a low battery.
 
A ferrite bead creates a low value inductor; a wound choke can be much higher value. You are dealing with KHz rather than MHz range, so a proportionally higher value choke is likely appropriate.
Wouldn't a 20 ns pulse width (i.e., wavelength 40E-9) imply a fundamental frequency around 25 MHz?
The impedance can be high enough that the high frequency content never passes through it, with little effect on the DC power.
The series resistor reduces the chance of it resonating with the regulator caps and causing a problem itself..
That sounds good. Could you suggest some ballpark values?
However, a series schottky diode would prevent the regulator input being pulled down by noise on B+; but could pass positive spikes, so a low value resistor as well is probably still needed to limit their effect.
I do have a huge 5KP30A TVS diode intended to limit positive spikes, at the moment. But that has a Reverse Stand-Off Voltage of 30.

I'm working on a Future Power Board design in which the Cut Out Diode is replaced with a MOSFET ideal diode with an LTC4359 controller. So, that might change things a bit. I doubt it can switch fast enough to check this pulse (I think it needs 300ns). I don't have the TVS diode in that design, currently. Anyway, I'd like to be able to use that board with this controller board.
I did not mention a diode as I thought the regulator input may be a bit close to limits with a low battery.
For sure. That is something I have worried about. If I scrapped the MCU eval. board and just used the MCU, I think all I'd need is 3.3 V. I plan to do that at some point, but with the chip shortage, there are just about no STM32 MCUs available in the world. I don't know when that'll change.
 
Last edited:
I'm still waiting for my new MCU boards, but the ferrite beads showed up today, so I couldn't resist trying some experiments. I got some confusing results.

First, I added a couple of 10 uF tantalum capacitors. One, from B+ (fat wire to the car battery, and power source for the controller board) to ground. There was already a 100 nF and a 330 nF there. Second, from 3.3 V to ground. There was already a 100 nF, a 10 nF, and another 100 nF directly on the pins of the SD card daughter board.

Then I tried a few different things in the fuse holder at the B+ terminal:
In the following 'scope images, CH1 is 3.3 V, CH2 is D+ (generator armature). I did these tests at low idle, so the generator was putting out very little, like, 10s of millivolts on average. I would not expect the big 82CNQ030 diode to be forward biased, and that is the only real connection between D+ and B+.
EDIT: WRONG! I had my wires crossed. In fact. CH1 is 3.3 V, CH2 is DF (field coils). D+ was likely a little under 4 V, however, B+ is around 6 V, so the diode would still be reverse biased.

The fuse (so, the only change is the new caps.):
fuse.png


Laird 28C0236-0EW-10
bead.png

Wurth 74275046:
25 MHz bead.png


A couple things jump out at me. One is that the capacitors appear to have flattened the spikes on D+ quite a bit, and the Wurth 74275046, especially, seems to make it even better! Strange, though, that the caps. and ferrite beads are on the other side of the diode from D+, but still seem to make a difference. Another is that none of these have done a whole heck of a lot to improve the situation on the 3.3 V line. In fact, the 3.3 V supply seems to be amplifying the spike on D+.

All this made me wonder what would happen if I disconnected the 5 V LDO regulator (by pulling the J2 jumper) and powered the MCU board with a 9v battery pack. In this configuration I'm using the LD1117S50TR 5 V regulator on the MCU board, which then feeds the LD39050PU33R 3.3 V regulator on the MCU board, which powers the MCU and the SD card. In this test, the two capacitors are still on B+, and I had the fuse back in the fuse holder. This is what I got:
batt.png

Again, not a whole lot of improvement. Well, OK, maybe no improvement.

I did find that if I rev the engine so that the generator voltage comes up, the spikes start to flatten out. Maybe that's because the 82CNQ030 diode is starting to connect D+ to B+ and the battery provides some smoothing? Or maybe that's just how things work with the armature and the commutator?

This all seems mysterious to me. I'm still hoping that everything will look better with a new, undamaged MCU. If not, I still have some ideas I haven't tried yet.
  • Series 1N5817-T schottky at the B+ tap (i.e., the fuse holder) [meant to try that and a low resistor today, but forgot]
  • 1N5817-T schottky from ground to D+ to try to keep it from spiking negative
  • Series 4.7 uH choke instead of a ferrite bead
  • Dedicated 3.3 V regulator just for the SD card
As always, let me know if you have any insights!
 
Last edited:
My new MCU boards finally showed up. Bad news: the 3.3 V power line still looks horrible. Maybe more hopeful news: I was barking up the wrong tree last week. I had my wires crossed, so I was looking at DF (field) when I thought I was looking at D+ (armature). So, if I can find the right tree maybe there is still some chance I can get this thing working.

This is what 3.3 V (CH1) and D+(CH2) look like today:
D+ & 3.3v.png


and here is 3.3 V (CH1) and DF(CH2):
new board, fuse.png

(Ignore those dashed lines. Zero is at the little "1" and "2" tags on the left.)

So I don't think D+ is my problem. However, I am still at a loss to explain what is happening.

Again, these 'scope traces are taken with the engine idling at around 850 - 900 RPM. The generator is putting out a little under 4 V on average, but no real current is flowing because B+ is at around 6 V. The regulator is doing its best to hold DF to ground.

Could the rotation of the armature and commutator induce a negative "inductive kick" into the field coil? If so, how can it find its way into B+ and down through the regulators to the 3.3 V line?

Here is what is connected to the DF in the regulator:
Screenshot 2022-02-12 200641.png

(see https://easyeda.com/editor#id=|98310162beb34c76a49f2d1b0163180b for context)

I would think D2 would try to keep DF from going to -3.28 V, but it is big TVS diode; maybe not fast switching. Even so, I would think D1 would keep the negative pulse from pulling down D+, which seems to be somewhat true. So, that leaves a path through the N type MOSFET, I guess. How could that happen?

The line tagged "Regulator switch control" goes straight to a push-pull digital output on the MCU. An I/O pin on the stm32l412kb can source or sink 20 mA. Could it be that somehow a negative pulse on DF feeds back through the gate of the IRL40B209 MOSFET to the MCU and pulls down its power supply?

I don't see any possible way that the NMOSFET could be pulling DF down well below zero.

(I am reconsidering that regulator switch design. I'm thinking I should delete C1 and put a resistor of, say, 1K? in series between the MCU GPIO and the NMOSFET gate. But I don't want to change anything until I have at least some theory of what is happening.)

I don't think I have a blown MOSFET; the basic function of the regulator seems to be working:
Time​
Engine RPM​
B+ Volts​
B+ Amps​
Duty Cycle​
Internal °C​
15:47:57.84​
812​
6.03​
0.17​
100.00%​
14​
15:47:58.84​
844​
6.02​
0.13​
100.00%​
14​
15:47:59.84​
886​
6.01​
0.16​
100.00%​
14​
15:48:00.84​
921​
6.01​
0.14​
100.00%​
14​
15:48:01.84​
931​
6.01​
0.13​
100.00%​
14​
15:48:02.84​
944​
6.02​
0.14​
100.00%​
14​
15:48:03.84​
883​
6.01​
0.13​
100.00%​
14​
15:48:04.84​
1318​
6.05​
2.69​
100.00%​
14​
15:48:05.84​
1503​
6.2​
8.29​
100.00%​
14​
15:48:06.84​
1752​
6.92​
16.17​
100.00%​
14​
15:48:07.84​
1890​
7.56​
19.16​
100.00%​
14​
15:48:08.84​
2243​
7.43​
8.21​
90.00%​
14​
15:48:09.84​
1347​
6.37​
3.27​
53.00%​
14​
15:48:10.84​
1918​
7.56​
16.62​
85.00%​
14​
15:48:11.84​
1133​
6.12​
0.13​
79.00%​
14​
15:48:12.84​
917​
6.09​
0.15​
95.00%​
14​
15:48:13.85​
924​
6.09​
0.13​
100.00%​
14​
15:48:14.85​
905​
6.06​
0.14​
100.00%​
14​
15:48:15.85​
882​
6.06​
0.15​
100.00%​
14​
15:48:16.85​
916​
6.06​
0.14​
100.00%​
14​
15:48:17.85​
902​
6.05​
0.16​
100.00%​
14​

I am stumped. Maybe I'm still looking up the wrong tree. Any ideas?
 
Last edited:
Can you show both PCBs and the schematic, as they all are now?
This is the power electronics schematic, wired point-to-point:

This is the controller board schematic with current patches:

EDIT: I also have a jumper from the "Regulator switch control" line to the "Spare LED" if that makes any difference. I accidentally picked a pretty high powered LED.

and the controller board PCB:
 
Last edited:
Definitely get rid of C1 on the gate of the FET - power FETs have massive gate capacitance to start with, and trying to direct-drive it from an MCU pin may be overloading it and causing glitches in itself; it needs either a series resistor to restrict the pin current to a safe level, or a power driver of some sort adding.

I also think you need to do some work on the PCB still; the ground planes are broken in islands due to so many long tracks on both sides, so not having much effect.

Quite a few of the topside tracks could be reduced or eliminated by some slight re-arrangements, and the power tracks made significantly wider.

(I have to go out now, I'll try and give some more details later).
 
Definitely get rid of C1 on the gate of the FET - power FETs have massive gate capacitance to start with, and trying to direct-drive it from an MCU pin may be overloading it and causing glitches in itself; it needs either a series resistor to restrict the pin current to a safe level, or a power driver of some sort adding.
The IRL40B209 does claim to be "Optimized for Logic Level Drive", so I didn't think I'd need a power driver. [They don't say if that means TTL or 3.3 V or what.] Ciss, Input Capacitance is specified as 15140 pF. What would be a reasonable value for the series resistor? I'm thinking I want a fast switching time to minimize heating.
I also think you need to do some work on the PCB still; the ground planes are broken in islands due to so many long tracks on both sides, so not having much effect.
I didn't think it would be critical, and since this is just a prototype... Would it make sense to make the top plane 3.3 V instead of GND? I have started working on a next rev.: https://oshwlab.com/carlk3/volt-reg-controller-board-2
Quite a few of the topside tracks could be reduced or eliminated by some slight re-arrangements, and the power tracks made significantly wider.

(I have to go out now, I'll try and give some more details later).
Do you think that is the reason for the glitches I'm seeing on the 3.3 V power line? I tried to use my signal generator to recreate the problem on the bench, but has nowhere near enough drive. I tried putting a -10V 15ns pulse on DF. It turns into -160 mV rebounding to about +100 mV. I can see a slight echo of that on the 3.3 V power line, at around + 60 mV, -16 mV.

Next steps: I'll rework the gate drive of the IRL40B209 by removing C1 and adding a 1K series resistor. I'll tack on some test points here and there, then put the thing back on the car for a long probing session to see if I can trace back the source of the glitch. I'm pretty sure it's coming from DF, but I can't see how it gets from there to B+ and ultimately 3.3 V.

I'm thinking of adding a capacitor or two from DF to GND to try to absorb the spike. Is there any point in putting a schottky there to try to keep DF from spiking negative? There is already a TVS diode and the body diode of the MOSFET.
 
Last edited:
Are you driving the field FET using slow on/off switching, or using PWM?
The outputs on the MCU appear to be rated at 20mA, so you can safely go down to 270 or 220 Ohms, to minimise the FET switching time. That is still very slow due to the high gate capacitance.

It would need a separate gate driver to be able to use PWM at even tens of Hz; I'd not try above 1Hz without that.


If you are re-doing the PCB, try to aim for the ground plane on the top side and minimise the lengths of tracks that interrupt that copper area, so it's as near continuous as possible; plus using as wide tracks as practical for all power interconnections.

I started changing a few bits in the previous version, but I did not get very far; I'm not struck on that web editor - I use the downloaded program. I also did not want to re-arrange components in any significant way as I was not sure of the reasoning for the locations.

Dynamo_Regulator.jpg
 
Are you driving the field FET using slow on/off switching, or using PWM?
The outputs on the MCU appear to be rated at 20mA, so you can safely go down to 270 or 220 Ohms, to minimise the FET switching time. That is still very slow due to the high gate capacitance.

It would need a separate gate driver to be able to use PWM at even tens of Hz; I'd not try above 1Hz without that.
Currently, it is switched on and off as required with respect to voltage, current, and power limits. The fastest it could try to switch with the current firmware is 100 Hz. I don't think that would happen very often, but I might need to put in something to guard against that. Of course, I could easily change the cycle time to 10 Hz or something; it is just a constant in the firmware. I could even make it configurable. Would PWM be better?
If you are re-doing the PCB, try to aim for the ground plane on the top side and minimise the lengths of tracks that interrupt that copper area, so it's as near continuous as possible; plus using as wide tracks as practical for all power interconnections.
What I currently have on the next rev. (https://oshwlab.com/carlk3/volt-reg-controller-board-2) is GND on top and 3.3 V on the bottom. That seems to work well for routing.
I started changing a few bits in the previous version, but I did not get very far; I'm not struck on that web editor - I use the downloaded program. I also did not want to re-arrange components in any significant way as I was not sure of the reasoning for the locations.

View attachment 135887
Thanks. I will look at making the changes in the next rev. (I have only done a quick auto-route so far since the schematic is not frozen yet.)

The main constraints on the component positioning are the size of the MCU board, the SD card socket, and the fuse (and, of course, the locations of the holes).
 
I think I am getting warmer, trying to find the problem causing these glitches on the 3.3 V power line. I added a schottky diode and a couple of capacitors from GND to DF. Then I put the unit on the car and did a thorough probing session. This is the 'scope trace that jumped out at me:
frame - mcu gnd.png

CH1 is the 3.3 V line from the MCU ground
CH2 is the regulator frame to the MCU ground

The yellow line is showing the difference from what ought to be ground to what ought to be ground.

I designed the board with a plated hole on the GND net for a brass standoff to be bolted to the frame:
6OwnsJAkFzx3WmhRijq7XU8boqwTMVI1oSPlI-yWWGLGWkdkahic8E0eqgr-y15EpJ-bZuTN4c6ek4rm2-BeENCJM-ntLq3_yvYbSlSCrX8Po24iPpm9JtR_EgzdSv0kI1IR_QSTprW-Mp1MGyWRGEfRJXrmBiVI1YkvuHLG6khrZJyDPGnyzxFHBVZjtLYzhLc49-iP1vZdzbonvutNvz1iC8L1gu_G7SAtirmDZnhazfxNiiOfk8jDjnX6BlzChk9FpCHh1gNgcbXzNkMIBfM7CBoc9ZWGleVZHJL8npAyOaxh2FKJsdk4Tufvx74xe9aEv1ZWVkuYMkLpDYlMTbcurtkWT00vUPRvqhCFDdLuqkPVhR1IiEhquI6TAkcfdeng6yn8-Mi_WStSqEGgQRgNqzdj_wDFaQCRBXF8utWUOnCZvzwQqNPy04ReYlnYceUhMmZMPJntTCYruHFcCOzABCekfr6V5F3Mw4h4zMOmpPl8rhkKhO_pxyRcQurstb0y9O0K3H3Polji5gLovFGD7Vb0V2DXApa1ItzLg1obk1zv-BO4-YPuPJTIx390yO9x3hETSquabW4LOICOlUdjLX8-JyBL5zZb4ruL-Yjr_oU7aIMsxt4b7JULiGWXASqOzuziBo7urzTCGhgKsFYbNvBhvKHJWMFDOR8FfdZJAOuhfVizk-9bE3Rjqw8zZ_j-9cY3s6VCIvrCHoIkeFci=w475-h633-no

but when I went to assemble the thing I didn't feel like cutting up this ridiculously robust terminal for B+:
_uOt3xywJrmHan7IONLUfEZXIVKsjb2JDyJO9Aj1S2kElco3lcTWpzrmW-ULOsZkC_3Kkt3YkPtkXiKuZYSLfzGC7TZyWr6grVBU1KZuDZx58qPKzCGlep8o4fGBJ47-bRUTlFF8SwvDVqiHWMkNwSruC5N1jeUBM7JNVlzMjSGdNC78IALmhoN-DDs-HRK579saiujgCH3vh1LWztlbebrpR8tEZNeB0hGfBKJ5qhBW0DxIqggOGaf4bd95rSvJlLhrlD42OsOF006Nb-HmS77gZ0P6gl6diUF0jEKf3pwr9sEArl6RV1r1d4Gh2NIPsv6Wrebx0TJxnmWt0uW_A3lCdb3KHJsJi4lz-Izycw4ATOApEuLUcwebVvYKhvK7co1UaMG4bJWZp9yL1RYFRodUpJPaLCMa2A7A8GnkEQ2CJsZAVeAhYmlRy8AsOi-VNRHZQjEdEsLY-h9THr7DMSkHBZOx4iQfUgLQnZyJkbrLCLMv5fJAzvYQQUZjyqg6xtBFkKHQgAlQlmLaMPIqe16PCfRn7pf1r-prCh2AwRV8_DHGa6fwfIsXjzR7HqFsv-RSYeW378m4vKlS2xbRzaa6oXX8Jl7S38uDJMH5p2YDFwK6GyFjalc0lyrtErHZfC1DxVxvDYoCdPTB6XC3y6pnByYdX0jwLbJHB975cheZMuknKTpVrdUxaJihS7OJYngpJNjdZ3gyh-UADsbGwJmx=w475-h633-no

so I skipped that bolted-on ground, which goes right into copper pours on the top and bottom of the board, leaving the only ground being through a 24ish gauge wire with a Molex-type header pin connection to the board. It looks like I have some mechanical/fabrication rework to do.
 
Well, I've tried a bunch of things, and I still can't get the SD card to work reliably. I have gone as far as adding a dedicated 3.3 V regulator for the SD card power. With the engine running I'm lucky if it lasts a minute before getting corrupted.

I now have so much filtering in place that even the voltage at the DF and D+ terminals looks reasonably smooth. I noticed that if I disconnect the RPM input wire from the points the 3.3 V voltage on the SD card looks better, but even with the wire completely removed, the SD card still won't work. I no longer see anything coming into the voltage regulator that would explain the spikes I see at the SD card. Before I added the dedicated LDO regulator for the SD card power, I noticed that the 3.3 V on the MCU board looked much better than the 3.3 V on the SD card*, even though it flows from the MCU board to the SD card. All this is leading me to conclude that I'm dealing with some kind of electromagnetic interference, maybe from the spark plug wires running nearby, or from the generator that the voltage regulator is bolted to.

How can I improve the EMI immunity? As a temporary fix, I'm thinking of relocating the voltage regulator, but ultimately I'd like to keep it in the stock location. I'm thinking shielding might help. I did try putting the metal cover on the voltage regulator, but it didn't seem to cure the problem. (But, it's hard to see how much it helped without being able to get in there and probe around. Later, I realized it has a rubber gasket, and I had been counting on using the hold down screw to ground it, only to realize that the screw is blocked by the mezzanine board that I had added for the new 3.3 V regulator.) I might need to run some kind of shielded cable for the points pickup (and maybe add a resistor at the points end?); it runs parallel to two spark plug wires. How much would it help to go to a 4 layer board with ground and 3.3 V planes in the middle? What else could I do?

* This shows the 3.3 V at the MCU board and the SD card:
3v3 mcu, sd.png

CH1 (bottom) is 3.3 V on MCU board
CH2 (top) is 3.3 V on SD card
 
Last edited:
I'm going to have another go at the Controller Board, and see if a 4-layer board solves my problems:

I was about ready to send off for the Power Board, too, but now I can't find current sensors in stock:
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top