Announcement

Collapse
No announcement yet.

Running a microcontroller in car - power supply aspects

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Re: Running a microcontroller in car - power supply aspects

    download "open camera" for it
    you can get it from f-droid store

    Comment


      Re: Running a microcontroller in car - power supply aspects

      Originally posted by stj View Post
      download "open camera" for it
      you can get it from f-droid store
      Already have it. I got it for when I need the torch to be on at the same time as the camera - the stock camera app doesn't let you do that. The first shot was taken with O/C. The later shot is the stock camera app in "pro" mode so I could mess around with the aperture...
      Wattevah...

      Comment


        Re: Running a microcontroller in car - power supply aspects

        My car battery just died after 6 years of service and I had to push the bastard to get it started yesterday This got me thinking about my project here and how bad the power output must've been when the car was being pushed and I popped the clutch, causing the car to judder really hard a couple of times before it finally turned over - spikes up the a$$...

        Redwire suggested a TVS diode on the input of my regulator from the battery (somewhere in the red circle, in place of ZD5, after the fuse). I had a look at the datasheet myself to better understand what that's for and what it'd do. If I understand correctly, it conducts very little current when the "reverse standoff voltage" across it is less than 15.3v and "breaks down" and conducts when it goes above 17.1v-18v. Is a TVS diode in this configuration used to protect against spikes all the time ("clamping" ?), or is it a single-use device intended to blow the fuse if the input exceeds a "safe" level ? Would it be a good idea to go relatively high with a 1.5KE27A, assuming we take the worst-case breakdown at 28.4v ? It would essentially go right across the battery, so it might not be enough....
        Attached Files
        Wattevah...

        Comment


          Re: Running a microcontroller in car - power supply aspects

          i dount you had any spikes, firstly the battery doubles as a huge cap,
          second, the alternator wouldnt be turning enough to generate anything.

          Comment


            Re: Running a microcontroller in car - power supply aspects

            A TVS diode operates basically as a zener diode, but designed for high energy pulses so they have loose ratings +/-10% and are not precision parts.
            Most transients in a car are from inductive loads- ignition system, blower fan, solenoids, fuel pump, ABS solenoids etc.

            This LDO circuit is proven for powering a small MCU in a vehicle, I've used it on cars and trucks for many years, with zero problems. But it's only good to 50mA before the IC heats up. It would be enough for your Arduino Pro-Mini.

            D1 blocks -ve spikes which can be -150V in a 12V car, -450V to -600V in a 24V truck.
            TVS1 20V clamps +ve spikes to at most 29.1V@21A (Vreg 30V max rating) and does not leak current in cold weather. A bigger 5,000W TVS is 1.5KE20 a little different specs but tougher 27.7V@54.9A.
            Car ECU/anti-lock brake controller etc. uses special 6,600W SM8A27 TVS - which can take 700A spikes, load dump and all that. Seriously tough part.
            BUT polyfuse F1 has some DC resistance that is useful to limit current through the TVS if a huge spike happens. Without some resistance there, the TVS tries to protect the entire car, which is not a good idea due to the possible energy being more than a small diode can take. So the resistance helps a lot.
            Quiescent current of LP2950 is 1mA with 30mA load, down to 0.1mA with lighter loads.
            If you used a LM7805, it's max. input is 25V (use lower 18V TVS but not good in winter) and quiescent current 5-8mA. Some brands need a minimum load of 5mA.

            In the lab, when you test a TVS for car transients, say you hit it with +100VDC impulse most TVS will instantly short. If you have a couple ohms resistance (line wiring+fuse/polyfuse) in series, the TVS diode does not clamp so hard and does not fail.
            Attached Files
            Last edited by redwire; 05-01-2020, 05:43 PM.

            Comment


              Re: Running a microcontroller in car - power supply aspects

              Thanks. This is great stuff to know.
              Originally posted by redwire View Post
              But it's only good to 50mA before the IC heats up. It would be enough for your Arduino Pro-Mini.
              I was really excited to hear this at first, but then realized it may not be enough: I'm also using some ACS712 current sensors to work out the current draw of the windows and know when to stop them when they reach the end of travel up/down. I had a look at the datasheet just now and these have a disappointingly high current draw of 10mA EACH ! This immediately puts an end to my "low-power" requirements. I'll have to power up the sensors only when needed and put them to "sleep" when idling. This shouldn't be too hard, since I can hopefully power them off one of the pins on the arduino directly, take a reading, stop the window if necessary, then cut the power again.

              Originally posted by redwire View Post
              D1 blocks -ve spikes which can be -150V in a 12V car, -450V to -600V in a 24V truck.
              Can this be a 1N4007 ? Mostly out of laziness, since I have plenty on hand already and don't need to source 5s

              Originally posted by redwire View Post
              TVS1 20V clamps +ve spikes to at most 29.1V@21A (Vreg 30V max rating) and does not leak current in cold weather. A bigger 5,000W TVS is 1.5KE20 a little different specs but tougher 27.7V@54.9A.
              Got a bit confused here What am I looking for in a TVS ? The Breakdown figure or the Maximum Clamping figure ? The schematic shows a P6KE TVS, which if I understand correctly has a power rating of 600w and would have to be a P6KE20A variety with a maximum clamping voltage of 27.7v, despite the Br voltage being 19-21v. The math also confirms that 27.7v*22A maximum current = ~600w. The 1.5KE20A is the same thing, but can take more current to go up to 1500w if the formula stands - I don't think it's 5000w like you said, unless I misunderstood.

              Car ECU/anti-lock brake controller etc. uses special 6,600W SM8A27 TVS - which can take 700A spikes, load dump and all that. Seriously tough part.
              BUT polyfuse F1 has some DC resistance that is useful to limit current through the TVS if a huge spike happens. Without some resistance there, the TVS tries to protect the entire car, which is not a good idea due to the possible energy being more than a small diode can take. So the resistance helps a lot.[/QUOTE]
              That diode sounds good, but I'm not sure I can source it. Considering my current "design" employs a glass fuse, which offers no resistance, I could put a small resistor in series with the circuit to account for it. This also answers a question I had in the back of my head this whole time, since this circuit is running straight off the battery and was worried what might happen when the car is jump-started (possibly with reverse polarity, to make it a worst-case scenario) or when it's cranked (in the winter). It's a 1.6L petrol engine, not a diesel, but still takes some current I imagine
              Last edited by Dannyx; 05-02-2020, 05:05 AM.
              Wattevah...

              Comment


                Re: Running a microcontroller in car - power supply aspects

                Originally posted by stj View Post
                i dount you had any spikes, firstly the battery doubles as a huge cap,
                second, the alternator wouldnt be turning enough to generate anything.
                Well that is mostly true but you can have voltage spikes so you do need have something to absorb the voltage spikes and smooth them out over time
                9 PC LCD Monitor
                6 LCD Flat Screen TV
                30 Desk Top Switching Power Supply
                10 Battery Charger Switching Power Supply for Power Tool
                6 18v Lithium Battery Power Boards for Tool Battery Packs
                1 XBox 360 Switching Power Supply and M Board
                25 Servo Drives 220/460 3 Phase
                6 De-soldering Station Switching Power Supply 1 Power Supply
                1 Dell Mother Board
                15 Computer Power Supply
                1 HP Printer Supply & Control Board * lighting finished it *


                These two repairs where found with a ESR meter...> Temp at 50*F then at 90*F the ESR reading more than 10%

                1 Over Head Crane Current Sensing Board ( VFD Failure Five Years Later )
                2 Hem Saw Computer Stack Board

                All of these had CAPs POOF
                All of the mosfet that are taken out by bad caps

                Comment


                  Re: Running a microcontroller in car - power supply aspects

                  Updated the power input part of my schematic. I'm not sure about that inductor+diode jobbie I did there and whether I should leave it in place or drop it entirely. I placed the TVS after it, which I'm not sure is a good idea, since L1 would take the full surge current if the TVS D10 breaks down and conducts.
                  Attached Files
                  Wattevah...

                  Comment


                    Re: Running a microcontroller in car - power supply aspects

                    To me it looks pretty good you have all the inputs to the micro controller isolate from the harsh electrical environment

                    The only thing you are not showing the outputs to your motors now if you are use H bridge controllers you more or less have do the same thing to isolate them from the harsh electrical environment with optic sensors

                    Or

                    If you are using relays you still need to do the same thing
                    Last edited by sam_sam_sam; 05-02-2020, 12:46 PM.
                    9 PC LCD Monitor
                    6 LCD Flat Screen TV
                    30 Desk Top Switching Power Supply
                    10 Battery Charger Switching Power Supply for Power Tool
                    6 18v Lithium Battery Power Boards for Tool Battery Packs
                    1 XBox 360 Switching Power Supply and M Board
                    25 Servo Drives 220/460 3 Phase
                    6 De-soldering Station Switching Power Supply 1 Power Supply
                    1 Dell Mother Board
                    15 Computer Power Supply
                    1 HP Printer Supply & Control Board * lighting finished it *


                    These two repairs where found with a ESR meter...> Temp at 50*F then at 90*F the ESR reading more than 10%

                    1 Over Head Crane Current Sensing Board ( VFD Failure Five Years Later )
                    2 Hem Saw Computer Stack Board

                    All of these had CAPs POOF
                    All of the mosfet that are taken out by bad caps

                    Comment


                      Re: Running a microcontroller in car - power supply aspects

                      Originally posted by sam_sam_sam View Post
                      To me it looks pretty good you have all the inputs to the micro controller isolate from the harsh electoral environment

                      The only thing you are not showing the outputs to your motors
                      True. I'll add the relays as well so we can hopefully work on the EMI suppression there too.
                      Wattevah...

                      Comment


                        Re: Running a microcontroller in car - power supply aspects

                        I'll be using relays for the sake of convenience and because they take up ever so slightly less space and they're cheaper. With an H-bridge I would've had to mess around with duty cycles and....naah

                        I went with 30A relays which is double than the maximum 15A current I measured on one window with my clamp meter (which it reaches only when stalled up or down and is around 7-8A when running freely), but I couldn't find any with 5v coils that would fit a perfboard (leads were too fat), so I had to settle for some 12v ones and use some transistors to interface them with my Mini...or a relay driver, but I'm trying to build this with junk parts I have readily available (still pisses me off to no end that our shop has all sorts of junk lying around, but I don't have access to...).

                        The majority of schematics I've seen use a 1k resistor between the base and the Arduino pin and no pull-down resistor, but I'm not sure what the transistor itself should be and whether I should add a 10k pull-down just to be sure the transistor is turned fully off. A darlington would be a good idea, since the higher hFe allows me to push more collector current with minimal base current.

                        TVS diode and capacitors added to motors as per Redwire's suggestion in post #71. Not sure what that TVS should be and what sort of EMI can be expected there. The case of the motor is not grounded AFAIK, since it's on a plastic mount inside the door which doesn't have a GND connector to begin with, other than the hinges.
                        Attached Files
                        Wattevah...

                        Comment


                          Re: Running a microcontroller in car - power supply aspects

                          You do not need a pull-down resistor on the base in this application because you are switching at a low frequency, basic on-off controls. 1k resistors in series with the base will give ~4mA base current, which, multiplied by the gain of any bog standard NPN, is more than enough to drive a relay coil. There is absolutely no need for a Darlington type in this application.

                          Transistors can be anything as long as the collector current rating is adequate. The typical resistance of a relay coil is 300-400 ohms which gives a maximum current of ~50mA. As you can see, pretty much any common transistor will work. 2N3904 will be more than enough.
                          Last edited by Th3_uN1Qu3; 05-04-2020, 05:55 AM.
                          Originally posted by PeteS in CA
                          Remember that by the time consequences of a short-sighted decision are experienced, the idiot who made the bad decision may have already been promoted or moved on to a better job at another company.
                          A working TV? How boring!

                          Comment


                            Re: Running a microcontroller in car - power supply aspects

                            The good news is that I managed to score that LP regulator IC and the TVS diodes locally for cheap Just got back with them now....the only downside is that the chap had anything BUT the 1.5KE20 type, so I got the next value up and down - the 18 and the 22
                            Attached Files
                            Wattevah...

                            Comment


                              Re: Running a microcontroller in car - power supply aspects

                              The inductor+diode is not essential, it is OK in some circuits but you need a scope to really see how HF noisy the car is. I would delete it to keep it simple (sorry), and just use 1N4007 and TVS and a polyfuse are going to work, even if you boost the car or pop the clutch with a low battery. I know this as fact because I had jr. engineers do a 24V truck 5V power supply that died on every truck, customers were really pissed. Jr. engineer used an 0805 MOV for "automotive use" and thought he was covered lol. It was a recall and warranty claims. I added a 1.5KE33 to fix that.

                              The TVS has a breakdown voltage spec. given by when it just starts to conduct, say at 1mA.
                              For Littelfuse P6KE20A this is 19-21V at room temp. and at -40C 18-20V. Note ST, Vishay, Diodes inc parts can have slightly different specs. Non "A" part is looser +/-10% tolerance and 5% higher clamp V.
                              The TVS clamps to 27.7V with a 22A peak pulse current, so I make sure this is below the Vreg's maximum OR there is some line resistance or polyfuse resistance to lower the spike current. Even 1 ohm helps a lot but this usually burns instead of the fuse, so I get it from a polyfuse. Lowest I go in a 12V car that goes through cold winter is P6KE18A.

                              It's too bad these chinese 5V buck converter modules seem to all be crappy for quiescent current drain. I wonder if any car phone chargers do any better, if you have some to measure. It might be better to use a lower current module, as switching 3A mosfets is not efficient for say 10mA load. You can power the hall current sensors only when the motor is being run.

                              Comment


                                Re: Running a microcontroller in car - power supply aspects

                                Originally posted by redwire View Post
                                The inductor+diode is not essential, it is OK in some circuits but you need a scope to really see how HF noisy the car is. I would delete it to keep it simple (sorry), and just use 1N4007 and TVS and a polyfuse are going to work, even if you boost the car or pop the clutch with a low battery
                                Forgot to buy some poly-fuses today too LOL I'll probably end up dropping the coil+diode, since it's too complex a thing to know if it truly helps or just takes up board space....

                                Originally posted by redwire View Post
                                The TVS clamps to 27.7V with a 22A peak pulse current, so I make sure this is below the Vreg's maximum OR there is some line resistance or polyfuse resistance to lower the spike current. Even 1 ohm helps a lot but this usually burns instead of the fuse, so I get it from a polyfuse. Lowest I go in a 12V car that goes through cold winter is P6KE18A.
                                Seems the two types I got both ride the line either up or down. The 18A could break down too easily and "false-trigger", while the 22A clamps a bit over the 30v limit of the LP2951, though I think I'll go with this one in the end. Tolerances are to be expected here too, as you pointed out....only one way to find out and that is to stress-test and see if something goes pop

                                Speaking of polyfuses. Had a look here and the trip time seems awfully high at 3-4s...unless I'm missing something and that's actually OK....

                                Originally posted by redwire View Post
                                I wonder if any car phone chargers do any better, if you have some to measure
                                Yes, I actually have one on hand - came free with something else I keep it in the glove box for emergency use. Never actually used it, since not only I'm not too confident in entrusting my S10+ to that thing, plus I only drive for like 10 minutes at most until I arrive at my destination and never go for long drives. The ol' junker's 13 years old now and she's only got 60k-ish KMs on the clock. She ain't no head-turner, but sure looks brand new. I still amaze people when I tell them she's soon turning 14

                                Originally posted by redwire View Post
                                It might be better to use a lower current module, as switching 3A mosfets is not efficient for say 10mA load
                                That's why I got that LP2951 you suggested, though I still worry about the current draw of the current sensors. I'll probably be able to shave off a few mA by removing their LEDs too.

                                Originally posted by redwire View Post
                                You can power the hall current sensors only when the motor is being run.
                                I'll do that, since according to the datasheet the "set-up" time is only a few uSeconds, so it shouldn't "miss" any events even if had just freshly "woken up". I'll power them from the same pin as the transistors for the relay, OR add another pin in code that comes on whenever the windows do stuff either up/down. I'd show you the code, but it's such a sh!t-fest in there that I'd be the laughing stock of the entire community
                                Last edited by Dannyx; 05-04-2020, 04:17 PM.
                                Wattevah...

                                Comment


                                  Re: Running a microcontroller in car - power supply aspects

                                  windows will be replaced by force-fields before you complete this - just build the prototype and test it!

                                  Comment


                                    Re: Running a microcontroller in car - power supply aspects

                                    Originally posted by stj View Post
                                    windows will be replaced by force-fields before you complete this - just build the prototype and test it!
                                    +1

                                    There's a saying: "time to shoot the engineer" (and get on with building the damn thing!)

                                    Comment


                                      Re: Running a microcontroller in car - power supply aspects

                                      *apply ice to burned area* >_> I know it's been years since I started discussing this, but time was scarce and I'm in no hurry It's only because I've been on this forced leave that I got around to actually doing it, since it would've still been in breadboard stage otherwise - no energy to do anything at work. It also gives me time to gather as much info as possible so I can solder ONCE and use many, instead of the other way around hopefully Trial and error will also play a part in this too, of course.
                                      Wattevah...

                                      Comment


                                        Re: Running a microcontroller in car - power supply aspects

                                        Just had a go with the LP2951 on a breadboard to see how it works and indeed it does. I built the simplest circuit possible based on the block diagram on page 2. At first I didn't realize just how important that 1uF cap on the output is. I didn't install it at first and got a wild 10v output, which made me think I broke it right away I then double checked everything and eventually added that cap, which instantly brought my output to the desired 5v ! This also got me thinking about that cap which will be cooking in the car and since it's so important, my output could go nuts if it fails....Still, it works for now.

                                        Also updated schematic.
                                        Attached Files
                                        Last edited by Dannyx; 05-06-2020, 06:40 AM.
                                        Wattevah...

                                        Comment


                                          Re: Running a microcontroller in car - power supply aspects

                                          Originally posted by Dannyx View Post
                                          Trial and error will also play a part in this too, of course.
                                          By actually (attempting to) building it, you will "discover" issues that you hadn't imagined.

                                          One of my first products was a remote display for use on boats ("Where are we, presently?"). I was extremely cautious to not expose myself to ridicule by screwing up such a "simple" design. Boss encouraged me to just release it to manufacturing -- instead of prototyping it (it was REALLY a trivial design).

                                          When I tested the first unit off the line, the power switch didn't work -- the display was always ON! Unlikely that the switch was broken (but, I checked that). Did I make a mistake in the PCB layout and effectively short the switch ON? No.

                                          It turns out, the design used so little power that the data line terminations could power the electronics even when the "main" power had been interrupted. When we discussed the problem in the department, everyone was stunned at the "diagnosis" -- no one would have considered that as an issue in the design because we were all used to circuits requiring considerably more power to operate!

                                          Comment

                                          Working...
                                          X