Running a microcontroller in car - power supply aspects

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • redwire
    replied
    Re: Running a microcontroller in car - power supply aspects

    Originally posted by eccerr0r
    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
    [...] 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.

    Leave a comment:


  • Dannyx
    replied
    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.

    Leave a comment:


  • eccerr0r
    replied
    Re: Running a microcontroller in car - power supply aspects

    Originally posted by redwire
    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...

    Leave a comment:


  • Dannyx
    replied
    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

    Leave a comment:


  • Dannyx
    replied
    Re: Running a microcontroller in car - power supply aspects

    Originally posted by stj
    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
    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.

    Leave a comment:


  • stj
    replied
    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.

    Leave a comment:


  • Dannyx
    replied
    Re: Running a microcontroller in car - power supply aspects

    Originally posted by redwire
    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
    I still like the series reverse-diode because the car cannot discharge the 680uF cap.
    You mean post #9 ? THIS ?

    Originally posted by redwire
    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

    Leave a comment:


  • redwire
    replied
    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.

    Leave a comment:


  • Curious.George
    replied
    Re: Running a microcontroller in car - power supply aspects

    Originally posted by Dannyx
    The thinking behind this is that if the output ever overshoots, ZD7 conducts and blows that fuse anyway, since I'd put a very low current one - 200mA or thereabout I reckon should be low enough....not sure how fast it'd act and whether it'd save the micro from getting toast though...
    One typically puts a transistor in series with a fuse to PROTECT THE FUSE!

    (i.e., fuses take an eternity to blow)

    Leave a comment:


  • Dannyx
    replied
    Re: Running a microcontroller in car - power supply aspects

    Originally posted by stj
    i'm not sure what r9 is even there for,
    but i know c5 should be directly across the regulator - how the hell can it stabilise the output with 87ohms in the way!
    See posts 32-34. That resistor has been a common discussion topic ever since I made the schematic It was just a thought I came up with.

    Leave a comment:


  • stj
    replied
    Re: Running a microcontroller in car - power supply aspects

    i'm not sure what r9 is even there for,
    but i know c5 should be directly across the regulator - how the hell can it stabilise the output with 87ohms in the way!

    Leave a comment:


  • Dannyx
    replied
    Re: Running a microcontroller in car - power supply aspects

    Back on this project, being stuck at home for the moment, more or less against my own will. I had a look at my schematic and though I could drop the 82 ohm R9 entirely and just put a fuse between the output of the regulator and the micro. The thinking behind this is that if the output ever overshoots, ZD7 conducts and blows that fuse anyway, since I'd put a very low current one - 200mA or thereabout I reckon should be low enough....not sure how fast it'd act and whether it'd save the micro from getting toast though...
    Attached Files

    Leave a comment:


  • Dannyx
    replied
    Re: Running a microcontroller in car - power supply aspects

    Still on this VERY slow project, just in case someone is still watching this thread and would be kind enough to reply back, I started laying it down on a piece of veroboard PCB to hopefully get one step closer to the final version. I now started looking at motor control, since it's equally important for this purpose: I initially wanted to go with THIS thing, but then I read about it more carefully and amongst other things I learned is that apparently you can't just hit it with a steady DC voltage on the control pins and let it run continuously - there has to be a switching PWM wave on the input pins there, with a duty cycle of up to 98%. Read the last post HERE.

    I also have to be careful how I power it, since you can fry the microcontroller if you're not careful, since the power input for the motor itself is also tied to the V+ header pin which you'd assume is separate and should be used to power the low-voltage control part, but it's not, so you can easily send 12v into the I/O pins of your micro Same for the EN pins. Good thing I read that up HERE !

    I also have THIS one in my shopping cart, since it's slightly cheaper. I'd need to provide my own heatsink though. It also handles less current and this is where it can get a bit ambiguous, since the first one doesn't precisely mention the current - it just says 0-30A, so I can only assume that's PEAK current and by no means continuous ! The "bare" one gives 10A as the continuous current and 30A as peak, though those values are probably "optimistic" ones and they're lower in reality. I actually measured the current draw on my car window: it's around 5-7A when the motor is running freely (depending on the temperature and how much crud is on the rubbers) and around 15A when the window reaches the end of travel and the motor stalls, so either of them should handle it if properly cooled (which might actually be a problem in the summer ! !). If those specs are anything to go by, the cheaper one can be driven up to 99% duty cycle, though I'm sure that's borderline irrelevant, so....yeah....not sure what to go with :|
    Last edited by Dannyx; 02-19-2020, 11:01 AM.

    Leave a comment:


  • Dannyx
    replied
    Re: Running a microcontroller in car - power supply aspects

    Originally posted by redwire
    The motor control should have a timeout of say 10 seconds to not cook the motor, in addition to the monitoring motor current and the switches. Chevy and Toyota had problems with recalls after people left a window cracked open and rain got in the switches and the motor stayed on.
    I have that. No matter what happens, the motor cuts out after 15s if something goes wrong and it doesn't stop for some reason. My switches are on the dash under the headunit, so water can't possibly get there, but still.

    As for the code, I probably missed something. I might try it again....maybe there's more to it than just replacing INPUT with INPUT_PULLUP. When I switched back to INPUT and added my resistor again, it worked perfectly once again, so I don't know, maybe I'm doing something wrong....I'd show you the code, but it's a mess, so I'd rather not

    I also happened to come across the perfect connector for the job: these things which I didn't even know could exist can carry both a high current input and some control signals, so they're perfect, albeit a bit pricey.
    Last edited by Dannyx; 12-19-2019, 04:30 AM.

    Leave a comment:


  • redwire
    replied
    Re: Running a microcontroller in car - power supply aspects

    It's not your hardware, I think. There must be other code using the same I/O pins as an output pin. I would look at the software more. I've never seen a digitalRead() work once and then stuck.
    Unless the opto capacitor makes the rise time slow and not a Schmitt trigger input, or they are analog input pins.

    The motor control should have a timeout of say 10 seconds to not cook the motor, in addition to the monitoring motor current and the switches. Chevy and Toyota had problems with recalls after people left a window cracked open and rain got in the switches and the motor stayed on.

    Leave a comment:


  • Dannyx
    replied
    Re: Running a microcontroller in car - power supply aspects

    Could be down to the optocouplers somehow, since it doesn't turn on right away - it takes one trigger to get stuck, so I imagine the optocoupler turns on, pulls the pin low, but then it doesn't go back high again for some reason....

    Leave a comment:


  • stj
    replied
    Re: Running a microcontroller in car - power supply aspects

    all 328 boards are the same - just more or less psu and programming crap on them.

    you may want to see if the opto's are leaky by probing or scoping the outputs during testing.

    Leave a comment:


  • Dannyx
    replied
    Re: Running a microcontroller in car - power supply aspects

    Yeah, I did this too: pinMode(PushButtonPin, INPUT_PULLUP); but got the unwanted result of the output being stuck on all the time after the first push, as if the button was held down...does this work on the ProMini as well ? It should, after all, the microcontroller's the same on all of them, or very close....

    Leave a comment:


  • redwire
    replied
    Re: Running a microcontroller in car - power supply aspects

    It looks pretty good so far
    R5 1k is a bit low, I would use 10k for less heat. If ZD5 is a good size, you could get rid of D1/L1, they can be awkward. D1 could be smaller 1N4004, or just in series with power and no L1.
    Arduino Atmega328 pull up resistors are about 36k ohm, PC817 transistor even really hot 90C has 1uA leakage current. So you should not be having problems with that, here is code I use for pusbutton only w/pullup:

    Code:
    //------ I / O  P i n  A s s i g n m e n t s ----- U N O ------------
    #define battery_voltsPin A3 
    #define PushButtonPin 6 
    #define LowBatteryLampPin 5  
    #define LEDPin 13  
    //*************************************************************************
    void setup() {
     
      digitalWrite(LEDPin,LOW) ;  // led off if low
      pinMode(LEDPin, OUTPUT);   // sets the digital pin as output
      //------------------------------------
      pinMode(battery_voltsPin, INPUT);	// sets the analog pin as input, no pullup 
      analogReference(INTERNAL);	// A/D Vref is 1.1V full-scale
      //------------------------------------
      digitalWrite(LowBatteryLampPin,OFF);	// Low Fuel Lamp off
      pinMode(LowBatteryLampPin, OUTPUT);		// sets the digital pin as output
      //------------------------------------
      pinMode(PushButtonPin, INPUT_PULLUP);   // sets the digital pin as input w/pullup
      //------------------------------------
    } 
    //*************************************************************************

    Leave a comment:


  • Dannyx
    replied
    Re: Running a microcontroller in car - power supply aspects

    Alright gents (and ladies, if there's any watching ), since I'm on my winter break and I have some spare time on my hands, I thought I'd go back on this project which should've been finished last year

    Here's what I've been up to: as you guys suggested, I went with 2k resistors for the LEDs of the optocouplers instead of having the zener diode as well. I tested and it works, so I rolled with it.

    Pullup resistors: you guys suggested using the internal pullups on the digital pins so I wouldn't have to use external ones, but I could not get this to work - either I'm doing something wrong (most likely, since we all know I'm a bit of noob at this stuff ), or simply changing the pinMode in the beginning is not enough and I have to tweak the rest of the code as well. What happens is I do pinMode(x, INPUT_PULLUP) and measuring with a multimeter shows the pin does indeed go high after pulling the 10k pullup resistor off the breadboard, but when I push the button and the optocoupler turns on and pulls that pin low, the action related to that button being pressed gets stuck on and runs continuously. If I understand correctly, it should work the same, with no other changes....

    Current sensors: I played around with the "analogRead" and a current sensor and I think I got this one right: I used the serial monitor to read the values the pin was giving me at different voltage inputs, from 0 when fully grounded, all the way to 1024 (I think) when pulled all the way to 5v. The current sensor I got (which I can't remember for the life of me what model it is right now), outputs a value between 2.5v at 0A and 8v! at 30A! (if I remember the datasheet correctly). My car window motor draws precisely 15a when the motor is stalled, so to test this on the bench, I paralleled two 10w low-ish value resistors to drop their resistance even more, wired this setup in series with my current sensor and put the whole thing on my power supply. I began cranking the voltage and observing the values the sensor gave me at different currents. It's approximately 3.8v at 15A, so I took a note of the value the serial monitor was giving me and I'll use this to tell the program to stop the H-bridge when it detects this value consistently for 1-2 seconds to prevent false triggers from the inrush current...at least that's the theory...

    Leave a comment:

Related Topics

Collapse

  • CG2
    Meaco Arete One / Deye Dehumidifier not working
    by CG2
    I've got a dehumidifier that has stopped working. Plug it in, press the power switch, and it beeps 5 times. Nothing showing in the display (which is just two 7 segment displays) apart from the two decimal points flashing. The model is a MeacoDry Arete One 18L, which seems to be a rebadged Deye (all the boards are marked Deye). Here's what I've got so far (details in case anyone else in future should need them).

    Starting with the power board. Mains power comes in at the red connector top left. The compressor is powered by the orange connector to the right of that and is switched by...
    08-17-2024, 07:47 AM
  • Kambi13
    Samsung NP370E4K No backlight running on battery
    by Kambi13
    Hi all, need some help. I have a Samsung NP370E4K-KD2BR, which as a 5th Gen Intel CPU that works fine when running with the charger plugged in, but has soon as I remove it and it's running on battery the screen backlight goes off.

    Tried different battery - no change
    Tried different screen - no change

    Removed the plastic film from the screen inverter and looked for pwm signal which as about 3.3v when running with the charger plugged in, when I take it off the voltage drops down to 2.232v, so my best guess is that the EC is not providing the correct voltage....
    09-04-2023, 11:06 AM
  • Dannyx
    "Kinetic" 433Mhz transmitter/receiver discussion
    by Dannyx
    Good day folks.

    TL;DR: has anyone tried pairing one of THESE "kinetic" battery-less switches with THESE generic remote modules ?

    Details: I recently got hit by this craze of wanting to add remote controls to the lights around my house, so I went with those generic 433Mhz remote relay modules found everywhere, which are really basic, easy to use and work well, since I used them before in other projects. What I like most about them is they accept all kinds of 433Mhz remotes that float around Aliexpress, since they're all the same under the hood, save for the...
    03-08-2022, 11:01 AM
  • Skgod
    Asus Rog strix g15 g513ih hn0865 and it's having display issues while running on igpu
    by Skgod
    Hey I am having Asus Rog strix g15 g513ih hn0865 and it's having display issues while running on igpu. Works fine when I open any game or whatsapp windows application. The issues are :
    Black screen, freeze
    The weird thing is that when as long as the laptop is running on igpu the problem keeps happening. But as soon as I open any game or whatsapp windows application, the laptop works completely fine.
    When the screen freeze or black screen I used to move the display lid up and down and it usually works like that.
    So can anyone tell me what would be the possible cause?...
    10-16-2024, 08:11 PM
  • FALKLAN
    Running Line Voltage and Integrating LED Pods - Automotive
    by FALKLAN
    Howdy everyone! I hope all is well where ever you are!

    I'm attempting to integrate a couple of LED pods into an automotive reverse lamp circuit. The problem being, while the vehicle is running there is a 8.5v current present on the reverse lamp power wire. Needless to say is that all LED pods and lights dimly illuminate while the 8.5v is present, so the LEDs are always powered on while the vehicle is running. When the vehicle is shifted into reverse, the voltage changes to 12 volts.

    I am uncertain how to convert this line into a switched 12v output line for the LED pods....
    02-05-2025, 12:30 AM
  • Loading...
  • No more items.
Working...