Monday, October 2, 2017

Bucket Subwoofer

Based on Ed's design here
Bucket Sub instructions

threads
Transcendent Sound


1. Peerless SLS 830667, 8" Paper Cone Woofer
2.  Binding posts (optional, but can also order from PE)

  1. 2. some silicone sealant
dow 738 or 732?

3. 3 feet, one inch in diameter and inch tall

4. 4 to 8 three inch deck screws

5. one 5 gallon bucket and lid

6. one bag of fast setting concrete.

7. three, 2 inch drywall or wood screws for the feet

8. maybe some small sheet metal or wood screws for the driver.....I did not screw it down on mine but it would not hurt.

I'm using a minidsp 2x4 as an electronic crossover to generate the sub signal, and a older Crown XLS-202 amp 

3.7.2 Bridge-Mono Mode Typical input and output wiring is shown in Figure 3.7. INPUTS: Use a custom “Y” adapter cable, wired to split the signal and invert the polarity for the Channel 2 amplifier input as shown in Figure 3.8. We recommend you label the ends of the Y adapter to help make sure to connect the correct end to each amplifier input. 

Connect the Y adapter between the signal source and each amplifier input. 

NOTE: Crown provides a reference of wiring pin assignments for commonly used connector types in the Crown Amplifier Application Guide (Section 1.21.) available at www.crownaudio. 

OUTPUTS: Connect the speaker across the red binding post of each channel. Do not use the black binding posts when the amp is being operated in Bridge-Mono mode. 

NOTE: The Channel 1 and 2 level controls MUST be set to identical settings when operating the XLS amplifier in Bridge-Mono mode




Building the sub
1. Turn bucket upside down and use driver to determine the size mounting hole. Cut hole in bottom of bucket. Test the fit.

2. Using 2 inch screws, screw the feet onto the lid and pound the lid on the bucket making sure it is all the way on, I used a rubber mallet. The cement should anchor the screws and feet

3. Between the lid and the the projection on the bucket drive the 3 inch deck screws in. They are the anchors for the cement. I used 4, use as many as you like.

4. Drill a small hole above the projection on the bucket for the wire to exit. Or install some binding posts if you want it "fancy".

5. Mix the concrete in another container....we don't want it on the inside walls, be neat here! Mix it thoroughly and not too runny! 

6. With bucket upside down, carefully pour/scoop cement through the driver hole and fill it just above the projection on the bucket making sure it covers the anchor screws, about 2 to 3 inches deep.

  1. 7.Let it cure at least 3 days.  The moisture is the concrete has to come out before the bucket is sealed.

  2. 8.Solder wire to driver, pass through hole or connect to binding posts and silicone the driver in place, use screws if you want but the silicone will hold it.
  3. You are supposed to turn the bucket upside down, make the hole for the driver, turn it over and pound the lid on, put the anchoring screws around the rim, screw the feet on with anchoring screws and fill it about 3 inches deep with fast setting concrete, wait at least 3 days , stick some binding posts on the side sealing them with silicone...................that is the enclosure!

    I use "co ax sealer" from Parts Express to seal the driver. Silicone is not good enough!

  4. If you do a good silicone, it'll work.  Something like Permatex will do the dance.  Avoid the caulk tubes.

9. Seal the wire hole with silicone

10. Hook her up and be amazed

  1. 11.Notice the lack of anything inside, don't screw it up with stuffing! 

Wednesday, August 9, 2017

Asus router

Asus router setup info
Stuff I setup on my Asus router
I have a tmobile tm ac1900
A rebadged Asus rt ac68u
DDNS through Asus so I could have a link where I could always access my pi through the router.
This is where Asus give you a link in the form of. Asus. Com and it constantly monitors your home Internet address which changes, so you can always connect

Select WAN on left, then DDNS on top.
Then just enter a host name, and apply.  If its available, you will get it.



VPN with openvpn on the router. This keeps it safe, all comm goes through VPN


Changes from default config
1.  Don't use the normal 192.168.1.x for the internal ip address.  Change 1 to something else.
Select LAN on the left.  Change the IP address, then select apply.
2.  enabled DDNS.  Select WAN on the left, then DDNS tab on top.  Yes to Enable the DDNS Client, I used the asuscomm.com free ddns server, created a new address.  It checks for availability.  Then click apply.  You don't have to worry about remembering the address, it will automatically insert the address into the openvpn file below.
3.  Turned on WPS (from wireless menu)
4.  Added pi as a static IP address
5.  Enabled guest network
6.  Turned on VPN Server using openvpn.  Used the default setting.  Create some usernames and passwords, add and save.  Export file.  Do the DDNS before doing this, and it will use the ddns address you created.  Export the file, should be client.ovpn
email the file to yourself

Android VPN setup
install open VPN connect on your phone.
go to your email, and download the client.ovpn file
start the open VPN connect program, and select the ovpn file.  It was in my downloads directory of the sd card.
enter your username and password
hit connect, wait a few, and it should connect.

You can now go to your browser, and connect to anything in your home network.
Address needs to be in the form of 192.168.xxx.xxx



Wednesday, January 18, 2017

Domoticz Configure

Open webpage by going to:
http://192.168.1.xxx:8080/#/Dashboard
replace xxx with the address of the Pi


It will say no favorite devices defined



Select Setup in upper right, then hardware

Select OpenZWaveUSB in Type

Give it a name, I used Zwave Stick Gen5, then select Add


It should show up on top of the screen.  If not, select Setup on top right, then Hardware.


Now select the blue setup box, and you will see whatever devices you have added to your zstick

Now select Setup on the top right, then Devices.



Click the green right pointing arrow
This will pop up

Enter a name, then Add Device

 Now if you select Switches on top (if you added a switch), you will see a box where you can control your switch

If you select the Star, it will turn yellow, and this will show up on your favorites screen.




Domoticz Installation



Instructions to install Domoticz and OpenZWave

This was a fresh install on a new RPi3.

Since I needed OpenZWave, I had to rebuild Domoticz



Installing from Source

Build times reported are when using a Raspberry Pi 3, using "make -j 3"
(Older revisions of the raspberry pi could take up to 10x longer to compile)
You also might need to install GCC 4.6 and compile with this version as 4.9 takes to much memory
Creating a large swap file does not solve the problem, and build with 'make -j 3'
If you are using an old version of the Raspberry Pi, remove the "-j 4" from the make commands!

sudo apt-get install cmake make gcc g++ libssl-dev git curl libcurl4-openssl-dev libusb-dev wiringpi

Now build and install the Boost library.
mkdir boost
cd boost
wget http://sourceforge.net/projects/boost/files/boost/1.60.0/boost_1_60_0.tar.gz/download
tar xvfz download
rm download
cd boost_1_60_0/
./bootstrap.sh
./b2 stage threading=multi link=static --with-thread --with-date_time --with-system --with-atomic --with-regex
sudo ./b2 install threading=multi link=static --with-thread --with-date_time --with-system --with-atomic --with-regex
cd ../../
rm -Rf boost/

Build Support for OpenZWave

If you need support for ZWave, you need to compile open-zwave before compiling domoticz Make sure to follow the below steps, you will end up with a folder layout like:
- open-zwave-read-only
- dev-domoticz
sudo apt-get install libudev-dev
For the first time, you need to clone the code (copy) from GitHub into your system:
git clone https://github.com/OpenZWave/open-zwave open-zwave-read-only
Refresh the source and Build OpenZWave(1m23.057s for initial build (rpi2 3 minutes))
cd open-zwave-read-only
git pull
make -j 3


go back to the top folder (your Home directory):
cd ..

Domoticz Source

For the first time, you need to checkout the source from GitHub onto your system:
git clone https://github.com/domoticz/domoticz.git dev-domoticz
Build Domoticz (21m15.899s on a raspberry pi 3 , 35m0.646s on a raspberry pi 2 for initial build)
If you have updated dev-domoticz, the make step will only re-build those files that have been changed - although if a header-file common to a lot of source files has been changed, this will still take a long time
Note building on pi 3 with image september jessy with gcc 4.9, you need bigger swapspace 512 instead of 100 (see this  or else it will take ages...


cd /etc/dphys-swapfile

CONF_SWAPFILE=512

free -m

Change to the Domoticz directory, and start building
cd dev-domoticz
cmake -DCMAKE_BUILD_TYPE=Release CMakeLists.txt
make
The build failed with "make -j 3", so changed to "make" , and it worked with no errors
took about an hour on my pi3 to build

Make Domoticz startup at boot time (Also needed for Web Update)


cd /dev-domoticz
sudo cp domoticz.sh /etc/init.d
sudo chmod +x /etc/init.d/domoticz.sh
sudo update-rc.d domoticz.sh defaults
Edit the startup script and change the USERNAME, DAEMON and DAEMON_ARGS parameters to reflect your current settings
sudo nano /etc/init.d/domoticz.sh
Make sure the lines look like this:
USERNAME=USER
DAEMON=/home/$USERNAME/dev-domoticz/$NAME
DAEMON_ARGS="-daemon -www 8080"

if you are using the default user name, it should say:
USERNAME=pi
If you want to use another web interface port change:
DAEMON_ARGS="-daemon -www 8080"
Test Domoticz (Important to get the file ownerships right!)
cd ~/dev-domoticz
sudo ./domoticz
Start Domoticz
sudo service domoticz.sh start
Now connect with a browser to see if it is up and running.
You can now start/stop/restart domoticz with:
sudo /etc/init.d/domoticz.sh start to start Domoticz
sudo /etc/init.d/domoticz.sh stop to stop Domoticz
sudo /etc/init.d/domoticz.sh restart to restart Domoticz
sudo /etc/init.d/domoticz.sh status to check the status of Domoticz (running/not running)

Updating Domoticz

Binary install update

Use the Web Interface to update Domoticz (Setup->Check for Updates)
If this fails for any reason (e.g. partial download giving segmentation fault) then you should manually update by:
Stable:
sudo /etc/init.d/domoticz.sh stop
cd ~/dev-domoticz
./updaterelease
Beta:
./updaterelease
./updatebeta

Source Update

Login to your Raspberry Pi with the 'pi' user and issue:
cd domoticz
git pull
make -j 4


Install watchdog

sudo modprobe bcm2708_wdog
echo "bcm2708_wdog" | sudo tee -a /etc/modules

Install the software watchdog daemon

sudo apt-get install watchdog
sudo update-rc.d watchdog defaults

Configure the watchdog daemon

Open /etc/watchdog.conf with your favorite editor (mine is nano).
sudo nano /etc/watchdog.conf
Uncomment the line that starts with #watchdog-device by removing the hash (#) to enable the watchdog daemon to use the watchdog device. Uncomment the line that says #max-load-1 = 24 by removing the hash symbol to reboot the device if the load goes over 24 over 1 minute. A load of 25 of one minute means that you would have needed 25 Raspberry Pis to complete that task in 1 minute. You may tweak this value to your liking.
If you only want to setup the watchdog to restart in case your system hangs, continue to the section Start the watchdog daemon

Use watchdog to check Domoticz

This script relies on the fact that the Domoticz.log is written in /tmp/ newer installs have this option disabled by default. To make this script work you must enable the logfile.
sudo nano /etc/init.d/domoticz.sh
and change the line OPTIONS="-www 8080" to:
OPTIONS="-www 8080 -loglevel=1 -log /tmp/domoticz.log"
(* Alternative ) In my case, the option must be set up like this
DAEMON_ARGS="$DAEMON_ARGS -www 8080 -loglevel=1"
DAEMON_ARGS="$DAEMON_ARGS -sslwww 443"
DAEMON_ARGS="$DAEMON_ARGS -log /tmp/domoticz.log"

Setup mailer:
sudo apt-get install sendmail-bin
sudo apt-get install mutt
If mutt does not install, then try updating your pi first by running:
sudo apt-get update
Then continue to:
cd /home/pi
create the file .muttrc with the following content: (vi .muttrc or nano .muttrc)
# basic .muttrc for use with Gmail
# Change the following six lines to match your Gmail account details
set imap_user = "username@gmail.com"
set imap_pass = ""
set smtp_url = "smtp://username@smtp.gmail.com:587/"
set smtp_pass = ""
set from = "username@gmail.com"
set realname = "Firstname Lastname"
#
# # Change the following line to a different editor you prefer.
set editor = 'vim + -c "set textwidth=72" -c "set wrap"'
# Basic config
set folder = "imaps://imap.gmail.com:993"
set spoolfile = "+INBOX"
set imap_check_subscribed=yes
set hostname = gmail.com
set mail_check = 120
set timeout = 300
set imap_keepalive = 300
set postponed = "+[GMail]/Drafts"
set header_cache=~/.mutt/cache/headers
set message_cachedir=~/.mutt/cache/bodies
set certificate_file=~/.mutt/certificates
set move = no
set include
set sort = 'threads'
set sort_aux = 'reverse-last-date-received'
set auto_tag = yes
set pager_index_lines = 10
ignore "Authentication-Results:"
ignore "DomainKey-Signature:"
ignore "DKIM-Signature:"
hdr_order Date From To Cc
alternative_order text/plain text/html *
auto_view text/html
bind editor <Tab> complete-query
bind editor ^T complete
bind editor <space> noop
# # Gmail-style keyboard shortcuts
macro index,pager am "<enter-command>unset trash\n <delete-message>" "Gmail archive message" # different from Gmail, but wanted to keep "y" to show folders.
macro index,pager d "<enter-command>set trash=\"imaps://imap.googlemail.com/[GMail]/Bin\"\n <delete-message>" "Gmail delete message"
macro index,pager gi "<change-folder>=INBOX<enter>" "Go to inbox"
macro index,pager ga "<change-folder>=[Gmail]/All Mail<enter>" "Go to all mail"
macro index,pager gs "<change-folder>=[Gmail]/Starred<enter>" "Go to starred messages"
macro index,pager gd "<change-folder>=[Gmail]/Drafts<enter>" "Go to drafts"
macro index,pager gl "<change-folder>?" "Go to 'Label'" # will take you to a list of all your Labels (similar to viewing folders).
edit the first lines to setup your gmail account info
Create a mail script in /home/pi:
cd /home/pi/
sudo nano mailIP
Paste the following (repalce YOURMAIL with full email address of where you want the email sent i.e. fred@hotmail.com):
 #!/bin/sh
 mailreciever=YOURMAIL
 today=$(date)
 #my_ip=`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{print $1}'`
 my_ip=`wget -q -O - checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'`
 my_pi="Domoticz RaspberryPi has rebooted! "
 message="Your Pi has rebooted at $today. Current IP address = $my_ip"
 echo $message > message.txt
 mutt -s "${my_pi}" ${mailreciever} < message.txt
The commented line fetches the internal ip, example fetches external ip.
Make sure the mailIP can be executed:
sudo chmod +x mailIP
Test the script by running it:
./mailIP
Setup rc.local to send the mail at each reboot: Edit /etc/rc.local:
sudo nano /etc/rc.local
Add this above the exit 0 line:
sudo /home/pi/mailIP & 
Make sure the rc.local can be executed:
sudo chmod 0755 /etc/rc.local
sudo bash
cp /home/pi/.muttrc /root


sudo nano /etc/watchdog.conf
Uncomment the lines file and change and set them to:
file                    = /tmp/domoticz.log
change                  = 300
This setting will restart the pi when domoticz.log hasn't been updated in 5 minutes, the time is in seconds (tested).
Be sure to remember this when stopping the domoticz service by hand!
and for new system , that do nothing yet, you can prevent unwanted reboot by adding a script like this :
cd /home/pi/domoticz/scripts/lua
nano script_time_domotizAlive.lua
commandArray = {}
print('Domoticz alive !')
return commandArray
It will update the log every minute.

Start the watchdog daemon



sudo service watchdog start