EP-0031: Difference between revisions
Jump to navigation
Jump to search
Line 49: | Line 49: | ||
==Examples== | ==Examples== | ||
*Shell scripts: | *Shell scripts:<code> | ||
<code> | \#\!\/bin/bash<br> | ||
#!/bin/bash<br> | |||
while true<br> | while true<br> | ||
do<br> | do<br> |
Revision as of 15:32, 22 June 2016
=Raspberry Pi LM75B Temperature Sensor v1.0 SKU:EP-0031
Product Feature
- 9bit high resolution ADC in chip
- Temperature resolution of 0.125°C.
- I2C bus plug and play
- Compatible with all kind of development board.
Port
- Raspberry Pi GPIO pins
Product Parameters
- Working voltage: 1.8V-5.5V, accuracy can be up to 0.5 when working voltage is higher than 3v.
- Temperatures range from−55°C to +125°C
- Supply current of 3.5µA in shutdown mode for power conservation
- Temperature accuracy of: ±2°C from−25°C to +100°C
- Temperature accuracy of: ±3°C from−55°C to +125°C
Typical Application
- Industrial controllers
- Environmental monitoring
- Smart home
- Interactive devices
How to wire it up
How to use it
- i2c-tools package is required, so you should install it before you get temperature as following command:
sudo apt-get update && sudo apt-get -y install i2c-tools
- Enable I2c function by editing /boot/config.txt,make sure it contain this two parameter as following:
device_tree=bcm2710-rpi-3-b.dtb
dtparam=i2c_arm=on
- Or you can use this command to enable I2C:
- Or you can use this command to enable I2C:
sudo raspi-config
- Select as this picture, then you can enable I2C easily.
- Please Remember to reboot your Raspberry Pi.
- After rebooting, please open a terminal and input this command to get temperature:
i2cget -y 1 0x48 0x00 w |awk '{printf("%0.1f C\n",(a=((("0x"substr($1,5,2)substr($1,3,1))*0.0625)+0.1) )>128?a-256:a)}'
Examples
- Shell scripts:
\#\!\/bin/bash
while true
do
i2cget -y 1 0x48 0x00 w | awk '{printf("%.1f C.\n", (a=((("0x"substr($1,5,2)substr($1,3,1))*0.0625)+0.1) )>128?a-256:a)}'
sleep 1
done
- C code: You can login to your Raspberry Pi and open a terminal, and then download the zip package from this link below:
File:LM75 C.tar.gz.zip
unzip it and compile it.
unzip LM75_C.tar.gz.zip
tar -xf LM75_C.tar.gz
cd LM75_C/
make
./test.o
- Python running in command line:
- Python running in X window environment: