OK I know this has been asked and answered before but I am not getting it. I am super new taking on a project way outside my level but hey thats how I learn :). Thanks in advance for any assistance.
I have DS1307 wired
GND
5V
SDA=A4
SCL=A5
Was thinking of BMP085 wired
VCC=3.3V
SCL=A2
SDA=A3
GND
Now based on the few posts (sorry I don't have the links handy) there is a 5V-3.3V difference between the two I2C breakouts which I don't understand what I do to get around that. Do I just add Resistors to bring it down? Also I read that I2C is A4 and A5 which would mean only one I2C can be used but there was some method to bypass this which I don't understand.
Anyone able to clarify this?
Is there a temp/humidity/RTC/Barometric sensor all in one? Any other sensors helpful along the same family?
This is a tough one. The two devices could exist on the same I2C bus (A4/A5 are the I2C pins not A2/A3) if they were compatible voltage-wise, but they are not. The DS1307 won't run on 3.3V, and the BMP085's I2C signal pins are not 5V tolerant.
Two alternatives that come to mind: (1) Use bidirectional level-shifters to interface the BMP085 to the 5V I2C bus, or (B) Run the whole system on 3.3V; this will require a different RTC that can run on 3.3V. The former isn't something I've tried, would take some research/experimentation.
DS1307 will work just fine with 3.3V pullup resistors on SDA/SCL:
SDA: Serial Data Input/Output. SDA is the data input/output for the I2C serial interface. The SDA pin is open drain and requires an external pullup resistor. The pullup voltage can be up to 5.5V regardless of the voltage on VCC.
SCL: Serial Clock Input. SCL is the clock input for the I2C interface and is used to synchronize data movement on the serial interface. The pullup voltage can be up to 5.5V regardless of the voltage on VCC.
Logic 1 Input
VIH min 2.2 max VCC + 0.3
Logic 0 Input
VIL min -0.3 max +0.8
@CrossRoads, thanks, learned something there. The ATmega328 datasheet says, "The bus drivers of all TWI-compliant devices are open-drain or open-collector." So just wire the pullups to 3.3V and everyone's happy!
OK so if I understand and remember I am still trying to grasp this stuff
Since I am mostly running at 5v and this sensor is 3.3v I need to either lower the voltage for BMP085 on the SCL and SDA to 3.3v (pull-down?) or switch the DS1307 to 3.3v and bump to 5v (pull-up?). What would it look like to do pull-down if I have that correct? just add a resistor from 3.3v in between sensor? I don't quite get what the pull-up and pull-down do exactly other than changing voltage.
How do I connect both sensors to the I2C? So far it looks like I either need to get a I2C expander or try the SoftI2CMaster linked prior?
Are there better sensors for what I am trying to do?
I eventually what to get temp, humidity, RTC, Barometric pressure and send the information over a network connection maybe wireless and once the data is received that unit will do what ever I want which might be charting or controlling heater/air conditioner/humidifier/... I was thinking of having two sensor units send data one inside the other outside. I think after I have gotten through this project I will have a good foundation for other projects.
The Arduino and the DS1307 run on 5V. The BMP085 runs on 3.3V. Hook SDA from both the DS1307 and the BMP085 together with the Arduino A4 pin, and SCL from both with A5. Wire a pullup resistor (2.2K - 10K, I use 4.7K a lot) from A4 to the 3.3V supply, and same for A5. The DS1307 and the BMP085 have separate addresses that are used to communicate with them on the I2C bus (use the Wire library).
Thank you all of you
I will give this a try and see what happens.
I don't quite understand what the pullup is doing exactly but as far as how to get it working looks easy enough.
If I use two-three 1k resistors, will that work? Unfortunately don't have 2.2k maybe I have a 10k for testing and I will run to store this week for better.
Maramor:
Thank you all of you
I will give this a try and see what happens.
I don't quite understand what the pullup is doing exactly but as far as how to get it working looks easy enough.
If I use two-three 1k resistors, will that work? Unfortunately don't have 2.2k maybe I have a 10k for testing and I will run to store this week for better.
Three 1Ks in series (3K overall) or two 10Ks in parallel (5K overall) should do very well.
After a little bit of work, I was able to get them all working. I found 4.7K resistors :).
Now when I have BMP085 on my LCD wont work? I haven't pulled together just a BMP085 and LCD just yet. I wanted to share the good news :).
I was thinking it had something to do with RTC and BMP but then why would it work fine going to Serial.
I tried creating a function that would begin() RTC store result in variable and end() RTC and same for BMP only to find out that end() does not exists :(. Not needed now that I thought about it as it works fine going to Serial. Maybe power?
By the way, I have RHT03, DS1307, BMP085, 16x2 LCD connecting to a UNO.
Since this is more a technical issue, should I stop posting here and start a new thread some place else?
I don't know why it does not work. Tried rewiring it a few times but still no go!!!! Argh!
Could it be a power issue? Maybe I have to many things pulling at the same time?
With my limited skills seems fine readings still show what I expect.
I am still new to this stuff more of a programmer then electronics but gotta start some ware. Might take a few classes someday just to get a good grounding :).
If you have a 5v Arduino and require a 3.3V I2C line, you need to divide out the voltage. Place a 4.7k from SDA to a 10K to ground and take the output in the middle to your DS1307. Do the same for the SCL line. For the 5V I2C, just take the SDA and SCL directly from the arduino without any voltage divider.
Do not forget the pullup resistors. This will ensure that you have proper voltages.
The LCD issue should not be occuring UNLESS you are using A4 and A5 as something to do with LCD which I doubt. The other issue is if you connect directly to the TX line on Arduino and try to do a Serla.print, it will show up on the LCD screen. I usually want both Serial monitor and LCD so I use the SoftwareSerial library and use ANY digital pin to print to the LCD. This way I have access to both.