Skip to content

7. Electronics design

Group assignment: Use the test equipment in your lab to observe the operation of a microcontroller circuit board.

Individual assignment: Redraw the echo hello-world board, add (at least) a button and LED (with a current-limiting resistor), check the design rules, make it, test it.

Extra credit: Simulate its operation. Render it.

Using the equipment

Multimeter

  1. Here we see little drawers where are the electronic components sometimes new other components to up-cycle them.

  2. Here we see a Multimeter that is a device that helps us to measure different magnitudes mainly voltage, current, resistance and also helps us to check the components if it working well like diodes even our board.

  3. This device has two proves with a pointed tip to measure small components and so on. We always have to be careful during the measurement about the polarity or connect in parallel or series depending on the magnitude we want to measure.

Oscilloscope

  1. This is the button called auto-set. If you are beginner this is a helpful button.

  2. This knob helps us to position the image in the right place of the screen horizontally. This knob works for both channels.

  3. These knobs are for positioning in the vertical axis of the screen. In this case are two of them one for each channel.

  4. Here we have a yellow button for turn on/off channel 1 and a blue button to turn on/off channel 2.

  5. This knob is the time division tool and helps us to scale up or down the signal horizontally in order to fit the signal in the screen.

  6. These knobs are volt division knobs and allow us to scale up an down the signal amplitude in order to see clearly the signal, these knobs work with time division knob.

  7. This an Oscilloscope prove and is connected in the channel 2 in this case. This proves has a little switch that helps us to compensate for the signal. If the signal has a good amplitude the switch is placed in the 1X section, otherwise is placed in 10X to amplify the input signal.

  8. These two BNC connectors are where the inputs have to be connected in order to measure the signals.

  9. In this side of the screen, the Oscilloscope shows us the magnitudes that are capable to measure, like frequency, voltages and so on.

  10. This is the signal of channel two of the Oscilloscope.

  11. The power button. Do not forget to turn off after using it!

Power supply

  1. These buttons are to select which channel we want to use.

  2. After choosing the channel you want to work with we use this knob to select the voltage.

  3. Like the voltage selector knob, we have a current selector knob, that helps us to select the limiting current in order to protect our circuit.

  4. The power source has a fix voltages with a selector switch.

  5. These are the connectors of the variable voltages, on the left side, we have the other channel.

  6. I order to connect our power source with the circuit we need of these two cables one for positive (usually red) and the negative (usually black).

Faced problems and solutions using the equipment

Problems:
  1. We tried to see the signal of a functions generator app in android that gets sine, square and triangle signals out the jack connector. We could not see it.
Solution
  1. In the beginning, we thought the bad connection of our smartphone output but we figure out that the volt division was not the right one, also we changed the channel from the number one to the number two.

Electronic design

Designing the schematic of the circuit

After learning the very basics of electronics I am able to redesign a hello world circuit.

  • The circuit that I modified

I take the hello button of the assignment of the input and I draw them from the board and I removed the FTDI connector. I also replaced the button with a slide switch and added a LED.

After I finished the schematic was the time of choosing the width of the right trace. If we want to send to somewhere for making professional PCB we have to use the graphics below. In my case my circuit it does not draw too much current I will only need less than 0.005 in but we cannot mill that width of copper. So, that is the reason why I used >=0.012 in in order to obtain a great trace by using CNC machine.

The value I mentioned (<0.005 in) was calculated by using the current that will draw you circuit the temperature of the board (initial temperature not included in the value) and knowing that the thickness of the board is 1 oz / ft2, 305 g/m2, 35 μm

Faced problems and solutions using the equipment

Problems:
  1. We have not in stock the button.

  2. We have not in stock the ATtiny44.

  3. I could not program the board because I put the resistor and the LED on one of the pins used for programming it (SCK).

Solution
  1. I used slide-switch.

  2. I used the ATtiny45.

  3. I redesign the circuit adding a jumper in order to program the board before adding the load on the programming pins.

Using Autodesk Eagle

Autodesk EAGLE is an electronic design automation (EDA) software. Enabling a printed circuit board (PCB) designers to seamlessly connect schematic diagrams, component placement, PCB routing, and comprehensive library content.

Steps to use Autodesk EAGLE in Linux

  • Download the program first from here.

  • Extract the compressed file

    • Manually doing right click in the file and do extract here
    • Through terminal:
tar -xvzf "file.tar.gz"
  • Open the extracted folder and run the eagle file using the terminal
sudo ./eagle
  • Login to your Autodesk account.

Drawing in the Autodesk EAGLE

This is the environment in the first opening of the software.

I will draw an example circuit that does mean nothing. This is just to show the tools I used in the Autodesk EAGLE.

  1. First of all, we have to create a new project on EAGLE.

  1. I created a new schematic.

  2. The green dot means if the project is active or not.

  1. This is to manage the visible layers that you want to see during the design.

  2. This is for moving objects whether parts or traces.

  3. This is for rotation of the objects, traces, and parts.

  4. With this, we can add a new component using the libraries.

  5. This is to make the connections between the components.

  6. These help us to modify the connections.

  7. With this, we can delete the elements.

  1. After clicking on add components pop-ups a window showing the active libraries.

  2. Active libraries.

  3. Search tool. Advance Search tool below.

  1. Open the library manager.

  2. Change the tab from In design to In use.

  3. Click on browse.

  4. Go to the Fab Lab library and click open.

  1. So, now the library of our interest it appears on the active libraries, that means that is an hour to select the needed components.

  1. First, you have to search the library of your interest, in this case, is called fab.

  2. You can search manually the components or by using the search engine.

  3. After you find the component you want selected press enter and then click on the workspace the quantity of the same component you need. After press escape to come back to search for another component.

  4. This is how looks my example after I finished. Can be all connected or labeled to the connection.

  1. To do the board we have to click in the icon of the number two, and will pop-up a window asking you if you want to create a board from the schematic, press yes.

  2. This is the icon to click in order to create the board.

  • This is how it will appear the environment to draw the board.

  1. In order to move the components first, we have to use the selection tool.

  2. Then with the move tool move the components as a group.

  3. The components are selected when is with a bright red.

  4. Here I show how it suppose to be the components.

  5. Finally, with the move tool resize the background. This last step is very important in order to get the right size of the export monochromatic image for generating the code using MODS or FABMODULS, in my case it does not matter because I will generate the CAM job, in order words, the Gerber files.

  1. These are the routing tools.

  2. After pressing the routing tool some new parameters. Here you can turn on/off the grid and modify it, like the size of the square.

  3. Here you can see what layer you are working with.

  4. Here you can choose the type of routing you want to use. I used to use the interactive routing that is by default.

  5. Here you can choose the type of the trace corner shape you want. The rule is to avoid the square corners.

  6. Here you can choose the width of your traces.

  7. Clicking on the grid icon it pop-ups a window.

  8. These are the values I used, these are because it allows you to move freely Through the environment.

  9. Here I change the trace width to 0.012 in. If you have more space always choose to increase the trace width to obtain better results in your PCB during the machining.

This is optional, this step is for the creation of the ratsnet.

  1. 1- This is the normal board.

  2. 2- Using this tool called polygon we create a closed geometry.

  3. 5- Correct the errors.

  4. 4- The resulting board after correcting it.

  5. 3- Use the tool called ratsnet and pop-up a window, here we choose the signal name, usually it is connected to the GND and the press ok.

  6. 7- Here we have the result board.

If you want to export to PNG image you must hide the other layers and show only the top layer.

Here we will do the CAM job.

  1. Clicking on this icon pop-up this window that is of the Gerber generator tool. Keep selected the option Export as a zip.

  1. Select Gerber and the tool Gerber RS-274X, and make a new Gerber.

  2. Select the layer you want to generate off and press ok, in this case, is the top.

  3. Rename them.

  4. Select the folder you want to save the generate Gerber in.

Faced problems and solutions using Autodesk Eagle

Problems:
  1. I could run properly Autodesk EAGLE because in Linux runs the EAGLE in a sandbox and the problem with this is that I could save my files.

  2. I use the auto-routing and the problem with it was the draws traces between the pins of the SMD chip, and that is too thin to mill it.

  3. I could not add properly the FAB libraries because in Linux you can add a file in the HOME directory with administrator permission through the terminal.

Solution
  1. The solution was to run the EAGLE with sudo ./eagle. Running this way EAGLE disable the sandbox.

  2. The solution was to watch how the auto-routing solves the traces and redraw in order to optimize the width of the trace.

  3. The solution was open the file manager of Xubuntu using the terminal sudo Thunar, after that you will able to add the libraries in the folders that you create in EAGLE.

Autodesk EAGLE files.

  • Cut

PCB milling

MODS vs FlatCAM

I started the week of electronic production using MODS, and it was a good experience, but that was because I used the Modela MDX-20. After I moved to the SRM-20 because we are 9 people doing the academy I started to see bugs in the MODS. One of them was that I had to download the file generated by the MODS and then send it through the software Vpanel of Roland and it does not work, first moves to the origin and then move to the Z-axis and stops.

This situation makes me feel frustrated and I started to search another way to generate the code for the router machine and I found the software.

I was great to find this software because is free too easy to install and it runs on Linux, Windows, and MAC. Is easy to work with and you can generate fast code for a big range of machines, for example, the Modela MDX-15/20, that only accept RML1 code for machining.

The image below was my first try using the Gcode generate with the FlatCAM.

Using FlatCAM

FlatCAM lets you take your designs to a CNC router. You can open Gerber, Excellon or G-code, edit it or create from scratch, and output G-Code. Isolation routing is one of the many tasks that FlatCAM is perfect for. It’s is open source, written in Python and runs smoothly on most platforms.

Installing FlatCAM

Installing Python 3

Step 1:

sudo apt update

Step 2:

sudo apt install python3-pip

Step 3:

pip3 --version
Installing pip3

Step 1:

sudo apt update

Step 2:

sudo apt install python3-pip
Installing PyQt5

Step 1:

pip3 install pyqt5

Step 1:

Installing FlatCAM
pip3 install flatcam

Generating Gcode with FlatCAM

  • Running FlatCAM

  • To run FlatCAM you have type flatcam in the software installed searcher and press enter.

  1. Here you can access all the tools an options that are in the software.

  2. Here you can see the version of the FlatCAM that you are using.

  3. In this panel you will see all the input files and generated one, also is the place where will appears all the cutting parameters in order to generate the right geometry and CNC job for each machine and tool diameter you have available in your FAB LAB.

  4. In this section you will see the imported Geber file and its position in the space, also you will see the geometry and the toolpath of the CNC job.

  5. This section is very important because it shows you the current measurement units that you have to choose to avoid mistakes during the routing.

  1. To open the Gerber file that you have generated with Autodesk EAGLE you have to go File/Open Gerber

  2. Then you have to choose the Gerber file of your interest and press Open.

  1. Here it will appear all the Gerber files that you want to generate Gcode with.

  2. Here you will see the actual position of your PCB and it allows you to reposition it as you needed.

  3. Here you will see the PCB selected.

  1. In the section, the vector will appear how much you will offset the origin of your file. Where (x, y) and a positive number to add and a negative number to subtract.They are not coordinates.

  2. With this button called offset, you apply the vector values and you will reposition your file.

  3. The button called offset auto is helpful because moves your file to the origin, and you can apply a vector value after.

  4. Here I show you the origin. You have to care about it to avoid problems during the cutting, in other words, collisions because of the wrong origin.

  1. Pressing offset auto.

  2. The new position of your image.

  1. Setting a new position with the vector and pressing offset to apply it. Is very important to give clearance to your image from the origin in order to cut the board after.

  2. The new position of your image.

  1. Because I am using millimeters in the FlatCAM and my tool diameter is in inches I convert the tool diameter from 1/64 in to 0.396875 mm.

  2. Here I show you the parameters I used for generating the toolpath. The button to press is Generate Geometry.

  3. In red will appears the geometry. Here you have to check if the space between traces is enough to pass the end mill between them. You have to see the red generated geometry between every trace.

  4. After the toolpath is generated it will appear in the project tab.

  1. Doing the double click on the generated geometry you are able to generate the CNC job for the geometry. Here I show you the parameters I used to generate with.

  2. The geometry will turn to blue and the is the color of the CNC job.

  3. And will appears a new file in the project tab.

  • To save the CNC job to Gcode of your preference you have to double click on the generated CNC job and you are able to choose the extension of your file, choose where you want to save the code set extra codes of Start Gcode and End Gcode. And press save.

  1. Here we want to generate the geometry to cut the PCB.So, we have to double click the Gerber file you are able to put the parameters for the geometry.

  2. Like the first time, I converted the 1/32 in to 0.79375 mm.

  3. Set all the new parameters for cutting.

  4. In the Bounding Box section, I selected the rounded corner and then the button Generate Geometry.

  5. Here you can see the generate geometry that is a bounding box with a rounded corner.

  6. In the Project tab, will appears a new file that corresponds to the new generate geometry.

  1. Doing a double click on the new geometry we are able to set the parameters for the CNC job.

  2. After setting those parameters and pressing Generate will appears a new CNC job file. All these parameters in the image are the actual parameters I used to cut every board I made using FlatCAM and the Roland SRM-20.

  3. The CNC job we will see in blue once we generate it.

  1. Like the first time, we have to press Export G-Code.

  2. Then Save.

If we want to change something in the Gcode or share it we have to save the project.

  1. Go to File/Save Project.

  2. Choose the folder you want to save it and press Save.

Faced problems and solutions using FlatCAM

Problems:
  1. When I generate traces geometry I choose 4 passes and the software generated for individual geometries and I had to generate 4 individual CNC jobs for each geometry.

  2. In the beginning, I could not install the FlatCAM in Linux.

Solution
  1. I selected the Combine option and I solve this problem.

  2. Meanwhile, I run FlatCAM in windows until I figure how to install it out in Linux.

FlatCAM files

Soldering the components and programming the board

  • Here I show the boards I made.

  • This was my first design and I could not program it because I connected a load to the SCK pin.

  • This is my second design in which I put a soldered jumper in order to program it before I connect to the SCK pin the load.

  • This is the jumper on the board.

  • This design has two headers for the power supply connection, with it I could energize the board from a USB port.

  • This is the load.

  • This is a slide-switch that I put instead of the button.

Coding and burning the Board

  1. First, we have to open the software Eclipse.

  2. Then create a new project.

  3. We have to set an empty project with the AVR-GCC Toolchain

  4. Select only Release. In this way, we can load to out microcontroller our code. That means it will generate the HEX file. The other option is only for debugging, the same thing as if we are programming with the ATMEL STUDIO in Windows.

  1. This is an important configuration in order to compile and burn the chip correctly, AVR Target Hardware properties.

  2. Doing right click on the project we make a new source code called main.c.

  3. Then we have to type to code.

  4. Then right click on the project Properties > AVR > AVRDude and Properties > AVR > Target Hardware

  1. This message appears after you select Load CPU.

  2. Here we add or select the programmer. In this case, is USBtinyISP.

  3. To compile we have to press the hammer and has to appear the message that is in the image.

  4. To upload/burn the chip we have to press the button AVR with a green arrow.

File download the project

In this file, you will find the C source code, the HEX file and extra files generated by the IDE software during the compiling process.

Source code

# include <avr/io.h>

int main (void){

    DDRB |= (1<<PB2);               //Sets the PB2 pin as a output
    DDRB &= ~(1<<PB3) | ~(1<<PB4);  //Set the PB3 and PB4 as a inputs
    while (1)
    {
        if (PINB & (1<<PB3))        // Check if the PB3 pin is in HIGH

            PORTB |= (1<<PB2);      // Sets the PB2 in HIGH

        else

            PORTB &= ~(1<<PB2);     //Sets the PB2 in LOW
    }
    return 0;
}

The circuit in action

Faced problems and solutions soldering the components and programming the board

Problems:

  1. I tried to program my board with my USBTiny with ATtiny45 and I got a signature error.

Solution

  1. I programmed successfully using the avrisp2 without the signature error. So, I decided to do again for my USBTiny but now using the ATtiny44 version.

What I learned this week?

I learned the AVR Microcontroller Design Considerations.

I learned how to modify the signature of the chip, in case you cannot program it.

I learned that the RST(Reset pin) must have a PULL-UP resistor externally and its value goes between 4.7k to 10K.

I learned that the programming pins have to be load free during programming.