Go Down

Topic: Vague project brief from a lecturer... (Read 2271 times) previous topic - next topic



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
- 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



Dec 06, 2012, 10:59 am Last Edit: Dec 06, 2012, 11:01 am by Grumpy_Mike Reason: 1
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.



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.


Dec 06, 2012, 11:31 am Last Edit: Dec 06, 2012, 11:38 am by AWOL Reason: 1
Code: [Select]
#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


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


"Pete, it's a fool (who) 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.
I speak for myself, not Arduino.

Go Up