Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Prerequisites:

Background:

The Problem

When we draw current from a battery it also produces heat, which induces a high current draw. If a battery gets hot enough, it will enter a thermal runaway where it gets so hot that it draws much more current than normal, producing more heat and drawing more current until the battery explodes (not good). There are a lot of preventative measures you can take to avoid thermal runaway like passive cell balancing. The simplest option to prevent the battery from getting too hot is controlling fans to dissipate heat in the battery box.

Given that the voltage stays the same, and the current increases when the cells get hotter. What circuit component must be changing due to the heat (not the current).

How do we control fans?

Unfortunately, we can’t have the fans on at all times since that’s a huge draw of our limited power, so BPS turns the fans on at different speeds depending on the state of the battery’s heat.

The first thought is to turn it on or off a switch via the BPS microcontroller and control it in software.

We also need to vary the speed through something called PWM. Essentially, you toggle the pin controlling the fan to be high and low at a specific frequency and duty cycle. It’s the same concept you use to control screen brightness.

https://www.environmentallights.com/library/pwm#:~:text=PWM%20is%20a%20very%20common,they%20are%20off%20(0%25).

Mosfets:

The “switch“ we’re using is called a mosfet. A mosfet is a voltage-controlled switch that depending on the voltage at the input, it shorts or opens the switch.

image-20240927-161431.png

For an N-Channel mosfet (NMOS) specifically, the pins are:

  • Gate - G

  • Drain - D

  • Source - S

Each mosfet has a voltage threshold (Vth). For a mosfet when the voltage between the gate and the source is greater than the threshold voltage the drain and source pins are shorted to each other. Note that the gate pin of the mosfet acts as a control for the switch.

Requirements:

  • The BPS MCU must control a switch

  • The switch must be able to handle the current going through the fan

  • This board connects to the BPS Leader board and a connector that sends 12V, GND, and 4 PWM signals

    • Screenshot 2024-09-27 113915.png

    • Make sure you make the connector the same as this on your board

  • We have 4 PWM pins that can be used to control a fan, meaning we need 4 connectors (one for each fan)

    • `image-20240927-165733.png

    • We use 2 wire fans so just power and ground

Schematic:

Some notes, make sure when you edit or open schematic or PCB files, only open them from the project menu or else you get some weird results

My recommendation for starting this is to lay out every component you know you need, we know we have 4 2-pin connectors, 1 6-pin connector, and some number of MOSFETs. Place those components first and the vision will be clearer

For the NMOS use the IRLM0030 symbol

Symbol Libraries:

We have many shared components for our boards, so we decided to have a separate repository just for storing shared components.

Repo Link: https://github.com/lhr-solar/UTSVT-KiCadLibraries

We store this library in your repository as a submodule which means we’re cloning a 2nd repository (the KiCAD Libraries repo) into your PCB repository

Steps to add the UTSVT-KiCAD Libraries repo to your repository.:

  1. Travel to your PCB directory in Git Bashimage-20240927-143532.png

  2. Get the clone link of the UTSVT-KiCADLibraries repo

  3. Type this into bash:

    git submodule add [clone link of the UTSVT-KiCADLibraries repo
  4. Go to the schematic editor of the starter project

  5. Go to Preferences->Manage Symbol Libraries

  6. Go to the “Project Specific Libraries“ page

  7. Press the + button at the bottom left of the screen

  8. In Library path, select the “utsvt-chips.kicad_sym” and change the nickname to usvt-chips

    1. {KIPRJMOD} is a variable that changes depending on the user.

    2. Make sure to use the {KIPRJMOD} variable instead of your /Users/[username] directory

  9. Repeat step 8 for every .kicad_sym file

  10. Press “Ok“

  11. To test if it worked, in the menu to add symbols type the nickname for one of the libraries you added and see if there is a symbol in that section

Why do I need to use {KIPRJMOD}

Why don’t I just download thee UTSVT-KiCAD Libraries as a zip and then copy and paste it into the repo?

Protections:

Bypass capacitors:

Wires (and traces!) have an inherent resistance, meaning we induce “noise“ in longer wires, creating a 12V that is sometimes 11.9V or 12.2V. To fix this, we add bypass capacitors in parallel with the 12V and GND lines to filter out that noise.

During layout keep the capacitors close to the pins you’re trying to filter noise to.

Current Limiting:

The gate to drain of a mosfet acts as a weak capacitor (cuz semiconductor physics don’t ask me), so for various reasons, we need to limit current on the input of the gate, so add a resistor in series with the gate ( a 100k ohm resistor works fine).

Look up the equation for current through a capacitor, given that equation why does switching the mosfet on and off induce high instantaneous current (assume current is staying constant).

Pullup Resistors:

If I gave you a mosfet, what would you say the voltage at the mosfet's gate is at? 0V? 3.3V? One might think that the mosfet is at 0V, but it’s actually in a state called high impedance (z). High impedance means it’s an unknown state (0V is a state, we know it’s at a low voltage), and in an unknown state outside noise could be acting on this input which may cause unknown transients to affect the pin (in this case it could mean a false switch activation or deactivation).

image-20240927-161431.png

To mitigate this we set the voltage of the gate to another voltage when no signal is being applied. Through a pull-up resistor or pull-down resistor. A pull-up resistor pulls the signal to some voltage (usually VCC →, in this case, it’s 12V). A pull-down resistor pulls it down to GND.

Pullup resistor

Pulldown resistor

Pulls a voltage to Vcc

Pull a voltage to GND

image-20240927-184845.png

image-20240927-184647.png

You only need a pullup or a pulldown, why did you choose one

Flyback diode:

Stuff like motors and fans acts as an inductor, meaning they store current and then dump it all out. When we suddenly switch off an inductive load, the inductor will try to dump out all this stored current (because by opening the switch we’ve removed the current source essentially). To prevent this dump from causing big current spikes through our system we add a flyback diode in parallel with the inductive load (also called snubber diode, freewheeling diode, etc).

Diodes are directional, what direction should you place the diode in and what would happen if the diode were placed in the wrong orientation

Mechanical:

To hold the boards down mechanically in the enclosures, we use mounting holes to screw into them. We need 4 mounting holes. The symbol is called Mouting Hole (the unconnected one).

Setting footprints:

womp womp

Final Checks:

When debugging problems, it’s nice to have status LEDs so add one for 12V power (make sure to add a current limiting resistor)

Run the ERC checker often Inspect -> Electrical Rules Checker

PCB:

Make things symmetric :0

Footprint Libraries:

Make sure you do the symbol libraries setup step before this step

  1. Go to the PCB editor

  2. Preferences → Manage Footprint Libraries

  3. Go to Project Specific Libraries

  4. Add each .pretty folder

    1. Make sure the nickname stays as the the name of the footprints foder (without the .pretty name)

Setting up constraints:

The PCB manufacturer we use (JLCPCB) has specific machining requirements that we need to follow to have them order the board.

They are linked here: https://github.com/lhr-solar/UTSVT-KiCadLibraries?tab=readme-ov-file#standard-constraints-for-laying-out-board

  1. Go to File-> Board Setup

  2. Go to Constraints

  3. Change the constraints

Edge cut of PCB:

The edge cut of the PCB defines the real size of the board. Try and make it small pls.

I recommend making the edge cut with the mounting holes first then doing the layout of the components around it.

Pressing E on a footprint shows the properties of the footprint including position

To align two components you can select them, right click → Align/Distribute, from there press Horizontal and Vertical

Laying out traces:

This is your opportunity to get creative!

A few tips:

  • Try to keep traces directionally consistent

    • top layer traces only go in one direction

    • bottom layer traces go in the other direction

  • Do a subcircuit first (one fan driver circuit) then copy that layout for the other drivers

    • If you select multiple components you can right click → Grouping → Group Items

  • Do your layout before first before you draw your traces!

Wrapping Up:

Make a PR for

  • No labels