I began this week by going through all the basics again. The last time was about what a PCB is, it's type and the components on the PCB. This week was how to use them create your own board, by drawing a schematic drawing for the same. The basics of PCB and components can be accessed from HERE

So before I begin drawing a PCB I need to know the basics of a circuit. What is a circuit, how electricity flows through different components? The following links explain all this in a very simple manner.

 

 

Assignment:

Individual

-Redraw the echo hello-world board-3D scan an   object

-Add (at least) a button and LED (with a current-limiting resistor)

-Check the design rules, make it, and test it

 

Group

-Use the test equipment in your lab to observe the operation of a microcontroller circuit board

 

 

Software :

-Autodesk Eagle

-Arduino IDE

-Photoshop

 

Materials :

-FR1 Board

-PCB Components

 

Accomplised

 

-Redrew the Hello echo board using Eagle

-Understood the basic drawing of a circuit

-Attempted to draw the same using AtMega328 MCU

-Understood the pinout of various MCUs

-Designed my own circuit with RGB led

-Programmed my board using Arduino

 

 

Group Work

 

Download Files

This brief read helped me a lot in understanding how to go about a circuit design. Now having understood a circuit, the importance of MCU cannot be understated. Hence my net mission was to understand the IC.

 

 

Integrated Circuits

 

An integrated circuit (IC), sometimes called a chip or microchip, is a semiconductor wafer on which thousands or millions of tiny resistors, capacitors, and transistors are fabricated. An IC can function as an amplifier, oscillator, timer, counter, computer memory, or microprocessor.

A particular IC is categorized as either linear (analog) or digital, depending on its intended application. From what I understand IC is the brain of a circuit and it controls all event happening on the board. The following link explaining all about IC's

Knowing the different type of IC’s is crucial as well.

Here's a very shallow breakdown of the micros in my world:

PIC - This is the classic micro form Microchip. Very simple, very proven, but it lacks many of the features that other mfg's are building into their chips. This is a big deal for me. I was a die-hard PIC person for years and I've started to see the limits of PICs and the benefits of other micros!

 

AVR - This is basically a direct competitor to PICs. They do everything a PIC does, but in my new opinion, better, faster, cheaper, and simpler.

 

MSP - These are very good micros by Texas Instruments (TI), not as beefy as AVR or PICs. However, they truly excel at low-power applications. More on this later, but imagine running a complete system on one AA battery for 5 years. This is in the realm of nano-amp current consumption. Crazy!

 

ARM - Why are all these three letters? I don't know actually… ARMs are the new kids on the block and they are huge. Very powerful, very low-cost, they are taking over the world but can be really intimidating if you've never played with a micro before.

8051 - The '8051 core' was the de facto standard in 8-bit (and 4-bit!) microcontrollers. Developed by Intel in the 1980s, it still seems to be the instruction set they love to teach you in college. They are based on archaic, but field proved instruction sets. Very old tech in my humble opinion, but these ICs have been significantly improved over the years (now Flash-based, ADC, SPI, etc.).

 

68HC08/11 - Another very common instruction set developed by Motorola. Extremely popular, and a micro commonly taught at university, it's the microcontroller I love to hate. These original micros often lack onboard RAM and flash-based memory.

 

Each one gets utilized as per requirement of the board. The cost of each varies depending on their function and capabilities.

 

To understand each component such as an IC the manufacturer of the same provides a DATASHEET.

Datasheet

 

A datasheet, data sheet, or spec sheet is a document that summarizes the performance and other technical characteristics of a product, machine, component (e.g., an electronic component), material, a subsystem (e.g., a power supply) or software in sufficient detail to be used by a design engineer to integrate the component into a system. Typically, a datasheet is created by the component/subsystem/software manufacturer and begins with an introductory page describing the rest of the document, followed by listings of specific characteristics, with further information on the connectivity of the devices. In cases where there is relevant source code to include, it is usually attached near the end of the document or separated into another file.

Datasheet of ATmega328/P

For example:

 

The Datasheet of a microcontroller will have the following:

 

-Description

-Configuration summary

-Block Diagram

-Pin Configuration

-I/O Multiplexing

-Resources

-Data Retention

-About code examples

-Capacitive Touch Sensing

-Packaging information

This provides a comprehensive data on how the MCU can be used.

 

To further understand how to read a datasheet, the following link is very useful

https://www.sparkfun.com/tutorials/223

Understanding Pinout

 

In electronics, a pinout (sometimes written "pin-out") is a cross-reference between the contacts, or pins, of an electrical connector or electronic component, and their functions.

The functions of contacts in electrical connectors, be they power- or signaling-related, must be specified in order for connectors to be interchangeable. When connected, each contact of a connector must mate with the contact on the other connector that has the same function. If contacts of disparate functions are allowed to make contact, the connection may fail and damage may result. Therefore, pinouts are a vital reference when building and testing connectors, cables, and adapters.

PinBeam.Pdf

The pdf provides basic information on how to read and understand a pinout. The pinout diagram for each IC is different and its specified in the datasheet for that particular IC. There are such well-designed pinouts that make reading them very easy. At least for me as a beginner was really helpful to have found one of these.

Pinout of ATtiny 25/45/85

Hence to design a circuit its not just enough to understand the working of the circuit but also to understand in detail all its components and how to connect them. The following links are really good to read to understand the basics of a circuit.

https://learn.sparkfun.com/tutorials/voltage-current-resistance-and-ohms-law

https://learn.sparkfun.com/tutorials/what-is-a-circuit

https://learn.sparkfun.com/tutorials/how-to-read-a-schematic

https://learn.sparkfun.com/tutorials/integrated-circuits

Note:

From my personal experience in trying to understand electronics, Sparkfun was a really great website because it has all information and really great tutorials for beginners that are explained in simple language.

Eagle

 

Eagle is PCB designing software. Its a really powerful software with really great features. As post to manual designing, these software really help make life easy. The software is very easy to use and is merely drag and drop. The software can be download from here:

https://www.autodesk.com/products/eagle/free-download

And the tutorials fro the same from here

https://www.youtube.com/watch?v=1AXwjZoyNno&t=286s

http://eagle.autodesk.com/eagle/product-tour

Note the youtube tutorial is for an older version nonetheless the basics are the same. The second links explains all the new feature of eagle.

 

Scheme

 

The task is to redraw the Hello-Echo board. This is the scheme of the board

These are the list of components required to design this board

 

 Component list:

 

1x ATtiny44

1x 10kΩ resistors

1x 10uF Capacitor

1x FTDI Header

1x 6 pin AVRISP Header

1x 20Mhz Resonator

 

Additional components:

1x Red LED

1x 1kΩ resistors

1xPush button

Fire up the eagle software and a new project can be created from the file menu

Creating New project

Right-clicking on the project menu provides more options on to create a new scheme, board library etc.

Creating New scheme

On clicking on scheme brings the workspace panel on which the circuit scheme is going to be drawn. On the left side are the tools that are frequently used. To start drawing we need specific components or the components that are available to us as the footprint of components varies with manufacturers and types. What we use is the one that is specified by FabAcadmy and hence we have a separate library for the same. So our first step is to install them. By clicking on the add button the library panel opens up.

Adding Components

From there click on open library manager to install fab.lbr. The fab library can be downloaded from here.

Adding Custom Library

Once installed the list of components show up in the library and by double-clicking the component they can be placed on the drawing board

Library installed

Adding Components to drawing

Now once the components are on board its time to connect them. There are two ways to do so. First is using the net tool to join the desired components. This is easy and great but the problem is there are a lot of crossing of lines and it's easy to get lost especially when its a big circuit.

Connecting using Net

The second way is to provide net on all connectors and when right clicked a menu opens up and using the name tab, you can name the net. When two nets have the same name they automatically connect. They connection make not show up in the scheme but will show up on the board.

Adding Net

Naming Net

Comparing the types ot NET

Once all the connections are complete we can switch to board to see how we can arrange them. To do this click on file and switch to the board

Switching to Board

All the components can be selected, drag and drop them into the dark black area.  Now arrange the components in the desired shape, but keep in mind that placing the components close to the components it's connected to helps avoid crossing of the line.

Importing all components

Arranging Components

Then when the components are arranged in the desired format, its time to set design rules. The DRC(Design rule check) can be accessed from the tool menu. This opens a window where the rules need to be set by the user. The little graphic on the side gives an idea of what parameters you are changing. As a default, I set everything to 13mil which is approx. 0.3mm. Also from the sizes tab, I made my minimum width of the trace to 13mil

Design Rule

Clearnace

Tarce Size

Now the rules are set. The next step is to route it. Meaning to connect all the components with traces. I used the auto route feature for this.

Auto-Routing

At the first attempt getting a 100% may not be always possible. From here on you can evaluate the design and make modification yourself or you can cancel the job and reorient the components again to a more effective position.

Auto-Routing

After a few attempts, I got a 100% routing. Yet the routing didn't seem efficient. So I modified them a little to suit my needs.

Auto-Routing

Final Board

The designing was done. Now its time to export it for trace and cutting. To do this its necessary to switch off the unnecessary information. In the view, menu click on layer settings. This will bring up a window with layer settings. Here you can switch on only the top layer if it's an SMD board. This will show only the traces on the board.

Layer Setting

Layer Setting

Then file and export as image. Set the location and dpi and do not forget to click on monochrome. This gives a b/w image that's necessary for cutting and tracing.

Exporting

Exporting

Once I got the trace file. I took it to Krita cropped it and made the cut file from it.

Importing and Cropping

Trace and Cut

Final Board - Trace and Cut

Unfortunately, my lab was out of Attiny 44. So I was unable to solder the board.

 

But to understand more about pinouts and other processors I tried to redraw the same board but instead of using an Attiny44 (14 pins), I tried to do it with AtMega328 AU (32 pins).

 

To do this I need to understand the pinouts for both the boards. I think it is in this process I learned a lot about boards. Trying to find the right connections and why I would have to connect A-B and not to C. It was really a great learning experience.

Pinout of Attiny 44

Pinout of ATmega 328

Comparing Pinout

Pin connection:

 

As seen in the picture the MISO MOSI AND SCK pins vary in the two MCU’s. The PA6 pin in attiny44 is MOSI where as the atmega doent even have a pin named PA6. When comparing two IC connections, its not right to match them using the port pin name . They have to be connected as per the pinout chart or the datasheet provided by the manufacturer. One post pin can be used for multiple uses like the PB3 pin in AtMega has IO, MOSI,OC2A and 12th Arduino pin. Depending on the connection to that pin the program needs to be specify its function.

I was successfully able to draw the scheme and take it to board.

Scheme of Hello-Echo

Auto-routing was almost useless until I placed all my components far apart. So I partially autoroute it and started modifying the traces myself. But almost all the time I got stuck with the one or two traces. Here is the result of my last attempt, still one trace left.

Scheme of Hello-Echo

TRI Board

 

So being unable to solder the hello echo board I decided to design my own board with an RGB led and a switch using AtTiny45. I took it eagle again to design my scheme.

 

Component list for TRI:

 

1x ATtiny45

1x 10kΩ resistors

1x 1kΩ resistors

1x 6 pin AVRISP Header

1x RGB LED

1x 1kΩ resistors

1xPush button

Creating new project

TRI Scheme

Having finished with the scheme I took it to the board to change the layout. I wanted to design in a way that has my processor in the middle with the switch and led to the extreme ends. Autorouting worked great for this board yes I made minor modifications and added text to name the board.

TRI Board

Having finished with the scheme I took it to the board to change the layout. I wanted to design in a way that has my processor in the middle with the switch and led to the extreme ends. Autorouting worked great for this board yes I made minor modifications and added text to name the board.

I exported the drawing as image and took it to krita to make cut and trace file. Please click here to know more about Krita

Opening In Krita

Trace and Cut

I exported the trace having finalized the design and began the milling.

 

During the milling week, I had used the local version of fab modules, but I tried using the online module to mill this board.

Copper board

Using double-sided tape to secure the PCB on the milling machine

Sacrificial board

Securing the board

In addition to the last milling, I didn’t use a sacrificial board. So this time I used a sacrificial board, used another fr1 board.

Then went to fabmodules.org to access the module. To make the machine communicate with the computer I opened up the terminal and used the following command

 

Cd Desktop

Cd fabmodules

 

This gets me into the folder where I had cloned fabmodule. Detailed instruction for the same can be followed from here

 

https://github.com/FabModules/fabmodules-html5/wiki/How-to-install

 

Then I entered the following command to make my system talk to the machine

 

Npm start

Having established a connection I went back to the site to configure my input and output setting.

I selected png as input format, .rml as output format, 1/64 trace, and MDX-20 machine.

 

Input

Output

Machine Selection

These are the parameter I used

Cut depth - 0.13mm

Tool diameter - 0.4mm

Offsets - 4

Offset overlap -50%

Path error 0

Calculating

I calculated the path and began the milling process

Using 1/64 bit to trace

Post Tracing

The board looked absolutely fine. The traces did not overlap or touch each other. Having done with milling I went on to solder the board. Another important challenge I faced while soldering is having to identify the orientation of RGB led. Thanks to Gautam I was able to identify that.

This is TRI board after soldering.

TRI Board

TRI Board

Programming

 

As I didn't know programming I had a help of a friend to do so and also I kept referring this tutorial that was super useful.

http://highlowtech.org/?p=1695

To program the board I used Arduino. Arduino software can be downloaded from here. NOTE: To know how to program using the FabISP please click here Week 9

https://www.arduino.cc/en/Main/Software

On opening the software this is what you are welcomed with

Arduino

Arduino supports a number of boards but unfortunately, it doesn't come with Attiny family pre-installed. So I had to do that manually. The following link will help with that.

 

https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json

 

The URL has to be pasted in the preference menu in the location shown

Installing Attiny family

Then when you open up the board manager in tools attiny will show up. I then installed it.

Installing Attiny family

Now the first step is To make the Arduino talk to the ISP, a program had to be loaded first. The Arduino ISP program can be found in the File- Examples menu. I connected the Arduino board to my laptop and uploaded the code.

Arduino ISP

The next step is to connect the jumper cables to the ISP header in the board to the corresponding pins in the Arduino. This image was really helpful in doing that

Connecting TRI to Arduino

Connecting TRI to Arduino

After connecting it's important to select the correct board that needs to be programmed. I wanted to upload a simple blink program to check my circuit is working. To do this select blink program from the examples.

From the tools menu, the Board, Processor, Clock, and Port need to be configured. In my case its Attiny 45

Selecting the right board

The programmer has to be Arduino as ISP. This establishes a connection between both ISPs

Once everything was set I uploaded the program. I had an error while uploading the program. Having checked all parameters again and re-uploaded. The problem remained. I checked my circuit with a multimeter, the circuit seemed fine. I tried once more to upload the program but this time I held down the switch button and tried. The program got UPLOADED  !!! Though it worked something was definitely wrong with the board. That was not all the board did not behave the way it was supposed to. The following video explains the same.

Expected behavior.

 

The red and blue led must blink with the switching having no effect on them.

Reality

The blue and red LEDs blink but when I press the switch the blue alone blinks.

 

The same thing repeated with other combination of colors. So to correct the circuit I had to go online to check similar circuits/connections. The major problem I saw was that I did not connect the light or the switch to a and connection. Someone told me that its called voltage divider bias. Not sure what that meant, but I decided to connect the switch to the ground through a resistor of 1kOhm.

Changing the design

I Milled and soldered the board.

Re-designed board

Re-designed board

Went through all the programming procedures and actually this time to upload the program I didn’t have to hold down the switch. It worked like a charm.

The Led worked exactly how they were suppose to.

Switch @ LOW

Switch @ HIGH

The following video shows the working of the board.

Update:

 

I have redesigned my board my adding a decoupling capacitor of 10mF. A decoupling capacitor is a capacitor used to decouple one part of an electrical network (circuit) from another. Noise caused by other circuit elements is shunted through the capacitor, reducing the effect it has on the rest of the circuit. An alternative name is bypass capacitor as it is used to bypass the power supply or other high impedance component of a circuit.

Redesigning

I have connected a current-limiting resistors to each of the LED’s. You would usually want to have a current limiting resistor in series with your LED so that you can control the amount of current through the LED.

If too much current is going through your LED, it will burn out too fast. If too little current is going through it, it might not be enough to lit the LED. A red LED requires much lesser voltage to illuminate when compared to other LED’s. Looking at the data sheet I was able to understand the characteristics of my RGB LED.

I have connected a current-limiting resistors to each of the LED’s. You would usually want to have a current limiting resistor in series with your LED so that you can control the amount of current through the LED.

If too much current is going through your LED, it will burn out too fast. If too little current is going through it, it might not be enough to lit the LED. A red LED requires much lesser voltage to illuminate when compared to other LED’s. Looking at the data sheet I was able to understand the characteristics of my RGB LED.

Trace + Cut

The resistor value is calculated using Ohm’s law.

 

V= I.R

V = Voltage in volts

I = Current in amps

R = Resistance in ohms

The following page explains all about ohms law. The required V and A of the led can be obtained from datasheet.

https://learn.sparkfun.com/tutorials/voltage-current-resistance-and-ohms-law

Alternatively there are online resistor calculators such as these that help in resistance value calculation.

http://www.ohmslawcalculator.com/ohms-law-calculator

Week 7 Group Work:

 

The assignment is to test the operations of a micro controller with the help of the equipment in the lab. It was quite difficult for us to understand what an oscilloscope does. As none of us are from electronics background we had to go through various tutorials to understand what an oscilloscope does and how to measure voltage from it. The tasks were not segregated to any specific person as we were all unaware on what needs to be done.

So after going through various tutorials we used the oscilloscope to measure the voltage, current and duty cycle of Atmega 328p. Additionally we also measured the input signal for a servo motor.

Conclusion

 

This week seemed easy at first but it wasn't. When the task was set the goal seemed easy because it was just redrawing a circuit and the software wasn't very complicated except for the components part and understand the basic tools and terminologies, but there were a lot more hurdles than anticipated to cross, but by the end of the week I did feel accomplished.  I didn't know making as simple as a LED glow could be so complicated. This made me think how we have taken so much for granted all our lives. I find electronics really interesting but at certain, I got frustrated when the circuit didn't work, not because it didn't work but I could come up with an explanation why it didn't.Electronics seems like a whole new universe to me and still have a lot to explore.

Files

 

All files can be downloaded from HERE

WEEK 7

The week was about learning to design/draw a circuit board. Though there are several ways to achieve that, we were asked to use software like Kicad, eagle etc. to do so. Neil started off the lecture with the basics. He explained what are the different components of a PCB and their uses. Then he moved on to circuits to explain the current flow and how to draw them, simulate them etc. The last part was how to test them. Having gone through electronic production in week 5 I was able to cope up with what was being discussed yet a lot of topics were new.