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.
Whichever MCU you use, I'd add a precision voltage reference (2.5V ?) so the ADC readings are consistent rather than being proportional to the device supply voltage.

Most automotive sensors are ratiometric which is, in effect, better. You just have to be aware and be ratiometric to the right voltage.
 
I found a little more information about the Clover Systems regulator, which no longer is available, as far as I can tell.

From the DRM Electronic Dynamo Regulator INSTRUCTION MANUAL:

In the DRM, the output voltage of the generator is compared to a precision
voltage reference. When the generator output exceeds this reference, the
current to the field coils is cut off. This causes the generator output to fall.
When the output falls below the reference voltage, the field current is turned
back on. In this way, the field current is modulated at a rate of 50 – 125 Hz.
These rapid changes are smoothed out by the inductance of the field coils, thus
maintaining a constant output voltage.
Current limiting is accomplished in the same way. Output current is sensed
with a Hall-Effect device that detects the magnetic field created by the output
current. When the output current exceeds a preset limit, the field current is
turned off. Just as with the voltage regulation, the field current is modulated to
maintain a constant output current.
Instead of a cut-out relay, DRM uses a MOSFET “ideal diode”, which is much
more efficient than Schottky diodes. Power is supplied whenever the dynamo
output voltage is greater than the battery voltage, rather than a pre-set voltage as
in the mechanical regulator.

1602258677853.png


So, they used a Hall-Effect current sensor and a MOSFET “ideal diode”.
 
...

Personally, I'd use a mid-range PIC as the controller; they have all the facilities needed and you can get a PCB made at JLCPCB, with a surface mount PIC ready assembled (along with any other surface mount parts).
...
JLCPCB looks like a great service! Do you use EasyEDA?
 
Going back to the design, I think it makes sense to start by picking the MCU, since some of the peripherals might depend on that. (However, I'd like to keep the design modular enough that it could [relatively] easily be ported to another MCU.)

I've looked at a few options, and I'm still open to suggestions. Here is what I've looked at so far:

STM32G431KB (Datasheet):
  • More than enough processing power and memory: Arm® 32-bit Cortex®-M4 CPU
  • Plenty of GPIOs: Up to 86 fast I/Os
  • Plenty of ADCs: 2 x ADCs 0.25 µs(up to 23 channels). Resolution up to 16-bit with hardware oversampling, 0 to 3.6 V conversion range
  • 4 x ultra-fast rail-to-rail analog comparators
  • 3 x operational amplifiers
  • Internal voltage reference buffer (I'm not sure what this is. Can it provide a reference voltage for the ADCs?)
  • Good price: $5.50 in quantity 1 from Mouser
  • Operates in the -40 to +85 °C (+105 °C junction) and -40 to +125 °C (+130 °C junction) temperature ranges from a 1.71 to 3.6 V power supply
  • Development board: STM32 Nucleo-32 development board with STM32G431KB MCU, supports Arduino nano connectivity. ($12)
    • The STM32 Nucleo-32 board does not require any separate probe as it integrates the ST-LINK debugger/programmer.
    • The USB port could be used for attaching a terminal for configuring the voltage regulator.
Teensy 3.2:
  • 32 bit ARM processor.
  • Plenty of flash and RAM
  • 2 x ADCs, 21 channels, 16 bit
  • 3 comparators
  • All programming is done via the USB port.
  • Compatible with Arduino Software & Libraries
    • This might be an advantage for other hackers that are familiar with Arduino
  • Reasonable price: $19.80
  • Temperature range? Chip says "MX20DX256"; not sure what that is.
PIC18F26K80:
  • 8 bit processor
  • 12-bit ADC, 8-11 channels
  • Very low price: $3.01 in quantity 1
  • Two built-in precision voltage references
  • Requires a probe for programming
  • Temperature measurement using on-chip diode channel
  • Ambient temperature under bias: -40°C to +125°C
  • Development board? (PIC18 Explorer Board) (PICDEM 2 Plus)
To me, the STM32G431KB looks like the Cadillac, but it is very affordable. For the first iteration, I'd like to use that STM32 Nucleo-32 development board (User Manual), since it has the USB port, oscillator, and other supporting electronics. I like the idea of getting a PCB made at JLCPCB, but I'm considering starting with one that has a socket for the NUCLEO-G431KB board, just to make it easier to get started. Heh, the NUCLEO-G431KB has an Arduino™ Nano V3 expansion connector; maybe one could plug a Teensy 3.2 into the same socket.

I also have been working a lot with ARM Cortex-M4, so it is familiar to me. I built a datalogger on one (carlk3/FreeRTOS-FAT-CLI-for-PSoC-63 ), and I have some ideas about putting an SD card into the voltage regulator so that I could collect data from real-world testing. Which leads to even crazier ideas, like adding more sensors to make a sort of flight data recorder (black box).
 
Fairly obviously the 18F PIC you've listed there is a LOT cheaper than the others, a LOT easier to use (as it's presumably through hole), but also still has far more power than you need for such a low requirement as this project.

My 18F of preference is the 18F27K42, which has plenty of peripherals, loads and loads of memory, is cheap, and comes in 28 pin skinny DIP for easy use.

32 bit ARM processors seem somewhat massively over kill :D
 
Fairly obviously the 18F PIC you've listed there is a LOT cheaper than the others, a LOT easier to use (as it's presumably through hole), but also still has far more power than you need for such a low requirement as this project.
Well, I'm looking at extremely low volume production here. To use the PIC, wouldn't I need something like the MPLAB ICD 4 In-Circuit Debugger? That's $57.95 USD. The STM32 Nucleo-32 development board has the ST-LINK debugger/programmer on board, so all I should need is a PC and a USB cable.

Also, (something I should probably add to my high level design) I'll need some kind of user interface for configuration of the voltage regulator (and maybe diagnostics, etc.) The Nucleo-32 has a UART and the USB port, so, again, all I need is a PC and a USB cable.

My 18F of preference is the 18F27K42, which has plenty of peripherals, loads and loads of memory, is cheap, and comes in 28 pin skinny DIP for easy use.

32 bit ARM processors seem somewhat massively over kill :D
That 18F27K42 does look like a very capable device. I agree that a 32 bit ARM processor is massive overkill, but it's easy to use (in the form of the Nucleo-32) and I can afford it.
 
Well, I'm looking at extremely low volume production here. To use the PIC, wouldn't I need something like the MPLAB ICD 4 In-Circuit Debugger? That's $57.95 USD.

No, just a PICKit3 or PICKit 4.

Also, (something I should probably add to my high level design) I'll need some kind of user interface for configuration of the voltage regulator (and maybe diagnostics, etc.) The Nucleo-32 has a UART and the USB port, so, again, all I need is a PC and a USB cable.


That 18F27K42 does look like a very capable device. I agree that a 32 bit ARM processor is massive overkill, but it's easy to use (in the form of the Nucleo-32) and I can afford it.

You could use an Arduino Nano, for small and cheap, and no programmer required.
 
No, just a PICKit3 or PICKit 4.
Well, that's still $57.95.
You could use an Arduino Nano, for small and cheap, and no programmer required.
Both the NUCLEO-G431KB and the Teensy 3.2 have an an Arduino Nano V3 connector, so maybe they could be (somewhat) swappable with a real Arduino. But the NUCLEO-G431KB is $12, cheap enough, and roughly the same form factor. I've been programming in C/C++ for decades, and I don't really want to use the Arduino scripting language, but I could see where others might prefer that.

Now, for a crazy idea: there is the Cypress PSoC 6 BLE Prototyping Kit (CY8CPROTO-063-BLE) which is again Arm® Cortex®-M4F, includes a royalty-free BLE stack compatible with Bluetooth 5.0, and contains an on-board Programmer and Debugger, for $20. I wonder if Bluetooth Low Energy could radiate through the metal can of the stock voltage regulator? I guess it wouldn't be too hard to replicate the cover in plastic, or stick a little antenna somewhere. It would be neat to be able to configure the regulator with your phone; view statistics, etc.
 
Hello everyone,

I got pulled off on some other projects (a couple even paying!), but now I am turning my attention back to this. I'll try to jump start the discussion by posting a schematic:

Schematic_Volt Reg_2021-10-03.png


I have shared the EasyEDA project: https://oshwlab.com/carlk3/volt-reg

I am interested in your thoughts on this:
  • Why won't it work?
  • How can I make it more robust? Specifically, in the face of:
    • Electrical noise
    • Heat
    • Vibration
    • Dummies with 12v jumper cables
    • Batteries falling through rust holes and shorting out
  • How can I make it easier to build? Should I get a PCB made? Switch to SMT components (at least for simple parts), and have the SMT components populated?
  • I was just guessing at a lot of the part selections and component values.
This is intended to be a prototype, so I'm using an evaluation board for the MCU (gives me the ability to program and debug over a USB cable), and I've tried sticking an SD card on there for data logging so I can gather some data about the performance of the prototype on the road. Also, the MCU can easily go down to µA or nA in its sleep modes, and can run from a 1.71 V to 3.6 V power supply, but the NUCLEO-L412KB demo board has different needs, so the "production" version will probably need the power supplies reworked. I imagine I'll have some significant parasitic current draw with those LD1117s connected to the car battery all the time.
 
You need to look at the gate drive for Q2; as it is, it can never turn on - the gate needs to be a few volts positive of the source when on & equal to the source when off.
Possibly use a P channel FET plus a smaller transistor switching the gate to ground, & pullup resistor to source?

It will also need a diode from J3 to D+, a "flywheel diode" across the field coil output, to avoid damage to Q1. Preferably a big schottky that can stand the field current.

To reduce standby power, you could use a regulator that has a shutdown pin to power all the non-MCU stuff? Or add another P channel FET in the power connection from the MCU reg to the battery sense and other reg, so they can be shut off.
 
You need to look at the gate drive for Q2; as it is, it can never turn on - the gate needs to be a few volts positive of the source when on & equal to the source when off.
Possibly use a P channel FET plus a smaller transistor switching the gate to ground, & pullup resistor to source?

It will also need a diode from J3 to D+, a "flywheel diode" across the field coil output, to avoid damage to Q1. Preferably a big schottky that can stand the field current.
Thanks! How's this, then?
Schematic_Volt Reg_2021-10-05.png

(Latest version is at https://oshwlab.com/carlk3/volt-reg)
To reduce standby power, you could use a regulator that has a shutdown pin to power all the non-MCU stuff?
The quiescent current of the LD1117s is 5-10mA, which isn't horrible for the prototype, but reducing it would be nice.
Or add another P channel FET in the power connection from the MCU reg to the battery sense and other reg, so they can be shut off.
Or, maybe I could move all the ground connections for the power supplies and the B+ voltage sense to an N channel FET gated by the ignition switch?

Of course, that might affect the B+ voltage sense accuracy. Maybe I could double (or more?) the resistances in the voltage divider and leave it connected straight to B+? Maybe add a filter cap? I guess I need to consider what the ADC in the MCU is referencing to.
 
That looks OK, but I forgot about the FET diode - a single one as it is arranged will allow reverse current from the battery to the dynamo..

You would have to use two back-to-back (sources and gates commoned) for total isolation, or just reverse source and drain - MOSFETS conduct in both directions, as long as the gate-source voltage is present. That would never cut off the dynamo output from the battery, but the field control should minimise any residual output.
 
I found a couple of LDO with enable regulators that look like they might work: KEC KIA78R33PI and KIA78R05PI. Alternatives considered: ROHM BA033CC0WT and BA05CC0WT or BA33DD0WT and BA50DD0WT.
That looks OK, but I forgot about the FET diode - a single one as it is arranged will allow reverse current from the battery to the dynamo..

You would have to use two back-to-back (sources and gates commoned) for total isolation, or just reverse source and drain - MOSFETS conduct in both directions, as long as the gate-source voltage is present. That would never cut off the dynamo output from the battery, but the field control should minimise any residual output.
Makes sense. Thanks.

How does this look:
Schematic_Volt Reg_2021-10-05 (2).png
 
That looks OK, but I forgot about the FET diode - a single one as it is arranged will allow reverse current from the battery to the dynamo..

You would have to use two back-to-back (sources and gates commoned) for total isolation, or just reverse source and drain - MOSFETS conduct in both directions, as long as the gate-source voltage is present. That would never cut off the dynamo output from the battery, but the field control should minimise any residual output.
Thinking about this some more... Besides trying to make an "ideal diode", there is the notion of "cut in voltage". On my old regulator, the spec. is 6.2-6.8v. Of course, the voltage probably droops once it's cut in, but there is a huge amount of hysteresis: the reverse current (at cut out) is spec'd at 2-5.5 amps! (That reverse current is something I'd like to avoid.)

For my Optima AGM battery, the spec. for charging is "Alternator: 6.65 to 7.5 volts, no amperage limit."

At https://www.powerstream.com/SLA.htm, it says "Anything above 2.15 volts per cell will charge a lead acid battery, this is the voltage of the basic chemistry. This also means than nothing below 2.15 volts per cell will do any charging (12.9V for a 12V battery)", which would be 6.45v for a 6v lead-acid battery.

I really don't know how important "cut in voltage" is. Maybe I should add the second MOSFET. Have to think about the case of a very discharged battery that pulls down the voltage after cut in.
 
On a mechanical regulator, the cut-out contact allows current both ways. The cut-in voltage and reverse current system is to prevent the battery being drained by the dynamo at low revs.
You don't have that problem with the the electronic version.

I'd run the regulator switch from the MCU; the ignition & voltage sense signals are there regardless, so you can control the whole thing as needed then.
(Plus the regulator would turn off when you force the ignition lamp on, as shown).

Re. the protection you mentioned earlier, you could add relatively large VDRs (eg. Zenamics) at each external terminal to help suppress transient spikes.

I also just realised R7 is now in the wrong place, I only glanced at it last time. R7 should be to ground to hold the Q2 off with no signals, and the FET needs a resistor between gate and source to hold that off unless turned on.

You could add overvoltage protection there, to prevent a spike damaging the FET gate; a low value series resistor between Q2 and the gate and a zener across gate & source to clip the gate voltage; eg. 10V.

I remember from somewhere than 12V vehicle electronics are supposed to be rated to stand 60V transients!
 
On a mechanical regulator, the cut-out contact allows current both ways. The cut-in voltage and reverse current system is to prevent the battery being drained by the dynamo at low revs.
You don't have that problem with the the electronic version.
I don't know enough about batteries to know if there's any harm in flowing current to a battery at a voltage less than that at which it can accept a charge. It could be that's a bug, not a feature: e.g., maybe it would help to warm up a cold battery. I was thinking I could kinda emulate the original regulator and cut in at a specified voltage, but once cut in, stay cut in until the Hall effect sensor shows a reverse current (but I would cut out at any reverse current, not wait for -2-5.5A). But that's all a "simple matter of programming" and could be configured later (if I add a second FET).

If the MCU could force total isolation (cut out), that might be useful in other ways: e.g., fault scenarios.
I'd run the regulator switch from the MCU; the ignition & voltage sense signals are there regardless, so you can control the whole thing as needed then.
(Plus the regulator would turn off when you force the ignition lamp on, as shown).
D'oh! I didn't really think that all the way through, did I? But, if I control the MCU's power supply regulator from the MCU, don't I have a bootstrap problem? Maybe I need to do both, with a diode OR at the ON switch of the 5v regulator. When the ignition switch is turned on, the power supply turns on and powers the MCU, and the MCU can then use a digital I/O pin to latch the power supply ON until it is done with it. (Bonus: allows for some kind of orderly shutdown sequence, if needed.)

Unless I stick a LiPo battery or something in there...
Re. the protection you mentioned earlier, you could add relatively large VDRs (eg. Zenamics) at each external terminal to help suppress transient spikes.
I will have to educate myself about those. I've been looking at Transient Voltage Suppressor (TVS) diodes, e.g.: ON Semiconductor 500 Watt Peak Power MiniMOSORB Zener Transient Voltage Suppressors (one example of many).
I also just realised R7 is now in the wrong place, I only glanced at it last time. R7 should be to ground to hold the Q2 off with no signals,
Thanks, I'll fix that.
and the FET needs a resistor between gate and source to hold that off unless turned on.
I think that's what I had until I flipped source and drain to avoid the current drain problem. So, R7 just needs to move, right?
EDIT: Oh, I need to add another resistor so I have one between the FET gate and source, and another pulling Q2 base to ground.
You could add overvoltage protection there, to prevent a spike damaging the FET gate; a low value series resistor between Q2 and the gate and a zener across gate & source to clip the gate voltage; eg. 10V.
Sounds like a very good idea. Say, 100Ω? Maybe a TVS zener?

Also, I've been thinking that the D+ power must be dirty, dirty. I can watch the sparks fly from the carbon brushes on the commutator. And talk about inductive... I wonder if adding a capacitor or two from D+ to ground would help that situation? And maybe a TVS?

I remember from somewhere than 12V vehicle electronics are supposed to be rated to stand 60V transients!
I think a common problem is the "current dump", which happens then the car is going down the highway and the battery decides to open up (or the terminal falls off, etc.) The alternator regulator is slow to respond and there is a big, long, high-voltage, high-current surge. Luckily, my generator is pretty anemic and can barely raise 25v on an open circuit with DF shorted to ground. And, from the point of view inside the regulator, we're in charge of regulating any surges!
 
Last edited:
OK; I was thinking the MCU power (and not the other reg) could be left on all the time & just put the MCU to sleep until the ignition was turned on to wake it.
It's not a good idea to have the voltage sense signals feeding in to an unpowered device; it can cause damage.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top