• BMP180 (GY-68) Arduino Uno Arduino Nano
  • 14. AMALIY MASHG’ULOT
  • bmp180 sensorini Arduino-ga ulash




    Download 1,87 Mb.
    bet2/7
    Sana26.12.2023
    Hajmi1,87 Mb.
    #128572
    1   2   3   4   5   6   7
    Bog'liq
    1ASHTTAI@13-14-15333

    bmp180 sensorini Arduino-ga ulash



    Ushbu mashg’ulot uchun sizga quidagilar kerak bo'ladi:

    • Arduino Uno / Arduino Nano / Arduino Mega;

    • bosim sensori BMP180 (GY-68);

    • LCD 1602 displey;

    • "ota-ona" simlari.




    13.4-rasm. bmp180 bosim sensorini arduinoga qanday ulash mumkin





    BMP180 (GY-68)

    Arduino Uno

    Arduino Nano

    Arduino Mega

    GND

    GND

    GND

    GND

    VIN

    5V

    5V

    5V

    SDA

    A4

    A4

    yigirma

    SCL

    A5

    A5

    21

    Arduino mikrokontrolleriga ulanish I2C interfeysi orqali amalga oshiriladi. SCL / SDA kontaktlari va modul quvvat manbai kontaktlar guruhiga ulangan. Bundan tashqari, sensor bilan ishlash uchun modul bilan ishlashni soddalashtirish imkonini beruvchi BMP180 Breakout Arduino kutubxonasini o‘rnatish kerak bo‘ladi. bmp180 (bmp080) va gy-68 uchun buyruqlar bir xil, shuning uchun kutubxona barcha sanab o'tilgan barometrlar uchun ishlaydi.
    #include "Wire.h"
    #include "SFE_BMP180.h"
    SFE_BMP180 pressure; // yaratish bosim ob'ekti
    #define ALTITUDE 1655.0 // SparkFun Kolorado ofisining balandligi metrda
    void setup(){
    Serial.begin(9600); // port monitorini ishga tushiring
    pressure.begin(); // bosim sensorini ishga tushiring
    }
    void loop(){
    char status;
    double T,P,p0,a; // aniq o'lchash uchun siz balandlikni bilishingiz kerak
    Serial.println (); // bu misolda ALTITUDE doimiysi ishlatiladi
    Serial.print ( "ko'rsatilgan balandlik:" );
    Serial.print (ALTITUDE, 0);
    Serial.println ( “ metr ” ); // bosimni o'lchashdan oldin siz haroratni bilishingiz kerak
    status = pressure.startTemperature();
    if (status != 0){
    delay(status);
    // haroratni o'lchash natijasi T o'zgaruvchisida saqlanadi
    status = pressure.getTemperature(T);
    if (status != 0){
    Serial.print("temperature: ");
    Serial.print(T,2);
    Serial.println(" deg C"); // bosim o'lchashni boshlash
    status = pressure.startPressure(3);
    if (status != 0){
    delay(status);
    status = pressure.getPressure(P,T);
    if (status != 0){
    Serial.print("absolute pressure: ");
    Serial.print(P,2);
    Serial.print(" mb, ");
    Serial.print(P*0.0295333727,2);
    Serial.println(" inHg");
    // bmp180 sensori balandlikka bog'liq bo'lgan mutlaq bosimni qaytaradi
    // parametrlar: P = mb dagi mutlaq bosim, ALTITUDE = joriy balandlik
    // natija: p0 = dengiz sathining mbardagi kompensatsiyalangan bosimi
    p0 = pressure.sealevel(P,ALTITUDE);
    Serial.print("relative (sea-level) pressure: ");
    Serial.print(p0,2);
    Serial.print(" mb, ");
    Serial.print(p0*0.0295333727,2);
    Serial.println(" inHg");}
    else Serial.println("error retrieving pressure measurement\n");}
    else Serial.println("error starting pressure measurement\n");}
    else Serial.println("error retrieving temperature measurement\n");}
    else Serial.println("error starting temperature measurement\n");
    delay(5000); }

    14. AMALIY MASHG’ULOT





    Download 1,87 Mb.
    1   2   3   4   5   6   7




    Download 1,87 Mb.