MAQS sensor board schematic capture
Please Log In for full access to the web site.
Note that this link will take you to an external site (https://shimmer.mit.edu) to authenticate, and then you will be redirected back to this page.
What is MAQS?
MAQS is our air quality monitor that we'll create in the first part of the term. We introduced MAQS in Lecture 03. Head over to the MAQS project page and poke around. MAQS's hardware is loosely divided into three subsystems: sensing, computation/communication, and power management. We've physically partitioned these three subsystems into three printed-circuit boards (PCBs).
For the computation/communication board, we'll just use the ESP32C3 dev board. But for the other two boards, we'll make those ourselves.
In this lab we'll start the design for the simpler one - the sensor board.
Learning Objectives
In this exercise, you'll create the schematic for the MAQS's sensor board in an electrical design tool called KiCad. If you want to be extra cool, note that it is pronounced "key-cad". It'll let us capture our design as a schematic, which we'll later turn into a printed circuit board (PCB) through a process called layout. Here, you'll do a little circuit design, and hunt for information in datasheets.
You'll need a working copy of KiCad 7+ for this lab. The instructions for getting it are here, along with the rest of the course software.
Why are we doing this?
We can get an SHTC3 board from a vendor. We can get a particulate measurement board from a vendor. So why make our own? Four reasons:
-
When we make our own we have complete control over what's on the board. Already, we have a 3V3 regulator on the SHTC3 board that aren't using. Now we can get rid of that -- fewer components, less cost, less power consumption.
-
We can go beyond the breakout. Breakout boards represent probably well less than 1% of the components that are out there. Now you can design your team project using almost any part that you can buy on Digikey. That allows for a better design.
-
Teaching. Many of the concepts involved in developing a PCB schematic and layout build on what you learned in 6.200 and related classes. It's a reinforcement exercise.
And, finally, being able to create your own PCBs, even simple ones, opens up new vistas. It's a great skill to have, for work or hobby.
Circuit Schematics
The first step of designing a PCB is drawing a schematic, which depicts all of the components and how they are connected. This process is called schematic capture. Schematics are how electrical engineers represent circuits logically, and let us do circuit design without having to think about where exactly the physical components will live in real life. They look something like this:
KiCad has it's own set of tools that'll help us make sure that the circuit our schematic represents actually works. Schematics are also used by circuit simulators like LTSpice that toss in physical models of each component, and simulate the circuit through time. If you do it right, this helps verify that the circuit will perform as expected.
If you haven't used KiCad before or if you want a refresher, we recommend the following tutorials on schematic capture:
Specifications & Design
The design specs for MAQS are listed on it's page, and it'll need to sense temperature, relative humidity, and air quality via particulate counting. We've chosen to use the following two sensors:
The SHTC3 communicates with a microcontroller via I2C, whereas the PMS7003 communicates via UART. Both will communicate using 3.3V voltage levels, but the PMS7003 further requires 5V supply voltage to run (because it has an on-board fan that needs that voltage). Since almost all of our system only requries 3.3V, what we'll do is incorporate a little boost converter to create 5V from the 3.3V.
Thus, our sensor board will include connectors for power (3.3V and GND), I2C communications (SDA and SCL lines), and UART communications (RX, TX lines).
What else do we need to specify?
In designing this subsystem, like many others in this class, we need to think through the interactions with other subsystems, as well as test and verification (and thus debugging!). For this first design, we'll basically tell you what you need to include and why. For the next design you're more on your own!
-
Connectors: how are we going to get the electrical signals from this board to the others? We'll need cables to do this - but there's an incredibly large selection of wires and connectors to build our cables from. Here we'll use a TE Connectivity's MTA connector system, and then some generic 22-gauge or 28-gauge wire between them. Why? These use something called "insulation displacement connectors" (IDC), which make for cables that are really straightforward to make. And because we don't have any crazy specs in terms of voltage, current, or frequency, this is a fine choice.
-
Debugging: We all hope our HW/SW works the first time - but it won't! So you need to make debugging easier. On the hardware side, that means:
- Making sure all important pins on the chips are "brought out" so they can be probed, or soldered to, and
- Including what are known as test points on key signal paths. Test points allow us to probe the circuit to verify it is working correctly. For this board, think about what signals would be useful to be able to test if the board does not work right away.
- Including status LEDs. It's annoying if you have to hook your system up to an oscilloscope or computer to know if it's on, or working. So we add status LEDs that help us know at-a-glance what's going on.
-
Testing & verification: related to debugging is testing. How do we know if our sensors work? We need to set up tests, same as the "unit tests" in software engineering. For an environmental sensor, that means testing across T, RH, particulate levels. Not easy! We'll return to this later.
Schematic Design on Paper
Before drawing the schematic in KiCad, we will first sketch things out on paper.
IC manufacturers will often provide reference or typical application designs in the datasheets. These show an example design that covers most of the use cases of their specific part - they do this to make your job as a designer easy, so you'll use their parts! For now, we're going to follow their lead, and use their reference designs for our two sensors. We'll find those in:
-
Check out Figure 6 on page 6 of the SHTC3 datasheet. The diagram shows how the sensor should be connected for correct operation.
-
Check out pages 3 - 5 of the PMS7003 datasheet. Pages 3 and 4 have the pinout of the connector on the PMS7003, while page 5 has a "typical circuit". We won't be using the SET/RESET pins (too much trouble for our simple system), and page 10 has some notes on what to do if you aren't using those pins.
-
To get the 5V that the PMS7003 requires, we'll use an AP3602A boost converter. This is normally used to drive LEDs, but it is fine to also drive the PMS7003. Page 1 of the datasheet has a typical circuit.
We'll be putting all of these components on the same PCB - but the reference designs don't know that! It's your job to combine them all into a single circuit. Go ahead and sketch this out on paper - you'll need more than just the three ICs, you'll also need some resistors, capacitors, and connectors.
-
You'll want to share ground across the ICs. However, be careful about the two different supply voltages (5V and 3.3V) -- you'll want to keep those separate.
-
Next, mark the signals that you think will need test points. A simple rule of thumb for us: put test points on each separate signal, aka 3.3V power, 5V power, ground, SDL, SCA, RX, TX.
-
Next, we need to add in status LEDs. We recommend at least a status LED on the 3.3V power line. If you'd like to add others, feel free. Each LED will need a series resistor connected between the LED's anode and the signal being measured (in this case, 3.3V). This so-called current-limiting resistor (details here, or here) needs to be of the right value so that the right amount of current goes through the LED: too much current and the LED will burn out, and it will consume too much power; too little current and the LED will not turn on or will be really dim. The amount of current depends on the LED. You have a choice of four colors, all from the same part family:
- Red: HSMS-C170
- Yellow: HSMY-C170
- Green: HSMG-C170
- Orange: HSMD-C170
The datasheet provides the typical (forward) voltage needed to achieve the 20 mA they use as their standard brightness (see Table 5). That's actually much brighter than we need, and will burn alot of power. We'll instead want a resistor sized to give around 5 mA of current thru the LED. A bit dimmer, but not as wasteful in terms of power. You can assume the same forward voltage even at the lower current. Pick your color, and calculate your resistance given our 3.3V supply voltage.
We don't ask you to hand in the paper schematic, but you'll need it to keep yourself from getting confused as you're putting things into KiCad. We're teaching you both design intuition and a new tool here, and your paper schematic is the bridge between the two - it's your map and anchor. Put some care into it. Once it's complete, let's capture it in KiCad.
Schematic Capture
Fire up KiCad. You should see a window open up. From this main Kicad window, you can make a new project by clicking File
-> New Project
.
If you want to add your kicad project to a git repo, we suggest you add the kicad specific gitignore lines to the repo's gitignore file. This will tell git to not upload kicad's autogeneraged backup files and cache files.
Once you have made a new blank project, the main kicad window will show 2 blank files in the project directory, a .kicad_pcb
file and a .kicad_sch
file. Let's open the schematic file by clicking on the schematic editor icon.
Placing Components
The first step is placing all the components our circuit needs into the schematic.
Let's add our passive components (resistors, capacitors, LEDs) first. To add a part (or symbol) to our schematic, press the letter A
on your keyboard or click on the Add a symbol
icon on the right of the schematic editor window.
In the searchbox type in R_US
or R
(R_US
is the american resistor symbol while R
is european style symbol) and select the resistor. The symbol will be attached to your mouse cursor and can be placed anywhere on your schematic by just clicking.
If you want to rotate your resistor, select it and press R
on your keyboard.
To add more resistors, we can repeat the above steps, or select the previous resistor and copy-paste.
We should probably specify the value of the resistors. To do so, we right click the symbol and open the Properties
dialog. Change the text in the Value
field of the Symbol Properties
dialog box that pops up.
Once you have added and given a value to all of your resistors, add your capacitors and LEDs in the same way. (Make sure to specify each capacitance or color)
Other parts to insert:
- a 4-pin signal connector (Hint: search for
Conn_01x04_Socket
) - a 2-pin power connector (Hint: search for
Conn_01x02_Socket
) - Test points: search for "testpoint" and choose one with only 1 connection.
- an 10-pin signal connector for the PMS5003 sensor (Hint: search for
Conn_02x05_Socket
).
Add the ICs
Once we have our passive components in place, let's add our Integrated Circuits (ICs). As you know, this design requires an SHTC3 RH/T sensor. We can search for this in the standard KiCad library and add it to our design.
At the library
Our design also needs an AP3602A boost converter. Unfortunately, this IC is not available in KiCad's default part library. To obtain its symbol and footprint, we can download them from an online service. Although the exact procedure can vary depending on the part, it generally involves the following steps:
- Find the exact part on an online electronics component distributor, such as DigiKey or Mouser.
- Scroll down to the section where the EDA/CAD or ECAD model is listed.
- Create an account with the library service, if necessary, and download the KiCad-specific library files.
Once you get your hand on the library files, we need to put them into a project specific library folder.
- In your project's folder, create a new folder called
lib
in the same location as the.kicad_pcb
and.kicad_sch
files. - Inside the
lib
folder, create a new folder calledAP3602A
. This is where the boost converter's files will go. - Within the
AP3602A
folder, move the.kicad_sym
file and the folder.pretty
folder
After all that, your directory structure should look something like this:
The last step is to tell Kicad to look in these folders for our part. Find and open the main Kicad project window:
On the top, open Prefrences
then Manage Symbol Libraries...
- Click the
Project Specific Libraries
tab on top (NOT Global Libraries) - Click on the icon of the folder towards the bottom
- Navigate to the part's
.kicad_sym
file and select it. Close the dialog box.
If all goes well, you will have added the part's symbol to your project. To add the part's footprint, lets return to the main project window. Once again on the top open Prefrences
but this time click Manage Footprint Libraries
. Repeate the same steps as above (Project Specific Libraries
). One difference is that for footprints, Kicad wants a folder that ends in .pretty
as opposed to the symbol's .kicad_sym
file. Since we spent time organizing the part's library folders, it should be in there.
Now we can finally search for the AP3602A and add it to our schematic.
Making connections
At this point, your schematic should contain a bunch of randomly arranged, unconnected parts. Click the wire tool in the right-side toolbar of your editor, and wire the parts together. This connects them electrically.
You'll also want to arrange your parts so that you don't end up with a ratsnest once everything's connected. You can rotate your parts by hitting the R
key with the part selected, and you can mirror the part with the X
and Y
keys - which one you press determines the axis it's mirrored on.
As you start to draw more than a few wires, eventually your wires will cross and eventually your design will get messy. See the next section below about how to make the design neater via use of Nets. In particular, you may find it useful to Power and Ground ports in your design, which are again accessible from the right-side toolbar.
Nets / Net Labels
Thus far we haven't had a ton of connections between components, and there haven't been that many components to connect to. That goes away for larger designs, which will turn into a ratsnest of chaos if we only connect things with wires. We'll need some notation to help us keep our schematics tidy and legible. The electrical engineers of yore decided that the best way to do this was by putting a label next to the wire to label the signal - and when we want to use this signal elsewhere, we just put the same label next to that wire, making them electrically connected. This means that everything with the same name is electrically connected.
Kicad (along with most electrical design tools) implements this feature as something called a net, which is just that named wire. We assign wires to nets by throwing a net label on the wire, and any two wires that have the same net label attached to them will be electrically connected. For this to work, the names must match exactly, but we get to pick the names. And as long as we name our nets things that make sense, we can make our schematic make sense to whoever's reading it. Just like variables in code.
Here's an example:
If you notice, we're using net labels for signals like NRST
, USB_DM
, PA05
, GND
, and so on.
For the purposes of this class, We would like you to use Net Lables to clarify your schematics. This will make your schematics easier to design and review. An additional benefit to labling your nets is that it makes the PCB layout stage less confusing. KiCad will present the net names to you during PCB layout. If a net has no label, KiCad will give the net a confusing name which you will have to decipher. Label yo Nets!
The one time we don't want you to label nets is if the pin connects directly to a power or ground net. In those cases you want to add a power port by clicking on the following (or hitting P
):
Even though it looks like a ground symbol, it will also allow you to put in power symbols. In the diaglog box, you can search for "+3V3" or GND" or lots of other options. Once you've added a power symbol, that will also label those nodes as power or ground nets (so you don't need to add explicit net labels).
To add a net label, click the net label
tool on the right hand side of the schematic editor (or press L
on your keyboard).
You will be prompted to give the net a name. Give the net a name and then click okay. Your label should look like this:
You can place your net label on an existing net to assign the name to that net. You can also just place the label on your schematic and attach a wire to in as if it were a one-terminal component. Here is an example of the different ways net lables can be used:
Assigning footprints
To reduce the size of our boards, we'll be using surface mount (SMD) components when possible. SMD components are mounted directly to the face of the board rather than requiring a through-hole. Surface mount parts come in a range of standard packages and sizes. For our resistors, capacitors, and LEDs we're going to standardize things by always using 0805 parts. 0805 refers to the dimensions of the package, in this case 0.08" by 0.05" (or, 2 mm by 1.2 mm, for those in societies without a manned lunar program). This choice is a bit arbitrary, but 0805 parts are common, small enough to create compact boards, and large enough to put together by hand.
To assign footprints to our parts, open the Footprint assignment tool
on the topside toolbar.
The list on the left contains all of the currently accessible footprint libraries. The list on the right shows each footprint within the selected library. The list in the middle are all of the parts present in your design.
To assign the 0805 footprint to the resistor, lets do the following:
- Find the
Resistor_SMD
library on the left - Find the
R_0805
footprint on the right. There will be two (one has larger connection pads that are easier to solder by hand (choose this one :-) )) - Once it's been selected, copy it into your clipboard using your os-specific clipboard keyboard shortcuts
- Select one of the resistors present in your design (middle list) and paste the footprint on your part. Rinse and repeat for the other resistors in your design. (Protip: select multiple resistors (click on the first, hold shift and click on the last) in your design and paste them all at once)
Great. Now assign the Capacitors and LEDs with their respective 0805 footprints
To assign the correct footprint to our pin headers, look for the Vertical
footprint of the right dimension in the Connector_PinHeader_2.54mm
library. Be careful to select the thru-hole footprint with the correct number of pins. They should all have a 100mil (2.54mm) pin-to-pin distance (except the 02x05 connector for the PMS7003, which should have 50mil (1.27mm) pitch).
The last footprint to assign is our test points. For ease of connecting to the test points, we suggest you assign the TestPoint:TestPoint_THTPad_2.0x2.0mm_Drill1.0mm
footprint.
After you have assigned the footprints, Apply, Save Schematic, & Continue
and press OK
.
Final Schematic Requirements
Before moving on, your schematic should meet the following requirements. Your schematic should have:
- One four-pin connector (or two 2-pin connectors) with pins SDA, SCL, TX, RX to provide access to the I2C & UART interfaces.
- One two-pin connector to provide 3.3V and GND.
- A LED (in an 0805 package) indicating when the board is connected to power.
- Test points on RX, TX, SDL, SCL, 3.3V, 5V, and ground nets for debugging. The test points can be placed anywhere on those nets.
- Appropriately named nets for SDA, SCL, TX, RX, GND, 5V, and 3.3V.
- The SHTC3 should be wired to 3.3V, GND, SDA, and SCL according to its component datasheets.
- The PMS7003 is represented by its 10-pin (02x05) connector. The VCC, GND, TXD, RXD pins need to be wired up. The RESET and SET pins can be left floating because we are not using them (check out pg10 of the datasheet for more on that).
- Very likely 3 resistors and 4 capacitors.
ERC
Every time you make a schematic you'll want to run the Electrical Rule Check (ERC), which is a set of automated checks it does to make sure your design looks okay. You can run from (Inspect / Electrical Rules Checker / Run ERC).
You'll probably get some errors about pins on the PMS7003 connector not being connected. The best way to fix that is to add explicit "No Connect" labels to those pins. Use (Place / Add No Connect Flag) and put them on all the pins you don't want to have any connections. Run your check again.
You will also get errors that say "Input power pin not driven by any Output Power pins". These you can safely Ignore by right-clicking and selecting "Exclude this violation".
Once you are satisfied with your schematic, save it. Kicad is actually pretty compatible with git at least as far as it coming to archiving and version-controlling your designs (a schematic file is just thousands of lines of markup language...same case with a pcb)1
On your computer, find where you created your Kicad project. In that folder, you'll see a number of files like a .kicad_pro
file, which is the overall project file, a .kicad_sch
file which is your schematic, a .kicad_pcb
file which is your PCB file, and a number of other files. This folder is what you want to track/version control. In a terminal (or a wsl or gitbash shell) go into that folder and do:
git init
This will initialize the folder as a repository. Then do:
git add .
This will add all the files in the folder to this repository. Next do a commit so this initial add is all included. Something like:
git commit -m 'initial add of files for design'
Next you need to "link" it to the remote repository we want you to push to (the repository that we'll, as staff have access to so we can review your design and provide feedback). The "invite link" for this first assignment is here. You should be able to there and using your github credentials log in. This should just "work" but message us on Piazza when/if t doesn't. Once you are in the classroom you can use the same link to basically link your project to this first assignment.
Once you go through setting that up you should have some sort of notification like this. This will tell you the actual rep you should be linking to
You'll use this full path name ("https://.....") in the next command (replace the https:// here with your specific link)
git remote add origin https://...
This will point your git repo to a already-existing github classroom endpoint so that when you "push" your changes here, it will to to a special copy just associated with you.
Next do:
git branch -M main
And then finally do:
git push -u origin main
At this point you will likely be prompted with some credentials. There are several ways to do this...a personal access token is sometimes the easiest in my opinion, though if you already have other means of authentication in place go with that Personal Access Tokens details can be found here.
Once that is all through, your design should be up in the repo and we'll be able to review it and give notes.
What's next
In Lab03 we'll do some schematic reviews, and the rest will get comments asynchronously. We'll then turn our schematic into an actual PCB in EX03 when we layout the board.