PCB Layout and Project Guidance

Hi there,

I’m creating a device to run in a car and I need some guidance.

In a nutshell, this device will receive a 12V signal (engine on) and the ATtiny85 will switch a MOSFET to power another device that will consume 15W (5V 3A).

Don’t worry too much in the details of that, it is more complicated and this is going to be software based anyway.
This another device will be a Tinker Board (similar to a Raspberry Pi).

Background

I never designed a device or even a PCB before, not even a small one, this is my very first project.

I know only the very basics of analog and digital eletronics but not much more than that.

Feel free to suggest any improvements or changes.

Restrictions

Since this is not a commercial project, I don’t have price restrictions.

A relay module costs R$12,91 while the MOSFET costs R$4,90 but the price is not the issue, the clicky noise is (more on this later).

Regarding power, I can’t keep the second device always on due to power restrictions, it would flat the car battery in around 1 day.

I’m looking into the most power saving asset for that and the ATtiny85 with some power saving techniques seems the way to go.

1. Is it okay to use an optocoupler (PC817) to isolate the 12V signal from the ATtiny85?

I’m using a 1kΩ resistor to limit the current but the environment of this signal is harsh.

The worse thing that may happen in that case is the optocoupler fry, right?

I was doing a very unorthodox approach of using a 7805 to convert that signal but this doesn’t provide any isolation from the harsh environment and felt very, very, very dirty application for a 7805.

To convert the signal, not to power the entire thing, this will be done by a buck regulator.

2. Is it okay to use a MOSFET (FQP30N06L) to switch the second device?

I asked about that before here in the forum and we conclude that a relay would fit.

But the device is going to be inside the car and the clicky noise of the relay is completely annoying.

3. Is the MOSFET going to rise 20ºC for that load?

Doing some calculations I found that this particular MOSFET would rise around 20ºC and supposedly the car is always around 25ºC inside while the engine is on, that would make the MOSFET be around 45ºC.

P = RDS(on) * I^2
P = 0.035 * 3 ^ 2
P = 0.315

PD = (MAX(TJ) - TA) / R0JA
PD = (175 - 25) / 62,5
PD = 2,4

TEMP RISE = P * R0JA
TEMP RISE = 0,315 * 62,5
TEMP RISE = 20 (rounding up)

TEMP = TA + TEMP RISE
TEMP = 25 + 19,68
TEMP = 45 (rounding up)

I’m not entirely sure about those formulas, are they correct?

4. Is the pull-up/pull-down resistor wrong?

Just by the convenience of designing the PCB as one layer, I used a resistor to jump and also keep the pin 3 HIGH and then supposedly LOW when the optocoupler activates.

This was really just for the layout convenience and I’m not sure if this is right.

Should I just reroute and use a jumper to avoid that mess or this is the way to go?

5. Is the PCB Layout generally okay?

This is not going to be a commercial product or anything like that, just a computer-ish for my car.

I’m probably going to make this PCB handcrafted, it seems easy to do after the layout is ready, and solder everything together, or even one of those.

I just don’t want to set my car on fire or fry the device :o

Thanks in advance!

For a one-off a piece of protoboard makes mores sense.

Optocouplers are routinely used to isolate signals, and are a good idea in automotive environments where electric noise can be pretty bad indeed.

Thanks!

Any guidance on the other topics?

  1. MOSFET looks suitable for a 3A load. It'll dissipate a good 300 mW, heating won't be a problem assuming there's at least some ventilation.

4, 5: can't say much without circuit diagram. I do miss at least a decoupling capacitor at the ATtiny, and depending on what you're switching a flyback diode on the output.

The load will be a Tinker Board, it is a board similar to Raspberry Pi with a better hardware.

There is a need for a flyback diode in that case?

No need, that diode is only needed for inductive loads such as motors.

About the decoupling capacitor, how to calculate the value?

I'm seeing different recommendations on Stack Overflow.

The power is going to come from a CPT240505.

Just use a 100 nF ceramic.

Like this?

I don't know the pinout of the Tiny, so not sure if that's the correct connection.
Place it as close as physically possible to the Vcc pin.

Maybe that clarifies.

The VCC is on the top right of the image and the GND on the bottom left.

  1. Most MOSFETS specify a maximum junction temperature of 120-150C. So long as you keep the junction below that temperature, it will perform as specified. Too-hot-to-touch is not bad for it.

My concern is more like how much hot it will be.

The device will be inside the car dashboard and going above 50ºC may be bad, not for the device, but for the dashboard.

I can think of putting a small fan to cool it down when it's above some degree but that's more work.

The dash can withstand more than 300mW unless maybe the mosfet is directly touching a plastic part.

Well, I'm a tropical country where the air temperature can easily go to 38ºC (Brazil).

Is not uncommon to see 45~48ºC in the air temperature sensor of the car after being parked for a few minutes.

Supposedly the temperate inside the car will be like 25ºC after a few minutes because of the air conditioner but I'm assuming that inside the dashboard it may be a bit hotter.

BTW, 300mW means what exactly? 20º of temperature rise over the air temperature?

I got some formula in the first message but not sure if they are correct.

10k between AT85 pin and mosfet gate?
That makes the mosfet slower (and heat up during switching).
Better make that ~220ohm, and add a 10k resistor from AT pin to ground.
See this page, first part/diagram.

R3 can go if you use internal pull up on the pin in pinMode().
Not sure why you use an opto coupler if you are going to share grounds.

The Attiny needs a decoupling cap between supply and ground.

Make the source and drain traces a bit wider if you're going to switch 3A.

A TO-220 mosfet could have a temp rise of about 60C per watt (depending on how/where you mount it).
So 300mW (0.3watt) is about 18 degrees C above ambient.
Leo..

300 mW is about the same as a traditional incandescent indicator light, as used to be commonly used in the dashboard of cars.

Nothing to worry about, unless you're potting the part or so.

And please do post a proper schematic, not just PCB views. Much easier to see how everything is connected.

Thanks, that link was very helpful to understand the MOSFET driver better!

About the optocoupler, I'm planning to use it to avoid spikes going into the ATtiny85, since the 12V voltage may spike up to 80V in a car.

This is useless if the ground is shared? Any better way to prevent the spikes of frying the ATtiny85?

sobrinho:
About the optocoupler, I’m planning to use it to avoid spikes going into the ATtiny85, since the 12V voltage may spike up to 80V in a car.

This is useless if the ground is shared? Any better way to prevent the spikes of frying the ATtiny85?

If the grounds are shared (why would this be?) it’s indeed quite useless.

The simple alternative is a resistor. The ATtiny is equipped with clamping diodes, which can handle about 1 mA of current. So design your resistor to keep the current <0.5 mA and you’re safe.

For 80V that’d be 160k. That resistor doesn’t stop sensing of the signal itself of course.

I thought we couldn’t simply put 80V in an ATtiny85 pin, can I?

I understand that you are suggesting to limit the current to be very small but the voltage won’t damage it?

Arduino documentation says that:

Pins configured as inputs with either INPUT or INPUT_PULLUP can be damaged or destroyed if they are connected to voltages below ground (negative voltages) or above the positive power rail (5V or 3V).

Remember that I’m not an expert in electronics, I may probably be missing something here.