Car Power Source

Hi, I have created a data display/logging device using a Arduino Mega. It is powered by the 12V car battery through a DC-Dc buck converter which provides 4.96V the whole time. This is fed into the arduino via the USB port. The device is grounded directly to the battery -ve terminal.

The DC-DC module has built-in decoupling capacitors of 100uF on the input side and 2.2 uF on the output side.

The device is connected to a 128x64 GLCD (in parallel mode), which also has 100nF and 10 uF capacitors across its 5V and GND pins

The LCD works perfectly until the car engine is started, when it either goes blank or starts displaying random characters.

I am assuming this behaviour is due to noise from various automotive sources. What other capacitors etc should be installed to prevent this? Do I need filtering caps on the IO’s to the LCD too?

Thanks

Typically the voltage drops when the starter motor is activated (see the headlights dim) so this is most likely causing the drop out of the display (and probably the Arduino).

Put a 470 to 1000 uF cap across the 5 volt rail and see if it still happens.

Thanks I will give that a try.
If it's worth anything, I did a hard-reboot by unplugging and replugging the power line while the engine was running but it didn't do anything either

Sounds more like supply noise, ie if it continues after the engine is running and you are getting some of the expected characters and some rogue ones.

Putting more capacitors may fix it, but you may also need to put an rf choke in series with the supply.

dejamzo:
The LCD works perfectly until the car engine is started, when it either goes blank or starts displaying random characters.

Is it only the LCD? Does the Arduino keep going?

You need to find out exactly what's going on. Is it a voltage sag? Is it a spike from the alternator...? An oscilloscope will tell you.

Just a thought, but are you sure its an electrical problem.

I had a recent issue caused by loose connections to the LCD which caused similar results.

It could be vibration from the engine, rather than electrical noise.

Can you run your circuit on a separate battery while leaving the hardware it currently is. Note you'd need to keep the GND connection to the car if you are reading voltages etc into your circuit

Hi Roger, that is one possibility too. I will give that a go when I get home this evening before trying to add some larger caps in. The only thing I couldn't track down was an inductor, would you recommend something in the mH range?

Hi dejamzo

Without looking at the noise on an oscilloscope etc and knowing the current that your device takes, I'm not sure if it would be possible to work out what size inductor you'd need.

I have a habit of dismantling any bits of old electronics I'm throwing out and take out any interesting looking capacitors and inductors and connectors. So I have a stock of re-cycled bits and pieces in a box, which I'd try.

If you have any 12v Mains transformers, you could try wiring your circuit via the 12V winding, i.e don't use the transformer as a transformer at all, just use the wire the LT side in series with your Arduino, as that would make a pretty big inductor.

BUT. Do NOT wire up the transformer across the 12V supply, from the car that would be disastrous.

i.e Don't do this unless you know exactly what I mean

Thanks

Roger

Yup gotcha, beats buying one from Jaycar. Unfortunately I don't have access to a scope at home, usually I just use the ones at uni but that isn't possible in this case :slight_smile:

LOL

Yep, Jaycar aren't cheap. I'm lucky to have one about 5km from home, but I only buy things that I urgently need from them, as they are about the most expensive way to buy components.

You may be better off going to an auto store (not sure if you have SuperCheap Auto or AutoBahn in NZ like we have in Aus. They may have noise suppression stuff for car audio.) But I suspect its still going to cost $$$ so salvaging an inductor from anything would be worth a shot. Transformers, motors etc etc Just a reel of wire (if you can access both ends )

But I'd check the vibration issue first :wink:

So I just tried a few things..

  1. Confirmed it was the whole arduino playing up not just the LCD
  2. Added a 470uF cap to the 12V side of the regulator
  3. Added a 100nF cap to the 5V side
  4. Isolated the power by using a 9V battery. It didn't change anything, despite unplugging the arduino and replugging several times

I have 3 DIN plugs, the first runs to some relays, the second runs to the analog sensors and the third runs to the ignition coil -ve.
I tried unplugging each of these to see whether one was causing the fault; I suspected the tacho wire would be the most likely culprit. However, it seems that it would only run correctly once all 3 plugs are removed.

The relays each have a digital output that turns a transistor on to earth the coil
The analog sensors are hooked up as voltage dividers to analog inputs each with a 2.2u cap for filtering
The tacho runs to an optoisolating circuit

These all work perfectly when the engine is off. Actually, the whole thing used to work even when the engine was running, but would glitch out randomly.

and the third runs to the ignition coil

Yikes. You didn’t tell us you had a wire to the coil !!

Sounds like RF pickup on the inputs, especially as you have wires near the HT etc.

I have you tried disconnecting the inputs one by one and see if any of them are causing this problem.

Depending on what the inputs are, you probably need to “decouple” them, which is to use a small value capacitor e.g. 100nF to ground, to attempt to dump any noise (spikes) to ground.
You may need to put small RF cokes in line with them as well.

Do you know anyone with an oscilloscope, (I presume you don’t have one ??) so you could monitor the noise on the inputs.

BTW you may also need to put fast acting zeners on the inputs that break down if you get a spike voltage on the input.

This sort of thing is always a can of worms, and without good test equipment, all you can do is try various approaches and see what helps and what doesn’t :wink:

I actually saved myself the trouble of designing the tacho signal conditioning myself and "borrowed" Megasquirt's (Megasquirt Manual Index - Megasquirt EFI).
Each of the inputs are decoupled with a 2.2uF cap (the voltage divider resistances are approx 300 ohm, hence the higher capacitance).
But yes you are right, I will have to hook a scope up to the inputs to see where/what the noise is. Another long process of elimination.... :smiley:

No worries

Take a look on at the supply voltage while you are at it, as there is still a chance that its coming in that way.

Will do, thanks for the help Roger. I'll let you know how it goes!

Added a 470uF cap to the 12V side of the regulator

I mentioned in a previous post

Put a 470 to 1000 uF cap across the 5 volt rail and see if it still happens."

By putting the cap on the 12 volt side of the regulator, the starter motor will drain it instantly thereby preventing the cap from holding up the voltage for the Arduino.

Put it on the 5 volt side so that its power is reserved for the arduino only as it should not discharge back through the regulator to be pulled down by the voltage drop on the cars 12 volt circuit. If it does, then you can add a diode to the circuit (again, Arduino side of the regulator).

EDIT: Just saw you comment "Isolated the power by using a 9V battery." so the above, whilst a good precaution and damps noise, probably is not the solution.

Have you checked that everything has the same ground potential? (ie. 0) Cars can often have different "levels" of ground depending on which part of the bodywork the various devices are grounded to.

I gather that when you run it with just the tacho connected it still glitches even though it is opto-isolated. But when you run it with nothing connected it does not glitch?

Does the logic in you code activate some devices or relays depending on the inputs? If so is one of these devices shorting so that when you try to activate it, it drops the voltage due to high current draw. Therefore when there are no inputs (i.e. disconnected) there is no glitching?

Hi Lemming,
I had measured the relay current before and each only drew approx 20 mA. I don't think there is any problem with this part of the circuit as they work perfectly when the arduino is connected to a clean supply.

I attempted a few more things this morning and confirmed that the device does work with a 9V battery while the engine is running ONLY when all other plugs (relays, sensors and tacho) are disconnected. As soon as any of these are connected the system glitches out.

The weird thing about all this is that I had tested it a few weeks ago with the engine running and it worked fine, and only glitched out randomly after a few minutes of operation so I had assumed it to be down to the supply noise.

This evening I will try enabling internal pull ups on all the pins to see if this makes a difference then gradually enable the different I/Os to see which ones make a difference.
I currently have 2.2uF capacitors decoupling the analog input sensors also so I will try adding 100n to each.

Appreciate the help :slight_smile:

Check that there is no resistance between the gounds of the arduino and connected devices causing different ground levels..

I would start by connecting the tacho first. If this causes a glitch either the optoisolator is not wired up correctly or the "dark side" is at work as the tacho is electrically isolated from the arduino.

When you disconnect the sensors etc, do you disconnect the devices from the cables (leaving the cables trailing from the arduino) or do you disconnect the arduino from the devices cables? It would be interesting to see if the cables are acting as antennas, picking up elctromagnetic interference.

I checked the resistance between the sensor grounds etc and the arduino and there seems to be no resistance between the two.
When I remove the sensors, there are still wires attached to the arduino that run between it and the DIN connectors.

I also ran a test by pulling up all pins except one, which flashed an LED. This worked fine, which suggests the power supply is not causing the problem (entirely).

The next step was to reconnect my board to the arduino and connect the LCD panel (which also has LED's on it). This is connected by a IDC26 cable approx 30cm long. The LED's on this flashed fine, however the LCD would glitch with random lines appearing etc. This worsened once the tacho, and even other analog sensors, were connected.

I thought maybe the ribbon was picking up noise so I have added 100nF caps to digital I/O line into the LCD. This has shown a visible improvement in that the LCD will display properly even with the tacho and sensors connected, however it will still display random lines.

I will keep trying tomorrrow! Being a race car, the number of tests I can run in one evening is limited before the neighbours start getting annoyed! :slight_smile:

Is it possible for you to connect the USB on the Arduino to. Laptop and use Serial.print of some debug messages e.g the data that you are sending to the LCD
And do this while the engine is running ?

It strikes me that the board appears to be continuing to operate, but that the output to the LCD is possibly the only thing that is malfunctioning

Normally when there are these noise type issues, the Ardunio keeps resetting, etc, which doesn't normally cause the sort of problem.