Pages: [1]   Go Down
Author Topic: Vague project brief from a lecturer...  (Read 886 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi

I'm not particularly good at programming and electronics and out lecturer has given us some vague brief.

We're using Leonardo boards and the temp sensor is an MCP9801

The bit I'm struggling most with is:
Interface the I2C Temperature sensor

What do I do? and what does he mean be interface?

This is a component leading up to the next few instructions if that helps. They are as follows:
Check the setup of the ADC channels, how can you make them the most sensitive for your
application
- Compare the analogue and digital temperature sensor and discuss their advantages /
disadvantages. (What temperature resolution can you archive, how do you set up for the
widest range of temperature.)
- Report temperature data back to your PC

Thanks
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 626
Posts: 34207
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Wire the data and clock signals from the arduino to the sensor. Also put power and ground to the sensor. Wire a 4K7 pull up resistor on each of these two signals.
Read the data sheet to see what address the sensor is at and read the I2C examples in the IDE to find out how to read data from this sensor.
All this means interfacing the sensor to the arduino.

I would suggest that the vagueness lies with you rather than the lecturer.
« Last Edit: December 06, 2012, 05:01:38 am by Grumpy_Mike » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry but what's the IDE?
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 626
Posts: 34207
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Integrated Development Environment - it is the arduino application running on your computer. It has example code in it under the less confusing menu title of Examples.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
#include <Wire.h>
int I2C_address = 0b1001000;


void setup()
{
  Wire.begin();        // join i2c bus (address optional for master)
  Serial.begin(9600);  // start serial for output
}

void loop()
{
  Wire.requestFrom(I2C_address, 1);    // request 1 byte from address.

  while(Wire.available())    // slave may send less than requested
  {
    char c = Wire.read(); // receive a byte as character
    Serial.print(c);         // print the character
  }

  delay(500);
}
I think this is getting there, I think I have to now specify which register I want to take data for, my temp sensor has 4 registers. At what point in this code do I say which Register I want to take data from?

Moderator edit: CODE TAGS
« Last Edit: December 06, 2012, 05:38:30 am by AWOL » Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 302
Posts: 26322
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

http://ww1.microchip.com/downloads/en/devicedoc/21909b.pdf
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Pages: [1]   Go Up
Jump to: