element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Sudden Impact Wearables Design Challenge
  • Challenges & Projects
  • Design Challenges
  • Sudden Impact Wearables Design Challenge
  • More
  • Cancel
Sudden Impact Wearables Design Challenge
Blog [real_time_monitor] Real Time Player Monitoring System Post#6 : Interfacing ADT7320 with CC3200 Launchpad and Body Temperature mesurement
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: ravi_butani
  • Date Created: 16 Feb 2015 7:12 AM Date Created
  • Views 599 views
  • Likes 2 likes
  • Comments 0 comments
  • analog_devices_inc
  • tektronix
  • sudden_impact
  • real_time_monitor
  • adt7320
  • cc3200_launchpad
  • electrolube
Related
Recommended

[real_time_monitor] Real Time Player Monitoring System Post#6 : Interfacing ADT7320 with CC3200 Launchpad and Body Temperature mesurement

ravi_butani
ravi_butani
16 Feb 2015

<< Previous Post

Table of Contents

Next Post >>


In my Previous Post , I have shared interfacing of ADXL375 High g Accelerometer with CC3200 LaunchPad.

 

In this post, I am sharing Interfacing of ADT7320 Temperature sensor with CC3200 LaunchPad and Body temperature measurement with ADT7320.

ADT7320 is High resolution Temperature sensor (Resolution 0.0625°C/LSB in 13bit and 0.0078°C/LSB in 16bit mode). Maximum Temperature measurement range is −20°C to +105°C. As Eval-ADT7320FBZ is flex module it is very much suitable for body temperature measurement (It provides maximum contact surface with body and excellent heat transfer).

 

Color code for ADT7320 wiring is as below...

image

ADT7320 supports 4-Wire SPI communication protocol in SPI Mode3 (Clock Priority = 1 and Clock Phase = 1)

By default ADT7320 is in continuous operation mode with 13 bit resolution. Reading Temperature Value Register (0x02 address and 16bit) gives bit15(MSB) to bit4(LSB) with -ve temperature in 2's complement format.

 

to get final result of temperature the received value need to divide by 8. and with 13 bit mode resolution is 0.0625 C/LSB.. Final equation of temperature in C is....

Temp in C = Received Value of temp Value*0.0625/8

 

As Read command Byte for ADT7320 is following with R/W' = 1..

 

image

So, to read 0x02 address (Temperature Value Register of 16 bit) with Read command, SPI read request byte is 0x50..

and after that for read receiving two bytes from ADT7320 two time 0xFF need to be written on bus.. Here first MSB and Last LSB sequence need to be used.

 

for reference SPI read waveform from ADT7320 Datasheet is as below..

image

 

Test Setup..


image

After considering all above points.. The code for energia to interface ADT7320 with CC3200 LaunchPad is as below.. The some code works just fine with Arduino too..

Note: I have used default configuration but You can use write command to change ADT7320 Configuration (i.e. to change resolution, set temp comperator interrupt, shutdown device etc...)

 

//ADT7320 Interfacing with CC3200 LaunchPAD (Rev 0)
// Released under CC-SA Creative commons Share Alike Licence
// by ravi Butani


#include <SPI.h>
const int chipSelectPin = 18;


void setup() {
  Serial.begin(9600);
  SPI.setDataMode(SPI_MODE3);// ADT7320 Supports only MODE3 SPI
  // start the SPI library:
  SPI.begin();
  // initalize the  data ready and chip select pins:
  pinMode(chipSelectPin, OUTPUT);


  delay(100);
}


void loop() {
    //Read the temperature data
    int tempData = readRegister(0x50, 2); // 0x50 is read commad for 0x02 register
    tempData = tempData/8;// MSB bit15 and LSB bit4 so received value need to be divide/8


    // convert the temperature to celsius and display it:
    float realTemp = (float)tempData * 0.0625;
    Serial.print("Temp[C]=");
    Serial.print(realTemp);
    Serial.print("\tRXdata>>3=");
    Serial.println(tempData);
    delay(500);


}


//Read from register from the ADT7320:
unsigned int readRegister(byte thisRegister, int bytesToRead ) {
  byte inByte = 0;          // incoming byte from the SPI
  unsigned int result = 0;  // result to return
  // take the chip select low to select the device:
  digitalWrite(chipSelectPin, LOW);
  // send the device the register you want to read:
  SPI.transfer(thisRegister);
  // send a value of 0 to read the first byte returned:
  result = SPI.transfer(0xFF);
  // decrement the number of bytes left to read:
  bytesToRead--;
  // if you still have another byte to read:
  if (bytesToRead > 0) {
    // shift the first byte left, then get the second byte:
    result = result << 8;
    inByte = SPI.transfer(0xFF);
    // combine the byte you just got with the previous one:
    result = result | inByte;
    // decrement the number of bytes left to read:
    bytesToRead--;
  }
  // take the chip select high to de-select:
  digitalWrite(chipSelectPin, HIGH);
  // return the result:
  return(result);
}




//Sends a write command to ADT7320


void writeRegister(byte thisRegister, byte thisValue) {


  // take the chip select low to select the device:
  digitalWrite(chipSelectPin, LOW);


  SPI.transfer(thisRegister); //Send register location
  SPI.transfer(thisValue);  //Send value to record into register


  // take the chip select high to de-select:
  digitalWrite(chipSelectPin, HIGH);
}

 

Here is Demo Video....

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

 

 

Reference :

http://energia.nu/wordpress/wp-content/uploads/2014/09/cc3200lppinmap.jpg

http://www.analog.com/media/en/technical-documentation/data-sheets/ADT7320.pdf

http://www.analog.com/media/en/technical-documentation/evaluation-documentation/UG-138.pdf

Arduino - SPI

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube