Commit 720f61f2 authored by Edwin Manuel Alvarez Valdivia's avatar Edwin Manuel Alvarez Valdivia
Browse files

week11 update

parent 973f541d
Pipeline #89007 passed with stage
in 18 seconds
......@@ -106,6 +106,13 @@
The choice of these sensors is aligned with my final project, since I have to measure the water temperature of the steaming machine and the amount of water that exists in the tank with the presence sensor.<br>
<br><h2>Analog Digital Converter (ADC)</h2>
The ADC contains a Sample and Hold circuit which ensures that the input voltage to the ADC is
held at a constant level during conversion.
<a title="ADC Diagram"><img class="image center" src="images/week11/adc.jpg"></a>
The ADC converts an analog input voltage to a 10-bit digital value through successive approximation. The minimum value represents GND and the maximum value represents the reference voltage.
These values ​​are within the microcontroller ranging from 0 to 1023, representing 0V and 5V respectively.<br>
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>
......@@ -130,12 +137,62 @@
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>
Here is the code.
<pre><code>#include <SoftwareSerial.h>
SoftwareSerial monserial(0, 1);
long distancia;
long tiempo;
int trigger=10;
int echo=9;
void setup() {
// put your setup code here, to run once:
pinMode(trigger, OUTPUT);
pinMode(echo, INPUT);
void loop() {
// put your main code here, to run repeatedly:
distancia= int(0.0175*tiempo);
monserial.println("Distance ");
monserial.println(" cm");
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>
Here is the code:
<pre><code>#include <SoftwareSerial.h>
SoftwareSerial monserial(0, 1);
int ther=A2;
float temp;
float value;
float reading;
void setup() {
void loop() {
// put your main code here, to run repeatedly:
reading = (1023.0 / value) - 2.0;
temp = reading*100.0;
monserial.print("Temperature ");
} </pre></code>
<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.
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