navitron
 
Renewable Energy and Sustainability Forum
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Anyone wishing to register as a new member on the forum is strongly recommended to use a "proper" email address - following recent spam/hack attempts on the forum, all security is set to "high", and "disposable" email addresses like Gmail, Yahoo and Hotmail tend to be viewed with suspicion, and the application rejected if there is any doubt whatsoever
 
Recent Articles: Navitron Partners With Solax to Help Create A More Sustainable Future | Navitron Calls for Increased Carbon Footprint Reduction In Light of Earth Overshoot Day | A plea from The David School - Issue 18
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: K-Project ... replacing Thermostats with a DIY Controller  (Read 477 times)
kristen
Hero Member
*****
Offline Offline

Posts: 1846


« on: November 05, 2018, 04:54:19 PM »

I want to replace the Thermostats / Manifold valves for my UFH (new extension), and the pump for CH RADs (Old part) with something that I can control.

I've been talking about it for far too long, and whinging that I don't have time isn't going to get anything to happen. So I've got my Credit Card out. @TT recommended ThePiHut because they have some nice Raspberry Pi bundles - seemed like an ideal starting point.


I know ZERO about control systems; I'm a Database Programmer, but have previously been an Applications programmer (Basic (decades) then C (decades) then some C++)

Latterly (more decades) my programming is SQL and some front end HTML/Javascript.  Basically I seek a holly grail of "describing" the Application in terms of some Metadata, and then the Engine writing all the code. I have got to the point where exceptions are few - so a particular Page/Function may need to be programmed, but 80%, maybe even 90%, is mechanically generated with no "twiddling"

So I'm hating the thought of starting from scratch ... and given that all I know is Windows-stuff I'm hating any thought of Unix. I've been around since the Dinosaurs, and rubbed-up against all such stuff over the years ... but nothing has rubbed OFF Sad

Here's the sort of dead-end I come up against:

https://www.raspberrypi.org/documentation/usage/python/

Nice straightforward description of using Python on A Raspberry Pi. I scroll down and glance at the code and think "Easy as Pie" no less! Well within my capabilities to pick up quickly.

Then I get to "Other ways of using Python". "IPython is an interactive Python shell with syntax highlighting, autocompletion".  Sounds ideal.

Code:
sudo pip3 install ipython

INSTALL I understand and IPYTHON I can guess.  SUDO I have to google. OK - "Superuser Do". I understand, but now I am tuning out. IME all that sort of stuff is way too much time fiddling with things that provide lousy error reporting so when it works its fine, and when it doesn't Good Luck.

I haven't seen PIP since CPM and prior to that on some DEC PDP Mini computers- it was a File Copy routine.  I have no idea if PIP3 is also a file copy routine ... but trying to remember a bunch of unrelated meaningless names, like characters in the Hobbit, doesn't work for me. I'm dyslexic, such things are hard/impossible for me (I tried to read the Hobbit, the names caused me to give up) so I'm glazing over already.

So I try investigating what I could connect to Windows instead, as then I'm on home-turf and more likely to be productive. But the sheer volume of stuff available for Raspberry Pi keeps nagging me ...

So that gets me to Arduino. I didn't know what the difference was - to me they are just a processor and some RAM and connections - and some Pros-and-Cons and Strengths-and-Weakness and some bundled-bits in one, which are not in the other - so I YouTubed and Raspberry Pi is a computer, and consequently could record data, host a MySQL database, and once a day upload it to the Internet - but I would need to patch MySQL, and everything else, to prevent vulnerability.

The thing I stumbled over when reading about Arduino was the Arduino IDE User Interface. It showed code being written in an IDE running under Windows (or Mac for that matter).  I think that's much more up my street, so I watched a YouTube, download it and figured that would do me.

And after all, all I really want to do is record temperatures and log them - ideally by uploading to a PC based system which can store them in a database and provide me with tools to view / analysis them.  Next phase will be to control things, maybe I will need a "more computer controller" solution at that time - sure Ardunio will be able to turn on / turn off to maintain 21C but stopping at 9PM and starting again at 6AM - or earlier if weather forecast is cold - might need more capability, particularly if it should have a erasonably sophisticated fall back operation if communication with the Mothership is lost - like sending me an SMS to say "Come quick" Smiley

So I bought the Ardunio Starter Kit (Rapid Electronics had a good price, and its a company I know)

I figure I'll need some help, and/or the journey might be of interest to others, so Orft We Jolly Well Go Smiley
Logged
offthegridandy
Hero Member
*****
Offline Offline

Posts: 864



« Reply #1 on: November 05, 2018, 05:36:26 PM »

Hi Kristen, let us know how you proceed.

I plan on making a Ardinio controller as part of my current project.  Last Christmas I brought a book on "How to do it" and having read most of the book figure I can, do it.

I can have electric power available from PV,Genny and WT.  When the new WT is finished I should have surplus power for most of the months of the year.  Excess power can go to immersion heaters in 2 different tanks or even to an electric fire.  I have written (somewhere in my notes) a series of "if" statements which will be the core of the programming.  I.e. "If this" then "do that".  I will be diverting my AC power not DC from the batteries which makes the use of relays simpler.  It's conceivable that I can have power from 2 sources ie PV and genny.  In theory I could have WT as well although I hope that if WT is churning away I'm not likely to have the genny running unless for an exceptional load.

My planning, programming and build of this dream device will be the final bit of the project so I look forward to learning from you as you take early steps.

Cheers.

Andy
Logged

8 KVA Lister TS2 Startamatic Genny
24 Volt 1000amp battery bank
Outback VFX3024
4.6 Kw PV array permanently ground mounted
Outback Flexmax 80
2 X Flexmax 30 PV CC
0.75 Kw wind turbine H Piggot design 2.4 Mtr Dia
12 Mtr lattice Tower.
u/floor heating from oil boiler cross linked to 12 Kw WBS
kristen
Hero Member
*****
Offline Offline

Posts: 1846


« Reply #2 on: November 05, 2018, 06:21:12 PM »

I'm hoping to go one step beyond a series of IF statements so something where the parameters of the requirement are described, and the system will sort out the best approach - but that only means that the IF stuff is "a soft set of rules" and in fact it boils down to a bunch of IFs ... or perhaps some weighted-IFs.

First mistake:

Didn't really think about any other bits I might need. I fished around with the "you might also like" but it seemed that all the bits & pieces from other bolt-on kits were already included in the Arduino Uno Starter Kit I had chosen  so didn't spot anything ...

... but as soon a I had confirmed the order I thought about "Storage?" and looked at SD-card addons - annoyingly missing from the "you might also like" list.

A quick Google turned up various breadboard projects to add on an SD card - that's fine, but a bit hairy-biker.

I then turned up a SHIELD (application not obvious to me from the name, its a piggy-back or daughter board) and then fishing around a bit more and found one with SD and Ethernet - which I figure I will also need. I hate wireless - its comes and goes here, even though we have repeaters all over the house ... after a powercut some come back by themselves and I have to figure out which ones didn't and pull their CAT5 and stick it back in again (all on PoE).  Supplier says "They are 100% reliable and that never happens anywhere else" ... yeah, right. He scratches his head somewhat when he looks at the diagnostics and history of their Up/Down cycles.

The SHIELD was under the free carriage limit ... but I phoned Rapid and they kindly cancelled my earlier order, and I placed a new one for both bits.  So my 72.87 is now increased by 23.04
Logged
andrewellis
Newbie
*
Offline Offline

Posts: 29


« Reply #3 on: November 05, 2018, 09:16:59 PM »

Just make sure you have enough memory on the arduino you have bought.  I found that with the sd card and ethernet libraries installed it meant there was no room left for any program.  The esp8266 is also a good product to look at.  It has more memory and built in wifi and is very similar to the arduino. You can develop on the same ide.
Logged

4.8kw Solar PV JA Panels, SolarEdge inverter inbound
Nibe F1255 12kw GSHP -> Radiators
Nissan Leaf
Countrypaul
Hero Member
*****
Offline Offline

Posts: 1257


« Reply #4 on: November 05, 2018, 11:26:22 PM »

Which Arduino did you go for - the Uno rev3?


Different models offer different amounts of memory and as Andrew said you need to make sure you have enough for your program as well as your hardware libraries. You will find it is entirely different programming to windows, forget about allocating memory just in case, you will need to save every byte you can. Keep any text you want to display in sram for example, don't use the strings class, avoid heap usage etc.

I also intend to look at my own control of my central heating (UFH driven from a TS) and monitoring of the tempertures everywhere. I have already played with an Arduino Uno and a one-wire system with 18B20 temp sensors, sd card and ethernet shield, along with a clock. Unfortunately I'm short of time too at present so that project is on hold - ight get a chance to resurrect it over winter nw we have actually moved in and are using the UFH though.

We also have a couple of Raspberry Pi's, but have not linked then to anything related to the house, one is used for a video server  (Pi B) and one is used for general web stuff (Pi B rev 3).

My background is VAX/VMS programming and management, but also dealt with RT11 on PDP 11s, then more recently Apple MAc (I did allmy thesis diagrams on a FatMac!), PC's running windows2, 3, 3.1, 3.11, 95, NT3.5, NT4...Windows 10 along with Centos (linux).
Logged
kristen
Hero Member
*****
Offline Offline

Posts: 1846


« Reply #5 on: November 06, 2018, 06:18:20 AM »

Very useful info, thanks.  My first computer ... back in the 70's ... had 16K of RAM and I built business systems for clients on that, so minimalist programming will be just fine. In fact I've never done the "just bolt together loads of mega-MB-modules, the Microsoft way", as its increased my headache by a new headache for every module ... so I reckon I'll be fine.  However, bit of a surprise that in this day and age Memory isn't a given.

Yes just the Ardunio Uno Starter Kit ... for starters.
« Last Edit: November 06, 2018, 07:54:32 AM by kristen » Logged
kristen
Hero Member
*****
Offline Offline

Posts: 1846


« Reply #6 on: November 08, 2018, 07:30:33 AM »

It starts Smiley


* IMG_4209_Arduino.jpg (53.72 KB, 800x600 - viewed 109 times.)
Logged
Tigger
Hero Member
*****
Offline Offline

Posts: 509


« Reply #7 on: November 08, 2018, 10:31:11 AM »

Woo hoo, keep us all updated with progress  fingers crossed!
Logged

30 tubes, south facing gable wall (Navitron Fornax Trial System).  Hunter Herald 8, integrated boiler hooked up with Oil Boiler via H2 control panel.  Scrounging fire wood wherever possible Smiley
kristen
Hero Member
*****
Offline Offline

Posts: 1846


« Reply #8 on: November 08, 2018, 11:12:16 AM »

In this thread

https://www.navitron.org.uk/forum/index.php/topic,30014.msg339940.html#msg339940

@Stig described using a Raspberry Pi heating controller based on this article

https://www.instructables.com/id/Raspberry-Pi-Home-Heating-Controller/

it's working rather well

Smiley

But I think @Stig has only the one temperature sensor, and whilst I'm starting to cogitate how I record temperature in every room I was rather put off by:

For each pi-heating-sensor you need :

Code:
Raspberry Pi Zero + SD card
Power supply
USB wifi dongle + micro usb adaptor
a 4.7kΩ resistor
1 or more 1-Wire Digital Thermometers ( DS18B20 )
10 pin GPIO connector ( 2 x 5 pin )

although in fairness given that I'm headed down the Arduino route, rather than the R-Pi, I'm not looking to emulate that.  I've got CAT5 to each room, so hoping to get away with just sticking a 1-wire sensor [plus maybe a resistor/capacitor] in each room and using the CAT5 for out-and-back (as @jonesy mentioned in this thread) so that everything is serial, but the overall length of the cable runs worries me

Maxim has an article Guidelines for Reliable Long Line 1-Wire Networks

"1-Wire networks that use Category 5e, twisted-pair copper wire and have 5V bus power supplied by the master"

Hmmm ... so maybe given that the wires will be out-and-back on the CAT5 then there is an opportunity to "boost" the 5V each time the wire comes back to base

I'm probably confusing 1-write parasitic use with external power supply mode; I have also read that a dedicated bus master helps - "Similar to UART/USART masters, they handle clocked operations natively with the use of a buffer, offloading the processing load from the host processor and increase accuracy. External pull-up resistors are also often not required." instead of "using IO (GPIO) pin, where manual toggle of the pin state is used to emulate a UART/USART with reconstruction of the signal from the received data. These are typically much less processor-efficient, and directly impact and are directly impacted by other processes on the processor shared with other system processes." - yup, about what I would expect.

Sorry, I only know enough about this sort of stuff to be dangerous!

That article also makes reference to "Switched Networks" where there are multiple limbs but only one is switched at any time, so none of the limbs exceeds the overall limit.  That looks promising - I'm only going to need to read the room temperature sensor infrequently - once a minute would probably be more than enough - so even if there is a power-up time requirement I don't think it will matter.



I also found this forum post useful.  This talks about 100M of CAT5 written by someone who knows way more than I do ... talks about appropriate use of twisted pairs, type of connectors use and capacitors, and so on.  A recipe for Doing It Right. The earlier part of the thread is folk discussing "I can't get a one metre cable working"

I also read that all temperature devices can be commanded simultaneously "issuing a 'Skip ROM' command (0xCC) followed by a convert T (0x44) would instruct all networked devices that have a Convert T command to perform a temperature conversion." but on a 1-wire configuration all the devices dropping power at the same time can lead to power starvation (I assume) and as such it may be better to command each sensor individually, and then interrogate its value. Given that I do not need frequent readings that's fine (and just a programming-job)

If an average room is 20' square then my CAT5 run is (round numbers) 6' from wall socket to ceiling and, lets say, 50' along the loft to get to the wiring hub location, and then 9' back down the wall to the wiring cupboard. So that's 20M each way, 40M round trip, and 100M overall max length for 1-wire (I think?) is not going to allow many of those in series.
« Last Edit: November 08, 2018, 11:14:39 AM by kristen » Logged
Stig
Sr. Member
****
Offline Offline

Posts: 426


« Reply #9 on: November 08, 2018, 11:51:58 AM »

In this thread

https://www.navitron.org.uk/forum/index.php/topic,30014.msg339940.html#msg339940

@Stig described using a Raspberry Pi heating controller based on this article

https://www.instructables.com/id/Raspberry-Pi-Home-Heating-Controller/

it's working rather well

Smiley

But I think @Stig has only the one temperature sensor, and whilst I'm starting to cogitate how I record temperature in every room I was rather put off by:

For each pi-heating-sensor you need :

Code:
Raspberry Pi Zero + SD card
Power supply
USB wifi dongle + micro usb adaptor
a 4.7kΩ resistor
1 or more 1-Wire Digital Thermometers ( DS18B20 )
10 pin GPIO connector ( 2 x 5 pin )

...

I've got the temperature sensor directly wired to the controller Pi rather than having another remote Pi as it's only a couple of metres away, I might wire in another for upstairs eventually.  That's courtesy of https://github.com/jonsag/pi-heating

I wouldn't worry much about the volt-drop on the 5V wire (funny how "1-wire" devices actually use 3 wires) but I guess really long wires would cause problems with achievable data rates - is the data rate fixed or is there a way to just run it all slower?  I've no experience with 1-wire stuff, sorry.
Logged
Countrypaul
Hero Member
*****
Offline Offline

Posts: 1257


« Reply #10 on: November 08, 2018, 02:57:51 PM »

With the Arduino you can actually have several one wire networks connected directly to the Uno. Depending on how many emp sensors you have/plan to have you may find that you could put each one onto a separate pin on the Arduino and have more reliability and less worres about cable lemgths etc.
Logged
kristen
Hero Member
*****
Offline Offline

Posts: 1846


« Reply #11 on: November 09, 2018, 06:33:39 AM »

With the Arduino you can actually have several one wire networks connected directly to the Uno. Depending on how many emp sensors you have/plan to have you may find that you could put each one onto a separate pin on the Arduino and have more reliability and less worres about cable lemgths etc.

Thanks. By the time I've put them in the Fridge and Freezer, and the shed etc., and up and down the thermal store and hot water tank, and on flow/return to solar thermal ... I reckon I might well have more than 50 sensors, maybe even be 75.

Having multiple Arduinos might well be acceptable - I have more than one wiring hub in the building. Looks like Arduino has 14 digital pins ?
Logged
Countrypaul
Hero Member
*****
Offline Offline

Posts: 1257


« Reply #12 on: November 09, 2018, 08:40:09 AM »

You may want to look at using some 1-wire hubs in that case as they can simplify the situation reduce reflections on the wires etc. Most hubs I have seen are 8 port, so allow 7 connections plus one to the host, they can also be nested so with 8 hubs you can get 49 1-wire networks, each of which can have mutiple sensors on of course. Just an option that might give you more flexibility and reduce teh number of Arduinos, power supplies etc that you might need.
Logged
kristen
Hero Member
*****
Offline Offline

Posts: 1846


« Reply #13 on: November 09, 2018, 11:38:01 AM »

You may want to look at using some 1-wire hubs

I like the sound of that, thanks.

What on earth did folk do before Internet/Forums ... must have spent an inordinate amount of time Faffing for a solution to lots of problems.

Put an elastic band around a can of paint (across top, down sides, across bottom) to wipe excess off the brush instead of getting it all over the can-rim, down the sides, and onto the carpet  Shocked . I'm a practical sort of person, but lots of tricks like that never occurred to me before YouTube ... Smiley

... maybe if I figured these things out by myself, using up all the time I spend fruitlessly on the internet, I'd be evens? Smiley
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.20 | SMF © 2013, Simple Machines
SMFAds for Free Forums
Simple Audio Video Embedder
Valid XHTML 1.0! Valid CSS!