Hello,
i would like to ask for advice, i am trying make Co2 measuring device for my home.
Right now i have esp32 wired in my ceiling light. I would like to add scd41 but i feel like measuring co2 up high in ceiling ist best solution as it would be right next to ventilation system.
I was thinking to add scd41 under light switch, in which i would make holes to make air circulation (something like there is in wall thermostats).
Problem for me is distance, SCD is comunicating over i2c. is it possible to convert i2c to UART/rs232 and than back again to i2c so i can use SCD over utp cable 5m long?
Is there any other solution? i would like to not use another microprocessor if it would be possible.
if not, i will probably switch to senseair S8 and use UART instead.
Measure Co2 where the concentration is the highest.
Look closer to I2C and get knowing how it works. That will serve You in the future.
I'd use UART over a RS-485 line.
For 5m, RS232 would be perfectly fine.
Yes, but why would you convert it back again? Why not just use a UART at the receiving end?
Many: there are lots of things designed to work over that distance - and more
i mean, SCD41 is I2C only am i right? so it will work only with I2C communication. But i am sure i2c will not work over 5meters for me.
Full or half duplex?
Either!
It's certainly not designed for that - but you might get away with it.
There are devices available for "boosting" I2C over longer distances; eg,
But things like RS232 and RS485 are specifically designed from the outset for longer distances between equipments...
A separate sender-receiver pair is required for each direction. RS-485 is somewhat bidirectional and does not require extra voltage.
I have I2C working without a problem over about 30m. No, it's not designed for that but it can be made to work.
Use twisted pair cable, either cat 5 or telephone. Use the pairs something like this:
White / blue 0V
Blue / white SCL
White / orange +5V
Orange / white SDA
Actual colours not important, keeping the pairs correct critical!
Put 0μ1 capacitors across the power at both ends of the cable
Use 2k pull up resistors, or better still 4k at each end (for a total of 4 resistors). You are probably OK to go down to 1k pull up resistors.
Lower the clock frequency
Keep the cable away from sources of noise, such as mains wiring.
What is not the case with the OP, having the Arduino in ceiling light and the sensor in the light switch.
An active pullup - such as the LTC4311 mentioned earlier - would be far better in such an application.
True, but the cables with I2C can be kept away from the mains cables. As I sometimes like to point out: electronics is a great hobby for experimenting, so experiment. I've not actually had any serious difficulties with I2C over long distances, so I think it will be OK. I even had an instance where I was getting intermittent readings from a temperature sensor (DS1624) and found that the the +5V wire had come off. So, even with parasitic powering it was sort of working.
True - but it still works, and is what the OP specifically mentioned.
It requires a little extra complexity in the software to do the direction switching.
Again, both will work fine; neither is being "stretched" beyond its intended application.
Bringing low voltage cables (usually single insulated) from areas of mains (especially those where single insulation also exists) into the outside world is a recipe for disaster in the form of electrocution and should not be endorsed.
How so?
The datasheet clearly indicates what you should have expected...
I need to chceck LTC4311, i didnt know about it, so maybe it will be way to go. Good idea!
PerryBebbington i am sure, it works for you and thank you for suggestion, i will try it too and we will see, but i have habbit, that these things out of "official" spec, that work well for others, do not work for me for some reason..
For people worried about my safety, thank you i appreciate it, but i am electrician with all certificates in my country under 1kV and i know how dengerous mains can be.
Also, i dont have mains in light switch, as it is only button input in to DI of esp32.
Well do you know Co2 is heaver than air, so it sinks to the floor? So the last place you would expect to see it would be on the ceiling. It is best put close to the skirting board.
I'd place a CO2 sensor to where the gas is consumed and exhaled - at nose level. My air quality monitor sits on my desk and reminds me when it's time to let fresh air in.