Announcement

Collapse
No announcement yet.

Running a microcontroller in car - power supply aspects

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

    #61
    Re: Running a microcontroller in car - power supply aspects

    Remember my EE mantra I keep preaching- "the fuse always comes first" - not after a bunch of stuff. You don't want the fuse after the 5V SMPS- if it has failed and the zener clamps, the SMPS will smoke and then what fuse is there? the 30A one?

    I still like the series reverse-diode because the car cannot discharge the 680uF cap.

    A 5.6V 5W 1N5339B zener clamps near 6V anyhow, I don't know if a ATmega328 would survive. I would not bother with the ZD7 protection on the 5V, if the 5V SMPS is dead then everything is dead.

    Comment


      #62
      Re: Running a microcontroller in car - power supply aspects

      Originally posted by redwire View Post
      Remember my EE mantra I keep preaching- "the fuse always comes first" - not after a bunch of stuff. You don't want the fuse after the 5V SMPS- if it has failed and the zener clamps, the SMPS will smoke and then what fuse is there? the 30A one?
      There IS a second 1A fuse in there after the 30A one (which is the automotive one already in the car's fuse box). I'm not sure how an LM buck regulator like that fails. Does it short to GND, blowing that 1A fuse, or does it become a wire, sending the input into the output ? If it's the first, then the 1A fuse should go. My "work" on the 5v output had been to protect against the second scenario.

      Originally posted by redwire View Post
      I still like the series reverse-diode because the car cannot discharge the 680uF cap.
      You mean post #9 ? THIS ?

      Originally posted by redwire View Post
      A 5.6V 5W 1N5339B zener clamps near 6V anyhow, I don't know if a ATmega328 would survive. I would not bother with the ZD7 protection on the 5V, if the 5V SMPS is dead then everything is dead.
      No, from what I read, 5.5v is the max you can hit an arduino with. That's why I currently have a 5.1v zener in there and that 82ohm resistor. It works, though I could probably get rid of the resistor entirely and lower the output of the buck regulator back down to 5v-ish, since it's currently at 6v to allow that zener to actually "work", so it's a regulator after another regulator, which I'm not sure how useful/practical it is...
      Attached Files
      Wattevah...

      Comment


        #63
        Re: Running a microcontroller in car - power supply aspects

        if your using the small chinese buck modules, i put a 5w zener across the output to throw them into a shutdown state.
        i trust the electronics, but not the tiny pot on them - infact i now like to replace the pot with a fixed resistor.

        Comment


          #64
          Re: Running a microcontroller in car - power supply aspects

          Originally posted by stj View Post
          if your using the small chinese buck modules, i put a 5w zener across the output to throw them into a shutdown state.
          That would be ZD7 ? Would a fuse before it be a good idea ? It'd blow if the diode clamps. Without it, the diode would keep sinking I think.

          Originally posted by stj View Post
          i trust the electronics, but not the tiny pot on them - infact i now like to replace the pot with a fixed resistor.
          Good idea in fact.
          Wattevah...

          Comment


            #65
            Re: Running a microcontroller in car - power supply aspects

            I noticed some errors in my schematic, so here it is again. I also uploaded the KiKad file in case someone wants to mess around with it. Cheers !
            Attached Files
            Wattevah...

            Comment


              #66
              Re: Running a microcontroller in car - power supply aspects

              Originally posted by redwire View Post
              Remember my EE mantra I keep preaching- "the fuse always comes first"
              I was caught off guard when working with a Variac where this statement is wrong or at least must be carefully revised...

              Comment


                #67
                Re: Running a microcontroller in car - power supply aspects

                Another decision I made is to go with traditional relays for controlling the motors rather than with an H-bridge. It's cheaper and simpler, but messier. I got myself a couple of ungodly relays and plan on using those to create a basic changeover arrangement to switch polarity.

                I'll have to add some form of arc suppression across their contacts + a transistor to drive the coils, since they're 12v and the arduino can't drive them directly.
                Wattevah...

                Comment


                  #68
                  Re: Running a microcontroller in car - power supply aspects

                  Originally posted by eccerr0r View Post
                  I was caught off guard when working with a Variac where this statement is wrong or at least must be carefully revised...
                  Where a source of power is, always a fuse first - to prevent fire. No if's and's or but's. Any feed or branch circuit always has a protective element first.
                  A Variac with lone fuse after it does not give coverage for the Variac failing causing bonfire. It could somewhat protect it from output overload but not input overload. You would be surprised how many EE's are stupid and have no fuse anywhere, I think it's (fuses) actually a 4th year University course lol.

                  Originally posted by Dannyx View Post
                  [...] I'll have to add some form of arc suppression across their contacts + a transistor to drive the coils, since they're 12v and the arduino can't drive them directly.
                  I used changeover relays for my power door locks, they are tougher than any H-bridge and I had no regrets. Just a bit big but oh well.
                  A snubber or TVS across the motor will protect the contacts and I would add a couple EMI caps so the Arduino does not crash when the relay contacts spark, as they always do to some extent. If the relays are close to the Arduino it can crash due to the EMI from the contacts.
                  A ULN2003 is a good relay driver or just use discrete transistors.

                  Comment


                    #69
                    Re: Running a microcontroller in car - power supply aspects

                    I guess there are fake LM2596 boards out there. The IC runs at 50kHz, not 150kHz and put in a 1k resistor instead of the pot, for 5V out.
                    My main worry would be if the mystery IC can run at 30V input (during a spike). I would bench test the module first. The zener on the output with a 1A fuse I think will protect the Arduino if the module shorts and gives say 12V for a while.
                    Last edited by redwire; 04-24-2020, 01:12 PM.

                    Comment


                      #70
                      Re: Running a microcontroller in car - power supply aspects

                      Originally posted by redwire View Post
                      Just a bit big but oh well.
                      Yes - big indeed, especially at this high current.
                      Originally posted by redwire View Post
                      A snubber or TVS across the motor will protect the contacts
                      R+C snubber like this ?
                      Originally posted by redwire View Post
                      and I would add a couple EMI caps so the Arduino does not crash when the relay contacts spark, as they always do to some extent. If the relays are close to the Arduino it can crash due to the EMI from the contacts.
                      I was just thinking of that and yes, the arduino will be right next to the damn things, so I'll definitely have to do this. Where does this go ? Across the motor's terminals ?
                      Wattevah...

                      Comment


                        #71
                        Re: Running a microcontroller in car - power supply aspects

                        Maybe something like this sketch as a starting point.
                        For EMI, it depends on the motor's wiring (long run or not) and if the metal housing is grounded. The brushes arcing can make EMI as well.
                        I think a bi-directional TVS will limit the back-EMF from the motor and the relay contact arcing will be small.
                        Attached Files

                        Comment


                          #72
                          Re: Running a microcontroller in car - power supply aspects

                          Good pointers on those caps and diode, though I went with a different approach to switching direction: I used a DPDT relay. The caveat is that I now need a second "master" relay to cut the incoming power, since the DPDT relay has no "off" state - it just crosses the + and -, so it'd always run one way or the other. The relay count would be the same (4 - 2 for each window), but I ended up going with your design instead, since 4 SPDT relays are smaller than two DPDTs.
                          Wattevah...

                          Comment


                            #73
                            Re: Running a microcontroller in car - power supply aspects

                            the advantage is you only power 1 relay to move the window, regardless of direction

                            Comment


                              #74
                              Re: Running a microcontroller in car - power supply aspects

                              Originally posted by redwire View Post
                              I guess there are fake LM2596 boards out there. The IC runs at 50kHz, not 150kHz and put in a 1k resistor instead of the pot, for 5V out.
                              My main worry would be if the mystery IC can run at 30V input (during a spike)
                              My buck converter doesn't even have an LM on it - it's a XL4005E1 so this should be interesting
                              Attached Files
                              Last edited by Dannyx; 04-25-2020, 03:15 AM.
                              Wattevah...

                              Comment


                                #75
                                Re: Running a microcontroller in car - power supply aspects

                                It looks not bad, many chinese DC-DC have a 1A diode which quickly cooks.
                                Arduino Nano uses about 20-35mA, so I wonder about using a 5A buck converter? If it is OK with light loads and regulates OK- but it might waste power.
                                I think the spec. limit for a car is about 70mA quiescent drain before the battery goes dead when the car is parked for a few weeks. Subaru firmware bug made their ECU use 150mA, which quickly wore out and killed the car's battery and pissed off all the owners who had to buy a new battery.

                                You can put the Nano to sleep and wake it up if IGN is on. The USB IC apparently draws most of the current.
                                I use a small LDO LP2950 for my MCU car projects, and the bigger 5A TPS40057 modules for USB car charging cell phones. Those use about 50mA (with LED) at rest.

                                Comment


                                  #76
                                  Re: Running a microcontroller in car - power supply aspects

                                  Originally posted by redwire View Post
                                  Arduino Nano uses about 20-35mA, so I wonder about using a 5A buck converter? If it is OK with light loads and regulates OK- but it might waste power.
                                  It's actually an Arduino Pro Mini - KiKad doesn't have a Pro Mini model so I just used whatever it had close, that's where you probably got the idea. I do have some smaller buck regulators too, but I'd probably have to add some electrolytics to it (both on the input and output) and I'm not sure how well those survive in a car where it can get very hot in the summer...

                                  Originally posted by redwire View Post
                                  You can put the Nano to sleep and wake it up if IGN is on. The USB IC apparently draws most of the current.
                                  No USB IC on the Pro Mini and I also had a look at THIS. I removed the LED and the regulator, but have not had a go with that sleep library. My hope is that it won't affect any of the functions running on it...
                                  Wattevah...

                                  Comment


                                    #77
                                    Re: Running a microcontroller in car - power supply aspects

                                    I would measure your 5V buck-converters and see if they are OK for low current use. Or change the Vreg IC to something low power and high enough input voltage to take transients in a car. The Pro-Mini LDO MIC5205 is a max. 20V input which is too low for a car, even with a clamp TVS. An 18V TVS clamps to 25V.

                                    Comment


                                      #78
                                      Re: Running a microcontroller in car - power supply aspects

                                      Not having the knowledge and tools (scope) to do in-depth analysis, the most basic check I did on them was measure the idle current draw, with nothing connected to the output, an input voltage of 12v and the output set to 5v. The smaller green ones were slightly disappointing, at least out of the box: the output is a full volt lower than what you set it to and the current draw is 10mA. These have some solder pads on the bottom which you bridge to set a fixed output voltage, so I bridged the ones for 5v and only got 4v. Not sure whether this can be improved by adding a beefier cap on the output or tweaking those resistors. There IS an "ADJ" setting as well, which inserts a small trimmer pot into the feedback loop in place of fixed resistors to control the output, but I was advised against using pots in the long run.

                                      I used one of these small ones to "fix" a monitor whose 5v (or 3.3v - can't remember) power rail had died and the switching IC was too expensive to replace, so I botched one of those in and it works to this day, so I think the monitor was happy even with 1v less than the rated input on that power rail, OR that one happened to have better regulation - can't remember precisely.

                                      The larger DC-DC converters (which I pictured in one of my previous posts) only use up 8mA with an input voltage of 12v and 6mA with an input of 15v. These are advertised as going up to 30v. The datasheet for the XL400 confirms this + the input cap is rated at 35v....
                                      Wattevah...

                                      Comment


                                        #79
                                        Re: Running a microcontroller in car - power supply aspects

                                        do the green ones have a pot on top?
                                        if yes then you need to cut a track to isolate the pot before using the fixed resistors

                                        Comment


                                          #80
                                          Re: Running a microcontroller in car - power supply aspects

                                          Originally posted by stj View Post
                                          do the green ones have a pot on top?
                                          if yes then you need to cut a track to isolate the pot before using the fixed resistors
                                          Yes, it does have a pot, but the tracks on the bottom are "pre-cut" and you have to put a blob of solder across the ones you want to "activate": 1.5v, 3.3v all the way up to ADJ which is the pot itself, so I don't think it's connected otherwise.
                                          Wattevah...

                                          Comment

                                          Working...
                                          X