Convert a thermostat into wireless with 08M

vertigo

Member
Hello,
I would like to convert a standard thermostat into a wireless one. The main problem I have is that the thermostat is powered with 24 VAC and I don't know how I could interface it with a 08M.
Here is a schematic of how the thermostat should be wired :

Depending on what should be activated (heating, cooling, fan), the thermostat will join pin R to pins W, Y or G.
I would like to keep all simple (ie no LED+LDR, no relay...), and I was thinking in that schematic :

Do you think it could work ? Perhaps instead of standard diodes, I should use Zener diodes (at least for the ones connected to G, W and Y).
What I will do after is detecting which picaxe pin is high and send a serial information through a standard 433 MHz TX. The RX module will then activate the corresponding relay, depending on the message received.
If interested, the installation guide of the thermostat can be found here.
Many thanks for your help.
Christophe
 

BeanieBots

Moderator
Well, no, it won't work.
Those are AC relays and they need AC to work.
If you replace the relays with DC ones and use transistors in place of your diodes, then you might have a chance.
 

gengis

New Member
don't do it

No, you can't do it the way you want.

There is a really simple choice, however. The part you want is called a "Thyristor (or Triac) Output" "Optocoupler."

Inside the 4 or,6,8 pin package is a triac or AC switch that connects from your 24 VAC supply to one side of your 24 VAC relay(s). It is basically a relay itself - provides optical isolation so your picaxe doesn't connect to the relays directly. The picaxe side of the optocoupler is nothing more than a LED inside the package. The picaxe turns on the LED the light turns on the triac completing the circuit on the other side of the voltage barrier.

In selecting the Triac output optocoupler, it has to be able to switch the current the relay needs to activate its coil, and handle the voltage. Most of them switch 120+ VAC and there are couplers that can switch up to one amp.

http://www.ortodoxism.ro/datasheets/toshiba/2292.pdf is a datasheet for one such part - if the current part number TLP525G switches isn't great enough to handle your relay - there are other parts you just need to search for them.

The TLP525 would be good for a relay that uses ~2 watts in the coil.

A more expensive way to do it is to use a solid state relay. Same idea as and optocoupler: LED on one side Triac on the other - but made to handle high current. If all you need is SPST normally open action in the relay the SSR can replace the electromechanical relay and be driven by a picaxe output directly. Most/many SSR are rated for 3-30 VDC on the "coil" side and will switch 24-240 VAC on the output from 2-50 amps.
 
Last edited:

vertigo

Member
Thank you for your answers.
I may have badly explained what I want to do : give me another chance.
The thermostat needs 24 VAC (not DC, even if I don't know if it would work with DC, but let's stay with AC). According to its program, the thermostat will join pin R to any of pins G, W or Y.
So, at any time there will be 24 VAC between R and W, or R and G, or R and Y or R will not be connected to any other pin (when the thermostat is OFF). What I want to do is being able to detect, with a 08M, which of G, W or Y pin is activated.
The relays in the first schematic are only for illustration : I don't want to use relays.
I hope this will help.
Thank you.
Christophe
 

BeanieBots

Moderator
If I understand correctly, you want to DETECT a 24v AC signal?
If yes, then diode into potential divider with cap to smooth the half-wave rectified signal should do it.
I'd go for 22k/4k7 with 220nF across the whole divider, fed via 1N4001.
Remember, 24v AC will give around 35v peak when rectified. The divider action and PICAXE input catch diode will limit the voltage on the input.
 

hippy

Ex-Staff (retired)
I would like to convert a standard thermostat into a wireless one.
Do you mean "convert" or do you want to remotely monitor when the relays close ?

Will the thermostat still be controlling the heating existing system through it's switching ? If it's just a wireless thermometer you want you'd be better off with a DS18B20.

If you want to monitor the relay switched lines, it should be possible to do that with just a 68K series resistor. A better scheme than direct connection would be to put the switched circuits through opto-isolators ( across switched-hot and cold lines ).

Be aware that even when a relay is closed there may not be any current flow if something else in the system has switched power off to that circuit, likewise other relays in the system may power the line even if the relay isn't closed. Heating circuits are rarely simple or as straight forward as they appear to be.
 

vertigo

Member
@Hippy
In fact, there will be 2 modules : one connected to the thermostat (much better than just a DS18B20 because the thermostat is programmable and has its own clock). This module will detect wich "order" is sent by the thermostat (= which pin G, W or Y is activated), send this to a 08M, which will convert this information into a serial data sent through a 433 MHz TX module.
The other module, with another 08M, will receive this serial data and according to the information received, will activate or deactivate the corresponding relay.

@BeanieBots
That's exactly what I would like to do ! Could you please give some details on how are the diodes connected (which side to where), and how I will have a common ground between the 24 VAC part and the picaxe part ?
This seems to be what Hippy suggested with the 68K resistor.
But I really can't see how to have a common ground.
Maybe a schematic would be helpful.
I really appreciate your help !

Christophe

Added this schematic :
 
Last edited:

BeanieBots

Moderator
As you've drawn it except no diode on the "common". Just connect that direct to the PICAXE 0v.
The diodes then need to feed into the potential divider which also has the cap across it.
That does ASSUME that things are as your diagram implies.
Namely, a common AC with 24v drive going to the relays.
It also assumes the 24v AC is isolated from the PICAXE DC supply.
 
Last edited:

vertigo

Member
Thank you BeanieBots.
Do you mean something like that ? (I have just drawn 1 connection that will be repeated 3 times)

What do you mean by It also assumes the 24v AC is isolated from the PICAXE DC supply ? I was thinking in powering the picaxe with the same transformer, as in this drawing :

It is not a good idea... Is there any way to use the same transformer ?
Many thanks,

Christophe
 
Last edited:

BeanieBots

Moderator
And if there is power ... BANG!
You can't do that. I was quite specifc about the 24v AC being isolated.

It probably can be done so that the PICAXE can be powered from the AC and also monitor the 'control' but it's too late in the day for me to think about right now.
 

vertigo

Member
Thank you for your warnings ! (I have changed the image in my previous post)
Does it mean that the first drawing (with the resistors, cap and diode) is correct ? Is the diode in the correct side ?
It would be easier for me to use the same transformer for both the thermostat and the picaxe, since they will be located almost in the same box.
BeanieBots said:
but it's too late in the day for me to think about right now
In French, we say "La nuit porte conseil", which could be, in English, "[SIZE=-1]Take advice of your pillow".[/SIZE]
Any idea for doing it ?
If it's not possible, I will have to find another way to power the picaxe board.
Again, thank you for your help.

Christophe
 
Last edited:

BeanieBots

Moderator
What you now have is a PICAXE circuit that can detect if the tranformer is powered.
So, from that you should be able to work out what to do.
It is not normally a good idea to use half wave rectification for power, but as long as the current drawn is low, it should be OK.
With reference to your current circuit, move the diode anode onto the line you wish to detect.
From the transformer, where the diode is currently shown, fit a rectifier (1N4001) and feed that into about 470uF. From that, via about 100R feed into another 470uF and then into a 7805 regulator to supply the 5v for the PICAXE.
The regulator should also have 100nF fitted close to the pins on both input and output sides.
 

vertigo

Member
What a greatful forum !
Here is my last drawing from what I understood :

Could you please double-check and confirm it is correct ?
To limit heating in the 7805, I should connect the new diode (the one pointing to the left) to the middle point of the transformer (a 2x12V model), so the regulator will receive 12V instead of the double, right ?

Christophe
 

hippy

Ex-Staff (retired)
Christophe : I think you've gone off on a tangent and come full circle ( although more like running along a Mobius strip ) ... To power the PICAXE you need AC, and if there's AC there's no need to monitor for the presence of AC, if there's no power you cannot monitor anything.

Perhaps this is a first step to a PICAXE simulation of Descartes ? Cogito ergo sum; if I'm running there must be power available.
 

vertigo

Member
Let me add one more drawing, Hippy :)

The thermostat will drive 3 switches, according to what function should be activated at any time : heating, cooling, fan or nothing (= all switches open). The picaxe will detect which switch is activated, if any, convert this into a serial information and send that information (for example : switch 1 is ON, switch 2 is OFF...) through a wireless 433 MHz TX module.
The picaxe must be powered all time.
Another picaxe driven module will receive this data and activate the relays accordingly.
I really like the idea in the last schematic because it is very simple, and I should be able to do it (as you may have noticed, I am a newbie but I have already played with the picaxe and I want to learn !)... If you can't see any danger (for people and/or for the components) in going that way, I will try it.
Thank you for the very helpful comments posted.
As Descartes has said "C'est proprement ne valoir rien que de n'être utile à personne." ;-)

Christophe
 

BeanieBots

Moderator
!emit gnol a ni nees ev'I tiucric a gniward fo yaw erucsbo tsom eht eb ot sah tahT

Or, tanslated into more conventional way of writing.
That has to be the most obscure way of drawing a circuit I've seen in a long time!
Just like text, a diagram should 'read' from left to right and top to bottom.
Take a mirror image along the verticle axis, flip the regulator and then turn the transformer through 90 degress so that the 0v is at the bottom and it will be a lot more readable.

Looks like it should work, re-drawn it will be much easier to spot.
Can you see any spelling mistakes in my first sentance?
 

vertigo

Member
Thank you for the comment, and I am sorry for the bad circuit.
Here is the same but using your recommendations.

You are right : it is much less "obscure" now (well, I hope so ! ;-)
I am just waiting for the transformer to test it.

Christophe
 

BeanieBots

Moderator
That's much better. So much easier to read.
From that, I can confidently say that it will do what you want.
If you want to make it even clearer, (just being picky now),
Raise the switches up a bit and turn them through 90 clockwise including the diode.
Turn the divider through 180 but with the cap to the left.
The divider 'tap' can then come off going to the right to show that the signal comes FROM there and goes TO the PICAXE input. It really does pay to lay the diagram out in a way that flows. With more complex circuits, it might not be so obviouse which signals go which way. Also, try to think of (conventional) electricity flowing down hill so try to keep higher voltages at the top of the page.
 

vertigo

Member
Thank you BeanieBots.
It was a real pleasure to post on this forum, because of the kindness, availability, quality of the answers and the desire to share knwoledge, of the members. A great must !
I will probably no more hesitate so much before posting a question or even just an idea on this forum.

Christophe
 

hippy

Ex-Staff (retired)
Much better circuits, as per BeanieBots suggestions, this ( but cropped to fit the upload demands ) is how I'd draw the input interface, keeping the left to right signal flow theme, with 0V at bottom ...
 

Attachments

Last edited:

vertigo

Member
OK, I know it's an old thread now, but I wanted to add the code I use so the thread will be complete. It uses parts from others (as Hippy's CRC calculator, a bit modified).
Again thank you for your very friendly help.

Here is the code for the transmitter module, the one connected to the thermostat. :

Code:
' Wireless thermostat interface
' TX module
'
' PICAXE 08M
' ChL - 12/2007

'                +V 1 U 8 0V
'       GND - 10K - 2   7 (0) to TX module
'fm thermo Heat (4) 3   6 (1) fm thermo Cool
'            NC (3) 4   5 (2) fm thermo Fan

' b0  b1 b2  b3 b4  b5 b6  b7 b8  b9 b10 b11 b12 b13
' --w0-- --w1-- --w2-- --w3-- --w4-- --w5--- --w6---

symbol TX    = 0
symbol HEAT  = pin4 'from thermostat HEAT relay contact
symbol COOL  = pin1 'from thermostat COOL relay contact
symbol FAN   = pin2 'from thermostat FAN  relay contact
symbol SPEED = N1200

symbol STATE = b2 'coded state of all 3 relays
symbol tmp   = b5
symbol tbyte = b6
symbol k     = w5 'b10 b11
symbol crc   = w4 'b8 b9
symbol crcl  = b8
symbol crch  = b9
symbol rand  = w0 'w6 'b12 b13
symbol randl = b0 'b12
symbol randh = b1 'b13

symbol POLYNOMIAL = $A001 '$8408

'       76543210
dirs = %00000001 'pin 0 is OUTPUT

'State code :
' heat = 00000010 =   2
' cool = 00010000 =  16
' fan  = 10000000 = 128

'Set all relays to OFF when powering on
STATE = 0
gosub send_data
pause 2000

main:

 STATE = 0
 
'######## HEAT
 if HEAT = 1 then 'heat ON
  STATE = STATE + 2
 end if
 
'######## COOL
 if COOL = 1 then 'cool ON
  STATE = STATE + 16
 end if
 
'######## FAN
 if FAN = 1 then 'fan ON
  STATE = STATE + 128
 end if

'DEBUG
' for b3 = 0 to 5
'  lookup b3,(2,16,128,18,130,144),STATE
'  gosub send_data
' next b3

 gosub send_data
 
 goto main

send_data:
 random rand
 if randl = 0 or randh = 0 then send_data
 
 'send preamble 
 for tmp = 1 to 5
  serout TX, SPEED, ($AA)
 next tmp
'send zone identification
 serout TX, SPEED, ("zone1")
'send data 
 crc = $FFFF '0
'send random data
 tbyte = randl
 gosub CrcAdd
 tbyte = randh
 gosub CrcAdd
 serout TX, SPEED, (randl,randh)
'send state 
 tbyte = STATE
 gosub CrcAdd
 serout TX, SPEED, (STATE)
 'send fill
 tbyte = randl + STATE
 gosub CrcAdd
 tbyte = randh + STATE
 gosub CrCAdd
 serout TX, SPEED, (STATE,STATE)
'send CRC 
 serout TX, SPEED, (crcl,crch)
'send end of message
 serout TX, SPEED, ("1enoz")
 wait 15
 return
 
CrcAdd:
 for tmp = 0 to 7
  k = tbyte ^ crc & 1
  if k = 0 then CrcAdd1
  k = POLYNOMIAL
CrcAdd1:
  crc = crc / 2 ^ k
  tbyte = tbyte / 2
 next tmp
 return
And here is the code for the reciever module, the one connected to the heating and cooling devices, and to a fan if wanted.

Code:
' Wireless thermostat command
' RX module
'
' PICAXE 08M
' ChL - 12/2007

'               +V 1 U 8 0V
'      GND - 10K - 2   7 (0) to control LED
'to Heat Relay (4) 3   6 (1) to Cool relay 
'   fm RX data (3) 4   5 (2) to Fan relay

' b0  b1 b2  b3 b4  b5 b6  b7 b8  b9 b10 b11 b12 b13
' --w0-- --w1-- --w2-- --w3-- --w4-- --w5--- --w6---

' LED  = out 0 (physical pin 7) to control LED
' RX   =  in 3 (physical pin 4) from RX module
' HEAT = out 4 (physical pin 3) to heating relay
' COOL = out 1 (physical pin 6) to cooling relay
' FAN  = out 1 (physical pin 5) to fan relay

symbol RX    = 3
symbol HEAT  = 4
symbol COOL  = 1
symbol FAN   = 2
symbol LED   = 0
symbol SPEED = N1200

symbol POLYNOMIAL = $A001 '$8408

symbol STATE = b0
symbol FUNC  = b1
symbol tmp   = b2
symbol tbyte = b3
symbol k     = w6 'b12 b13
symbol crc   = w5 'b10 b11
symbol crcl  = b10
symbol crch  = b11
symbol CRCR  = w4 'b8 b9
symbol CRCRL = b8
symbol CRCRH = b9
symbol rand  = w3 'b6 b7
symbol randl = b6
symbol randh = b7
symbol fill1 = b4
symbol fill2 = b5

'State code :
' heat = 00000010 =   2
' cool = 00010000 =  16
' fan  = 10000000 = 128

'       76543210
dirs = %00010001 'pin 0, 4 : OUTPUT

'Set all relays + control LED to OFF when powering on
low COOL
low HEAT
low FAN
high LED
wait 2
low LED

main:
 serin RX,SPEED,("zone1")
 serin RX,SPEED,randl,randh
 serin RX,SPEED,STATE
 serin RX,SPEED,fill1,fill2
 serin RX,SPEED,CRCRL,CRCRH
 serin RX,SPEED,("1enoz")

 crc = $FFFF '0
 
 tbyte = randl
 gosub CrcAdd
 
 tbyte = randh
 gosub CrcAdd
 
 tbyte = STATE
 gosub CrcAdd
 
 tbyte = randl + fill1
 gosub CrcAdd
 
 tbyte = randh + fill2
 gosub CrcAdd
 
 if crc   != CRCR  then rx_error
 if fill1 != STATE then rx_error
 if fill2 != STATE then rx_error
 if fill1 != fill2 then rx_error
 
 high LED
 pause 100
 low LED

'########## HEAT
 FUNC = STATE & %00000010
 if FUNC = 2 then
  low  COOL
  high HEAT 'heat ON
 else
  low HEAT  'heat OFF
 end if

'########## COOL
 FUNC = STATE & %00010000
 if FUNC = 16 then
  low HEAT
  high COOL 'cool ON
 else
  low COOL  'cool OFF
 end if

'########## FAN
 FUNC = STATE & %10000000
 if FUNC = 128 then
  high FAN 'fan ON
 else
  low FAN  'fan OFF
 end if

 goto main

rx_error:
 for tmp = 1 to 3
  high LED
  pause 100
  low LED
  pause 200
 next tmp
 goto main
 
CrcAdd:
 for tmp = 0 to 7
  k = tbyte ^ crc & 1
  if k = 0 then CrcAdd1
  k = POLYNOMIAL
CrcAdd1:
  crc = crc / 2 ^ k
  tbyte = tbyte / 2
 next tmp
 return
Christophe
 
Last edited:
Top