Commit 5b9dd5bc authored by Edwin Manuel Alvarez Valdivia's avatar Edwin Manuel Alvarez Valdivia
Browse files


parent 9507a42a
Pipeline #83466 passed with stage
in 30 seconds
......@@ -92,7 +92,7 @@
<p>Input devices.</p>
<article class="col-4 col-12-xsmall work-item">
<a href="construction.html"><img src="images/thumbs/construction.png" alt="" /></a>
<a href="week12.html"><img src="images/thumbs/outputsV2.png" alt="" /></a>
<h3>Week 12</h3>
<p>Output devices.</p>
<title>Edwin Alvarez Valdivia</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<link rel="stylesheet" href="assets/css/main.css" />
<body class="is-preload">
<!-- Header -->
<header id="header">
<div class="inner">
<a href="index.html" title="Return to home" class="image avatar"><img src="images/Edwin.jpg" alt="" /></a>
<h1><strong>Hello!, I am<br> Edwin Alvarez</strong><br>
<a href="aboutme.html">About me</a>.<br>
<a href="finalproject.html">Final Project</a>.<br>
<a href="contact.html">Contact</a>.<br>
<!-- Main -->
<div id="main">
<section id="Intro">
<header class="major">
<h1>Input devices.</h1>
For the assignment of the 12th week: Outputs devices, it will be divided into 6 parts: Output devices, board, programming, problems, group and Download.
<h2>Output devices</h2>
In this week we started working with outputs, these devices make a change of a variable that we are measuring by different sensors.<br>
In the laboratory we have several types of devices that work as outputs, both analog and digital, here is a list of the components we have available:
<div class="table-wrapper">
<table class="alt">
<td>Led of different colors.</td>
<td>LED RGB</td>
<td>Red, green and blue led.</td>
<td>DC Motor with encoder.</td>
<td>LCD display.</td>
<td>1.4Kg Servomotor.</td>
<td>2.5Kg Servomotor.</td>
<td>Stepper motor.</td>
In the same way that it was done on the inputs board, I choose the output devices thinking about my final project. The chosen devices are: RGB LED and a servomotor.<br>
The RGB LED will indicate when the steam machine is in the heating process (red LED), it is ready to work (green LED) and when the output valve is active (green LED), for the simulation of the valve I will use the CS-939MG servomotor
As described above, I have decided to use an analog and a digital sensor, as I will use these sensors for my final project. Therefore, I reread the attiny44's datasheet to know how to use the analog and digital input pins.<br>
The attiny44 has a total of 7 analog pins, internally it has a digital analog converter (ADC) which will help us to interpret the analog sensor in a better way.<br>
There is a table on page 180 of the<a href=""> data sheets</a> that indicates the maximum value that the ADC can have is 1023, which would be the analog value of the maximum input voltage, in this case it will be 5VDC.
In other words, it means that the analog pins will have values between 0 and 1023, which would be from 0 to 5VDC. With programming we must convert this measure into a value that we can understand using different formulas.<br>
On page 55 of the data sheet they mention that digital pins are bidirectional, that means they can serve as inputs and outputs. We remember the hello world board in which we use a led as a digital output and the button as a digital input, only its operation is configured on setup as input or output.<br>
Only in case analog pins work only as inputs, they cannot be outputs. In case of wanting to use an analog output, we must use the PWM pins of the microcontroller.<br>
With these previous concepts, we proceed to make the schematic of our inputs board, remaining as the next picture.
<a title="Schematic circuit"><img class="image center" src="images/week11/schmatic.JPG"></a>
We remember from week 7, the attiny44 has a small internal clock of 8MHZ, for that reason I save the resonator and take both pins for the ultrasonic sensor and make a smaller board.
The final board is shown in the following picture.
<a title="Board circuit"><img class="image center" src="images/week11/board.jpg"></a>
We start with the manufacturing and soldering process, having the following result.
<a title="Inputs board"><img class="image center" src="images/week11/inputsboard.jpg"></a>
As it was done in the week of the programming, it is necessary to make a connection of the manufactured board, the ISP to burn the bootloader and the FTDI to load the program to the microcontroller.
The final wiring with the included sensor is as follow picture:
<a title="Board connection"><img class="image center" src="images/week11/connection.jpg"></a>
Now, it is time to programming both sensors.<br>
The first test is the distance sensor, I work with these one several times, for that reason it was the first one.
In my board I did not use a led for output, so I only use the software serial monitor to see my distance.
<a title="Distance code"><img class="image center" src="images/week11/distance.jpg"></a>
For this case, I use<a href=""> this tutorial</a> to programming my temperature sensor. These was the formula:
<pre><code>reading = (1023.0 / value) - 2.0;
temp = reading*100.0;</code></pre>
<a title="Temperature code"><img class="image center" src="images/week11/temperature.jpg"></a>
<br><h4>Both sensors</h4>
I try to make an only program, but I have a critical problem. The software serial library uses a lot of the internal memory, my programs are too heavy for the attiny44.
<a title="Memory problem"><img class="image center" src="images/week11/fullmemory.jpg"></a>
For my final project I need another board, because the memory is very small for all the process, I try another atmega328 version.
<a title="New board"><img class="image center" src="images/week11/newboard.jpg"></a>
In this version I use some pins to Vcc and GND for some sensors. To upload a code to the atmega328, is necessary to use this configuration:
<li>Board: Arduino uno.</li>
<li>Programmer: USBtinyISP.</li>
<a title="IDE configuration"><img class="image center" src="images/week11/atmegaIDE.jpg"></a>
I connect my ISP and FTDI to upload a simple blink, but I have some problems. It’s possible to burn the bootloader.
<a title="Bootloader"><img class="image center" src="images/week11/bootloaderatmega.jpg"></a>
When I try to upload my code, I have an error:
<a title="Time error"><img class="image center" src="images/week11/atmegaerror.jpg"></a>
I will review my schematic one more time to find the problem, I try to use finally my atmega board to the output board for the next week.<br>
In the following video we can see the operation of both sensors separately.
<iframe width="560" height="315" src="" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
In programming the temperature sensor, I used some work codes from years past of various fabacademy students, but when using the software, I always had problems with memory space, as seen in the picture.
<a title="Temperature error"><img class="image center" src="images/week11/temperror.jpg"></a>
That was the main reason to investigate various codes to get one that approximates the actual temperature. For my project I will use other types of more commercial sensors, which has a simpler measurement as well as a conversion formula easier to interpret and modify.
<h2>Download files</h2>
You can donwload files Here: <br>
<a href="images/week11/thermistor.ino" download>Thermistor code</a><br>
<a href="images/week11/distance.ino" download>Distance code</a><br>
<a href="images/week11/inputs.ino" download>Distance and Thermistor code</a><br>
<a href="images/week11/inputs.sch" download>Schematic design</a><br>
<a href="images/week11/inputs.brd" download>Board design</a><br>
<a href="images/week11/traces.png" download>Traces</a><br>
<a href="images/week11/out.png" download>Out</a><br>
Atmega328 version 2<br>
<a href="images/week11/fabedwinv2.sch" download>Schematic design</a><br>
<a href="images/week11/fabedwinv2.brd" download>Board design</a><br>
<p><ul class="actions">
<li><a href="index.html" class="button primary">Main Menu</a></li>
<!-- Footer -->
<footer id="footer">
<div class="inner">
<ul class="icons">
<li><a href="" class="icon fa-instagram"><span class="label">Instagram</span></a></li>
<li><a href="" class="icon fa-github"><span class="label">Github</span></a></li>
<li><a href="" class="icon fa-linkedin"><span class="label">linkedin</span></a></li></ul>
<!-- Scripts -->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/jquery.poptrox.min.js"></script>
<script src="assets/js/browser.min.js"></script>
<script src="assets/js/breakpoints.min.js"></script>
<script src="assets/js/util.js"></script>
<script src="assets/js/main.js"></script>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment