How to wire multiple signals for autonomous heating

Hello guys,

I'm doing a simple project for autonomous heating.
This is my connection scheme:



Sorry for image, but I'm writing from phone, and can't do better.

P1, P2, P3 are a signals which indicate if Floor 1, Floor 2 or Floor 3 needs heat.
Boiler signal indicates if PELLET Boiler is working well or not.
R1 turn on the pellet boiler, R2 turn on gas boiler.

So, Arduino will manage four mode of operation:

  • Automatic mode: if P1 and P2 and P3 are off, turn off R1 and R2. Else (at least one of three is on):

  • If Boiler is on, turn on R1

  • If Boiler is off, turn on R2

  • Only Pellet boiler: turn on R1

  • Only GAS boiler: turn on R2

  • Summer: turn off R1 and R2

It's very simple, but I have two questions:

Thank you so much :slight_smile: and merry merry christmas :smiley: :wink:

IMG-20181224-232021.jpg

sabruri1:

Do you have a problem? With your wiring, you need to use pinMode(somePin, INPUT_PULLUP) and the logic is reversed (reading switch in on position / pressed button results in LOW).

sabruri1:

  • I would like to add a momentary switch for manually changing of mode of operation. How can I connect it? And what's the best way for coding it?

You can connect it in the same way as the other switches (P1 .. Boiler). To keep track of mode, you will need a (global or static) variable that changes when a button's state changes (this is, when it goes from not-pressed to pressed or vice versa). To detect a state change, you need another (global or static) variable that keeps track of the last state so you can compare it with the current state; you also need to debounce the button.

Merry Christmas.

What display is that connected to D6 and D7 by the way?

You probably need de-bouncing on all the switches or hysteresis on analog inputs (the nature of the inputs has not yet been made at all clear) to reject transient interference, though arguably the code must also have an overall "de-bounce" of many seconds to minutes to prevent unnecessarily frequent switching of the output controllers.

@sabruri1, no sock-puppets.

Thread locked...
http://forum.arduino.cc/index.php?topic=586962.msg3993373#msg3993373

Fair warning: Using imgbb is likely to get you banned.