# Message Boards

GROUPS:
 I was wondering if it was possible to use DeviceRead to read a temperature sensor. So far Mathematica will only produce 1's and 0's from device read. Is importing the device data from an external file the only way to get my temperature data and other exact numerical data into Mathematica? Why doesn't device read read the output voltage?Thanks for your time.
3 months ago
5 Replies
 Hi Owen,What kind of temperature sensor are you interested in reading from? We also support interfacing with I2C devices : http://reference.wolfram.com/language/ref/device/I2C.htmlThanks,Ian
3 months ago
 We read temperature from a USB connected serial device on a laptop. What platform and temperature device are you using?
 Hello again,As Neil was saying, the temperature sensor you have is analog, and so there is no way to connect it directly to the pins on the Pi and read the analog voltage of the sensor. However you can use a simple ADC chip to convert the analog voltage into a digital stream usable by the Pi. For example, this is an ADC chip that can send the digital data back to the Pi + Wolfram Engine over I2C : https://www.adafruit.com/product/1083Another simple option would just be to connect the TMP36 to an Arduino on one of the analog pins (say A0 for example), and then connect the Arduino to the Raspberry Pi over USB. Then in Mathematica you could read from the TMP36 sensor like so: DeviceOpen["Arduino","/dev/ttyAMA0"] ( DeviceRead["Arduino","A0"] - Quantity[0.5,"Volts"] ) / (Quantity[10,"Millivolts"] / Quantity[1,"DegreesCelsius"] ) Thanks,Ian