Running a microcontroller in car - power supply aspects

Collapse
X
 
  • Time
  • Show
Clear All
new posts

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

    Updated schematic. Added D6 and D7, plus a simple plot of the lock/unlock pins.
    Attached Files

    Leave a comment:


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

    Originally posted by budm
    Why would Low (Grounded) signal be problem? The MCU signals are ref. to GND. Am I missing something?
    Actually you're right. I was thinking the pin would short out through the diode, because for some reason I mistakenly assumed the diode would go between the L and U/L pins themselves, which is not correct - it would go between EACH pin and GND, so when the pin is pulled high, the diode is reversed-biased and doesn't conduct and when it stays low, it's essentially GND, so no current flow either.

    Another thing that confused me is the way those L/UL rails are laid out they look very similar to a split-rail supply, with GND being in the middle, L being let's say + and U/L being -, although it's nothing of the sorts, so that's another thing that threw me off, so you're right: diode across each of those LEDs and I should be good. Can't believe I screwed up on such a simple electronics circuit

    Leave a comment:


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

    Why would Low (Grounded) signal be problem? The MCU signals are ref. to GND. Am I missing something?

    Leave a comment:


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

    Had another look over the schematic and made another change: the lock/unlock signals on the right now also have optoisolators (PC5 and PC6). This is actually how the circuit is currently set up on the breadboard, but I omitted those two for some reason. Trouble is, I can't add a protection diode there because those pins swing low/high when locking/unlocking. Basically those two wires I labeled there run from the ECU to the 4 actuators in the doors and 1 in the trunk and I need to somehow tap into them to trigger certain functions on the Arduino. It's a simple H-bridge inside the ECU that does this I THINK: when you lock the car, the LOCK pin gets 12v on it and the UNLOCK pin stays low. When you UNLOCK the car, the reverse happens: U/L pin gets 12v on it and the L pin stays LOW. I measured this to confirm. Adding a diode there would create a short, yet I still need to have some sort of protection there, since linear actuators create a ton of inductive kickback which overtime can kill those LEDs. A capacitor perhaps ?
    Attached Files

    Leave a comment:


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

    Originally posted by budm
    I see, trying to keep wiring as original.
    Precisely.

    Leave a comment:


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

    I see, trying to keep wiring as original.

    Leave a comment:


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

    Originally posted by budm
    I am curious as to why the OPTO LED's side are not running of the regulator in your circuit
    This
    Originally posted by budm
    It looks like you are using OPTO as level shifter.
    It's mostly out of commodity and to keep the car's circuit as stock as possible. 12v is present at the switches already, so to run off 5v, I'd have to cut the incoming power wires from the car's system to the switches and wire in my 5v line there, which of course would work, but I just don't want to alter that part. It's not a pleasure working on the wires in that dash - very tight in there, with wires going everywhere, so it has to be as plug and play as possible: connect it up then get out of there as quickly as possible

    Leave a comment:


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

    I am curious as to why the OPTO LED's side are not running of the regulator in your circuit. It looks like you are using OPTO as level shifter.
    Last edited by budm; 07-17-2019, 09:44 AM.

    Leave a comment:


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

    THIS is how it should look, with the diodes flipped around, in parallel to the LEDs.
    Attached Files

    Leave a comment:


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

    Here's the schematic in KiCad I made...you can mess around with it if you have KiCad installed. It's easier to pass the same project back and forth.
    Attached Files

    Leave a comment:


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

    I was showing two possible ways to go for the inputs.
    If the 1N4148 was replaced by a 5.1V zener, you see the LED will turn on first at 1.3V and the zener can never see 5.1V

    Resistors are OK. 20k and 10k, or higher like 50k and 25k. Just so the MCU

    The LM2596, there are so many chinese fake IC's in those I would not trust them so much.

    Leave a comment:


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

    Yes it suppose to go that way so you clamp the reverse voltage off of a coil or a motor a very common thing to when you want to have a pin from a micro controller to control a outside device to use a optic sensor
    Last edited by sam_sam_sam; 07-11-2019, 06:46 PM.

    Leave a comment:


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

    Can you clarify the schematic a bit: is it meant to represent two possible implementations on the right there ?

    So the diode was supposed to go parallel to the LED in the opto after all...

    I shall upload the KiCad file so you can all mess with it. I just don't have it on my PC right now and it's too late and I'm too lazy to get up

    Leave a comment:


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

    Here are two common ways to run digital inputs to an MCU. The hassle is protecting for overvoltage spikes from static electricity or switching inductive loads, like blower, wiper motor, ignition etc.
    A 12V car the old test standard is pulses for -150V 0.1usec (at 10kHz), -100V 2 msec, +50V 50usec to represent ignition noise, DC brushes arcing etc. I left out the big surge caused by a bad battery connection "load dump" because it's hard to deal with.

    The opto: 1N4148 clamps any -ve spikes from the switches and wiring. An LED is easily damaged by reverse voltages. +ve spikes overcurrent the LED but this OK. A +200V spike would put in 100mA. The opto LED is rated 50mA for a long term and 1A for fast <100usec overload.
    You put the diode in series but a 1N4148 avalanches past 100V so it is not enough.

    Using resistors, 20k and 10k give 9V minimum and 4.5V maximum for logic high/low, so a dead car battery can still work. The 20k limits current into the MCU. A +/-200V spike would put in 10mA to an MCU input pin, after the capacitor charges, so a long term spike would not damage things.

    The capacitor helps with noise from cell phones which get picked up by a car's wiring. It's low current and high frequency, so the opto does not pass it but resistors will.
    Attached Files

    Leave a comment:


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

    Let's review this. I redid the schematic following your suggestions:
    Put the switches after the fuse, because switch/door wiring always shorts out.
    There is a fuse there already, I just didn't include it because it will not be part of the PCB - a 30A one from the car's actual fuse box, because the part before the switches is in place already and running the windows directly, so it sucks a lot of current. I will probably swap it for a small 5A one after the mod, since the switches will no longer run the motors directly and don't require the full 30A.

    Now this part threw me off a bit:
    The zeners on the opto's don't help for +ve overvoltages. The opto LED is about 1.2V and will clamp hard first, so the 5.1V zener will never turn on.
    So the LEDs clamp BEFORE the diode actually starts regulating ? I didn't think it worked that way when I "designed" it - I just thought of the classic zener regulator instead of doing this
    A dropping resistor and 1N4148 reverse-diode will work fine, you don't need anything else. The opto LED would see (11 to 14V - 1.2V)/1k or ~10mA which is OK, I prefer 5mA 2k.
    I know you can run LEDs off 12v just fine with the appropriate resistor, which is how I was going to do it at first, ironically, but it seemed better to have a zener in there....turns out it wasn't a great idea and I should go with the simpler idea after all. Not sure I put the diodes in the right place though, but my basic electronics knowledge tells me there's no reason they should be in parallel across the optos since there's no inductive kickback there to supress, correct ? Should I add a cap across the opto as well ?

    The opto-coupler is not isolating because the same ground is on input and output sides. You didn't use one for IGN, LockSignal inputs etc. so what is with that.
    The idea behind the opto's was to prevent battery voltage from shooting into the Mini's pins if anything went wrong. Then again, you could indeed argue that the other pins you mentioned do not use opto's at all. That was actually the original design (zener+resistor on each pin), but then someone suggested dropping an optoisolator in there too in another post about this project, where I was asking for advice on how to step down car voltage to MCU voltage.

    You can turn on internal pullup resistors in the Arduino, about 20kΩ and 50kΩ to save parts (the 10k parts R5-R8).
    pinMode(right_window_up_pin, INPUT); // set pin to input
    digitalWrite(right_window_up_pin, HIGH); // turn on pullup resistors
    Not a bad idea actually. Must admit I did not know how to do that at the time, that's why I did it the old fashioned way. I mean I knew about internal pull-ups, but didn't know how to use them. I thought using (digitalWrite X, HIGH) on an INPUT pin keeps the pin "on" all the time, thus making a LOW reading on it impossible. I'll have to try it out. Should I still keep the caps on those pins though ?

    This whole thing draws maybe 20mA from 5V?
    Precisely - I actually measured it a while ago. It's even lower than that in fact (around 15mA when an opto is "on" - button pressed), which is what I want. I'll probably also try out tweaking the code to enable those low-power states of the arduino to lower current draw even further...

    Why do you have 82 Ohms in series with load, which also feeding the 5.1V ZENER?
    I set the DC-DC converter to around 6v output so it's slightly higher than Vz of that diode and chose that seemingly random 82ohm value mostly based on practical tests than math. I know the various formulae and calculations of zener regulators, but I did it the practical way by measuring the output of that zener regulator dropped after the DC-DC converter with different value resistors. I started at 1k and it was WAY too high - the Mini simply didn't run or stopped working whenever I hit a button and the voltage drop increased even more. I measured the voltage at VCC and it was like 3v - way too low. I began dropping the resistor's value more and more until I got an acceptable 4.8v which is still a bit too low, but works....for now at least. It's fed straight into the VCC pin, not the RAW pin, since I removed the on-board regulator of the Mini.

    The input inductor and diode, my automotive buddy says he added a bunch of crap, reverse-mosfet and stuff with it to his ECM designs.
    I think you need something like a ferrite bead at least to stop EMI from the power supply going into back the car. I can draw something later.
    Yeah, this part was a bit impromptu and needs a bit of work, because so far I've been running it on the bench with a wall-wart or even a SLA battery sometimes, so I'll have to design the input part a bit better.
    Attached Files

    Leave a comment:


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

    I think the worry is the 5V buck-converter could fail and overvoltage everything, roast Arduino for dinner.

    Arduino Pro Mini (5V version) uses MIC5205 LDO and even 5.1V input is enough for 5V out, but the input max. of 16V is not enough for a car because of transients.
    OP could run the LM2596 into the Mini Vin and that would cover overvoltage from damaging things?

    Leave a comment:


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

    Why do you have 82 Ohms in series with load, which also feeding the 5.1V ZENER? Vdrops on that resistor will vary with the load current.
    Last edited by budm; 07-09-2019, 05:35 PM.

    Leave a comment:


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

    Originally posted by Dannyx
    Why ? I can't just send battery voltage straight into the optos (even with a resistor)
    of course you can,
    your running an led from 12v through a current limiting resistor - that's how it's done.

    Originally posted by Dannyx
    What would get destroyed here ? The zener or the diode ? That's for safety only - it should only conduct in case the switching DC-DC converter somehow fails. That's right - don't forget that's a switching converter and I only pictured it as a 3-leg device out of convenience...not sure if that's what made you worry there.
    i know what your thinking, i'v done it myself.
    but firstly as i said, 5v1 is riding the line.
    second, if the switcher output rises the diode will clamp what - 500mW?
    it will burn-up.
    you need a 5w zener atleast and you need it not false-trigering - so 5v6 or higher.
    so when it clamps, it draws enough current to blow the fuse - not itself.
    in the old days when clamps where common, it was usually done with the zener triggering a thyrister to short the rails.

    Leave a comment:


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

    The schematic looks really good for first time in KiCad.

    Some things to maybe consider:
    Put the switches after the fuse, because switch/door wiring always shorts out.

    The zeners on the opto's don't help for +ve overvoltages. The opto LED is about 1.2V and will clamp hard first, so the 5.1V zener will never turn on. A dropping resistor and 1N4148 reverse-diode will work fine, you don't need anything else. The opto LED would see (11 to 14V - 1.2V)/1k or ~10mA which is OK, I prefer 5mA 2k. For spikes, the LED max. is 1A(!) so a 1k resistor still good for hundreds of volts for a short transient <100usec.

    The opto-coupler is not isolating because the same ground is on input and output sides. You didn't use one for IGN, LockSignal inputs etc. so what is with that.

    You can turn on internal pullup resistors in the Arduino, about 20kΩ and 50kΩ to save parts (the 10k parts R5-R8).
    pinMode(right_window_up_pin, INPUT); // set pin to input
    digitalWrite(right_window_up_pin, HIGH); // turn on pullup resistors

    I find C6 is better 220-680uF for the cheap LM2596 ripoffs from china, but make sure the fuse can take inrush current. This whole thing draws maybe 20mA from 5V?

    The input inductor and diode, my automotive buddy says he added a bunch of crap, reverse-mosfet and stuff with it to his ECM designs.
    I think you need something like a ferrite bead at least to stop EMI from the power supply going into back the car. I can draw something later.

    Leave a comment:


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

    Originally posted by stj
    you shouldnt have zeners on the opto's
    Why ? I can't just send battery voltage straight into the optos (even with a resistor), so that's my way of stepping it down.

    Originally posted by stj
    you shouldnt have 5v1 across the regulator output either - it will be destroyed.
    What would get destroyed here ? The zener or the diode ? That's for safety only - it should only conduct in case the switching DC-DC converter somehow fails. That's right - don't forget that's a switching converter and I only pictured it as a 3-leg device out of convenience...not sure if that's what made you worry there.

    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...