Fabrication industrielle
Internet des objets industriel | Matériaux industriels | Entretien et réparation d'équipement | Programmation industrielle |
home  MfgRobots >> Fabrication industrielle >  >> Manufacturing Technology >> Processus de fabrication

Raspberry Pi lisant la température et la pression BMP085

Un autre petit appareil i2c amusant acquis à bas prix via eBay. Il lit la pression barométrique et la température. Il existe des calculs mathématiques relativement simples pour convertir les sorties en quelque chose de lisible.

Une fois de plus, ADAFruit fournit un guide et une bibliothèque fantastiques pour l'utilisation de l'appareil dans leur Utilisation du BMP085 avec Raspberry Pi. Comme dans les articles précédents, j'aurais pu simplement utiliser la bibliothèque ADAFruit prête à l'emploi. Bien que je ne ressente pas le besoin de réinventer la roue et de recoder à partir de zéro, j'aime bien comprendre comment cela fonctionne.

J'ai tiré les informations de quelques autres sources :

Vous trouverez ci-dessous le schéma très simple de connexion de l'appareil au Pi.

import smbus import heure classe BMP085() :      OSS = 3      def __init__( auto , i2c, adresse) :          auto .i2c = i2c          auto .address = adresse          auto .ac1 = auto .readSignedWord( 0xaa )          auto .ac2 = auto .readSignedWord( 0xac )          auto .ac3 = auto .readSignedWord( 0xae )          auto .ac4 = auto .readWord( 0xb0 )          auto .ac5 = auto .readWord( 0xb2 )          auto .ac6 = auto .readWord( 0xb4 )          auto .b1 = auto .readSignedWord( 0xb6 )          auto .b2 = auto .readSignedWord( 0xb8 )          auto .mb = auto .readSignedWord( 0xba )          auto .mc = auto .readSignedWord( 0xbc )          auto .md = auto .readSignedWord( 0xbe )      def readWord( auto , reg) :          msb = auto .i2c.read_byte_data( auto .address, reg)          lsb = auto .i2c.read_byte_data( auto .address, reg + 1 )          valeur = (msb << 8 ) + lsb         retour valeur     def readSignedWord( auto , reg):         msb = auto .i2c.read_byte_data( auto .address, reg)         lsb = auto .i2c.read_byte_data( auto .address, reg + 1 )         if (msb> 127  :            msb = msb - 256          valeur = (msb << 8 ) + lsb         retour valeur     def readUT( auto ) :         auto .i2c.write_byte_data( auto .adresse, 0xf4 , 0x2e )         time.sleep( 0.0045 )         ut = auto .readWord( 0xf6 )         retour ut     def readTemperature( auto ) :         ut = auto .readUT()         x1 = ((ut - auto .ac6) * auto .ac5)>> 15          x2 = ( auto .mc << 11 ) / (x1 + auto .md)         auto .b5 = x1 + x2         retour (( auto .b5 + 8 )>> 4 ) / 10.0      def readUP( auto  :          auto .i2c.write_byte_data( auto .adresse, 0xf4 , 0x34 + ( auto .OSS << 6 ))          retard = ( 2 + ( 3 << auto .OSS)) / 1000.0          time.sleep(delay)          msb = auto .i2c.read_byte_data( auto .adresse, 0xf6 )          lsb = auto .i2c.read_byte_data( auto .adresse, 0xf7 )          xlsb = auto .i2c.read_byte_data( auto .adresse, 0xf8 )          haut = (msb << 16 ) + (lsb << 8 ) + xlsb         up = haut>> ( 8 - auto .OSS)         retour haut      def readPressure( auto  :          haut = auto .readUP()          b6 = auto .b5 - 4000          x1 = ( auto .b2 * (b6 * b6)>> 12 )>> 11          x2 = ( auto .ac2 * b6)>> 11          x3 = x1 + x2          b3 = ((( auto .ac1 * 4 + x3)<> 2          x1 = ( auto .ac3 * b6)>> 13          x2 = ( auto .b1 * ((b6 * b6)>> 12 ))>> 16          x3 = ((x1 + x2) + 2 )>> 2          b4 = ( auto .ac4 * (x3 + 32768 ))>> 15          b7 = (up - b3) * ( 50000 >> auto .OSS)          if (b7 < 0x80000000  :              p = (b7<< 1 ) / b4          autre  :              p = (b7 / b4)<> 8 ) * (p> > 8 )          x1 = (x1 * 3038 )>> 16          x2 = ( - 7357 * p)>> 16          p + = (x1 + x2 + 3791 )>> 4          retour p i2c = smbus.SMBus( 0 ) bmp085 = BMP085(i2c, 0x77 ) t = bmp085.readTemperature() p = bmp085.readPressure() imprimer "Température :%.2f C" % t imprimer "Pression :    %.2f hPa" % (p / 100 ) Pour plus de détails :Raspberry Pi lisant la température et la pression BMP085

Processus de fabrication

  1. Enregistreur de température Raspberry Pi
  2. Profil de température Raspberry Pi avec LabVIEW
  3. Mesure des températures avec un capteur DS18B20 1 fil et Raspberry Pi
  4. Moniteur réseau de température et d'humidité Raspberry Pi
  5. Lire la température avec DS18B20 | Raspberry Pi 2
  6. Surveillance de la température sur le Raspberry Pi
  7. Mesure de la température avec RASPBERRY PI
  8. Bibliothèque Python du capteur de température TMP006 utilisant Raspberry pi,
  9. Capteur de température Python et Raspberry Pi