Rachel's Yard

| A New Continuation
Categories Technical

(This is one of many parts series on dominating the world with Siri.)

Back when I moved into this house in August, I had to have the old garage door openers replaced... Let's just say that they were very very very old. So I contacted a local contractor (support local business!) for installation, and unfortunately, because my garage door is an one-piece door (instead of a sectional door), he recommended me using a screw drive garage door instead of belt drive, and that limited my options for the motor. Needless to say, the garage door opener was not very smart...

That means I have to use the dreadful HomeLink in our cars to control them. Not very fun. I originally had the idea of controlling it with a Raspberry Pi, but it was thrown to the back of my head...

Fear not, the DREAM IS ALIVE!

initial commit

^ That's the Raspberry that we are gonna use for the hub.

Hi

^ At least the camera works. The popular Homrbridge plugin homebridge-camera-ffmpeg currently does not have audio, so I modified the plugin and optimized it for RPi. More importantly, there's sound!

I have no idea what I'm doing

^ I literally have no idea what I'm doing... I know that you need a relay, a magnetic switch, and some jumpers... But that's all. I have NO IDEA how to wire them... (Story of a software gurl...) Special thanks to Ben La Monica for creating this awesome plugin!

Remote control

^ Time to take apart the remote... The garage door openers do have the wall-mounted ones, but I don't want to ruin those...

(This is when my friend Niraj comes over and help me with this... Kudos to the EE guy.)

magnetic switch

^ Let's try the magnetic switch... It works, of course... As Niraj said, this is the easiest part.

relay

^ Annnndddd the relay works, no problem!

It works, I have no idea why. It doesn't work, I have no idea why.

^ In theory, once I hook up the circuit from the remote to the relay COMM and NO, closing the relay should work, but.... It didn't. Debugging took like 3 hours, and it turned out to be interference? Anyway...

dessert!

^ Need to make myself feel better with dessert...

HomeDepot

^ Need to make a quick trip down to Home Depot... Just realized that I can't find my multimeter, and my soldering iron was trashed...

Niraj the boi

^ Once we figured everything out, time to solder... And I'm a terrible at soldering... Time for Niraj the big boi!

Finished product

^ Finished product! Don't ask about the Dremel on the table... It was something stupid...

Lovely

^ Look at this thicc boi

Annnnnd it's 1AM already, so we will do the sensor and wiring the next day (also we need to move the cars around which is annoying...)

Garage Hub

^ Garage Hub in its natural habitat (with the sensor hooked up).

interference

^ Again, I have to move the remote further away from the box... Because interference.

And there you have it, Open Sesame:

Open Sesame


Future Roadmap

Currently, I can only open/close one garage door at a time, due to the limitation of the remote (you can't press two buttons at the same time). I might get two one-button remote so it can control both door at the same time.

(This is one of many parts series on becoming the ultimate Apple fanboi/fangurl.)

Recently I've acquired a HomePod for the bomb ass speaker (trust me, it's better than Sonos), and for its Home Hub so I can automate all the things, and I can access my stuff at home remotely.

thicc boi

I have a bunch of TP-Link switches and bulbs, but sadly, it doesn't have first-party support yet. Fear not, homebridge is here for the rescue...

Home.app


However, I do have an old Bluetooth spekaer (Big Blue Live) that needs some AirPlay love... Trip down to Fry's, get a Raspberry Pi and a case, and go to town...

We want to accomplish this:

1
iPhone <-> AirPlay <-> RPi <-> Bluetooth <-> Blue Blue Live

Here are the dead simple steps to follow... I'm on Raspbian Stretch Lite, and I highly recommend Stretch (Debian 9). YMMV.

  1. Upgrade your Raspberry

    1
    2
    3
    sudo apt-get update
    sudo apt-get dist-upgrade
    sudo rpi-update

  2. Install PulseAudio as ALSA is no longer maintained

    1
    sudo apt-get install pulseaudio pavucontrol pulseaudio-module-bluetooth

  3. Compile and install the development branch of shairport-sync. Please also compile shairport-sync with Apple alac support (--with-apple-alac), PulseAudio support (--with-pa), and SSL support. I use PolarSSL for its "lightweight-ness" (--with-ssl=polarssl). Configure with ./configure --with-pa --with-avahi --with-systemd --with-apple-alac --with-stdout --with-ssl=polarssl --with-metadata --with-soxr, and install whatever missing libraries on your way...

  4. Fix your permission. policykit-1 should already be installed when you install pulseaudio, and you need to add pi to the group bluetooth and lp. Reboot for shits and giggles after you are done.

  5. Now you should able to pair without running as root. Run bluetoothctl:

    1
    2
    3
    4
    5
    [bluetooth]# agent on
    [bluetooth]# scan on
    [NEW] Device xx:xx:xx:xx:xx:xx Big Blue Live
    [bluetooth]# pair xx:xx:xx:xx:xx:xx
    [bluetooth]# trust xx:xx:xx:xx:xx:xx

But don't connect yet. We don't need to connect manually.

  1. Disable the built-in DAC on Raspberry Pi by commenting out dtparam=audio=on under /boot/config.txt, reboot for shits and giggles

  2. Configure shairport-sync at /usr/local/etc/shairport-sync.conf

    1
    2
    3
    4
    5
    6
    7
    8
    general =
    {
    name = "AirPlay Pi"; // This is going to be the name shown to your devices
    interpolation = "soxr"; // Despite what the configration said, RPi is more than powerful to handle soxr
    output_backend = "pa"; // this should not need explanations
    drift_tolerance_in_seconds = 0.010; // might as well
    alac_decoder = "apple"; // use alac decoded
    }

  3. Configure auto connect. Put the following to a file, and set appropriate permissions:

    1
    2
    3
    4
    5
    6
    7
    #!/bin/bash

    sleep 5

    /usr/bin/bluetoothctl << EOF
    connect xx:xx:xx:xx:xx:xx
    EOF

  4. systemd madness. Put the following to /etc/systemd/system/bt-connect.service:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    [Unit]
    Description=Connect to BT speaker
    After=shairport-sync.service

    [Service]
    Type=oneshot
    ExecStart=/path/to/the script in step 8
    RemainAfterExit=true
    User=pi
    Group=pi

    [Install]
    WantedBy=multi-user.target

  5. sudo systemctl daemon-reload and sudo systemctl enable bt-connect

VoilĂ , now you should have a functional AirPlay -> Bluetooth Raspberry Pi.


Possible issues

PulseAudio might not use a2dp and uses headset profile by default, resulting in a very horrible audio quality... If that's the case, shutdown shairport-sync, and run pulseaudio --start. Then run the script in Step 8 to connect to your speaker. Run pactl list sinks to identify, and run pactl set-card-profile <id> <a2dp or a2dp_sink>. Afterward, kill pulseaudio with pulseaudio -k and restart shairport-sync, also run script in step 8 to reconnect.

Update 1: E3-12xx v4 has a lead time of 4 weeks from Asia via ACME, no source via Superbiiz

So I've been looking at Paperspace.io and Sixa.io for virtual desktop solutions, and it does look very appealing. However, is it possible to run it in a home-lab environment?

Currently, I have a XenServer running on my E5-1650v3 node (256GB) and Apache Guacamole for vdi. I do want to enable some sort of GPU capabilities (like for my Jetson TX2 training, but I will use Sixa.io for now; my workstation has a very shitty support for Linux). Looking at XenServer's HCL, and Intel seems to be a promising solution...

However, Intel is being a stupid asshole. E3-15xx v5 are available only in BGA. (WTF?) and E3-12xx v4 are not available anywhere except very special order. I was able to find v5 but only in Asia (none available in North America). What the fuck?

But, the Skull Canyon NUC does have a Iris Pro processor and unofficially supported by XenServer...

Here's the pricing as of the time of the writing:

pricing

next
1 2 3 ... 14
Weightless Theme
Rocking Basscss
RSS