gorstj
Posts: 25
Joined: Mon Mar 05, 2012 2:03 pm

Re: Wifi Internet Boiler

Fri Nov 16, 2012 8:30 pm

Also comparing your compiled version to my /uk/co/jayynne directory you have a 'class' file for every 'java' file. I only have a 'class' file for BoilerControl

fruitloaf
Posts: 84
Joined: Sun Feb 05, 2012 11:41 am

Re: Wifi Internet Boiler

Fri Nov 16, 2012 9:44 pm

I'm not sure if this will help but you can switch to one of the other java gpio libraries very easily and they might not have the hardfloat issues. The reason for using softfloat is that the Oracle java only works on softfloat and has much better performance than openjdk.

In BoostMonitor.java ControlBroker.java and LcdDisplay.java replace
GpioControlPi4J.getInstance() with GpioControlGpioJava.getInstance()

There should be 3 replaces in total - 1 in each file. Recompile and try again.

fruitloaf
Posts: 84
Joined: Sun Feb 05, 2012 11:41 am

Re: Wifi Internet Boiler

Fri Nov 16, 2012 9:48 pm

gorstj wrote:Also comparing your compiled version to my /uk/co/jayynne directory you have a 'class' file for every 'java' file. I only have a 'class' file for BoilerControl
The class files are the compiled java files. You're not getting the compiled files because you have permissions problems. Copy the java directory to your home directory and run sudo chown -R pi:pi /home/pi/java

Now try

Code: Select all

cd /home/pi/java
./compileandrun.sh uk/co/jaynne/BoilerControl
I'll try to test out a fresh install and write some better scripts tomorrow that won't have these issues.

gorstj
Posts: 25
Joined: Mon Mar 05, 2012 2:03 pm

Re: Wifi Internet Boiler

Sat Nov 17, 2012 8:25 am

Thanks for your help.

I will mostly be running boiler-control so I suppose I could use a soft-float OS. What distribution do you use?

I will try re-compiling with alternative GPIO later.

fruitloaf
Posts: 84
Joined: Sun Feb 05, 2012 11:41 am

Re: Wifi Internet Boiler

Sat Nov 17, 2012 8:54 am

I'm just using plain Debian give the other library a shot though as it might not have those issues.

gorstj
Posts: 25
Joined: Mon Mar 05, 2012 2:03 pm

Sat Nov 17, 2012 12:34 pm

I feel that I have mostly been taking from this project so far so thought I should contribute something back.

I see there have been people asking about 'combi' boilers and 'zerovolt' thermostat inputs.
I have success in controlling my boiler with a solid state relay driven by a transistor based circuit.
When the relay is closed it makes a connection at the thermostat input on the boiler therefore switching the heating on (I leave the timer on the boiler set on continuous). The hot water compnent of the boiler works on demand as one would expect with a combi boiler.

Here are some links to parts I have used, I have no affiliation this is just what worked for me:

Solid state relay (remember to use a transistor based circuit, dont drive directly from a GPIO output or you will break your PI!) http://www.ebay.co.uk/itm/180946239323? ... 1497.l2649
(I am not sure whether it is safer to have the solid state relay inside my project enclosure with 13A flex going from the SSR to the thermostat input, or have breadboard cable coming from the project enclosure to the SSR inside the boiler housing with a small length of 13A flex..... I am going for the former at the moment)

Transistor circuit (remember to change the GPIO pin to the one used in Boiler-Controller): http://www.susa.net/wordpress/2012/06/r ... sing-gpio/

I used a transistor from Maplins as rather than 2N3904 transistor from Maplins as they didnt stock the one reccomended above: http://www.maplin.co.uk/low-power-lf-np ... case-32952

Just need to get Boiler-Controller working and make a case!

gorstj
Posts: 25
Joined: Mon Mar 05, 2012 2:03 pm

Re: Wifi Internet Boiler

Sat Nov 17, 2012 1:11 pm

fruitloaf wrote:I'm not sure if this will help but you can switch to one of the other java gpio libraries very easily and they might not have the hardfloat issues. The reason for using softfloat is that the Oracle java only works on softfloat and has much better performance than openjdk.

In BoostMonitor.java ControlBroker.java and LcdDisplay.java replace
GpioControlPi4J.getInstance() with GpioControlGpioJava.getInstance()

There should be 3 replaces in total - 1 in each file. Recompile and try again.
Tried the above but it failed. I changed import uk.co.jaynne.gpio.GpioControlPi4J to import uk.co.jaynne.gpio.GpioControlGpioJava in the first few lines - is this correct?

It now compiles without errors..... but when it is ran:

Code: Select all

[email protected] ~/java $ sudo ./run.sh uk/co/jaynne/BoilerControl
Exception in thread "main" java.lang.ExceptionInInitializerError
	at uk.co.jaynne.ControlBroker.getInstance(ControlBroker.java:38)
	at uk.co.jaynne.Scheduler.<init>(Scheduler.java:11)
	at uk.co.jaynne.BoilerControl.main(BoilerControl.java:18)
Caused by: java.lang.NullPointerException
	at be.doubleyouit.raspberry.gpio.AbstractGpioGateway.validatePinHasGpioChannel(AbstractGpioGateway.java:105)
	at be.doubleyouit.raspberry.gpio.AbstractGpioGateway.setValue(AbstractGpioGateway.java:91)
	at uk.co.jaynne.gpio.GpioControlGpioJava.setValue(GpioControlGpioJava.java:73)
	at uk.co.jaynne.ControlBroker.deactivateHeating(ControlBroker.java:75)
	at uk.co.jaynne.ControlBroker.<init>(ControlBroker.java:29)
	at uk.co.jaynne.ControlBroker.<init>(ControlBroker.java:12)
	at uk.co.jaynne.ControlBroker$SingletonHolder.<clinit>(ControlBroker.java:34)
	... 3 more
I also tried compiling against Pi4J SNAPSHOT 0.0.3 but with no joy (I changed 0.0.2 to 0.0.3 in compileandrun.sh and downloaded the updated SNAPSHOT 0.0.3 to /lib)

Code: Select all

[email protected] ~/java $ sudo ./compileandrun.sh uk/co/jaynne/BoilerControl
Compiling
/home/pi/java/uk/co/jaynne/gpio/GpioControlPi4J.java:9: error: cannot find symbol
import com.pi4j.io.gpio.event.GpioListener;
                             ^
  symbol:   class GpioListener
  location: package com.pi4j.io.gpio.event
/home/pi/java/uk/co/jaynne/gpio/GpioControlPi4J.java:123: error: cannot find symbol
	public void addListener(GpioPin pin, GpioListener listener) {
	                                     ^
  symbol:   class GpioListener
  location: class GpioControlPi4J
/home/pi/java/uk/co/jaynne/gpio/GpioControlPi4J.java:48: error: cannot find symbol
		com.pi4j.io.gpio.GpioPin outpin = gpio.provisionOuputPin(translatedPin, pin.toString() , outDefaultState);
		                                      ^
  symbol:   method provisionOuputPin(Pin,String,PinState)
  location: variable gpio of type GpioController
/home/pi/java/uk/co/jaynne/gpio/GpioControlPi4J.java:63: error: cannot find symbol
		com.pi4j.io.gpio.GpioPin outpin = gpio.provisionInputPin(translatedPin, pin.toString());
		                                      ^
  symbol:   method provisionInputPin(Pin,String)
  location: variable gpio of type GpioController
/home/pi/java/uk/co/jaynne/gpio/GpioControlPi4J.java:78: error: cannot find symbol
			outpins.get(pin).high();
			                ^
  symbol:   method high()
  location: interface GpioPin
/home/pi/java/uk/co/jaynne/gpio/GpioControlPi4J.java:80: error: cannot find symbol
			outpins.get(pin).low();
			                ^
  symbol:   method low()
  location: interface GpioPin
/home/pi/java/uk/co/jaynne/gpio/GpioControlPi4J.java:94: error: cannot find symbol
		PinState state = inpins.get(pin).getState();
		                                ^
  symbol:   method getState()
  location: interface GpioPin
/home/pi/java/uk/co/jaynne/gpio/GpioControlPi4J.java:138: error: cannot find symbol
		inpins.get(pin).removeAllListeners();
		               ^
  symbol:   method removeAllListeners()
  location: interface GpioPin
/home/pi/java/uk/co/jaynne/gpio/GpioControlPi4J.java:148: error: cannot find symbol
			case PIN3_GPIO0: return Pin.GPIO_08;
			                           ^
  symbol:   variable GPIO_08
  location: interface Pin
/home/pi/java/uk/co/jaynne/gpio/GpioControlPi4J.java:149: error: cannot find symbol
			case PIN5_GPIO1: return Pin.GPIO_09;
			                           ^
  symbol:   variable GPIO_09
  location: interface Pin
/home/pi/java/uk/co/jaynne/gpio/GpioControlPi4J.java:150: error: cannot find symbol
			case PIN7_GPIO4: return Pin.GPIO_09;
			                           ^
  symbol:   variable GPIO_09
  location: interface Pin
/home/pi/java/uk/co/jaynne/gpio/GpioControlPi4J.java:151: error: cannot find symbol
			case PIN8_GPIO14: return Pin.GPIO_15;
			                            ^
  symbol:   variable GPIO_15
  location: interface Pin
/home/pi/java/uk/co/jaynne/gpio/GpioControlPi4J.java:152: error: cannot find symbol
			case PIN10_GPIO15: return Pin.GPIO_16;
			                             ^
  symbol:   variable GPIO_16
  location: interface Pin
/home/pi/java/uk/co/jaynne/gpio/GpioControlPi4J.java:153: error: cannot find symbol
			case PIN11_GPIO17: return Pin.GPIO_00;
			                             ^
  symbol:   variable GPIO_00
  location: interface Pin
/home/pi/java/uk/co/jaynne/gpio/GpioControlPi4J.java:154: error: cannot find symbol
			case PIN12_GPIO18: return Pin.GPIO_01;
			                             ^
  symbol:   variable GPIO_01
  location: interface Pin
/home/pi/java/uk/co/jaynne/gpio/GpioControlPi4J.java:155: error: cannot find symbol
			case PIN13_GPIO21: return Pin.GPIO_02;
			                             ^
  symbol:   variable GPIO_02
  location: interface Pin
/home/pi/java/uk/co/jaynne/gpio/GpioControlPi4J.java:156: error: cannot find symbol
			case PIN15_GPIO22: return Pin.GPIO_03;
			                             ^
  symbol:   variable GPIO_03
  location: interface Pin
/home/pi/java/uk/co/jaynne/gpio/GpioControlPi4J.java:157: error: cannot find symbol
			case PIN16_GPIO23: return Pin.GPIO_04;
			                             ^
  symbol:   variable GPIO_04
  location: interface Pin
/home/pi/java/uk/co/jaynne/gpio/GpioControlPi4J.java:158: error: cannot find symbol
			case PIN18_GPIO24: return Pin.GPIO_05;
			                             ^
  symbol:   variable GPIO_05
  location: interface Pin
/home/pi/java/uk/co/jaynne/gpio/GpioControlPi4J.java:159: error: cannot find symbol
			case PIN19_GPIO10: return Pin.GPIO_12;
			                             ^
  symbol:   variable GPIO_12
  location: interface Pin
/home/pi/java/uk/co/jaynne/gpio/GpioControlPi4J.java:160: error: cannot find symbol
			case PIN21_GPIO9: return Pin.GPIO_13;
			                            ^
  symbol:   variable GPIO_13
  location: interface Pin
/home/pi/java/uk/co/jaynne/gpio/GpioControlPi4J.java:161: error: cannot find symbol
			case PIN22_GPIO25: return Pin.GPIO_06;
			                             ^
  symbol:   variable GPIO_06
  location: interface Pin
/home/pi/java/uk/co/jaynne/gpio/GpioControlPi4J.java:162: error: cannot find symbol
			case PIN23_GPIO11: return Pin.GPIO_04;
			                             ^
  symbol:   variable GPIO_04
  location: interface Pin
/home/pi/java/uk/co/jaynne/gpio/GpioControlPi4J.java:163: error: cannot find symbol
			case PIN24_GPIO8: return Pin.GPIO_10;
			                            ^
  symbol:   variable GPIO_10
  location: interface Pin
/home/pi/java/uk/co/jaynne/gpio/GpioControlPi4J.java:164: error: cannot find symbol
			case PIN26_GPIO7: return Pin.GPIO_11;
			                            ^
  symbol:   variable GPIO_11
  location: interface Pin
25 errors
Done, running
Error: Could not find or load main class uk.co.jaynne.BoilerControl

gorstj
Posts: 25
Joined: Mon Mar 05, 2012 2:03 pm

Re: Wifi Internet Boiler

Sun Nov 18, 2012 11:24 am

Some sort of success!

I downloaded https://github.com/downloads/Pi4J/pi4j/ ... APSHOT.jar into my java/lib directory replacing your copy of the same file (is your version old/corrupt?)

I then get which looks a lot more promising!
(N.b. I havent set up mysql etc yet so these errors could be related to that)

Code: Select all

[email protected] ~/java $ sudo ./run.sh uk/co/jaynne/BoilerControl
Nov 18, 2012 11:21:16 AM com.pi4j.util.NativeLibraryLoader load
INFO: Library [pi4j] loaded successfully using embedded resource file: [jar:file:/home/pi/java/libs/pi4j-core-0.0.2-SNAPSHOT.jar.1!/lib/hard-float/libpi4j.so]
WARNING: wiringPi: Unable to determine board revision from "0"
 -> You may want to check:
 -> http://www.raspberrypi.org/phpBB3/viewtopic.php?p=184410#p184410
 -> Assuming a Rev 1 board
**HEATING OFF, BRR**
**WATER OFF, BETTER BE CLEAN ALREADY**
Press q to exit
No schedules today
Exception in thread "Thread-11" java.lang.NullPointerException
	at uk.co.jaynne.ConfigBoostMonitor.run(ConfigBoostMonitor.java:28)
	at java.lang.Thread.run(Thread.java:722)
Exception in thread "Thread-9" java.lang.NullPointerException
	at uk.co.jaynne.ConfigBoostMonitor.run(ConfigBoostMonitor.java:28)
	at java.lang.Thread.run(Thread.java:722)
Exception in thread "Thread-5" java.lang.NullPointerException
	at uk.co.jaynne.ControlBroker.isHolidayPeriod(ControlBroker.java:118)
	at uk.co.jaynne.ControlBroker.toggleWaterBoostStatus(ControlBroker.java:128)
	at uk.co.jaynne.BoostMonitor.run(BoostMonitor.java:33)
	at java.lang.Thread.run(Thread.java:722)
Exception in thread "Thread-3" java.lang.NullPointerException
	at uk.co.jaynne.ControlBroker.isHeatingOn(ControlBroker.java:209)
	at uk.co.jaynne.ControlBroker.turnHeatingOff(ControlBroker.java:65)
	at uk.co.jaynne.Scheduler.run(Scheduler.java:64)
	at java.lang.Thread.run(Thread.java:722)
Exception in thread "Thread-13" java.lang.NullPointerException
	at uk.co.jaynne.ControlBroker.isHeatingOn(ControlBroker.java:209)
	at uk.co.jaynne.LcdOutput.run(LcdOutput.java:23)
	at java.lang.Thread.run(Thread.java:722)

gorstj
Posts: 25
Joined: Mon Mar 05, 2012 2:03 pm

Re: Wifi Internet Boiler

Sun Nov 18, 2012 9:24 pm

Now trying to get the php/apache config together.

I have setup my database with name pi, username pi and password raspberry (user has full access to everything, I have double checked my user/passwordseveral times)

When I open http://raspberrypi/ I get a page which has 'holidays' 'schedules' 'groups' in top right.
However I get the error message:

Code: Select all

Error
There was an error processing your request:
Access denied for user 'pi'@'localhost' (using password: YES)
There is nothing in any of my MYSQL logs.

In Apache error.log (I cant see any file/directory called api on the github site)

Code: Select all

[Sun Nov 18 21:19:44 2012] [error] [client 192.168.69.2] File does not exist: /var/www/public/api, referer: http://raspberrypi/
In Apache access.log

Code: Select all

192.168.69.2 - - [18/Nov/2012:21:14:52 +0000] "GET / HTTP/1.1" 200 1107 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11"
192.168.69.2 - - [18/Nov/2012:21:14:53 +0000] "GET /css/main.css HTTP/1.1" 304 210 "http://raspberrypi/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.1$
192.168.69.2 - - [18/Nov/2012:21:14:53 +0000] "GET /js/jquery-ui-1.8.23.custom.min.js HTTP/1.1" 304 212 "http://raspberrypi/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0$
192.168.69.2 - - [18/Nov/2012:21:14:53 +0000] "GET /js/jquery-1.8.0.min.js HTTP/1.1" 304 212 "http://raspberrypi/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Sa$
192.168.69.2 - - [18/Nov/2012:21:14:53 +0000] "GET /js/jtable/themes/lightcolor/orange/jtable.css HTTP/1.1" 304 210 "http://raspberrypi/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML, like Gecko)$
192.168.69.2 - - [18/Nov/2012:21:14:53 +0000] "GET /js/jquery-ui/css/ui-lightness/jquery-ui-1.8.23.custom.css HTTP/1.1" 304 211 "http://raspberrypi/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML,$
192.168.69.2 - - [18/Nov/2012:21:14:53 +0000] "GET /css/reset.css HTTP/1.1" 304 209 "http://raspberrypi/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.$
192.168.69.2 - - [18/Nov/2012:21:14:53 +0000] "GET /js/checkStatus.js HTTP/1.1" 304 209 "http://raspberrypi/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/$
192.168.69.2 - - [18/Nov/2012:21:14:53 +0000] "GET /js/clock.js HTTP/1.1" 304 209 "http://raspberrypi/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11"
192.168.69.2 - - [18/Nov/2012:21:14:53 +0000] "GET /js/jtable/jquery.jtable.min.js HTTP/1.1" 304 210 "http://raspberrypi/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.12$
192.168.69.2 - - [18/Nov/2012:21:14:53 +0000] "GET /js/jtable/themes/lightcolor/jtable_lightcolor_base.css HTTP/1.1" 304 210 "http://raspberrypi/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML, li$
192.168.69.2 - - [18/Nov/2012:21:14:54 +0000] "GET /api/configuration/status/ HTTP/1.1" 404 509 "http://raspberrypi/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64$

fruitloaf
Posts: 84
Joined: Sun Feb 05, 2012 11:41 am

Re: Wifi Internet Boiler

Tue Nov 20, 2012 11:06 am

Sorry it's taken me longer than I thought to get some instructions up as I was too busy on the weekend to complete them and I couldn't find a spare SD card for my Pi.

The instructions to install from a fresh install of debian squeezy softfloat are up at https://github.com/james-jaynne/boiler-control-php

I'm just updating the java instructions now

fruitloaf
Posts: 84
Joined: Sun Feb 05, 2012 11:41 am

Re: Wifi Internet Boiler

Tue Nov 20, 2012 3:41 pm

Java instructions updated - let me know how you get on with these
https://github.com/james-jaynne/boiler-control

fruitloaf
Posts: 84
Joined: Sun Feb 05, 2012 11:41 am

Re: Wifi Internet Boiler

Tue Nov 20, 2012 4:50 pm

gorstj wrote:Now trying to get the php/apache config together.

I have setup my database with name pi, username pi and password raspberry (user has full access to everything, I have double checked my user/passwordseveral times)

If you follow the new install instructions that I've put up you should be golden. Specifically it looks like you don't have mod_rewrite installed for apache and enabled in the apache config. If you are sure you have the database setup correctly then you can start the instructions at the point you download the source from github.

fruitloaf
Posts: 84
Joined: Sun Feb 05, 2012 11:41 am

Re: Wifi Internet Boiler

Mon Dec 10, 2012 10:24 am

Just to let you know that I've posted an update for the web part of this that gives a better experience on mobile browsers. It shouldn't be zoomed out by default and the on/off button is more touch friendly.

The update is pretty simple - download a copy of the latest from github, replace the public directory and in the application directory everything except the config directory.

gorstj
Posts: 25
Joined: Mon Mar 05, 2012 2:03 pm

Re: Wifi Internet Boiler

Tue Dec 11, 2012 8:15 am

Thanks - I am sure this will be useful.

I cant seem to find the update on github. The last update seems to be 21 days ago and the CSS files were last updated several months ago. Are you sure you have uploaded the update?

Thanks

fruitloaf
Posts: 84
Joined: Sun Feb 05, 2012 11:41 am

Re: Wifi Internet Boiler

Tue Dec 11, 2012 9:40 am

gorstj wrote:Thanks - I am sure this will be useful.

I cant seem to find the update on github. The last update seems to be 21 days ago and the CSS files were last updated several months ago. Are you sure you have uploaded the update?

Thanks
Doh you're right - it was committed locally but not pushed to git - it's there now.

gulliverrr
Posts: 38
Joined: Wed Jan 02, 2013 1:38 pm

Re: Wifi Internet Boiler

Wed Jan 02, 2013 2:41 pm

First of all congrats for making such a great effort to document all your work. I find it the most boring part after I finish hacking away but as gorstj feels, its not fair to the rest of the community who always help... so, here is my input.

***SOFTWARE & CONFIGURATION***
I tried the install instructions for the php part (webserver and interface) from here:

Code: Select all

https://github.com/james-jaynne/boiler-control-php
and it worked straight away!

I tried the java installation and compilation from here:

Code: Select all

https://github.com/james-jaynne/boiler-control
and I have a few comments:
1. Oracles JDK (http://www.oracle.com/technetwork/java/ ... 59576.html) worked on both (latest) soft float anf hard float raspbians so if you dont have something old, dont worry about it at all, just follow the instructions (adding my below corrections)!
2. Command:
sudo mv boiler-control-master/scripts/boilercontrol/init.d/* /etc/init.d/
should be:

Code: Select all

sudo mv boiler-control-master/scripts/init.d/boilercontrol /etc/init.d/
3. Before compiling add this command too

Code: Select all

sudo mv /boiler-control-master/src/* /opt/boilercontrol/
so that directory uk is in /opt/boilercontrol/

I think these were my changes. Everything else worked fine!

***HARDWARE***

LCD: You can follow Adafruit's instructions (they were great!)

Code: Select all

http://learn.adafruit.com/drive-a-16x2-lcd-directly-with-a-raspberry-pi/overview
but the wiring used in this post are different and can be found here:

Code: Select all

/boiler-control-master/src/uk/co/jaynne/lcd/LcdDisplay.java
and pasted below
RS = GpioPin.PIN24_GPIO8;
E = GpioPin.PIN22_GPIO25;
D4 = GpioPin.PIN19_GPIO10;
D5 = GpioPin.PIN16_GPIO23;
D6 = GpioPin.PIN13_GPIO21;
D7 = GpioPin.PIN12_GPIO18;

Mind the labeling of the RasPi pinout! PIN numbers all the pin header contacts in order from 1 to 26 and GPIO is the actual hardware label. Be carefull!
The LCD pinout can be found from adafruits instructions

Code: Select all

http://learn.adafruit.com/system/assets/assets/000/001/757/medium800/Untitled.png?1345326108
Image

After following all the above steps and changes, I now get an LCD working and LED's (in GPIO14 and 15) instead of relays yet for testing until I move to the real thing!

My ToDo list:
* Add buttons: I'm not sure how I need to connect GND, 3.3V and the Boost buttons from GPIO24 and GPIO7. I'm also not sure how the buttons work either (need to check the code). Are they momentary switches (they dont hold a state on or off) that initiate the boost and if yes is the boost permanent until a schedule changes it or is it for x minutes? I would like the latter and be able to specify this x according to my boiler
* Add another transistor/relay to control the backlight of the screen to turn it on on the first keypress and turn it off y seconds after I stop pressing buttons...

will be posting my updates here...
thanks again everybody!

gulliverrr
Posts: 38
Joined: Wed Jan 02, 2013 1:38 pm

Re: Wifi Internet Boiler

Wed Jan 02, 2013 6:29 pm

I NOW HAVE A FULLY WORKING BOILER CONTROLLER!
I was going crazy as my boost buttons appeared to be getting pressed continuously and the LEDs I had instead of the relays for the time being were going on and off every few seconds.
I thought it was a problem (as I said before in my ToDo list) of the wiring and the inputs were not tied properly to GND or HIGH (3.3V). So I started checking the code and found that line 31 from:
uk/co/jaynne/BoostMonitor.java

Code: Select all

...
if (!status) {
...
means the inputs are normal HIGH. That means when you dont press any buttons the 2 input pins should have some voltage applied to them. I assume that this should be the +3.3V from pin 1 so I followed this (upper schematic)
Image
from:
http://www.cl.cam.ac.uk/~db434/raspi/bu ... _switches/
But I got no results! :(

So I changed the above code to this:

Code: Select all

...
if (status) {
...
(change !status to status)

but now used the lower schematic from the previous image and it worked perfectly.
I may have done something stupid with the wiring before, but I swear I couldn't make it work with the normal HIGH option and personally I prefer the normal LOW.
btw (answering to my previous questions :)) the boost buttons turn manually ON the respective function until a schedule kicks in. I may change this to turn ON but start a timer to turn it OFF after some time. This may not be very useful for the heating but it is (at least for me) for the hot water. If I want to shower and I only need it to turn on for say 20 minutes why leave it ON until the next scheduled OFF? As I said the heating may be a totally different case so I may modify it partially to affect only hot water...

will update

gulliverrr
Posts: 38
Joined: Wed Jan 02, 2013 1:38 pm

Re: Wifi Internet Boiler

Thu Jan 03, 2013 7:03 am

carry on replying to my own questions... :)
Boost feature already worked as I wanted it. It does set a timer but is "hardcoded" in the SQL to 60 minutes.
I modified the code so that the Water Boost button starts adding 10s of minutes up to 60 where it resets back to 0 (and you can repeat cycling to 10, 20, etc). Additionally it shows the boost countdown on the display so that you can check how long you have to wait! I quite fancy adding a little buzzer to let me know when the time is up but I still need to tidy up my code here and there.
Working on the LCD backlight timeout I mentioned before...

fruitloaf
Posts: 84
Joined: Sun Feb 05, 2012 11:41 am

Re: Wifi Internet Boiler

Thu Jan 03, 2013 2:20 pm

Nice work - I'll try and get those bugs in the install fixed. Additionally I should move the "on" setting of the buttons to the configuration database rather than it being hardcoded. I'm no electronics expert but apparently its better to be default high.

I have been meaning to change the interface so when boosting you get an option of how long you want it set for rather than the default of an hour. If you've managed to do that yourself you can push your changes along with the LCD ones to git and I can merge them.

I've not really worried about the LCD display too much myself as I found it hard to fit much info on a 16x2 screen and my controls are at the back of a cupboard so I rarely see them.

I'm hoping to soon make a few changes to speed up the program by switching to mysqllite and having the php program connect to the java one via sockets which should save a good amount of memory.

gulliverrr
Posts: 38
Joined: Wed Jan 02, 2013 1:38 pm

Re: Wifi Internet Boiler

Thu Jan 03, 2013 3:25 pm

You are right about the space on the screen. I have actually removed the "heating" feature as my house has two isolated systems for hot water (electrical) and heating (gas) which are quite apart and I dont plan to integrate (aka wire) heating just yet so I used the freed up space of heating info on the screen for the countdown. Keep in mind that the web interface is still untouched and I plan to keep it that way so the boost time is not configurable there too but read from the database but each time you use the hard button for boost the selected period is stored in the database so next time you boost from the web you get this value. Just thought that I could read this value from the db for the first hard button press so the initial value was the previous value and then you would rarely need to change it! This usually applies between Summer and Winter...

So ignoring the LCD space issue, my logic is the following (see code).
Also keep in mind that the modifications are only done for the hot water so if anybody needs something for heating too they need to adjust the code.
BoostMonitor.java:

Code: Select all

...
while (!Thread.interrupted()) {
  boolean status = gpio.getValue(pin);
  try {
  if (status)
  {
    lastKeyPress = Calendar.getInstance().getTimeInMillis();
    WaterBoostPeriodMinutes = WaterBoostPeriodMinutes + 10;
    if (WaterBoostPeriodMinutes > 60)
    {
      WaterBoostPeriodMinutes = 0;
    }
    Thread.sleep(200); //sleep to ignore multiple presses
  }
  
  Thread.sleep(20);
  } catch (InterruptedException e) {
    break;
  }
  //wait 3 seconds before calling boost to allow user decide the boost period
  if ((lastKeyPress > 0) &&  (Calendar.getInstance().getTimeInMillis() > lastKeyPress + 3000))
  {
    lastKeyPress = 0;
    //System.out.println("Timeout! Calling Toggle fct...");
    //storing it in db for web use
    config.set("boostTime", WaterBoostPeriodMinutes);
    WaterBoostPeriodMinutes = 0;
    if (water) {
      control.toggleWaterBoostStatus();
    }
    if (heating) {
      control.toggleHeatingBoostStatus();
    }
 }
...
in the LcdOutputJava.java I modified the code around line 38 to show the countdown (and hide the heating info) like this:

Code: Select all

...
config = new ConfigSqlSource();
line2 = "Boost: ";
if (wBoost)
{
  long iremainingWBoost = (config.get("waterBoostOffTime").getLongValue()-Calendar.getInstance().getTimeInMillis())/60000;
  if (iremainingWBoost < 0)
  {
    iremainingWBoost = 0; //sometimes it momentarily showed negative values so I reset to 0
  }
  line2 += String.valueOf(iremainingWBoost) + " min"; //thats during countdown
}
else
{
if (BoostMonitor.WaterBoostPeriodMinutes > 0)
{
  line2 +=  BoostMonitor.WaterBoostPeriodMinutes + " min"; //thats during setting up desired period
}
else
{
  line2 += "OFF";
}
}...
as you can see I've messed up your code quite a bit so I find disastrous for all your work to merge this into yours. Obviously I'm more than happy to do so if you are happy with that too or maybe I can just post the files here for any individuals to adapt if they want to...

gorstj
Posts: 25
Joined: Mon Mar 05, 2012 2:03 pm

Re: Wifi Internet Boiler

Sun Jan 13, 2013 8:11 pm

Anyone had issues with the LCD displaying garbage after a couple of hours?

Mine is very consistent in displaying garbage after a little while. No errors are displayed in the command line (if run on the command line rather than a service). The display returns to normal on restarting the boilercontrol service.

There are just random characters on the top line. Every 10 seconds (how fast I have set the lcd to update) the last couple of characters change.

The program still works fine. The button inputs, relay output and control via the web interface are unaffected.

Any ideas?

fruitloaf
Posts: 84
Joined: Sun Feb 05, 2012 11:41 am

Re: Wifi Internet Boiler

Sun Jan 13, 2013 9:28 pm

gorstj wrote:Anyone had issues with the LCD displaying garbage after a couple of hours?

Mine is very consistent in displaying garbage after a little while. No errors are displayed in the command line (if run on the command line rather than a service). The display returns to normal on restarting the boilercontrol service.

There are just random characters on the top line. Every 10 seconds (how fast I have set the lcd to update) the last couple of characters change.

The program still works fine. The button inputs, relay output and control via the web interface are unaffected.

Any ideas?
I have that but I assumed it was just my display - I'll try and play with some of the timings and see if that helps. Unfortunately I don't know much about these displays so I don't know what could be causing it.

Multipi
Posts: 1
Joined: Sun Jan 13, 2013 10:13 pm

Re: Wifi Internet Boiler

Sun Jan 13, 2013 10:41 pm

I have a 1602 LCD connected to an arduino, it's displaying time powered up and has a user defined character that moves along the top line, after a while the character gets corrupted, not noticed how long this takes and whether it only appears in one of the positions.

gorstj wrote:Anyone had issues with the LCD displaying garbage after a couple of hours?

Mine is very consistent in displaying garbage after a little while. No errors are displayed in the command line (if run on the command line rather than a service). The display returns to normal on restarting the boilercontrol service.

There are just random characters on the top line. Every 10 seconds (how fast I have set the lcd to update) the last couple of characters change.

The program still works fine. The button inputs, relay output and control via the web interface are unaffected.

Any ideas?

fruitloaf
Posts: 84
Joined: Sun Feb 05, 2012 11:41 am

Re: Wifi Internet Boiler

Wed Jan 16, 2013 10:33 pm

I've uploaded a few significant changes to both the php and java side. The changelog is below. For now the changes are all in the sockets branch rather than the master so if you would like to upgrade check that out.

changelog
==============
v1.1
-changed communication between php and java to mostly use sockets rather than the database
-boosting boiler now instantly shows it is on/off
-removed many database calls from java and php side - should reduce CPU load
-now shows heating/water state and boost state separately
-boost time remaining now shown
-moved pins configuration to database, create entry in configuration table with key pinsHigh and the value
true (high) or false (low) when pressed
v1.0
-release

TODO
-frontend work to allow choice of boost length
-make sure all configuration options are in the database

gulliverrr
Posts: 38
Joined: Wed Jan 02, 2013 1:38 pm

Re: Wifi Internet Boiler

Wed Jan 30, 2013 11:26 pm

I had the same problem with the random chars and I thought it was just me though :) This happened with the previous code version. I haven't tried the new one yet. Will do in a bit.
I really dont think its the hardware of the display though. I believe something happens with java while trying to write the text on it. I think I saw some crash/error logs of java somewhere while I was doing something else, didnt pay enough attention and then I couldn't remember where the file was to have a look... trying to find where java write stores its logs but I cant :(

Will update if I find anything, and if not, if I still have in on the new version...

Return to “Automation, sensing and robotics”