So the objective of this week was to learn how to Design and Produce a microcontroller cicuit board. To do that, we needed to learn how to design a PCB, Produce the Board, Program and Test the Board.
The first step in any PCB production process is preparing the design. There are many software availablein the market that are used for PCB design. Some of those software are the following:
So the first stem before building any circuit is to choose our components that are required.
But components are not always available on Eagle, and to make them available, we need to add some Libraries that are prepared by others and available on the internet as open-source.
In my case i downloaded the Fab Libarary that is found on the Fab Academy Archives.
Next i inserted the Library into Eagle. To do that follow the following steps:
So the second step in my design was to re-draw the echo hello-world board based on the component we need to achieve the basic circuit. To do so, we start by adding the components we need on the Schematic part of the software.
To add components on Eagle, use the "add" button as shown in the image, and choose the components you want.
Next we need to connect the added component togather, based on the best connections according to the data sheets. So in order to connect components, the following steps are followed:
After re-drawing the circuit of Echo Hello-World Board, the next step is to add the components i want in my circuit. The best way to connect the components was deduced from the data sheet of each component.
To add components on Eagle, use the "add" button, and then go to the Fab library and choose the component that you need.
Next connect all the components using the method described in the previous step.
After connecting all the components on the board, the next step is to organize the schematic of the components. This schematic represents the location of the components on the board and the path of the connection in between the components. This step takes time and requires some art and concentration. During this level, the following points must be taken into consideration:
After finalizing the layout of the PCB on Eagle, we want to extract the image that represents the PCB design. To do so we need to follow the following steps.
So the next step after extracting the image from Eagle is to produce the images we need to use on Fab Modules to generate the g-code later.
So first we open the original image from Eagle and "save as" a new copy that you can edit. Call the first image "internal path".
Using GIMP is easy, just fill the area you dont want with black and that's it. I produced 2 images for the internal path to be used in fab modules. The images are the following:
So the next step after extracting the internal paths is toextract the images of the external path we need to use on Fab Modules to generate the g-code later.
So we open the original image from Eagle and "save as" a new copy that you can edit. Call the first image "external path".
Using GIMP is easy, just fill the area you dont want with black and thats it. I produced 1 image for the internal path to be used in fab modules. You can download the image from the following link:
After extracting all images that represent the internal and external paths of the milling bit, it's time now to produce the g-code. I used Fab Modules to produce the g-code for PCB milling on the ROlang MDX-40.
The following steps were followed on Fab Modules to generate the g-code:
So the next step after producing the g-code is to forward the job to the CNC machine and perform the milling.
After preparing the G-code, the following steps were taken to mill the layout onto the copper board:
So the next step after milling the copper board, is to weld all the component needed in this cicuit.
Now that we have the PCB layout cut-out, the next step is to start soldering. In order to do so we first need certain tools to proceed, find the list with specs below:
So after getting done with the hardware part of the cicuit, it is time to write the code that will control the circuit.
Because i was using the Arduin IDE to write my code that i will be using on my hello board, i used the Attiny44 pinout diagram to understand the pins and know how to assign the pins in the code.
In order to measure the light intensity using the LDR and cotrolling the LEDs, we need to right a code that does that exaclty.
So my code mainly measures the light intensity using an Analog Input. The measured value will then be compared with the light/dark threshhold set by me in the code, and based on that the delay time is calculated to control the frequency of the LEDs flashing. If there is light, meaning that the LDR value is high, the Green LED will blink at a frequency depending on the strength of light. On the other hand, if there is darkness, meaning that the LDR value is low, the Red LED will blink at a frequency depending on how dark it is.
After finalizing the code, the next step is to upload the code to the newly constructed Hello Board. To do that, we have to set first the Arduino Board as an ISP. To do so, the following steps are followed.
After setting the Arduino board as an ISP, the next step is to push the code to the Hello Board
Connect the Arduino Board to the new Hello Board following those connections:
So the problem with the ATtiny44 Microcontroller is that it does not have the capability to connect to the serial monitor on the computer. Saying that, to get the best results on the Hello Board and know the threshhold line between light and darkness, a trial and error phase had to be followed.
After trying many times, i chose the threshold to be 500 as it gave the best results.
After downloading the final code to the new Hello Board, I wanted to test it and check its full capabilities. So i gave the board an extenal power using an FTDI Basic Breakout - 5V and checked if it works all by itself. And it did work :D. The video represents the functionality of My Hello Board.
Now that i made sure that both the code and the hardware work as expected, the next step was to observe the operation of the microcontroller and check how it outputs the signal to the various pins, depending on the input. The video shown represents that.
The Yellow graph represents the signal going to the Green LED and the Blue signal represents the signal going to the Red LED. When the intensity of light increases, we notice that the frequency of blinking of the Green LED increases, by decreasing the delay time. On the other hand, once there is darkness, the signal stops at the Green LED and starts on the Red LED pin, changing its frequency depending n how dark it is.