ZMC v3. Whole house audio step by step Part 1

Show or discuss your existing Home automation project here, so a detailed explanation!.....
AshaiRey
Senior Member
Senior Member
Posts: 1310
Joined: Mon Feb 02, 2009 5:27 pm
Location: Netherlands
Contact:

ZMC v3. Whole house audio step by step Part 1

Post by AshaiRey »

For a few years now I have a home made whole house audio system called ZMC. Two months back I fried my ZMC v2.0 due to an electrical discharge. Six of the 12 amps where burned out including two power supplies. This mischief gave me the opportunity to improve the system and implement lessons learned from the two previous systems. I have ZMC v3.0 up and running for a month now and it is working like a charm.

If you want to have whole house audio you have to ask yourself a few questions first like.

- What do you expect from the system?
My goals where far, far too high when I started with this. After two versions I noticed that I didn't use most of the functionality I had built in and a few of them I really never used at all. What my wife and I want is music in the background, not to loud, not to annoying. Something like a portable radio on the shelve in the kitchen but then a bit more sophisticated.

- How important is stereo for you?
I had stereo at four locations but never really noticed the benefits of that. I had stereo in the kitchen but mono sounds just as good. And I see no point in having stereo anymore inside the fridge.. (Yes, I had that.)

- How loud must the music be?
I don't want the music so loud that you can't have a conversation. Because of this I can just drive the speaker directly from the box without any extra amplifier.

- Do you need instant volume control?
This could be a maybe. The sound levels in all my rooms are tuned to a pleasant level. There isn't hardly a moment that you want to change that but some means to raise or lower the level would be nice.

- How much time would you like to spend in controlling this all.
For me this is none. I just want that the music goes on when I enter the room and off when there isn't movement in the room for some time. Another thing I wanted is to raise the volume automatically in the bathroom when I turn on the fan and take a shower. All can be automated.

It will tell here in detail how I did my whole house audio ZMC v3.0 in a few articles and I will include also a few nice to have features that are rather neat to implement.

So if you are reading this up to here then you really want to know what is possible and what I use for it
The hardware.
- One XAP800 (eBay).
- Wires (CAT5 cable is always good).
- Speakers (see note below).
- Serial cable with all wires connected one on one.
- Optional TelCom unit (TH2).
- Optional microphones.

The software.
- G-Ware (XAP800 software)
- HomeSeer plus a control script.
- Or any other way to send serial commands.

Note :
For speakers I use a few cheap ceiling speakers and old speaker boxes from old stereo systems bought from a second hand store (kringloop winkel) for Euro 5,- a set. You really don't need high end speakers if you put then under the kitchen cupboard in to the dust and spider webs.

What you will get due to the XAP800
- Up to 12 output channels per XAP800
(You can stack up to 8 of them to a max. of 96 outputs per stack)
- Up to 12 inputs
(You can stack up to 8 of them to a max. of 96 inputs per stack)
- 8 of those inputs are high end mic inputs that also can be used as line inputs
- A matrix mixer. Connect one or any input to any one or any output like you want it.
- Filters, dynamic compression, full control over your audio.
- Microphone gating detection.
- An industry grade system.

But what did I do with it?
- I have audio in 9 rooms, including the garden.
- Automatic volume control depending on the situation
- Announcements in any or all the rooms without disturbing the music in others.
- Killing those annoying commercials that sound louder then the normal music.
- Four rooms are equipped with microphones for VR control.
- Only VR communications to the room where the question is asked.
- VR control of the whole HA system
- Baby phone functionality with any number of rooms equipped with a microphone.
- Intercom functionality with any number of rooms.
- Security monitoring due the use of microphones.
- Answering the phone through the audio system and making phone calls through out the house.
- Switching in other room(s) into the phone call.
- High WAF. (this is the best reason)

The next article will describe how to setup things the preferred way for audio distribution.
Last edited by AshaiRey on Tue Jan 21, 2014 2:36 pm, edited 1 time in total.
Bram
raymonvdm
Senior Member
Senior Member
Posts: 1153
Joined: Sun Dec 18, 2011 1:23 am

Re: ZMC v3. Whole house audio step by step

Post by raymonvdm »

It sound real nice, and i also googled the XAP800 but i don`t have the know how or budget for now.

I`m currently using Logitech Media Server and Squeezelite to get music in three rooms, and it seems more expensive then a setup with the XAP800 but it is working and the WAF factor is okay

Do you mind to share some pics ?

The only wish for now is adding speakers to the bathroom. But weatherproof speakers are rare to find at the second use shop
Running HS3PRO on PC with Z-Wave / OpenTherm / Plugwise / RFXcom / MQTT / XAP400 / Logitech Media Server and Squeezelite on PI`s
AshaiRey
Senior Member
Senior Member
Posts: 1310
Joined: Mon Feb 02, 2009 5:27 pm
Location: Netherlands
Contact:

Re: ZMC v3. Whole house audio step by step

Post by AshaiRey »

raymonvdm wrote:It sound real nice, and i also googled the XAP800 but i don`t have the know how or budget for now.
The know how is what i am trying to provide here and about the budget. The XAP800 units are on average $30,- on eBay.com but i've seen them as low as $10,- per unit.
Do you mind to share some pics ?
I certainly will share pictures. This posting was just an introduction
The only wish for now is adding speakers to the bathroom. But weatherproof speakers are rare to find at the second use shop
I use this type of ceiling speakers in the badroom. About Euro 6,- a piece http://www.conrad.nl/ce/nl/product/312513/
They are working fine for 4 years now. The speaker isn't HiFi quality but with the already terrible accoustics in the bathroom you don't hear the difference.
Bram
Rutger
Member
Member
Posts: 339
Joined: Wed May 19, 2010 8:48 pm
Location: Netherlands

Re: ZMC v3. Whole house audio step by step Part 1

Post by Rutger »

This ZMC project looks very promising, so I bought (also) at an auction a XAP800 (appr. € 100 incl. VAT, shipping and customs). It's now running with two speakers. A mic will be connected soon and hopefully this weekend your script will be running here also.
Thanks for sharing.
My home automation blog: https://rutg3r.com
raymonvdm
Senior Member
Senior Member
Posts: 1153
Joined: Sun Dec 18, 2011 1:23 am

Re: ZMC v3. Whole house audio step by step Part 1

Post by raymonvdm »

My bathroom has a concrete ceiling so no room for halogeen spot lookalike speakers so back to google on that one. During thee summer i`m using outdoor wireless speakers which i now placed in the bathroom (no summer yet) The only issue is that they do not power on when plugin in the power source.

I`m using Logitech Media Server for catalog and audio control combined with squeezelite daemons on RaspeberryPi`s and the local HomeSeer server

The advantage of this is that each room can play different music on the same time :D
Running HS3PRO on PC with Z-Wave / OpenTherm / Plugwise / RFXcom / MQTT / XAP400 / Logitech Media Server and Squeezelite on PI`s
raymonvdm
Senior Member
Senior Member
Posts: 1153
Joined: Sun Dec 18, 2011 1:23 am

Re: ZMC v3. Whole house audio step by step Part 1

Post by raymonvdm »

I found a XAP400 which is almost the same as the XAP800 so i`m in the game :-) and started to build the system myself and one small step at a time i`m getting somewhere and these are the steps taken

- The unit is powered on and the RS232 port is set to 38400 Baud and flow control is on

- G-Ware 5.06 is installed on my Windows 64bit machine and i can connect to the unit (XAP400 Device ID 1)

- I made the matrix config and input 8 is playing to output 4 and output 9 using 2 old speakers

- I can connect using putty and found out all my serial command should start wit #71 and not #51 when using a XAP400 as device ID1

Code: Select all

#71 VER 
OK> #71 VER 2.0.6
- I downloaded the HS2 script and ini file http://www.zoelen.net/site/Uploads/AZ_ZMC3.zip and changed the script so it will connect to com2

- Tried to start an event with the following action

Code: Select all

  Run script: AZ_ZMC3.vb("Connect") 
But got this error

Code: Select all

23-8-2014 0:30:39  Error opening com port 2 :  Error: Unable to obtain a handle to the COM port 
What to do next ....?
Running HS3PRO on PC with Z-Wave / OpenTherm / Plugwise / RFXcom / MQTT / XAP400 / Logitech Media Server and Squeezelite on PI`s
AshaiRey
Senior Member
Senior Member
Posts: 1310
Joined: Mon Feb 02, 2009 5:27 pm
Location: Netherlands
Contact:

Re: ZMC v3. Whole house audio step by step Part 1

Post by AshaiRey »

When the script tries to connect it will open the com 2 port. The error tells you that to port can't be opened. (you figured this part out already i guess)
So something is still keeping the com port open.
- Did you disconnect with the G-Ware software because this also uses the com port?
- Did you disconnect from the terminal software (putty)?
- Try a higher com port such as 6 or 7. Com 2 can be in use by some USB device or by the system.

For the device type you can add it to the script here

'*********************************************
'GLOBALY USED CONSTANTS
'Leave these as the are
'*********************************************
CONST AP800 = 1
CONST XAP800 = 5
CONST XAP400 = 7

and change this
'** Unit indentifiers
Dim UNIT_TYPE As Integer = XAP800

To
'** Unit indentifiers
Dim UNIT_TYPE As Integer = XAP400
Bram
raymonvdm
Senior Member
Senior Member
Posts: 1153
Joined: Sun Dec 18, 2011 1:23 am

Re: ZMC v3. Whole house audio step by step Part 1

Post by raymonvdm »

The connection now seems to be working on COM2, just by using the above changes

Now i need to find out how to map all settings to the XAP400 since AZ_ZMC3.vb("Main","ALLES;UIT") does not seem to have any impact :D

After some hours of fiddling around i have managed to get the most parts working. The Macro`s are created but with device_type=7 (XAP400) instead of 5 (XAP800). And when i send a speak command it get silent because i don`t have a second input yet. I was hoping the music will return after the speech but this is not yet working
Running HS3PRO on PC with Z-Wave / OpenTherm / Plugwise / RFXcom / MQTT / XAP400 / Logitech Media Server and Squeezelite on PI`s
AshaiRey
Senior Member
Senior Member
Posts: 1310
Joined: Mon Feb 02, 2009 5:27 pm
Location: Netherlands
Contact:

Re: ZMC v3. Whole house audio step by step Part 1

Post by AshaiRey »

I don't have a maual for the XAP400 but i think you have to look for that and see if the commands you planning to use are in the same format as the XAP800. There might be some differences there. The script wasn't created with a XAP400 in mind.
And when i send a speak command it get silent because i don`t have a second input yet. I was hoping the music will return after the speech but this is not yet working
The way it works is that a virtual device holds the VR state. If that state goes off again an event is triggered that reverse the saved setting back to the previous state.

Also i may have used channels that aren't available on the XAP 400
Have a look at the top of the script in this section
'*********************************************
'GLOBALY USED VARIABLES
'Change these to reflect your system
'*********************************************
Lool at these variables
Note P stands for processor and the first letter is the channale to use
Dim MICCHANNEL As String = "A|P" 'XAP input channel used by the Microphones (processor A)
Dim SINGLESPEECHCHANNEL As String = "B|P" 'XAP input channel used by speech (processor B) - Single channel
Dim AUDIOCHANNEL As String = "C|P" 'XAP input channel used by the radio (processor C)
Dim ALLSPEECHCHANNELS As String = "D|P" 'XAP input channel used by speech (processor D) - All channels
Now i need to find out how to map all settings to the XAP400 since AZ_ZMC3.vb("Main","ALLES;UIT") does not seem to have any impact :D
Do you have this in your ini file

[ROOMNAMES]
; The names for room 1 to 12
ROOM0="Alles"
(more rooms below)

Turning everything off is done with macro 203. Run that macro on your device to see if the commands are correct for the XAP400.
Bram
raymonvdm
Senior Member
Senior Member
Posts: 1153
Joined: Sun Dec 18, 2011 1:23 am

Re: ZMC v3. Whole house audio step by step Part 1

Post by raymonvdm »

Today i went to the AcTION to get some audio cables @ 65cents a peace someone can affort a miscut :-)

- Audio OUT -> Input 8
- Speech OUT -> Input 7

I run the following script and this is working

Code: Select all

 Run script:	AZ_ZMC3.vb("Main","Wasruimte;OMROEP;This is a test message $$DS:X6 |2")
                  Wait:	5 seconds
             Run Event:	ZMC_Alles_AAN
The music stops and the messages is heard after that the music continues, but input 7 is still enabled and so if i play a sound on the second audio card i hear both :-) This is fixed in MatrixNEW.png

I will share my settings on this link http://files.raqxs.nl/domotica/zmc/

Note: I also get this error but i`m not shure how to see what the unit is sending
Running HS3PRO on PC with Z-Wave / OpenTherm / Plugwise / RFXcom / MQTT / XAP400 / Logitech Media Server and Squeezelite on PI`s
raymonvdm
Senior Member
Senior Member
Posts: 1153
Joined: Sun Dec 18, 2011 1:23 am

Re: ZMC v3. Whole house audio step by step Part 1

Post by raymonvdm »

Switch one room off does not seems to be working. I`m not sure why because on is working fine

Code: Select all


Case "UIT"
	  If Debug = true Then hs.writelog(strScriptName, strLocation & " : Audio UIT" )

	  If intAllRooms = 0 ' Turn OFF everything
		ActionString = "0|203"  'MACRO 203 - All audio outputs OFF
		StartMacro( ActionString )
		RemoveAllEvents()
		UpdateAllDevices(DeviceOffsetVol , HS_OFF, DEVICESTRING_OFF)
		If Debug = true Then hs.writelog(strScriptName, "<b>FINISHED ZMC SCRIPT.</b>")
		Exit Sub
	  End If

	  dv = GetDeviceCode(strLocation, VOLUME)
	  TurnDeviceOFF(dv, DEVICESTRING_OFF)

Code: Select all


Run script:	AZ_ZMC3.vb("Main","Wasruimte;UIT")
Run script:	AZ_ZMC3.vb("Main","Wasruimte;AAN;1080")

However is seems to do something

Code: Select all


31-8-2014 19:16:55  - AZ_ZMC v3.1 - <b>STARTING ZMC SCRIPT.</b>
31-8-2014 19:16:55  - AZ_ZMC v3.1 - Room found named : WASRUIMTE
31-8-2014 19:16:55  - AZ_ZMC v3.1 - WASRUIMTE : Audio UIT
31-8-2014 19:16:55  - AZ_ZMC v3.1 - Turn device OFF : X79
31-8-2014 19:16:55  - AZ_ZMC v3.1 - <b>FINISHED ZMC SCRIPT.</b>

Note: Switching using motion detection is working. I just found out that there are new scripts created under "Audio Systeem" when i trigger a single room. When i use All on and All off there is no trigger :D
Running HS3PRO on PC with Z-Wave / OpenTherm / Plugwise / RFXcom / MQTT / XAP400 / Logitech Media Server and Squeezelite on PI`s
AshaiRey
Senior Member
Senior Member
Posts: 1310
Joined: Mon Feb 02, 2009 5:27 pm
Location: Netherlands
Contact:

Re: ZMC v3. Whole house audio step by step Part 1

Post by AshaiRey »

I am not sure now what is working for you and what not?

For me the control is mostly done by motion sensors (or VR) and not manual. I use the devices more as indicators for the state and to show them in a easy way on a HSTouch screen.
When a motion is detected a new event is created under Audio System. Each time motion is detected the old event is discarded and a new one is created. To turn off the music in a room i usually click the event. To disable sound in the room i use the mute device for that room. I made it to automate the sound system, not to push buttons on a other place. :)

All is just working fine for so long now that i can't remember how things stick together and because i don't have my system at hand not i can't check it for you. But if i recall well then command ALLES;UIT is used to turn all channels to their default state before i start the mediaplayer. I am not using it in another way.

Things might become offset due to testing so you could check
- The ini file and see if it doesn't hold any (wrong) dynamic values that might get restored afterwards.
- The device for the mute state of the room.
- Don't switch to quickly because it is a serial device.

If the sound turn on but not off then have a look at the mixer matrix to see if the matrix connection is removed. If not look in the debug log to see what is send to the mixer
Bram
raymonvdm
Senior Member
Senior Member
Posts: 1153
Joined: Sun Dec 18, 2011 1:23 am

Re: ZMC v3. Whole house audio step by step Part 1

Post by raymonvdm »

All On is working and All Off is working
Running an event so the channels plays for 18 minutes is also working ( AZ_ZMC3.vb("Main","Slaapkamer;AAN;1080") ) including the Off after 18 minutes

The one thing that is not working is when i run the event AZ_ZMC3.vb("Main","Slaapkamer;UIT")
Running HS3PRO on PC with Z-Wave / OpenTherm / Plugwise / RFXcom / MQTT / XAP400 / Logitech Media Server and Squeezelite on PI`s
AshaiRey
Senior Member
Senior Member
Posts: 1310
Joined: Mon Feb 02, 2009 5:27 pm
Location: Netherlands
Contact:

Re: ZMC v3. Whole house audio step by step Part 1

Post by AshaiRey »

Oke, i had a look at home and indeed here the event AZ_ZMC3.vb("Main","Slaapkamer;UIT") didn't work as i expected.
So what does it do then?
The only thing it does is swithing the volume device off (change state).
If you want to kill the music in that room you have run the event 'Slaapkamer volume' under Audio system.
Bram
raymonvdm
Senior Member
Senior Member
Posts: 1153
Joined: Sun Dec 18, 2011 1:23 am

Re: ZMC v3. Whole house audio step by step Part 1

Post by raymonvdm »

I know, but i would expect it actually stopped the audio output. Ik wil add another script rule to the event, copied from the Audio System events
Running HS3PRO on PC with Z-Wave / OpenTherm / Plugwise / RFXcom / MQTT / XAP400 / Logitech Media Server and Squeezelite on PI`s
Post Reply

Return to “Home Automation Projects”