6. Electronics design¶
Individual assignment¶
- Redraw an 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
Making the schematic in EAGLE¶
The first thing I had to do when making a schematic in EAGLE is downloading and importing the necessary libraries. Download those libraries by clicking this link. This folder includes the libraries “eagle_fab”, “fab_new”, and “Sparkfun libraries”.
Then, I had to make a new schematic in the software called Autodesk EAGLE.
When in the EAGLE schematic, we actually have to incorporate the libraries by adding them to the design. To do this, go to the “library manager” tab.
When you are in this menu, go to the “available” menu. This allows you to see all the libraries that are on your computer, but not yet added to the design. Click on the “browse” button and select all the desired libraries.
Now that these can be seen in the “available” menu, you have to select all of them (ctrl + a) and then click the button that says “use (xxx)”.
Then click on “add part” on the left column. This is where all the components can be taken from libraries and added to the schematic.
From this menu, select all the necessary parts from the libraries such as the header, ATtiny412 chip, resistors, the button, etc.
This is our completed schematic. Now the next thing we have to do is convert this schematic to a board.
Designing a board in EAGLE¶
To convert the schematic, go to the “file” dropdown menu and select “switch to board”
This should result in something looking like this:
Since we obviously don’t need all of this space, we should scale everything down.
Those yellow lines that go from one component to another indicate where traces will need to be placed. The software is much better at making these traces I am going to use the “autorouter” function in the left column
This should result in something that looks like this:
Now that this board design was completely ready to be exported to the milling machine, I had to save the board as a “.brd” file
When I was in my room attempting to troubleshoot the problem, my dad came in and noted that it is, in fact, pretty pointless to make the board so compact. He said that it would be so much easier to solder when the board itself was bigger and there was more space between each component. It was unnecessary to make it so compact because I was only going to mill a couple of boards, so this increased efficiency actually led to nothing. If I were to be making boards like this on an industrial scale, that wasted space would be multiplied thousands or millions of times over. Although it might not look like much in the image below, this extra space between each component definitely helped and sped up the soldering process
Exporting to the milling machine¶
Milling¶
Our lab bought some new bits that allowed for us to mill our boards up to 2 times faster than before. Below are the settings of the new bits. There is also an image of all the new engraving bits:
My first failed board occurred here in the milling process. I was going to use a 1/64 inch bit to mill out all the traces that were thick enough for that since it would only take 1 pass instead of the 5 passes the engraving bit would need. The problem was, though, that I accidentally used a 1/32 inch bit, so the traces were completely destroyed and ruined. This is obviously important because this is a very silly mistake and could easily have been avoided by simply looking more closely at the bit or comparing it with other similarly sized bits.
This is a snippet of the milling process:
Soldering¶
Programming¶
const int buttonPin = 1; // the number of the pushbutton pin
const int ledPin = 0; // the number of the LED pin
int buttonState = 0; // variable for reading the pushbutton status
void setup() {
pinMode(ledPin, OUTPUT); // sets the LED as an output
pinMode(buttonPin, INPUT); // sets the button as an input
digitalWrite(buttonPin, HIGH); // this turns on or activates the internal pull-up resistor on the chip
}
void loop() {
buttonState = digitalRead(buttonPin); // variable "buttonState" is either a 1 or 0 depending on whether the button is pushed or not
if (buttonState == HIGH) {
digitalWrite(ledPin, HIGH); // turns on the LED
} else {
digitalWrite(ledPin, LOW); // turns off the lED
}
}
Testing¶
Troubleshooting¶
After several failed attempts, I finally got my button board working. After I had soldered all my components in place and had uploaded the code to the button, the button still didn’t work. Dr. Harris explained to me that there is an internal pull-up resistor inside the AtTiny412 chip, itself and that it must be initiated or activated for it to do anything. This is crucial since this gives the chip concrete data about whether or not an input is being given or not. After I wrote a simple line of code
digitalWrite(buttonPin, HIGH);
it started working. Dr. Harris further elaborated that there are some environmental conditions (sometimes as seemingly insignificant as the surrounding air) that can have major impacts on the functionality of the board.
Working button board¶
This is a video of the working button board. I am using an arduino as a programmer to send the button program to the ATtiny412 chip on my board.
Files¶
Group assignment¶
- Use the test equipment in your lab to observe the operation of a microcontroller circuit board
Visit this link for the group site. I worked on definitions of the terms and I also learned how to use the oscilloscope, since I had only ever used multimeters previously.