How to design a Shield ?

Hello,

I hope everybody is fine and doing well. I'm planning to design my first rover shield for Arduino MEGA on proper PCB.
Short description of the shield:
12V in: from LiFePo4 battery
2x12V out: for the two DC motors (max. 15A each, the 2 x controllers are external)
12V out: to the buck voltage regulator
5V in: from the buck voltage regulator.
(This will drive the various sensors and signals for the external motor controller.)
5V -> 3V3 only for the PS2 controller
Fuses: for the two motors (2 x 15A) & shield (1A)
Connectors: JST XH
PCB: Rigid, 2 layers, through-hole mounting, copper weight 1oz(35um); minimum trace & distance for 1oz: 6/6mil
Software: KiCad 5.1.6 and FreeCAD 0.18 (only for the missing 3D models)
As a started I attached a very basic sketch about the planned layout.

I'm mainly interesting for the design guidelines/rules of the PCB/electric circuit in this particular case of shield.

  • Maybe some diode (1N4001?) required between A&B points (reverse diode over the buck voltage regulator) ?
  • Circuit protection.
  • Layout, arrangement of the components.
  • Trace widths of signals, GND & Vcc. (Shall be the Vcc thicker than GND ?)

Kindly provide some guidance to avoid beginner's mistake.
Thank You very much for Your support in advance !

PS: Maybe the above specification is too short, if more information required, please don't hesitate ask.

I'd put all the motor power items onto the motor controller. 30A over the PCB and Gnd is a source of trouble.
The Gnd lines or planes should be the thickest of all lines and wires.

@ DrDiettrich: Thank You very much for Your quick answer.
The motors, the Shield and the MEGA are powered from the same, 12V battery.
The motor controllers are physically already separated (approx 20 cm away from the MEGA).
I'm planning the power line for the motors on the same Shield-PCB, because so I can easily connect the other, "motor power items" (volt & current meter, fuses & screw terminals and split the voltage).

If I make the orange section (dashed rectangle) on a separated PCB, but the connection (GND Vcc etc.) remain the same, will it help ?

Looking at your design, doesn't this sensor shield already have 98% of what you need?

Also, if you are powering everything from 3.3V, how will you perform 3.3-5V logic level translation? The Mega is a 5V device.

A separation will help only if you find the right power Gnd point for the logic Gnd to the Arduino. Motor currents should not run over the logic Gnd line.

@ aarg:

Looking at your design, doesn't this sensor shield already have 98% of what you need?

Unfortunately the link is banned here. Kindly send some pictures. Thank You for Your help!

Also, if you are powering everything from 3.3V, how will you perform 3.3-5V logic level translation? The Mega is a 5V device.

Kindly check the circuit again. The MEGA is powered on the +5V pin form the buck regulator.
The 3V3 (lilac trace) coming from 7803 voltage regulator and required only for the PS2 controller, so no logic level shifting required.

@ DrDiettrich:

A separation will help only if you find the right power Gnd point for the logic Gnd to the Arduino. Motor currents should not run over the logic Gnd line.

I don't fully understand, but maybe this can be a way out:
I 'cut' the Gnd line. In this case I have to use two batteries (and two charging points):
Battery 1: for the 2 motors + voltage divider + current sensor (ACS712)
Battery 2: for the rest.
The ACS712 not a problem, but in this case I have to solve, how the voltage divider will communicate to the MEGA. (The current sensor & voltage divider required to measure the battery capacity/SOC.)

Don't the motor driver boards have a logic Gnd pin, distinct from the motor power V-?
Motor drivers often have their own current sense signal.
Which driver board do you use?

@steger, you asked me to look at it, but DrDiettrich already mentioned the grouding trouble.
I can try to tell it in a different way.

You need to seperate the GNDs. The GND from power things should not disturb the GND for the sensors.
Look at R2 and R3. It can measure a voltage, but the GND-side of R3 must be connected to GND. Well, it is not.
There is a "Current measurement" block in the way.
Then there is a black wire at the bottom where a lot of things are connected to.
The left side of that black wire is not the same as the right side of that black wire. I don't care how thick that wire is. Noise of 100mV is super easy to achieve, and it not very hard to get spikes of more than 1V.

A beginner thinks that ground is ground. If you would see with a good oscilloscope how much noise and voltage and current peaks are in a circuit, then you would immediately understand why grounding is a craftsmanship on its own and why decoupling capacitors are required.

A good buck converter has already all the decoupling capacitors included. However, a larger 100µF to 470µF capacitor in a circuit can often help to soften things.

steger:
@ aarg:Unfortunately the link is banned here. Kindly send some pictures

Unfortunately, the images are deliberately made difficult to download. The shield has a multitude of the "servo" connectors just like yours I think, 3 terminals with ground, power, and some I/O pin.

@ DrDiettrich: thank You very much for Your answer.
@ Koepel: thank You for Your very detailed feedback. It helped a lot to understand the issue. You mentioned the magic worlds: “decoupling capacitors” ;). So I have to put a bunch of capacitors on the board to avoid noises, ripples peaks etc., therefore the motor GND will not disturb the logic GND and the circuit can remain nearly the same. :wink:

I juts made some quick search and try to summarize here the general rules of thumb:

  1. Battery output: 100µF to 470µF (electrolitic), distance not concerned.
  2. Power supply (for example: LM7805, LM317):
    2.1 Input side: 10µF (ceramic), distance < 3cm
    2.2 Output side: 1µF (ceramic or electrolitic ?), distance < 3cm
  3. Chip/IC: 10-100nF per chip, next to the Vcc pin, distance < 1cm
    or equal distance between the Vcc and GND pins ?
  4. Parallel large & small capacitors.

I hope it is okay.

Bypassing with capacitors and ground routing are two separate design elements. No amount of bypassing can fix a poorly laid out ground system. In fact, the effectiveness of the capacitors depends on a good ground layout.

@ aarg: It seems it is really a matter of craftsmanship:

Bypassing with capacitors and ground routing are two separate design elements. No amount of bypassing can fix a poorly laid out ground system. In fact, the effectiveness of the capacitors depends on a good ground layout.

How to do correctly and make a good ground layout ? Please share some guidelines / examples.
Thank You for Your help and support in advance. :wink:

Well, one thing that crossed my mind, sorry if it seems like a diversion, is that you should not run high power grounds through the board at all. Create some junction like a terminal block for them, and then just have one wire to the board ground - it is really only needed to keep the signals ground reference at the right voltage. If you have connectors on some high power units, and want to connect those to the board, there is some justification... keep all the high power grounds close together, and use a ground "pour" in the CAD program, to create massively wide ground planes. If it's double sided, put ground planes on both sides and join them wherever possible with through holes and arrays of vias. The alternate use of big ground planes is for electrostatic shielding. I designed a highly sensitive amplifier recently, I provided a shielded box for it, but in fact I discovered that the ground planes on the PCB made it unnecessary, it worked perfectly well with no hum pickup even just sitting open on the bench. I use the shielded box anyway, but it's an interesting demo.

Really, to drill down into the PCB design aspect of ground pours, is something that is documented and discussed more in the CAD field so you should look into your CAD documentation about pours, and maybe go on the ECAD forums and ask. It's not as "black magic" as RF design, but it is a kind of art to do a good one.

@ aarg: Thank You very much for the very detailed guidance. It is not "diversion", it is learning point for EVERYBODY ! :wink:

So, I separated the power GND from sensor GND and put the power GND on a junction terminal.
The terminal distributing the power to the motor controllers and to MEGA+Shield.
In addition the voltage divider and then current meter is here as well (to measure the capacity level of the battery).

I put the junction terminal 5cm away from the motor controllers and the Shield+MEGA.
Can be less the distance?
I added some decoupling capacitors after the battery and 4-5mm before 5V & GND pins on MEGA Shield.

I hope the above is improving the concept. Kindly check the below schematic and give Your valuable feedback. Thank You !

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.