Go Down

Topic: Programming Reqd - on/off heating control for partially sighted elderly (Read 435 times) previous topic - next topic

YorkshireDave

Hi. I'm looking for help to do this please. We'll happily pay.
It's all for my 95 year old partially sighted, and rather forgetful these days, father-in-law.

My concept is this.

A standalone box with two momentary buttons (one backlit blue & one backlit red) a speaker a temperature sensor & a relay

It would work thus:
- continually monitors temp sensor
- when the temp is 'low', boiler relay would energise as being 'called for' and the red LED would be 'on'
- when boiler NOT being 'called for' relay would be off and red LED would be off
- press any button. Get a 'welcome chime' and the current space temp read out e.g. "Bing bong, it is twenty one point five degrees"
- at 'welcome chime' both LEDS (red & blue) would start flashing and a voice would say, "To raise the temperature press the red button, to lower the temperature press the blue button"
- when either button is pressed the set point is moved up/down by 0.5 degrees centigrade and the new set point temp is read out. If the button is pressed quickly, the current announcement is curtailed and the new value read out.
- after 5 seconds of no further presses it announces, "The new set point is XX.X)
- after a further 5 seconds the flashing buttons go back to either solid or off (i.e. stand by mode)

I already have an Arduino Mega which I was hoping to use. I have the DF Mini in mind for storing the wav (or whatever files) to be read out. Currently no idea about suitable temp sensor although I do realise it will need some hysterisis (so, come on at 0.5 degs below set point and go off at 0.5 above set point)

I'd like this to be available as an open project once completed so other elderly people can benefit from it  :) 

PaulS

Quote
Currently no idea about suitable temp sensor although I do realise it will need some hysterisis
Hysteresis is a function of the code, not of the temperature sensor. What range of temperatures do you plan to measure?

"Speaking" the temperature is not going to be all that easy. And, it may sound quite stilted.
The art of getting good answers lies in asking good questions.

patduino

You may want to consider arranging the buttons vertically so the "increase" temp button is above the "lower" temp button, and not rely on your father-in-law (or future clients) seeing and distinguishing between different colors.

Pat.
There are 10 types of people in the world, those who understand binary, and those that don't.

PaulMurrayCbr

Hmm. So, you'll be looking at one of those MP3 boards.

Code-wise, reasonably straightforward. Two objects: the boiler control and the button/setpoint thing. You possibly don't need another LED for the boiler on thing. Turn the blue led on of the boiler is off, the red led on if the boiler is on. when the temp is being adjusted, if the boiler temp is lower than the new setpoint (and so the boiler is currently on), flash the blue button to indicte "press here to lower the setpoint".

http://paulmurraycbr.github.io/ArduinoTheOOWay.html

YorkshireDave

Thank you guys. Just realised I never had notifications turned on!! Not a good start  :o

Paul. Having physically tested the concept with him, including the two different lights he actually gets it and it stuck!! So, if possible I 'd like to stick with that. I get where you are coming from completely and for lots of people you would be right.
However for Ken, our objective is also to give him feedback so that, e.g. if he's feeling chilly and wanders along to the buttons, he can see that the boiler is already firing (red light on) so there is no need to alter things 'yet'. Hope that makes sense?

Pat. Yes we will. Thank you. It reinforces the raise / lower difference

Paul. I realise where the hysteresis is but obviously didn't make myself clear. Apologies. The temp would be -5 to say +35. On most sensors designed for domestic ambient use this normally the straightest part of the curve. Was thinking a TMP36? Could I connect that directly ? With regards the voice output, I was hoping to play a wav file. Apparently there's some form something Mini on FleaBay that plays wav files from a microsd card. So long as its reproduced reasonably it will be fine. His hearing's the only thing not failing bless him.

jarnoldbrown

Why not use a Dallas DS18B20 or a DHT22/11 ?
There are libraries for both, and they give you the temperature without any curves being involved.

PaulMurrayCbr

Paul. Having physically tested the concept with him, including the two different lights he actually gets it and it stuck!! So, if possible I 'd like to stick with that.
Ok, cool. Or warm, as the case may be.

Paul. I realise where the hysteresis is but obviously didn't make myself clear. Apologies. The temp would be -5 to say +35. On most sensors designed for domestic ambient use this normally the straightest part of the curve. Was thinking a TMP36? Could I connect that directly ? With regards the voice output, I was hoping to play a wav file. Apparently there's some form something Mini on FleaBay that plays wav files from a microsd card. So long as its reproduced reasonably it will be fine. His hearing's the only thing not failing bless him.
With respect to programming, I could certainly do you up a framework sketch for what you are going to need. This actually is often the tricky bit - the logic of the flow of control. Making the buttons flash and whatnot.

 I'd write a function 'getCurrentTemperatureC" (I assume you are using centigrade) which just reads an analog input and test it with a pot on the pin. You'd have to rewrite it to correctly work out the temp from whatever hardware you decide to use.

Likewise, for the voice output I'd write a stub class that prints (slowly) to Serial. The stub class would implement an interface:

Code: [Select]


class Messages {
  virtual void sayWelcomeMessage(float n); // "the temperature is now X degrees"
  virtual void sayAdjustingMessage(float n); // probably just the bare number
  virtual void sayNewSetpointMessage(float n); // "the setpoint is now X. We hope you have enjoyed using this thermostat!"
  virtual void cancelSpeaking(); // each 'say' method calls this anyway, but we'll expose it here
}



Once you have your hardware, you'd have to implement your own class to play the appropriate wav files.

I mean, it seems like I haven't done much … but it's that top boring layer of the overall flow of an app that people get tangled up in.

Since this is for an old fella and it's not going to be a complete sketch, I'd just do it for free. Big COMMENTS IN UPPER-CASE to indicate the code you are going to need to replace.

Would you like to proceed with this?
http://paulmurraycbr.github.io/ArduinoTheOOWay.html

YorkshireDave

Paul. That's very very kind of you :-) Thank you.

Got to dash to work now but will be back on later. Many questions? ;-)

YorkshireDave

Paul

Yeh now I know what a sketch is!!

How do I upload a PDF? Ive done an outline of the control as I saw it. Hoping it may help!!

I have a Arduino Mega and I can order the sound shield if that thes best thing to do.

Yes please Paul :-)

PaulMurrayCbr

Yeh now I know what a sketch is!!
That's … not a good sign. I am not going to be able to make your sound card (or whatever you are using) work without your actual hardware. You are going to have to do some coding to make that stuff go.

All I'm proposing to do is stick a potentimeter (to simulate the temperature), two buttons, and three LEDs into a breadboard and get the logic going. We don;t need three outputs, of course, because the output to your furnace relay module also drives the "furnace is on" led.

How do I upload a PDF? Ive done an outline of the control as I saw it. Hoping it may help!!
Hit the "reply" button at the bottom of the thread rather than the "quick reply" link. This will take you to the "full edit" page.

I have a Arduino Mega and I can order the sound shield if that thes best thing to do.
I really don't know much about sound hardware. I'm concerned that you may be getting your hopes up - I'll be giving you less than you might suppose. I'll do it this weekend. Probably Sunday, after Saturday's hangover has worn off a bit.

(EDIT)

Ok. I just had a look at https://learn.adafruit.com/adafruit-wave-shield-audio-shield-for-arduino/play6-hc , which is the page for the adafrruit sound card.

The salient things for me is that it has the following facilities:
'play' - play a wav file
'stop' - stop playing the current waf file
'isplaying' - lets you know if the current wav file is finishged yet

So, I'll code to this interface:

Code: [Select]

class Spoken {
public:
  boolean isPlaying();
  void stop();
 
  // the welcome is in two parts to permit the temperature to be said in the middle
  void sayWelcomePart1();
  void sayWelcomePart2();

  // the closing is in two parts to permit the temperature to be said in the middle
  void sayClosingPart1();
  void sayClosingPart2();

  // says any number from 'one' to 'ninteen'
  void sayOneToNinteen(int number);

  // says 'ten', 'twenty', 'thirty', etc
  void sayTenToNintey(int number);
  void sayPoint();

}


There'll be a simple implementation that just slowly puts the words out on Serial. You will need to replace this with something that talks to your sound card.

This means you will have to figure out how to record some .wav files, how to get them onto the SD card, and how to open the correct file and tell the sound card to say it.

The idea is that you (or someone) write a class

Code: [Select]

class SpokenUsingSoundcard : public Spoken {
}


whose job it is to know how to do that stuff. You then plug that into the skecth in place of "SpokenUsingSerial" which I will write.
http://paulmurraycbr.github.io/ArduinoTheOOWay.html

PaulMurrayCbr

http://paulmurraycbr.github.io/ArduinoTheOOWay.html

YorkshireDave

Thank you Paul. You're a star.

Been talking to my son, who's in avionics, and we feel between us all we can sort it  :)

I will order the parts talked about next week.

Recording, editing and labelling wav files is a doddle - phew!

I've been looking for a simplistic programming environment to get me started. Do you have any suggestions?

Thanks again

BTW

This is what I drew up...

PaulMurrayCbr

I've been looking for a simplistic programming environment to get me started. Do you have any suggestions?
I just use the arduino IDE. I belive there are plugins for eclipse and whatnot, but meh.

I'm signing off for the evening and going out drinking. However, that sketch is available at https://github.com/PaulMurrayCbr/arduino_forum_499650 .

So far, it successfully says "bing bong, the temperature is ninteeen point five degrees" to the serial out (at 9600 baud) and that's all it does. But I ave built the classes that construct your three messages and that only need a "talker" capable of saying particular stock phrases. There's a file in the project, "TalkerUsingSoundcard.cpp" which contains the blank functions that will need to be written in order to make the thing go.

The other thing you will need to write is the getSensorTemp_dC() function which is in the main .ino file - it will have to talk to your sensor and convert correctly to a temperature in 'deci-centigrade'. The reason for doing this is to permit fractional temperatures (eg: 18.5) without the annoyance of floating-point roundoff errors.

The project is … a shade complicated in structure, but the reason it's like that it to isolate out the bits relating to a soundcard while allowing a test output thingy to be slotted in.

Todo: actually write the button up/button down functionality.

Cheers.

http://paulmurraycbr.github.io/ArduinoTheOOWay.html

YorkshireDave

Many thanks enjoy your evening - have one or two for me :-)

YorkshireDave

Paul.

Please forgive my ignorance, and probably incorrect use of language etc, here, but would it be, could it be 'simpler' in any way shape or form if we were to sit and record complete temperatures (e.g. "twenty one & a half degrees", "twenty two degrees" as individual files so that when a button is pressed and we see a computational outcome of say 21.5 (plus or minus .25 degrees) the reader simply reads file name '21_5'? Hope that makes sense!

We'd only need to record 10 - 30 degrees - so 40 little files. They could then be in a friendly voice rather than some mechanical or 'disconnected' type of voice perhaps less easy to understand. Sorry to be a pain, but just trying to think about how much easier and more comforting it could be with a known voice speaking in a more 'recognisable' way.

 

Go Up