w.1.homw web.png

Week 12
Input devices

Happy to see you once again, This week we are pushing ourself one step up in electronic. In week 9 output devises I learned how to control various Output devices. In this week I am learn about how to read data from various input devicesabou design those PCBs to make a hello world circuit board. 😀

The task list for this week:

  • Group assignment:
    • probe an input device's analog levels and digital signals
  • Individual assignments.
    • measure something: add a sensor to a microcontroller board that you have designed and read it.

    Group assignment

    image not found

    Study Input devices .

    This assignment was about studying various kinds of input devices and studying their input signals.

    image not found

    Study digital waves form of signal using IR .

    To study the digital Input signals use IR Sensor as a digital input device and use digital read function to programit with my I/O board.We use digital oscilloscope to study digital waves form of signal.

    image not found

    Study Analog waves form of signal using potentometer.

    Similarly to study the Analog Input signals we use potentometer as an analog Sensor and use Analogread function to programit with my final board.We use digital oscilloscope to study Analog waves form of signal of the input.

    Check here to read more about our group assigment.

    Individual assignments:

    Sensor:

    A sensor is a device that detects and responds to some type of input from the physical environment.

    image not found

    How a sensour work.

    Sensor I am using:

    IR Sensor:

    An infrared sensor is an electronic module which is used to sense certain physical appearance of its surroundings by either emitting and/or detecting infrared radiation.
     IR sensors are also capable of determining the heat being emitted by an object and detecting motion.

    image not found

    .

    Working of IR sensour:

    An IR sensor is use to detecting obstacles. IR transmitter transmits IR signal, as that signal detects any obstacle in its path, the transmitted IR signal reflects back from the obstacle and received by the receiver.

    image not found

    .

    • PINOUT:
      • VCC: 3.3V-5V power input pin
      • GND: 0V power pin
      • OUT: Digital Output Pin
    • TECHNICAL SPECIFICATION/RATING
      • Operating Voltage: 3.0V – 6.0V
      • Current: at 3.3V : ~23 mA & at 5.0V: ~43 mA

    Making a I/O board:

    For our individual assignment this week I deside to make a Input board base on ATtiny44 .Using EAGLE .

    Creating Scametic Digram:

    image not found

    .

    Creating PCB layout:

    image not found

    .

    PCB milling:

    image not found

    .

    Soldering I/O board

    image not found

    .

    Components requird.

    image not found

    .

    Programing I/O board.

    Seting up Arduino IDE for Programing I/O board (Attiny 44).

    SoftwareSerial Library

    ATtiny 44 Does not have Rx and Tx pins define in it .So For reading the Signals through FTDI we required them.So I have to define theme externally via softwere.For that I am using a SoftwareSerial library which allows serial communication on other digital pins of an Microcontroler board .

    Syntax
     SoftwareSerial(rxPin, txPin, inverse_logic)

    Parameters
    • rxPin: the pin on which to receive serial data.
    • txPin: the pin on which to transmit serial data.
    • inverse_logic: used to invert the sense of incoming bits (the default is normal logic). If set, SoftwareSerial treats a LOW (0v on the pin, normally) on the RX pin as a 1-bit (the idle state) and a HIGH (5V on the pin, normally) as a 0-bit. It also affects the way that it writes to the TX pin. Default value is false.

    Setting hardwere.

    image not found

    To Study Input Signals through FTDI .I need to install SoftwareSerial Library .As I told because of the limited supply od FTDI ICs .I couldnt make my own one .But I am using this boutout CP2102(6-pin) USB 2.0 to TTL UART serial converter .As an FTDI to read the signals using Arduino Serial monitor.

    Data reading functions in programing :

    analogRead()

    Read the value of the specified analog pin.

    • Syntax:analogRead(pin)

    sensorValue

    analogRead() returns a number between 0 and 1023 that is proportional to the amount of voltage being applied to the pin.

    • int sensorValue = analogRead(A0);

    Serial.begin(9600)

    This starts serial communication, so that the Arduino can send out commands through the USB connection. The value 9600 is called the 'baud rate' of the connection. This is how fast the data is to be sent.

    • Serial.begin (9600);

    Reading IR sensour module input signial using I/O board.

    AnalogRead Serial code.

      /*
        AnalogReadSerial
        This Code is costum by vrushabh zunjurkar for fab accademy 2022.
      */
      #include <SoftwareSerial.h>
      SoftwareSerial mySerial(0,1);//rx ,tx 
      
      int LED=3;
      // the setup routine runs once when you press reset:
      void setup() {
        // initialize serial communication at 9600 bits per second:
        mySerial.begin(9600);
        pinMode(LED, OUTPUT);
      }
      
      // the loop routine runs over and over again forever:
      void loop() {
        // read the input on analog pin 0:
        int sensorValue = analogRead(A2);
        // print out the value you read:
        mySerial.println(sensorValue);
      
       digitalWrite(LED, HIGH);
       
        delay(100);        // delay in between reads for stability
      }      
          
    
          

    AnalogRead Serial code.

    Serial Monitor output on Arduino IDE.

    Serial Plotter output on Arduino IDE .

    K-Type Thermocouple with MAX6675 Amplifier as an Input devise.

    What is Thermocouple?

    image not found

    A thermocouple is a device that consists of two different metal that form an electrical junction—thermal junction. The change in temperature at junction creates a small measurable voltage at the reference junction that can be used to calculate the temperature.This is also known as Seebeck effect.

    A thermocouple is classified on base of different metals junction they use . The metals used will affect the voltage range, cost, and sensitivity. There are standardized metal combinations that result in different thermocouple types: B, E, J, N, K, R, T, and S.
    A k-type thermocouple is made out of chrome and alumel conductors junction and has a general temperature range of -200 to 1260ºC (-326 to 2300ºF).

    MAX6675 Amplifier

    The MAX6675 Amplifier performs cold-junction compensation( sensor to measure temperature at the reference junction) and digitizes the signal from a type-K thermocouple.Amplifies the tiny voltage at the reference junction so that we can read it using our microcontrollers. The data is output in a 12-bit resolution, SPI-compatible protocal , read-only format.So it can be readable by a microcontrol.
    For more information read the datasheet.

    Code for K-type thermocouple with MAX6675 Amplifier.

          /*Fab accademy 2022 by vrushavh.
          this code is refered from https://randomnerdtutorials.com/arduino-k-type-thermocouple-max6675/
          K-type thermo couple data read on Serial moniter*/
         
         #include "max6675.h"
         
         int thermoDO = 9;
         int thermoCS = 8;
         int thermoCLK = 10;
         
         MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
         
         void setup() {
           Serial.begin(9600);
         
           Serial.println("MAX6675 test");
           // wait for MAX chip to stabilize
           delay(500);
         }
         
         void loop() {
           // basic readout test, just print the current temp
           
           Serial.print("C = "); 
           Serial.println(thermocouple.readCelsius());
           //Serial.print("F = ");
           //Serial.println(thermocouple.readFahrenheit());
          
           // For the MAX6675 to update, you must delay AT LEAST 250ms between reads!
           delay(1000);
         }
              
        
    
        

    Code for temperature reading.

    Themprature reading from K-type thermocouple .

    Tempratur reading in degree celcius.

    In this week I want to test K-type thermo couple .which will be used by me in my final project to. As my project is based on Heating Application .I have to give Some kind of Security Alert for high temperature.
    Why K-type thermo couple ?
    My project is base on LPG incineration so.The body will enclose the fire with temperature goes above 700-800 degree celsius.Becous A K-type thermocouple is a type of temperature sensor with a wide measurement range like - 200ºC to 1350ºC (-326 to 2300ºF) .Its the perfect sensor for my application.

    Using Push button as an input device.

    I try to use a push button as an Input device to start the program in my final project board .Currently I want to operate it as a one push ON/OFF button to turn ON/OFF a button.

    One push on/off Code:

       //Fab accademy 2022 by vrushavh.
      //this code is refered from  https://robojax.com/using-arduino-push-button-push-and-push-relay-and-ac-bulb.
        //one push LED on OFF code
          
          
        int pbuttonPin = 11;// connect output to push button
        int LEDPin = 3;// Connected to relay (LED)
          
        int val = 0; // push value from pin 2
        int lightON = 0;//light status
        int pushed = 0;//push status
        
        
        void setup() {
          //push button ON and OFF
          Serial.begin(9600);
          pinMode(pbuttonPin, INPUT_PULLUP); 
          pinMode(LEDPin, OUTPUT);
        digitalWrite(LEDPin, HIGH);// keep the load OFF at the begining. If you wanted to be ON, change the HIGH to LOW
        }
        
        void loop() {
          val = digitalRead(pbuttonPin);// read the push button value
        
          if(val == HIGH && lightON == LOW){
        
            pushed = 1-pushed;
            delay(100);
          }    
        
          lightON = val;
          
        
              if(pushed == HIGH){
                Serial.println("Light ON");
                digitalWrite(LEDPin, LOW); 
              
              }else{
                Serial.println("Light OFF");
                digitalWrite(LEDPin, HIGH);
          
              }     
          delay(100);
        }
            
      
    
      

    One push on/off video demonstration: