Commit 5f1e1257 authored by Doaa Allshureih's avatar Doaa Allshureih

edit

parent 38b5bbef
Pipeline #166602 passed with stage
in 19 seconds
int Led = 5 ;// define LED Interface
int buttonpin = 8; // define the mercury tilt switch sensor interface
int val ;// define numeric variables val
void setup() {
pinMode(Led, OUTPUT) ;// define LED as output interface
pinMode(buttonpin, INPUT) ;// define the mercury tilt switch sensor output interface
}
void loop() {
val = digitalRead(buttonpin) ;// read the values assigned to the digital interface 3 val
if (val == HIGH) { // When the mercury tilt switch sensor detects a signal, LED flashes
digitalWrite(Led, HIGH);
} else {
digitalWrite(Led, LOW);
}
}
This diff is collapsed.
 <div id="Doaa .AlShureih" class="navbar navbar-default navbar-static-top" role="navigation">
<div id="Doaa .AlShureih" class="navbar navbar-default navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header"><a class="navbar-brand" href="#Doaa.Alshureih">Doaa .S AllShureih</a>
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-menubuilder"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span>
......@@ -44,7 +44,7 @@
<br> This week I will read the datasheet for the microcontroller I had design it in <a href="http://fabacademy.org/2020/labs/talents/students/doaa-allshureih/weeks/week6.html
">Electronics Design week</a>
then program the board I had made to do something, with as many different programming languages and programming environments as possible.
<br> But Like many labs around the world, our lab close after the last session due to the COVID-19 pandemic, I couldn&rsquo;t mill my PCB, so I will not be able to use my own attiny44A board that I designed. Instead of that,
<br> But Like many labs around the world, our lab close after the last session due to the COVID-19 pandemic, I could not mill my PCB, so I will not be able to use my own attiny44A board that I designed. Instead of that,
I got an entry permit for the college, I went there and took my electronics kits and some sensors, I will be using the Arduino Uno ATmega328 controller. But I will try to simulate the connection between attiny44A microcontroller and Arduino by using Tinkercad.
<br>let us discover more about microcontrollers and datasheets.
......@@ -55,9 +55,9 @@ It should give you the information you need to create a working and reliable pro
<br><br>
<b>How we can read Datasheet?</b><br>
First thing I googled how we can read Datasheet? I spend all the afternoon trying to understand that I have read many articles and watch videos that can explain what is the datasheet for the microcontrollers?
It is really a huge document with a lot of information, about each tiny thing in this tiny ship! It is really like the HEART and BRAIN! It is done everything from A-Z for most circuits.
I was looking for our circuit that I couldn&rsquo;t fabricate it, because of Corona pandemic, next I will write and post some of the information that I read about it.
It Is a collection of electronic components resistors, transistors, capacitors, etc. All stuffed into a tiny chip, and connected together to achieve a common goal.
It’s really a huge document with a lot of information, about each tiny thing in this tiny ship! It’s really like the HEART and BRAIN! It is done everything from A-Z for most circuits.
I was looking for our circuit that I couldn’t fabricate it, because of Corona pandemic, next I’ll write and post some of the information that I read about it.
It Is a collection of electronic components resistors, transistors, capacitors, etc.all stuffed into a tiny chip, and connected together to achieve a common goal.
The microcontroller also has additional elements such as RAM for data storage, read-only memory for program storage, flash memory for permanent data storage, and other devices.
There are a dozen different vendors who manufacture microcontrollers. Few among them are Intel (8051), Atmel (AVR), Microchip Technology (PIC), Hitachi, Motorola, etc. We will discuss two such microcontrollers that have created waves recently; AVR and PIC.
<br><br>
......@@ -92,7 +92,7 @@ These first microcontrollers combined different types of computer memory in on
It was one of the first microcontroller families to use on-chip flash memory for program storage, as opposed to one-time programmable ROM, EPROM, or EEPROM used by other microcontrollers at the time.
Every AVR has some input/output ports. The port has up to 8 physical pins on its package. Every pin can be configured as input or output. If a pin is used for input, it can turn on built-in pull-up resistors through register PORTx.
If a pin is configured as an output, it can handle up to 40mA of load per pin and max 100mA for all pins on the port.
<br><br> To understand more about it visit this the link below it is useful.
<br><br> To understand more about it visit this the link below its useful.
<a href="http://www.robotplatform.com/electronics/microcontroller/microcontroller.html">History of Microcontroller</a>
<br><br>
<br><b>Attiny 44/85 microcontroller </b><br>
......@@ -103,7 +103,7 @@ It is the keystone of the circuit, the below picture explained the pin configura
<br><br><b>Mapping of theATTiny44/85 pins courtesy:</b><br>
<br><img class="img-thumbnail" src="./images/WEEK8/6.jpeg"style="width:480px;height:auto px;"><br><br>
<br><br><b>Programming Attiny 44/85 microcontroller by using Tinkercad programming environment</b><br>
Tinkercad is an environment there are a variety of components you can add to your design. You will find an integrated code editor and a debugger.
Tinkercad is an environment there are a variety of components you can add to your design. Youll find an integrated code editor and a debugger.
It allows you to Program and simulate your Prototype with electronic components, completely within the browser, before building them in real.
You can even get to the serial monitor, all in your browser with no actual Arduino hardware. you can simulate Arduino with a debugger that could come in handy if you care about the circuit simulations.
<b>What did I do?</b> I connected attiny85 with a potentiometer to control the servo motor. I tried to do this by Tinkercad in a simple way.
......@@ -120,7 +120,7 @@ The workspace where you can assmble the components and code:
<li>6-9V Battery </li>
<li>Bredbored </li>
<br><br><img class="img-thumbnail" src="./images/WEEK8/parts.jpg"style="width:480px;height:auto px;"><br><br>
<b>Connection:</b>
<b>Connection of the components:</b>
<br><br><img class="img-thumbnail" src="./images/WEEK8/attiny.jpeg"style="width:480px;height:auto px;"><br><br>
Based on I/O pins in Attiny85 I conncted the componnetes as shows below, by add line -wiers-.
As <a href="http://ww1.microchip.com/downloads/en/devicedoc/Atmel-7701_Automotive-Microcontrollers-ATtiny24-44-84_Datasheet.pdf
......@@ -138,6 +138,7 @@ The workspace where you can assmble the components and code:
<li>The secound pin -wiper wiper, it acts as a variable resistor or rheostat- conncted analog input A1 of Attiny85.
<li>The thired pin -trimnal 2- conncted to the power of Attiny85
</ul>
<br><b>Atitny85</b> to the power source:
<ul>
<li>The Volt conncted to the positive in the battery.</li>
......@@ -286,7 +287,7 @@ Stack Pointer The stack is mainly used for storing temporary data, for storing l
<br>
What did I do? I connected the<b> ATmega328P microcontroller </b>IN Arduino UNO to control LED brightness by using a potentiometer. How? by gradually changing electrical signal from turning the potentiometer with Arduino's analog inputs, located on the board from the digital i/o (input/output) pins. These special analog pins are connected to the Arduino's analog to digital converter, which converts an incoming analog signal between 0V and 5V into a range of numbers from 0-1023 (zero counts as a value). I used the <b>Arduino IDE programming environment.</b>
The Arduino Integrated Development Environment (IDE) is the main text editing program used for Arduino programming.
It is where you will be typing up your code before uploading it to the board you want to program.
It is where youll be typing up your code before uploading it to the board you want to program.
Arduino code is referred to as sketches.
The Arduino IDE supports the languages C and C++ using special rules of code structuring.
The Arduino IDE supplies a software library from the Wiring project, which provides many common input and output procedures.  
......@@ -304,8 +305,9 @@ The Arduino IDE supplies a software library from the Wiring project, which provi
<br><br><img class="img-thumbnail" src="./images/WEEK8/25.jpeg"style="width:480px;height:auto px;"><br><br>
<b><br>Connction</b>
<br><br><img class="img-thumbnail" src="./images/WEEK8/led.jpg"style="width:480px;height:auto px;"><br><br>
<BR>Connction of the LED:
I conncted the Long positive leg to the output from the resistor that conncted to pin 8.the shortleg negtive to GND.
<BR>Connction of the potentiometer:
<BR>The potentiometer can work as a rheostat (variable resistor) or as a voltage divider.
<ul>
<li>The first pin -trimnal1- conncted to the ground of Arduino.
......@@ -329,8 +331,8 @@ I Inserted the code:
const int analogInPin = A0; // Analog input pin that the potentiometer is attached to
const int analogOutPin = 9; // Analog output pin that the LED is attached to
int sensorValue = 0; // value read from the pot
int outputValue = 0; // value output to the PWM (analog out)
int sensorValue = 0; // value read from the pot
int outputValue = 0; // value output to the PWM (analog out)
void setup() {
// initialize serial communications at 9600 bps:
......
......@@ -44,11 +44,14 @@ As we know now from the previous week <a href=" http://fabacademy.org/2020/labs/
"> Embedded Programming </a> the Micro-controller is a microcomputer used for control purposes, and for data analysis. It has an internal CPU, RAM, IOs interface. A microcontroller is a subset of Arduino. Every Arduino is a microcontroller but not every microcontroller is Arduino. To know more about the difference between Microcontroller and Arduino.
<BR><a href=" https://engineeringclutch.com/difference-between-microcontroller-and-arduino/
"> Microcontroller VS Arduino </a>
<br>So we will use the sensors as input, what does input mean?
<br><br><img class="img-thumbnail" src="./images/WEEK8/20.jpeg"style="width:280px;height:auto px;">
<br>So we will use the sensors as input, <b>what does Input device mean?</b>
<br> Input device is a piece of computer hardware equipment used to provide data and control signals to an information processing system.
I found another kit I ordered last year, It includes more than 10 sensors, but all of the are sensor modules. It is no difference between the sensor and the sensor module.
Sensors use to sense stuff. for example, Pushbuttons, touchpads, tilt switches, photo resistors, thermistors, Gas sensors, tilt sensors, motion sensor, heart sensor, touch sensor, moisture sensor, laser sensor, and more!
<br><br><img class="img-thumbnail" src="./images/week9/LDR2.jpg"style="width:280px;height:auto px;">
<br><br><img class="img-thumbnail" src="./images/week9/LDR2.jpg"style="width:280px;height:auto px;">
<br>
<br>Sensors modules use also to sense but in an easy way!
<br>The only difference between the sensor and module is that the module will have a filtering capacitor and pull-up resistor inbuilt, and for the sensor, you have to use them externally if required.
......@@ -73,7 +76,7 @@ Modules are designed to be easy to put together into a larger system.
<li>Touch area : Similar to a fingerprint icon inside the area, you can touch the trigger finger.</li>
<li>Key Touch pad detector IC, it is suitable to detect capacitive element variations.</li></ul>
<br><br><b>Testing Touch Sensor</b>
<br><br><b>Testing the Touch Sensor</b>
In this project I will let you know the basic operation of a capacitive touch sensor switch module and how it can be implemented with an Arduino board.
The touch sensor is connected to the Arduino UNO board as input to act as a security system if anyone touched the LED -the output- will be switched on as an alarm.
<br>
......@@ -140,7 +143,7 @@ connection of the LED:
</code></pre></div>
<br>
<br><br><img class="img-thumbnail" src="./images/week9/upload.jpg"style="width:480px;height:auto px;"><br>
<br><br><img class="img-thumbnail" src="./images/week9/magiccode.jpg"style="width:480px;height:auto px;"><br>
<br> I uploaded the code after verified and checked the errors.
<br><br><img class="img-thumbnail" src="./images/week9/sm.jpg"style="width:480px;height:auto px;"><br>
......@@ -175,8 +178,9 @@ In the presence of reducing gases, the surface density of adsorbed oxygen decrea
<li>A0 provides analog output voltage in proportional to the concentration of smoke/gas.</li>
<li>DAT D0 Indicator LED ,shows that the sensor didact toxic gas.</li>
<li>PWR Power indicator pin show that the sensor is on.</li></UL>
becurful when you connect the gas sensor normaly it will be hot, because from inside it has tow part the heater and the sesor dedactor.
<br><br><b>Testing Gas MQ-2 Sensor</b> In this project I will Programme the sensor to act as a portable alarm system, the code is very simple & basically just keeps reading the analog voltage on A0 pin.
Be careful when you connect the gas sensor normally it will be hot because from inside it has two car parts the heater and the sensor detector.
<br><br><b>Testing the Gas MQ-2 Sensor</b>
<br>In this project I will show you how I programmed the sensor to act as a portable alarm system, the code is very simple & basically just keeps reading the analog voltage on A0 pin.
 It also prints a message on the serial monitor when smoke is detected, and alarm the user by LED lighting and buzzer.
<br><br><b>Components needed:</b><br><ul>
<li> Arduino UNO.</li>
......@@ -188,7 +192,7 @@ In the presence of reducing gases, the surface density of adsorbed oxygen decrea
<li>Lighter for testing only.</li>
<br>
<br><br><img class="img-thumbnail" src="./images/week9/gas2.jpeg"style="width:480px;height:auto px;"><br>
<br>Connction the components:
<br><b>Connction of the components:</b>
<br>Connction of the MQ2 Gas Sensor:
<ul>
<li>GND to GND of the Arduino.</li>
......@@ -315,4 +319,4 @@ This week I should add a sensor to a microcontroller board that I had design it
</p>
</body>
</html>
\ No newline at end of file
</html>
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