Industrielle Fertigung
Industrielles Internet der Dinge | Industrielle Materialien | Gerätewartung und Reparatur | Industrielle Programmierung |
home  MfgRobots >> Industrielle Fertigung >  >> Manufacturing Technology >> Herstellungsprozess

Raspberry Pi liest BMP085 Temperatur und Druck

Ein weiteres lustiges kleines i2c-Gerät, das günstig über eBay erworben wurde. Es liest den Luftdruck und die Temperatur ab. Es gibt einige relativ einfache Mathematik, um die Ausgaben in etwas Lesbares umzuwandeln.

Auch hier bietet ADAFruit eine fantastische Anleitung und Bibliothek für die Verwendung des Geräts in der Verwendung des BMP085 mit Raspberry Pi. Wie in früheren Beiträgen hätte ich einfach die ADAFruit-Bibliothek verwenden können. Ich habe zwar nicht das Bedürfnis, das Rad neu zu erfinden und von Grund auf neu zu codieren, aber ich möchte gerne verstehen, wie es funktioniert.

Ich habe die Informationen aus ein paar anderen Quellen gezogen:

Unten ist das sehr einfache Schema zum Anschließen des Geräts an den Pi.

importieren smbus importieren Zeit Klasse BMP085():      OSS = 3      def __init__( selbst , i2c, Adresse):          selbst .i2c = i2c          selbst .address = Adresse          selbst .ac1 = selbst .readSignedWord( 0xaa )          selbst .ac2 = selbst .readSignedWord( 0xac )          selbst .ac3 = selbst .readSignedWord( 0xae )          selbst .ac4 = selbst .readWord( 0xb0 )          selbst .ac5 = selbst .readWord( 0xb2 )          selbst .ac6 = selbst .readWord( 0xb4 )          selbst .b1 = selbst .readSignedWord( 0xb6 )          selbst .b2 = selbst .readSignedWord( 0xb8 )          selbst .mb = selbst .readSignedWord( 0xba )          selbst .mc = selbst .readSignedWord( 0xbc )          selbst .md = selbst .readSignedWord( 0xbe )      def readWord( selbst , reg):          msb = selbst .i2c.read_byte_data( selbst .address, reg)          lsb = selbst .i2c.read_byte_data( selbst .address, reg + 1 )          Wert = (msb << 8 ) + lsb         zurück Wert     def readSignedWord( selbst , reg):         msb = selbst .i2c.read_byte_data( selbst .address, reg)         lsb = selbst .i2c.read_byte_data( selbst .address, reg + 1 )         wenn (msb> 127 ):             msb = msb - 256          Wert = (msb << 8 ) + lsb         zurück Wert     def readUT( selbst ):         selbst .i2c.write_byte_data( selbst .address, 0xf4 , 0x2e )         time.sleep( 0,0045 )         ut = selbst .readWord( 0xf6 )         zurück ut     def readTemperature( selbst ):         ut = selbst .readUT()         x1 = ((ut - selbst .ac6) * selbst .ac5)>> 15          x2 = ( selbst .mc << 11 ) / (x1 + selbst .md)         selbst .b5 = x1 + x2         zurück (( selbst .b5 + 8 )>> 4 ) / 10.0      def readUP( selbst ):          selbst .i2c.write_byte_data( selbst .address, 0xf4 , 0x34 + ( selbst .OSS << 6 ))          Verzögerung = ( 2 + ( 3 << selbst .OSS)) / 1000.0          time.sleep(delay)          msb = selbst .i2c.read_byte_data( selbst .address, 0xf6 )          lsb = selbst .i2c.read_byte_data( selbst .address, 0xf7 )          xlsb = selbst .i2c.read_byte_data( selbst .address, 0xf8 )          up = (msb << 16 ) + (lsb << 8 ) + xlsb         up = up> > ( 8 - selbst .OSS)         zurück up      def readPressure( selbst ):          up = selbst .readUP()          b6 = selbst .b5 - 4000          x1 = ( selbst .b2 * (b6 * b6)>> 12 )>> 11          x2 = ( selbst .ac2 * b6)>> 11          x3 = x1 + x2          b3 = ((( selbst .ac1 * 4 + x3)<> 2          x1 = ( selbst .ac3 * b6)>> 13          x2 = ( selbst .b1 * ((b6 * b6)>> 12 ))>> 16          x3 = ((x1 + x2) + 2 )>> 2          b4 = ( selbst .ac4 * (x3 + 32768 ))>> 15          b7 = (up - b3) * ( 50000 >> selbst .OSS)          wenn (b7 < 0x80000000 ):              p = (b7<< 1 ) / b4          sonst :              p = (b7 / b4)<> 8 ) * (p> > 8 )          x1 = (x1 * 3038 )>> 16          x2 = ( - 7357 * p)>> 16          p + = (x1 + x2 + 3791 )>> 4          zurück p i2c = smbus.SMBus( 0 ) bmp085 = BMP085(i2c, 0x77 ) t = bmp085.readTemperature() p = bmp085.readPressure() Drucken "Temperatur:%.2f C" % t Drucken "Druck:    %.2f hPa" % (p / 100 ) Für weitere Details:Raspberry Pi liest BMP085 Temperatur und Druck

Herstellungsprozess

  1. Himbeer-Pi-Temperaturlogger
  2. Raspberry Pi-Temperaturprofil mit LabVIEW
  3. Messen Sie Temperaturen mit einem 1-Draht-DS18B20-Sensor und Raspberry Pi
  4. Raspberry Pi Temperatur- und Luftfeuchtigkeits-Netzwerkmonitor
  5. Temperatur lesen mit DS18B20 | Raspberry Pi 2
  6. Temperaturüberwachung auf dem Raspberry Pi
  7. Temperaturmessung mit RASPBERRY PI
  8. TMP006-Temperatursensor-Python-Bibliothek mit Raspberry Pi,
  9. Python- und Raspberry Pi-Temperatursensor
  10. Einfache Temperatur und Luftfeuchtigkeit auf Raspberry Pi