07. Electronics design¶
This week, a continuation of week 5 where we learned how to manufacture PCB’s, was about designing these PCB’s before manufacturing and then programming them to do a task.
Understanding Basics¶
The first important step to start this learning process was re-learning about the basics of electronic circuits and how they work that we all learned at a young age in school. The below link is a brief explaination of that
Next was undertsanding in detail about the parts and components of the PCB, their functions and what is to be connected where and the Do’s and the Dont’s, for which our Instructor , Kishan Chavda, gave us a tutorial session.
Schematic Symbols for components¶
Resistors¶
Resistors on a schematic are usually represented by a few zig-zag lines, with two terminals extending outward. Schematics using international symbols may instead use a featureless rectangle, instead of the squiggles.
Potentiometers and Variable Resistors¶
Variable resistors and potentiometers each augment the standard resistor symbol with an arrow. The variable resistor remains a two-terminal device, so the arrow is just laid diagonally across the middle. A potentiometer is a three-terminal device, so the arrow becomes the third terminal.
Capacitors¶
There are two commonly used capacitor symbols. One symbol represents a polarized (usually electrolytic or tantalum) capacitor, and the other is for non-polarized caps. In each case there are two terminals, running perpendicularly into plates.
The symbol with one curved plate indicates that the capacitor is polarized. The curved plate represents the cathode of the capacitor, which should be at a lower voltage than the positive, anode pin. A plus sign might also be added to the positive pin of the polarized capacitor symbol.
Inductors¶
Inductors are usually represented by either a series of curved bumps, or loopy coils. International symbols may just define an inductor as a filled-in rectangle.
Switches¶
Switches exist in many different forms. The most basic switch, a single-pole/single-throw (SPST), is two terminals with a half-connected line representing the actuator (the part that connects the terminals together).
Switches with more than one throw, like the SPDT and SP3T below, add more landing spots for the the actuator.
Power Sources¶
Just as there are many options out there for powering your project, there are a wide variety of power source circuit symbols to help specify the power source.
DC or AC Voltage Sources¶
Most of the time when working with electronics, you’ll be using constant voltage sources. We can use either of these two symbols to define whether the source is supplying direct current (DC) or alternating current (AC).
Batteries¶
Batteries, whether they’re those cylindrical, alkaline AA’s or rechargeable lithium-polymers, usually look like a pair of disproportionate, parallel lines.
More pairs of lines usually indicates more series cells in the battery. Also, the longer line is usually used to represent the positive terminal, while the shorter line connects to the negative terminal.
Voltage Nodes¶
Sometimes – on really busy schematics especially – you can assign special symbols to node voltages. You can connect devices to these one-terminal symbols, and it’ll be tied directly to 5V, 3.3V, VCC, or GND (ground). Positive voltage nodes are usually indicated by an arrow pointing up, while ground nodes usually involve one to three flat lines (or sometimes a down-pointing arrow or triangle).
Diodes¶
Basic diodes are usually represented with a triangle pressed up against a line. Diodes are also polarized, so each of the two terminals require distinguishing identifiers. The positive, anode is the terminal running into the flat edge of the triangle. The negative, cathode extends out of the line in the symbol (think of it as a - sign).
There are a all sorts of different types of diodes, each of which has a special riff on the standard diode symbol. Light-emitting diodes (LEDs) augment the diode symbol with a couple lines pointing away. Photodiodes, which generate energy from light (basically, tiny solar cells), flip the arrows around and point them toward the diode.
Other special types of diodes, like Schottky’s or zeners, have their own symbols, with slight variations on the bar part of the symbol.
Transistors¶
Transistors, whether they’re BJTs or MOSFETs, can exist in two configurations: positively doped, or negatively doped. So for each of these types of transistor, there are at least two ways to draw it.
Bipolar Junction Transistors (BJTs)¶
BJTs are three-terminal devices; they have a collector (C), emitter (E), and a base (B). There are two types of BJTs – NPNs and PNPs – and each has its own unique symbol.
The collector (C) and emitter (E) pins are both in-line with each other, but the emitter should always have an arrow on it. If the arrow is pointing inward, it’s a PNP, and, if the arrow is pointing outward, it’s an NPN. A mnemonic for remembering which is which is “NPN: not pointing in.”
Metal Oxide Field-Effect Transistors (MOSFETs)¶
Like BJTs, MOSFETs have three terminals, but this time they’re named source (S), drain (D), and gate (G). And again, there are two different versions of the symbol, depending on whether you’ve got an n-channel or p-channel MOSFET. There are a number of commonly used symbols for each of the MOSFET types.
The arrow in the middle of the symbol (called the bulk) defines whether the MOSFET is n-channel or p-channel. If the arrow is pointing in means it’s a n-channel MOSFET, and if it’s pointing out it’s a p-channel. Remember: “n is in” (kind of the opposite of the NPN mnemonic).
Digital Logic Gates¶
Our standard logic functions – AND, OR, NOT, and XOR – all have unique schematic symbols.
Adding a bubble to the output negates the function, creating NANDs, NORs, and XNORs.
They may have more than two inputs, but the shapes should remain the same (well, maybe a bit bigger), and there should still only be one output.
Integrated Citcuits¶
Integrated circuits accomplish such unique tasks, and are so numerous, that they don’t really get a unique circuit symbol. Usually, an integrated circuit is represented by a rectangle, with pins extending out of the sides. Each pin should be labeled with both a number, and a function.
Because ICs have such a generic circuit symbol, the names, values and labels become very important. Each IC should have a value precisely identifying the name of the chip.
Unique ICs: Op Amps, Voltage Regulators¶
Some of the more common integrated circuits do get a unique circuit symbol. You’ll usually see operation amplifiers laid out like below, with 5 total terminals: a non-inverting input (+), inverting input (-), output, and two power inputs.
Simple voltage regulators are usually three-terminal components with input, output and ground (or adjust) pins. These usually take the shape of a rectangle with pins on the left (input), right (output) and bottom (ground/adjust).
Crystals and Resonators¶
Crystals or resonators are usually a critical part of microcontroller circuits. They help provide a clock signal. Crystal symbols usually have two terminals, while resonators, which add two capacitors to the crystal, usually have three terminals.
Headers and Connectors¶
Whether it’s for providing power, or sending out information, connectors are a requirement on most circuits. These symbols vary depending on what the connector looks like, here’s a sampling.
Motors, Transformers, Speakers, and Relays¶
We’ll lump these together, since they (mostly) all make use of coils in some way. Transformers (not the more-than-meets-the-eye kind) usually involve two coils, butted up against each other, with a couple lines separating them.
Relays¶
Relays usually pair a coil with a switch:
Speakers and Buzzers¶
Speakers and buzzers usually take a form similar to their real-life counterparts.
Motors¶
Motors generally involve an encircled “M”, sometimes with a bit more embellishment around the terminals.
Fuses and PTCs¶
Fuses and PTCs – devices which are generally used to limit large inrushes of current – each have their own unique symbol.
The PTC symbol is actually the generic symbol for a thermistor, a temperature-dependent resistor.
Reference Link : https://learn.sparkfun.com/tutorials/how-to-read-a-schematic/all
Connections of Components¶
Next is identifying how all of the symbols are connected together.
Nets, Nodes and Labels¶
Schematic nets tell you how components are wired together in a circuit. Nets are represented as lines between component terminals. Sometimes (but not always) they’re a unique color, like the green lines in this schematic.
Junctions and Nodes¶
Wires can connect two terminals together, or they can connect dozens. When a wire splits into two directions, it creates a junction. We represent junctions on schematics with nodes, little dots placed at the intersection of the wires.
Nodes give us a way to say that “wires crossing this junction are connected”. The absences of a node at a junction means two separate wires are just passing by, not forming any sort of connection. (When designing schematics, it’s usually good practice to avoid these non-connected overlaps wherever possible, but sometimes it’s unavoidable).
Net Names¶
Sometimes, to make schematics more legible, we’ll give a net a name and label it, rather than routing a wire all over the schematic. Nets with the same name are assumed to be connected, even though there isn’t a visible wire connecting them. Names can either be written directly on top of the net, or they can be “tags”, hanging off the wire.
Nets are usually given a name that specifically states the purpose of signals on that wire. For example, power nets might be labeled “VCC” or “5V”, while serial communication nets might be labeled “RX” or “TX”.
Reference Link : https://learn.sparkfun.com/tutorials/how-to-read-a-schematic/all
After understanding everything above, it’s time to start working with eagle
Working with Autodesk eagle¶
Autodesk EAGLE is an electronic design automation (EDA) software. Enabling printed circuit board (PCB) designers to seamlessly connect schematic diagrams, component placement, PCB routing, and comprehensive library content.
Autodesk Eagle can be dowloaded from here.
https://www.autodesk.com/products/eagle/free-download
After a tutorial from our instructor and watching a few online videos, I started working hands on on the software. The task was to redraw the Hello Echo board. Below is the schematic of the board
-
Following are the list of components required to design this board:
-
1 x ATtiny44
- 1 x 10kΩ resistor
- 1 x 10uF Capacitor
- 1 x FTDI Header
- 1 x 6 pin AVRISP Header
- 1 x 20Mhz Resonator
Additional components:
- 1 x LED
- 1 x 1kΩ resistor
- 1 x Push button
Note: In the second attempt, I’ve added a power LED(and a 1kΩ resistor) which indicates when the board is getting Electric Power.
- It’s time to launch Eagle. Once open, right click on projects and click on new project.
- After naming this new project, right click on this project and select New > Schematic.
- This will open a new window to start drawing the schematic drawing.
- Next is installing the fab library. For this go to FabAcademy Resource Library and download the zip file.
- On extracting this zip file, you should see a list of files including the lib file which is the extension for Eagle libraries.
- Copy this file into the eagle library directory where eagle is installed (Here, C:\Users\Dhruv\Documents\EAGLE\libraries).
- Go to Eagle Window, and open Library Manager from Library drop-down menu.
- In the In Use tab, click on browse and select fab library from the directory where it is copied. This should bring all the fab components in eagle.
- Go to add part. There you should see a list of components in the fab drop down. These are all the components we have in the fab inventory, which include everything we need for the hello-echo board.
- Select these components required for your PCB(listed earlier) and place them on the schematic window.
-
After having all the required components in the schematic, its time to establish the connections. Connect the circuit by joining wires or naming the wires (A combination of both is preferred for easy understanding).
-
For adding wires, click on
-
For naming wires, click on
-
For setting values to components, click on
-
The resultant schematic should look something like this:
Note : This is a useful link I found which helped me understand this process better.
Designing the board¶
- Once the schematic is ready, it’s time to design the PCB. For that, click on generate board on the top and you should see all the components ready to be placed and connected as shown below.
- Place the components on the board such that less number of connecting wires intersect. Place components with more connections at the centre for better results
- Go to Tools > DRC, and change the clearence between the wires to 16mil for more accurate results and not risking copper to intersect with the next wire after soldering.
- Now go to Tools > Autorouter, select High under effort, and N/A under bottom, and press continue.
- The software will start autorouting as shown.
- Out of the options, select the one with the maximum percentage of connections. The aim is to get to 100%.
- Select the one with 100% and make an outline for the board with thickness of 32mil.
- Turf off all the layers except the top layer.
- Go to File > Export > Image and select the destination folder. Check on the monochrome box. and increase the resolution(here : 1200).
A Helpful link : Board Layouting
Seperating the traces and Cut file¶
-
Open this png in photoshop.
-
Go to rectangular lasso tool and select the area with traces
- Invert the selection using ctrl+shift+i to select everything but the traces. Fill this area with black colour using paint bucket tool.
-
Save this as the trace file.
-
Now, go back to the original file and select everything inside the cut area.
- Fill this area with white colour.
-
Save this file as the Cut File.
-
These are the final trace and cut files for this board.
Making the board¶
Follow the steps in week 5 documentation to use the trace and cut file to mill the board.
The finished board, after soldering all the components, should look something like this.
Programming¶
Being a first timer in programming, I referred to several tutorials before actually starting to program the board. The link below was really helpful.
Programming using FabISP¶
- The first step is installing the latest Arduino Software. For that use this link.
(Note: Do not use the Windows app as it gives an error while programming)
-
Once the sofware is installed, you need to add the ATTiny Boards Library in the software. For that, visit this link and follow the instructions.
-
Go to File>Preferences and copy the link(http://drazzy.com/package_drazzy.com_index.json) and paste it in the Additional Boards Manager URLs section.
- Now go to Tools>Boards>Boards Manager,
and find the ATTinycore by Spence Konde and install the latest version.
-
After completeing these one-time steps, the process of programming the board can start.
-
The first step to program the board is to burn the bootloader onto the FabISP. It is a firmware that allows you to install new firmware without the need of another programmer.
-
The following equipment were used for the same:
-
Programming Device(FabISP)
-
Board you want to programme(Here, I’ve used one with ATTiny44 microcontroller)
-
Jumper Wires
-
(Note : Make sure you have the schematic of the board you’re programming on hand)
- Now it’s time to connect all the equipments to start programming. Keep the board layout and programming board Pin-out open and connect the jumper wires accordingly.
The connections made are:
Thi board diagram can be referred from below image:
- The connections were made as shown below.
-
For using any board, you first need to burn the bootloader onto that board before uploading it on your ATTiny44 board. For that select USBTinyISP as your programmer and click on burn bootloader.
-
To start testing your board you can use a simple default code to test. Here, I’ve used a blink code. Go to file>Examples>Basics>blink. This will open the blink code in a new window.
- Go to tools>Boards and change it to ATTiny 44.
- Change the Clock to External:20MHz
- Upload the sketch using a programmer and you should see the LED on the board blinking. Here is the video.
- Thus, we designed, manufactured, and uploaded a basic programme onto the board this week. We’ll look at writing our own programmes and using them to perform various tasks in coming weeks.
All the files for this week are attached here
Group Work¶
The Group Assignment was using the test equipment in your lab to observe the operation of a microcontroller circuit board. The group page can be found here