Measuring Temperature with a BeagleBone Black

Similar documents
Adafruit's Raspberry Pi Lesson 11. DS18B20 Temperature Sensing

SSH to BeagleBone Black over USB

Arduino Lesson 13. DC Motors. Created by Simon Monk

Arduino Lesson 0. Getting Started

Setting up IO Python Library on BeagleBone Black

Arduino Lesson 14. Servo Motors

Arduino Lesson 9. Sensing Light

Adafruit's Raspberry Pi Lesson 9. Controlling a DC Motor

Adafruit's Raspberry Pi Lesson 5. Using a Console Cable

Arduino Lesson 17. Sending Movement Detector

Adafruit's Raspberry Pi Lesson 5. Using a Console Cable

Adafruit's Raspberry Pi Lesson 5. Using a Console Cable. Created by Simon Monk

Arduino Lesson 16. Stepper Motors

CPSC 226 Lab Nine Fall 2015

Using an IR Remote with a Raspberry Pi Media Center

Adafruit's Raspberry Pi Lesson 6. Using SSH

Adafruit MCP9808 Precision I2C Temperature Sensor Guide

Arduino Lesson 1. Blink

UniPi technical documentation REV 1.1

Arduino Lesson 4. Eight LEDs and a Shift Register

7/Basic Input and Output

Matrix and 7-Segment LED Backpack with the Raspberry Pi

Adafruit BME280 Humidity + Barometric Pressure + Temperature Sensor Breakout

Your Multimeter. The Arduino Uno 10/1/2012. Using Your Arduino, Breadboard and Multimeter. EAS 199A Fall Work in teams of two!

Adafruit's Raspberry Pi Lesson 7. Remote Control with VNC

PiFace Control & Display

5inch HDMI LCD User Manual

Beginner s Guide to the PI MATRIX. by Bruce E. Hall, W8BH 1) INTRODUCTION

Cornerstone Electronics Technology and Robotics I Week 15 Voltage Comparators Tutorial

2.2" TFT Display. Created by Ladyada. Last updated on :15:09 PM EDT

Playing sounds and using buttons with Raspberry Pi

Data Logging Software and Cable Bundle Model DL-SC3 User Manual. Overview

In-System Programmer USER MANUAL RN-ISP-UM RN-WIFLYCR-UM

Parallax Serial LCD 2 rows x 16 characters Non-backlit (#27976) 2 rows x 16 characters Backlit (#27977) 4 rows x 20 characters Backlit (#27979)

Arduino Lesson 5. The Serial Monitor

Copyrights 2010 Victron Energy B.V. All Rights Reserved

Drive a 16x2 LCD with the Raspberry Pi

TSL2561 Luminosity Sensor

SL1100 Installation Instructions. This Installation Packet is Organized into Five Chapters:

Adafruit SHT31-D Temperature & Humidity Sensor Breakout

Character LCDs. Created by Ladyada. Last updated on :45:29 PM EDT

Data Sheet. Adaptive Design ltd. Arduino Dual L6470 Stepper Motor Shield V th November L6470 Stepper Motor Shield

UPS PIco. to be used with. Raspberry Pi B+, A+, B, and A. HAT Compliant. Raspberry Pi is a trademark of the Raspberry Pi Foundation

PolyBot Board. User's Guide V1.11 9/20/08

TEECES DOME LIGHTING SYSTEMS

Adding a Real Time Clock to Raspberry Pi

Raspberry Pi radio player with touchscreen

Adafruit NFC/RFID on Raspberry Pi

DASYLab Techniques. Saving DASYLab data to an ASCII (text) readable file. Updated to reflect changes in DASYLab 13

Kurz MODBUS Client User s Guide

The self-starting solar-powered Stirling engine

Tiny Arduino Music Visualizer

Eric Mitchell April 2, 2012 Application Note: Control of a 180 Servo Motor with Arduino UNO Development Board

MCP4725 Digital to Analog Converter Hookup Guide

Web Site: Forums: forums.parallax.com Sales: Technical:

How to use the OMEGALOG software with the OM-SQ2010/SQ2020/SQ2040 Data Loggers.

PRODUCTIVITY THROUGH INNOVATION 600 CONTROL DIRECT DRIVE TECHNICAL/OPERATION MANUAL

Intro to Intel Galileo - IoT Apps GERARDO CARMONA

Monitor Your Home With the Raspberry Pi B+

Network Interface Failover using FONA

Applied Electronics. Commercial Dimming System UPDATE NOTICE

Building a Basic Communication Network using XBee DigiMesh. Keywords: XBee, Networking, Zigbee, Digimesh, Mesh, Python, Smart Home

USER MANUAL V5.0 ST100

Lab 4 - Data Acquisition

BMV-602 Data Link Manual

Arduino Motor Shield (L298) Manual

K-Type Thermocouple Sensor User s Guide

CAN-Bus Shield Hookup Guide

Advanced Data Capture and Control Systems

Intel Do-It-Yourself Challenge Lab 2: Intel Galileo s Linux side Nicolas Vailliet

Adafruit's Raspberry Pi Lesson 3. Network Setup

ADC-20/ADC-24 Terminal Board. User Guide DO117-5

INDEX. Trademarks All name and product s trademarks mentioned below are the property of their respective companies.

WebIOPi. Installation Walk-through Macros

Touch Screen for Pictiva OLED display. Application Note. Introduction

GENERAL SCIENCE LABORATORY 1110L Lab Experiment 6: Ohm s Law

Set up and Blink - Simulink with Arduino

Board also Supports MicroBridge

Microstack Accelerometer Getting started

BeagleBone Black: Installing Operating Systems

Pololu DRV8835 Dual Motor Driver Shield for Arduino

Conversion Between Analog and Digital Signals

A REST API for Arduino & the CC3000 WiFi Chip

Raspberry Pi Adding a Real Time Clock (RTC)

Introduction to Eclipse

Six-servo Robot Arm. DAGU Hi-Tech Electronic Co., LTD Six-servo Robot Arm

PHYS 2P32 Project: MIDI for Arduino/ 8 Note Keyboard

Internet of Things with the Arduino Yún

Preparing Raspberry Pi

USB to RS-422/485 Serial Adapter

Surveillance System Using Wireless Sensor Networks

Arduino Lab 1 - The Voltage Divider

7inch HDMI LCD (B) User Manual

Robot Board Sub-System Testing. Abstract. Introduction and Theory. Equipment. Procedures. EE 101 Spring 2006 Date: Lab Section # Lab #6

SYSTEM 45. C R H Electronics Design

DATASHEET. ADAM Arduino Display Adaptor Module. Arduino Compatible Shield P/N: 4Display-Shield-FT843 For the 4D Systems 4DLCD-FT843 Display

Pantone Matching System Color Chart PMS Colors Used For Printing

UNIVERSITY OF CALIFORNIA College of Engineering Department of Electrical Engineering and Computer Sciences

GUI application set up using QT designer. Sana Siddique. Team 5

LMU Hardware and Installation Guide

Transcription:

Measuring Temperature with a BeagleBone Black Created by Simon Monk Last updated on 2013-07-08 05:15:44 PM EDT

Guide Contents Guide Contents Overview You WIll Need Installing the Python Library Wiring The Python Console Writing a Program Next Steps 2 3 4 6 7 8 9 11 Page 2 of 11

Overview In this tutorial, you will learn how to connect temperature sensor to a BeagleBone Black. Because the BBB runs Linux, there are many ways in which it can be programmed. In this tutorial we show how to read analog values form a TMP36 temperature sensor using Python. The temperature sensor chip used is the TMP36. You can find out more about this chip here: http://learn.adafruit.com/tmp36-temperature-sensor/overview (http://adafru.it/cgz) Page 3 of 11

You WIll Need To try out this tutorial, you will need: BeagleBone Black TMP36 Half-sized Breadboard Page 4 of 11

Male to Male Jumpers Page 5 of 11

Installing the Python Library This tutorial uses Ångström Linux, the operating system that comes pre-installed on the BBB. Follow the instructions here, to install the Python IO BBIO library. http://learn.adafruit.com/setting-up-io-python-library-on-beagleboneblack (http://adafru.it/cgh) Page 6 of 11

Wiring Wire up the solderless breadboard using the header leads as shown below. Make sure that you get the TMP36 the right way around. The blue lead is connected from the GNDA_ADC connection to the GND pin of the TMP36 temperature sensor. The red lead is connected from pin 3 of the other connector (3.3V) to the positive supply pin of the TMP36 and the orange lead to pin P9.40. Note that only certain pins can be used as analog inputs (see http://learn.adafruit.com/setting-up-io-python-library-onbeaglebone-black/adc (http://adafru.it/ch0)) The pins are numbered left to right, 1, 2 then on the next row down 3,4 etc. You can find out about all the pins available on the P8 and P9 connecters down each side of the BBB here: http://stuffwemade.net/hwio/beaglebone-pin-reference/ (http://adafru.it/cgi) Page 7 of 11

The Python Console Before writing a Python program to measure and report the temperature, we can try some experiments in the Python Console. To launch the Python Console type: # python Python 2.7.3 (default, Apr 3 2013, 21:37:23) [GCC 4.7.3 20130205 (prerelease)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> First, we need to import the library, so enter the command: >>> import Adafruit_BBIO.ADC as ADC Now enter the command below into the Python Console to setup the ADC (Analog to Digital Convertor). >>> ADC.setup() You can now read the value at the analog input (between 0 and 1) using the command below. Try it a few times while putting your finger on the TMP36 to warm it up. The readings should gradually increase. >>> ADC.read("P9_40") 0.38999998569488525 >>> ADC.read("P9_40") 0.38833332061767578 >>> ADC.read("P9_40") 0.39722222089767456 >>> ADC.read("P9_40") 0.42500001192092896 Note: Using the up arrow will repeat the last line that you entered in the Python Console. These readings are not yet an actual temperature, so in the next section we will write a short Python program to display the temperature in both degrees C and F. Page 8 of 11

Writing a Program Exit the Python Console by typing: >>> exit() This should take you back to the Linux prompt. Enter the following command to create a new files called tmp36.py nano tmp36.py Now paste the code below into the editor window. import Adafruit_BBIO.ADC as ADC import time sensor_pin = 'P9_40' ADC.setup() while True: reading = ADC.read(sensor_pin) millivolts = reading * 1800 # 1.8V reference = 1800 mv temp_c = (millivolts - 500) / 10 temp_f = (temp_c * 9/5) + 32 print('mv=%d C=%d F=%d' % (millivolts, temp_c, temp_f)) time.sleep(1) Save and exit the editor using CTRL-x and the Y to confirm. Page 9 of 11

To start the program, enter the command: python tmp36.py You will then see a series of readings. mv=757 C=25 F=78 mv=760 C=26 F=78 mv=762 C=26 F=79 mv=765 C=26 F=79 mv=763 C=26 F=79 mv=763 C=26 F=79 mv=766 C=26 F=79 mv=768 C=26 F=80 When you want to stop the readings, use CTRL-c. Warning: The analog inputs of the BBB operate at 1.8V. Since the TMP36 has a theoretical maximum output of 3.3V, there is a potential for the BBB to be damaged if the voltage in millivolts exceeds 1.8V. This will only happen on a TMP36 if the temperature exceeds 130 degrees C (266 degrees F). Page 10 of 11

Next Steps Now that you can measure the temperature, you could do other things with it like displaying a message when the temperature exceeds some limit. You could also use the project as a temperature logger, using Python to write the readings to a file, each accompanied by a time stamp. If the temperatures are written one per line, with a comma between the time and the reading, then you will be able to import it directly into a spreadsheet and produce charts from the data. About the Author. As well as contributing lots of tutorials about Raspberry Pi, Arduino and now BeagleBone Black, Simon Monk writes books about open source hardware. You will find his books for sale here (http://adafru.it/cah) at Adafruit. Last Updated: 2013-07-08 05:15:46 PM EDT Page 11 of 11