WEEK7: ELECTRONICS DESIGN
ASSIGNMENTS:
- Redraw the echo hello-world board, add (at least) a button and LED (with current-limiting resistor)
- Check the design rules, make it, and test it
- Extra credit: simulate its operation
- Extra credit: render it
Group assignment
- Use the test equipment in your lab to observe the operation of a micro-controller circuit board
DESIGNING CIRCUIT WITH MICRO-CONTROLLER UNIT
STEP01: UNDERSTANDING ELECTRONICS COMPONENT ESP MCU
- For this week's assignment goal was to design circuit with micro-controller. In order to do so first one has to understand functionality of components, and its identification.
- So, I start with exploring resources, which helped me clear fundamentals of circuit , its flow, and connection requirements for Printed Circuit Board (PCB).
- Here are some very good resources from the Sparkfun to understand the same.
- Understanding components and its flow: This article helps to understand component functionality.
- Understanding Circuit: This article illustrate circuit from its root.
- PCB basics: Explains from beginning of circuit board
STEP02: DRAW BASIC CIRCUIT
- Now I tried to draw basic circuit with micro-controller. In order to do so first I identified required components to glow LED with button which run by micro-controller program.
- Required components are as below.
- A) Micro-controller (To perform required functionality by storing program)
- B) LED
- C) Resistor
- D) Button and Resistor (Initially I made mistake not to use resistor with button)
- E) ISP header (To connect PCB to programmer)
STEP03: WORKING WITH AUTODESK EAGLE
- Autodesk Eagle is PCB design software with Electronic Design Automation (EDA) scripting. Eagle stands for Easily Applicable Graphical Layout Editor.
- It has main two work sections, 1) Schematic - Where one can load parts from component libraries and make connections between them. 2) Board layout - Where one can rout board connection (auto-rout with optimized flow, and manual as well) and design PCB for production
- Very good tutorial on Eagle by Sparkfun are as here. Schematic tutorial, and Board layout tutorial
A) Downloading component libraries
- Component libraries we have to add in Eagle, there are some by default libraries available as well.
- I have downloaded library package from Gautam Prakash website (Last year student from FabLab CEPT).
- Mostly I have used Adafruit, Sparkfun, NodeMCU, and Fab libraries.
- Link is here to download Eagle libraries
- In order to add library one has to go in Schematic -> Library -> Library manager -> Browse
B) Adding components for my board
- Now I start with adding my components to make above designed board, I used same list to find and load component in schematic
- Process to load component in schematic is to click on ADD button from left toolbar -> find your component from list -> Double click to add
- I have added all required component in my schematic
- My components are,
- A) ATTiny 45 MCU
- B) Red LED and 1k Resistor
- C) Button switch (4 leg smd)
- D) 10k Resistor for button
- E) ISP header (6 pin)
C) MAKING CIRCUIT CONNECTIONS
- Next step is to make connections between components, so that circuit current flow gets completed.
- For this one has to keep in mind basic functionality and current flow between electric components.
- Best way to do this reading datasheet of component, so that one can get exact idea about pin configuration and footprint of particular component.
- I have downloaded datasheet of ATTiny45 and understand its pin configurations.
- Secondly, one can also get component detail in Eagle only, once we click on component it shows detail description for the same, and also have link of datasheet or manufacturer if you are adding component from those libraries.
- To make connections I have started with button and ATtiny 45, for this one can just draw connection line (green), or change name value to make connection.
Calculating resistance value for LED
- Value of resistance can be calculated by means of Ohm's law.
- So, for my circuit's case, I am supplying voltage V=3.3V, and Current draw will be 10mA. For this case Resistance value based on V=IR formula, will be obtained as 330 Ohm.
- So, for this case it's advisable to use resistance nearby to this value.
- Although LED resistance value can be changed based on brightness you want from LED. For brighter LED light more current will be supplied and for darker less current so higher will be resistor value.
D) Working with Board layout and Routing
- Now to generate board layout one has to click on BRD symbol from top toolbar in eagle schematic. After that one will be shifted to board view and all component will be bottom left corner, which need to be pick and placed in circuit view.
- Here one can arrange component by their own choice, but need to keep in mind that it has no overlaping of traces or wires.
- For this Eagle has Autoroute tool, which optimized wire traces and paths to connect all components. Here important parameter to understand is DRC (Design Rule Check) which has various parameter such as clearances, wire size, and distances etc.
- I have set min clearances 0.315mm and min trace width 0.03mm, references taken from Gautam prakash webiste. Here one can adjust their own trace width, clearances, wire size etc.
- I have adjusted component as per my design and run auto-routing, and got connections automatically.
E) Redesign circuit as per milling traces requirement
- After autorouting I exported my board file as png image in monochrome style.
- Then I checked file in fabmodules.org and run milling traces for my lab's machine and tool sizes. And I got result that many traces and pads were getting overlap, so I have to go back to design and increase distances between those wires and pads accordingly.
- I have did this iteration 8 to 10 times to get all connection rights to fit in my compact design. I could have done by changing design but I wanted to keep my design as it is. As Niel explained this exercise is like solving puzzle.
- Once all paths were right I made my file ready in Adobe photoshop to make png of Traces and Cut path differently.
STEP04: MILLING CIRCUIT BOARD IN MODELA MDX-20
- For milling circuit board I have used different approach as suggested by Regional Instructor Ohad that we should use new online fabmodules.org to mill board in our machine. In last week 04 assignment I have used old system based software.
- To work with fabmodules.org following steps need to be followed.
- 1) Open fab modules.org in system connected with modela machine by cable. In fab modules select png file -> Select output as .rml -> Select machine MDX-20.
- 2) Got to linux terminal and type "cd fabmodules" and hit enter
- 3) Next type "npm start" and hit enter. It should show "listening for connection"
- 4) Select cutting parameter and tool size and hit Calculate
- Once file is ready to cut I have changed tool to 1/64th inch in machine and stick my board above sacrificial board with the help of double sided tape.
- Once ready hit Send to start milling.
Calculate traces in Fab modules with cutting parameter and tool size
Milling two times side by side one after another
STEP05: Soldering board with LED and BUTTON
- As I have practiced soldering in week 04, this time I was pretty familiar with requirement of soldering and things to be taken care while soldering SMD components.
- I have collected all components on sheet where I placed my soldering station and solder wire.
- This time I have used bit different technique for soldering as guided by Instructor Rudrapalsinh, I applied liquid flux first, solder one leg of component by taking solder on soldering iron tip, and afterwards apply solder and iron at the same time to board.
- With this I solder two PCB, by keeping one extra for practice soldering and programming.
Redesigning board with decoupling capacitor
- As suggested by instructor and evaluator that adding decoupling capacitor between power line in circuit is advisable.
- Very good study on decoupling capacitor can be found here on Sparkfun
- After studying I have found that when ATtiny45 uses as MCU, which is using internal clock, which prevents the circuit from high frequency noise.
- This is valuable point which I have missed, so below is redesigned board with routing as 100%.
- Adding decoupling capacitor between VCC and GND line.
- Adding decoupling capacitor between VCC and GND line.
- DRC rule for my board, I have used wire size as 0.4mm.
- DRC rule for clearance, I have used 0.4mm for all the clearance as my bit size is 0.4mm.
- Routing under auto-routing.
- Final design file with decoupling capacitor
PROGRAMMING OF BOARD
- To program my board I have decided to use Arduino to load the code in Integrated circuit i.e. ATTiny45 here in my case.
- First I aim to program to blink LED
- Very good online reference I got from here. Also got very good support from Mr Kishan Chavda who is Research Assistant in my fablab.
Program my PCB with Arduino (Programming the board with FabISP is done here)
- For this application first I have to make my Arduino UNO as programmer which can load program in my IC.
- Now I have to load/download ATtiny board. To do so, one need to have Arduino IDE in computer. Then follow these steps.
- File -> Preferences. In Preferences window go to Additional board manager URLs and paste this link: https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json. This will download ATtiny board in your Ardiuno IDE.
- Now go to Board manager again, search attiny, and install the board.
- Next go to Tools -> Board -> Select Arduino Genuino Uno
- Go to File -> Example -> Arduino ISP ->ArduinoISP
- In Arduino ISP window got to Tools -> Select board as Arduino/Genuino Uno. and hit Burn Bootloader. Close the window once it got successful.
- In new window of Arduino IDE, go to Tools and select following items.
- Board: ATtiny25/45/85
- Processor: ATtiny45
- Clock: Internal 8MHz
- Programmer: Arduino as ISP
- Next step is to connect my circuit with arduino by header and jumper wire.
- For this one has to connect MISO (12), MOSI(11), SCK(13), RESET(10), VCC(+5), and GND of the Arduino programmer to the corresponding pins on the ATtiny45. Bracket number is pin number in Arduino Uno.
- Once connected hit the Burn Bootloader. Once you get message "Done burning bootloader". Close that window.
- Now go to Board manager again, search attiny, and install the board.
- Next go to Tools -> Board -> Select Arduino Genuino Uno
- Go to File -> Example -> Arduino ISP ->ArduinoISP
- In Arduino ISP window got to Tools -> Select board as Arduino/Genuino Uno. and hit Burn Bootloader. Close the window once it got successful.
- In new window of Arduino IDE, go to Tools and select following item:
- Board: ATtiny25/45/85
- Processor: ATtiny45
- Clock: Internal 8MHz
- Programmer: Arduino as ISP
- Next step is to connect my circuit with arduino by header and jumper wire.
- For this one has to connect MISO (12), MOSI(11), SCK(13), RESET(10), VCC(+5), and GND of the Arduino programmer to the corresponding pins on the ATtiny45. Bracket number is pin number in Arduino Uno.
- Programming the board with FabISP is done here
- Now to write program for LED blinking. Go to File -> Example -> Basics ->Select > Blink.
- Change pin number by writing over LED_BUILTIN, my LED is connected with 4th pin of IC so, I change it to 4 everywhere.
- Upload the code. If code uploaded successfully your LED should blink.
- LED blinking with delay of 1 second.
- Write code for Button in Arduino by going to new window. For this I used If/else condition. Code is as below
LED is blinking once program got uploaded, and getting power supply from PC
MAKE LED BLINKING WITH BUTTON
- Once done upload code. I tried to press Button but LED was not blinking. After many discussion and online research got to know that I haven't given resistor to Button.
- So I went back to Eagle, add resistor in my design, change board view accordingly. mill another board, soldered it with 10k resistor with Button and keeping other component same. Run the programming again, and....yes! Its working!
Redesign in Eagle by adding resistor for Button switch
Milling and Soldering new PCB
LEARNING CONCLUSION
- This week went great as I learned completely new as I didn't have such prior work experience or not even introduction to circuit design.
- So, basically designing circuit on Eagle is very essential and the first task for any circuit board to be produced.
- I liked Autodesk Eagle as it accommodates wide range of library for components, based on different packaging and footprint of parts.
Original Files:
- Original files which I have made and used for this week can be downloaded here as package including programming files.
INDIVIDUAL CONTRIBUTION TO GROUP WORK
- Electronics design group work we have equally worked in group and learned how to observe operation of micro controller unit.
- It was completely new so we have spend time to learn about tool i.e. Oscilloscope.
- Best tutorial we got on this is from Sparkfun - how to read various parameter of board by means of oscilloscope.
- Basically, we have decided to measure voltage, current and duty cycle of board on oscilloscope.
- Results and signal graph of these parameters can be seen on group work page.
For detailed documentation of development of Electronics design group work, refer our lab work website by clicking here
Go to Week 8
Go to Weekly work page