help design sensor circuit

Status
Not open for further replies.

jsbhalla88

Member level 1
Joined
Mar 3, 2015
Messages
41
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Visit site
Activity points
314
Hi guys,
I am a programmer and want to design a circuit with 2 humidity and temperature sensors connected to a PIC microcontroller over I2C, and PIC connected over a RS485 network to PC.
I don't know from where should I start..i know the circuit to power on the microcontroller, but don't know how to connect the sensors.
can anyone help..?

 

Have you chosen the sensors first? Better use the sensor which is operates at the same voltage of PIC. Interface the I2C lines with the PIC and a connect a pull-up resistor on the same line. Are you going to use only 2 sensor. In that case one I2C line is sufficient to communicate with both.
 


Yes, I have chosen the sensors.
I have found circuit connections for them, but I don't know which value pull up to use..?? how to calculate .??
I will be using only 2 sensors. I was planning on using software I2C so that I can connect to them at different pins.
I am not sure how can I communicate with both the sensors over a single I2C line..???
what will be the connections for both the sensors to connect over one I2C line.???
it will be a redundant system. so if one sensor stop working, data will be collected from the other one. they wont operate at the same time..
 

Mcu datasheet from microchip's website
pic16f1825: **broken link removed**

On page 4, you will se a table of the mcu pin functions.
Not sure if you are aware yet that i2c makes use of 2 wires(and that those 2 lines are called sda and scl)

Sda - data line
Scl - clock

You are probably going to be using the pdip package (14 pins). According to the table, SDA is pin 9 of the device while SCL is pin 10.

You connect these pins to the sda and scl pins of your sensors. A very important thing about i2c is you will need pull up resistors on both scl and sda. So connect these lines to vdd via resistors. You only need 1 resistor for scl and 1 for sda so there is no need to add pull up resistors per i2c on each device. I hope this makes sense.

Aside from power and sensor connections, are you also aware of the minimum hardware requirements for the pic mcu? Your basic mcu circuit without sensors should look like this:http://picpgm.picprojects.net/hardware/picpgm_lvisp_connect2target.png

Edit: just saw your new post and thought i'd add a few more things.
I don't think you need to worry about the exact values of the pullups for now, but id say 10k should work fine. I2c is actually a data bus, and it was designed so multiple device could communicate using these 2 lines only.
 
Last edited:

Single I2C line can communicate with 2 different sensors. You can differentiate them by using their own device address which gets varied according to devices. There will be 3 address lines available on the sensors (check the datasheets of both the sensors).
The communication initiation will start with command of 8 bit data from the Master which is PIC in your case.
 
Reactions: ernpao

    ernpao

    Points: 2
    Helpful Answer Positive Rating
On page 4, you will se a table of the mcu pin functions.
thanx..
Pin RC0 and RC1. but how to connect 2 sensors to this..??
Not sure if you are aware yet that i2c makes use of 2 wires(and that those 2 lines are called sda and scl)
I had just studied that..thanx for mentioning.
are you also aware of the minimum hardware requirements for the pic mcu?
thank you again...

- - - Updated - - -

I cant find the third address line..
pins I have on my sensor:
Vcore, Vdd, Vss, Alarm_high, Alarm_low, SCL, SDA, Ready..
 

So go through the datasheet carefully. Somewhere they must have mentioned about the addressing or provide the part number of your sensor.
 

I am using 2 different sensors. here are the digikey part number of both:
1.) 235-1337-ND
2.) HIH9131-021-001TR-ND
 

Hobbyckts:
I have to use 2 sensors over different pins using software I2C in order to make a redundant system. so that if one sensor fails, the other keeps on working an is not affected by the failure of the other.
so, using both sensors on same line is not a good idea here..
how to calculate pull-up resistor? I found that 10K is typically used.
I am studying I2C protocol, it says you have to send address. well I don't know which address to send. can you tell me address from the data sheet, if you found one.?
 

Download the application note from the manufacturer website and check device address. It is mentioned quite clearly about that and also the procedure which you have to follow during the I2C transaction.

In Single I2C line you can communicate with both the sensors but not at the same time. So it depends on you to use single or dual I2C communication lines.

Any value lesser or equal to 10K for pull-up resistor is more than enough in this cases.
 

The column which is showing IC Default of value 0101000 is the default device ID
 

okay..got that..
I am not using it, but just curious to know, how to use the same type of sensors over a single I2C, as you mentioned.. how will you differentiate between the sensors as they have same addresses.?
 

In i2c, you have to make sure that no two devices have the same address. This is why i2c decices usually have a pin/s that can be set to a 1 or 0 so you can choose an alternate i2c address on the device. Check if your device has those.
 

This is why i2c decices usually have a pin/s that can be set to a 1 or 0 so you can choose an alternate i2c address on the device.
These devices don't have address pin strapping. The ChipCap2 sensor can be however configured to a different I2C address by software. I didn't see yet address information for the Honeywell HIH9000 sensor, I guess your first step is to get it from the manufacturer or distributor. Or have you any indications that it's using the same address as ChipCap2?
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…