mountbaldy
Posts: 5
Joined: Tue Feb 13, 2018 7:49 pm

I2C to 1-Wire RPi Zero - Solar Hot Water Heater Build

Mon Jan 14, 2019 11:54 pm

Hi all,

I am new to the forum. I am looking for assistance in a Solar Hot Water Heater Controller build. My goal for this project is to use 3 temperature sensors (hot water holding tank, solar panel, and outside temperature) and 1 KY-019 relay board. Power will come in from line and be converted via a HLK-PM1. I will write a python script to monitor tank temperature, outside temperature and solar panel temperature. The pump relay will only be engaged when a certain set of criteria are met. All of this data will be posted to a web gui that will show the status of the pump, and associated temperature data. Ideally, I would like to have some prototype boards that could be used for multiple relay purposes to control various things based on temperature (brewery, greenhouse, ect.). In this case the 1-wire sensor seems to be the most ideal solution.

My plan was to use three 1-wire DS18B20 sensors wired in series with a single 4.7K Ohm Resister between 3.3V power and the Data cable (GPIO PIN4). My cable run is about 6 meters. I reviewed the information here, https://www.maximintegrated.com/en/app- ... /CMP/ELK5/ and discovered that my resistor may be slightly high and that I needed to supply 5 volts to the sensor and 3V3 down the jumped data line with the sensor. I tested this only to have intermittent problems reading temperatures (sensors would disappear). Also initially with the standard 4.7K resistor setup, it would not even read at that length of cable.

After much digging, I have discovered that the 1-wire sensor setup on the Pi Zero is good for testing but not so good for long term use and can suffer from inconsistent temperature readings. Since my solar hot water heater project is temperature dependent and cannot be running in freezing temps, I am thinking that the I2C to 1-Wire option is a better fit.

I live in the US. I am having one heck of a time locating any I2C to 1 wire breakout boards. Anywhere. Or the DS2482. I see ABElectronics UK has a 1-wire Pi Zero board but I am impatient and do not want to wait to get my board. Not to mention price.

Am I completely off my rocker for thinking of using these DS18B20 1-wire sensors or is their a better option for my application? Is their any built in I2C control on the pi zero for 1-wire sensors like the DS18B20?

Also, I am not opposed to running CAT6 to these outside sensors and running wires the entire way from the board. My end goal is to have an addressable sensor that is reliable and with higher precision of accuracy. I also don't want to break the bank.

Any advice here is greatly appreciated!

Cheers!


Mountbaldy

mountbaldy
Posts: 5
Joined: Tue Feb 13, 2018 7:49 pm

Re: I2C to 1-Wire RPi Zero - Solar Hot Water Heater Build

Tue Jan 15, 2019 10:00 pm

I broke down and ordered a 1 Wire PiZero addon from PiHut. It'll hopefully be here by next week. I'm hoping it'll do what I need it to. Fingers crossed!

Until then, I beleve I'll be following some advice given on other post here stating :
JohnsUPS wrote: ↑
Sun Jan 13, 2019 12:51 pm
You want to wire all of the sensors in parallel. This will avoid the star topology, and you can go quite a distance. I currently have an installation of five DS18B20 sensors along 369 feet of CAT6, and they are working flawlessly.

Wired like so:
At each sensor, there is a 10ufd tantalum capacitor across Vcc & Gnd. These are NOT the parasitic type sensors.
CAT6 cable (CAT5e would also be fine). The pairs within the cable are connected together:
ORG/ORG+WHT connected together, and is used for 5V Vcc to each sensor.
BLU/BLU+WHT connected together, and is used for the data connection.
BRN/BRN+WHT & GRN/GRN+WHT all connected together and is the ground connection.
Notice that the twisted pairs are connected together. This is done to reduce inter-electrode capacitance, especially on the data line.
A DS2482-100 1-wire driver (using 5V Vcc) for driving the data line.
The chip uses I2C, so 5v to 3.3V level shifting is done on the I2C lines to the Pi.
Small Python script then reads then data and populates an RRDTool Database.

As an alternate solution, there is a DS2482-800 driver chip with eight channels. You could run one sensor off of each channel. This may provide more flexibility in your layout if the number of sensors is likely to change, or if the sensor locations are moved.
Cheers!

Brandon92
Posts: 773
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: I2C to 1-Wire RPi Zero - Solar Hot Water Heater Build

Tue Jan 15, 2019 10:22 pm

What do you want to switch with that relay board. It is not really suitable for switching heavy loads.
See (my) post in this topic about that type of relay that is used.

And do you have experience with working with mains voltage?
mountbaldy wrote: My end goal is to have an addressable sensor that is reliable and with higher precision of accuracy. I also don't want to break the bank.
What is "higher precision of accuracy" in this case? And by the way, I2C is also not designed to run over long cables. It is more a protocol between chips on a single PCB. But there are chips out there that make it possible to use it over cable >50meter (if I remember correctly).

mountbaldy
Posts: 5
Joined: Tue Feb 13, 2018 7:49 pm

Re: I2C to 1-Wire RPi Zero - Solar Hot Water Heater Build

Wed Jan 16, 2019 12:00 am

I was hoping to use that board with this 12V DC pump. I will certainly take a look at the post you mention. I do have experience with main power. I have done quite a bit of mains electrical work in the past. I have minimal pi experience. I did build a hestipi, which uses mains power.

My level of sensor accuracy is +/- 1 degree F, so nothing too serious. It appears from this link, that it is quite possible to get distance from 1-wire communications via I2C to 1-wire adapter.

Also, my wire run is not very long. I am looking at 10 - 15 M max. Any advice on temperature sensors to use here is appreciated. I just have a pile of the DS18B20 sensors. I just need a reliable temperature sensor that I can depend on.

I am completely new to all of this so, please, correct me if I'm wrong.

Thanks for the advice!

Cheers

mountbaldy
Posts: 5
Joined: Tue Feb 13, 2018 7:49 pm

Re: I2C to 1-Wire RPi Zero - Solar Hot Water Heater Build

Wed Jan 16, 2019 12:17 am

Also one other requirement for the temp sensor is that it needs to be water proof.

Cheers

prairietech
Posts: 28
Joined: Wed Mar 20, 2013 9:22 pm

Re: I2C to 1-Wire RPi Zero - Solar Hot Water Heater Build

Thu Jan 17, 2019 2:57 am

Here's the waterproof sensors I use:
https://www.adafruit.com/product/381

Have you ever considered using Node Red software to display temps in charts and also control your relays? You can also send email alerts if temps get too high or low.

Node Red runs great on a Raspberry and I think is included with the Raspian image.

JohnsUPS
Posts: 104
Joined: Fri Jul 06, 2018 2:13 am
Location: USA

Re: I2C to 1-Wire RPi Zero - Solar Hot Water Heater Build

Fri Jan 18, 2019 1:12 pm

You will probably have to make your own breakout board for the DS2482. This is what I did. Not difficult. The easiest package to work with is the 8-SOIC package, so an adapter board that will go from the 8-SOIC foot print to a DIP package 0.1" spacing (if you're not making your own PCB) is probably in order.
I got my DS2482's from Digi-Key, and the adapter boards from Bangood.com, then soldered the chip on. Digi-key may also have them (just looked it up, and they source some from Adafruit).

Return to “Automation, sensing and robotics”