Over the past six or seven years, I’ve managed to build-up quite a repertoire of Apple hardware products. As OS/X progresses, unfortunately, some of my older hardware just isn’t able to perform with the latest OS in a way that makes the machine useful. This, most recently, was an issue with one of my Mac Minis which happens to be a 2.1, 32bit model from 2007. I’ve been using this machine as one of my home automation servers and have been running Snow Leopard on it for a while. I decided that I wanted to give the machine new life by scrapping OS/X and installing Linux Mint.

If you’re reading this post then you, most likely, have already discovered that the process isn’t as simple as it sounds. For those that don’t know, Apple Macs use what is known as Extensible Firmware Interface (EFI) to handle the boot process rather than the older Basic Input Output System (BIOS) mechanism that has been around for so long and has been a staple on PCs until recently. The details of these two systems is beyond the scope of this article but suffice it to say that, unfortunately, most Linux distributions are not able to leverage the alternative architecture that controls/manages the boot process on these Mac machines.

The good news for us in our quest to install an alternative operating system on our Mac is that Apple has included a mechanism on its machines that allows it to present an emulated BIOS and a Master Boot Record (MBR) that Linux will need to install and boot. These are some of the features that are provided via Apple’s “Bootcamp” multi-boot system.

What We’ll Need

Really all we need is a copy of the Linux ISO for whatever distro we plan to install.

Many of the guides that cover this subject talk about using Unetbootin to install the Linux ISO to a USB stick. The idea is to then boot off of the USB stick and then perform the Linux installation. This has worked for me on 64bit Mac Minis but it did not work on my 32bit Mini 2.1. There are articles that claim to be able to force these machines to boot via USB but it’s just as easy to burn our ISO to DVD and boot/install from that.

Many of these same guides also talk of using rEFIt or rEFInd, but neither are needed to accomplish our goal of installing and booting Linux on a Mac Mini.

The Process

Note: Following these steps will not set up a dual boot instance of Linux on your Mac. These steps will completely remove OS/X from your computer.

Boot up your Mac Mini target into OS/X and then follow along:

Step 1: Download the 32bit version of the Linux Mint Mate ISO and burn it to a DVD.

Step 2: Pop the Linux DVD image into the Mini and reboot your Mac and hold down the option key (alt key on Windows Keyboards) being sure to select the Optical boot option from the list of available options. Don’t be surprised if it says Windows.

Step 3: Run the Linux Mint installer from the desktop, during the install, select use all space during the partition setup step.

Tweaks

For me, this process worked just fine. When I would reboot the machine, I would be presented with the normal Apple white / gray screen, I would hit enter a few times and Linux Mint would boot right up. I did notice that I had to press enter to force the boot. If I didn’t the computer would appear to lock-up.

After a bit more research, I discovered that I needed to tell the Mac to boot in BIOS mode rather than attempting a normal EFI boot. The easiest way to accomplish this is to insert a copy of your OS/X media into the Mini’s optical drive and reboot. In my case, it boots right up off of the optical drive but you may have to hold the option key down and select your optical drive as your boot option. Once the install screen comes up, select Terminal from the utilities menu and run the following command to determine which partition is your boot partition.

diskutil list

My boot partition was disk0s1. Once I knew this, I was able to issue the following command:

bless --device /dev/disk0s1 --setBoot --legacy --verbose

Much better! Now turning the computer on resulted in an instantaneous boot into Linux. Now I noticed that a warm boot would result in the computer just hanging on the white / gray screen just as before but a cold boot would work every time. The key to fixing this issue is to modify the reboot kernel parameter from its default of kbd to cold. To do this, I needed to modify the the GRUB_CMDLINE_LINUX_DEFAULT line in /etc/default/grub to include reboot=cold. In my case this modified line now reads GRUB_CMDLINE_LINUX_DEFAULT=“quiet splash reboot=cold”.

After making these changes, My Mac Mini would boot Linux Mint perfectly every time and is much much faster than it was when it was running OS/X!

A Couple of Gotchas

(1) When trying to go back and configure my Mac to “legacy” boot, I did notice that trying to boot off of my Mountain Lion DVD would not work. I didn’t try troubleshooting the issue but instead tried booting off of my Snow Leopard DVD which worked just fine.

(2) When I did my initial install, I did use the rEFIt Boot Loader. In an attempt to fix the lock-up I was experiencing, I issued the following command from a Linux terminal to change my partition table from GUID Partition Table (GPT) to the more common Master Boot Record (MBR).

mklabel msdos

This blew away the rEFIt Boot Loader and put me back to the default Apple bootloader. After reinstalling Linux Mint, I found that this change didn’t resolve or otherwise help the “hang-up” issue and therefore was a totally unnecessary step. This did show me, however, that using an alternative bootloader was unnecessary as the Apple bootloader works just fine.

Until next time – GEEK OUT!

~GT~

 

I’ve been building my home automation system for years and have achieved extensive lighting, climate, entertainment, security and entry control. Never satisfied, I’m forever pondering potential refinements that would enhance the overall effectiveness and capability of my system. I recently concluded that one of those refinements would involve automating the control of the natural-gas fireplaces in my home.

Let me interject here that one should exercise EXTREME caution before deciding to implement any kind of automated home controls such as those I will outline below!

The key to gaining control of a fireplace is to have some kind of automated ignition system. In my case, I had Skytech remote control systems installed on each fireplace when I built our home. This system makes starting and terminating a fire as simple as pressing a button.

Why
As I’ve built my home automation system, I have focused on centralization and ease of control. Most of the house can be managed through a central console, but the interface is also accessible from a myriad of other devices throughout the house. My motivation was to get rid of the “ugly” Skytech remotes and incorporate control of the fireplaces into the central control system. This is not only more elegant than the current system, it, more importantly, allows me to incorporate the fireplaces into my HA scenes. Another reason for implementing automated control of the fireplaces is safety. Imagine, if you will, that one of my children are the last to leave the house for the day and forgets to turn off a fireplace. With centralized control, the HA system can now automatically turn off all fireplaces when it senses that the house is empty or when the security system is engaged. Another scenario would be to automatically shut-off the fireplaces if the HA system senses a structure fire or if high levels of carbon monoxide are detected.

The Plan
Since I’ll replace the every-day use of the fireplace remotes with my centralized control system, I thought the easiest way to accomplish my goal was to use an Arduino and a couple of reed relays to simulate button presses on the remote.

Circuit Schematic

Circuit Schematic

Since my goal is to automate control, I decided to use an Ethernet Shield so I could make a simple URL call to turn a fireplace on and another call to turn a fireplace off.

The schematic above shows what I actually implemented.

The parts

  1. Breadboard
  2. 1 x Arduino Uno
  3. 1 x Ethernet Shield
  4. 2 x Reed Relays
  5. Spool of solid 22 AWG wire

The relays I had on-hand were NTE Electronics SPST NO R56-1D.5-6D, although the on-board diode contained in this model is unnecessary, these would work just fine for this application.

The Implementation
The key to accomplishing our goal is to open the remote and locate the buttons. In this case, the buttons are mini push button switches. I then turned the PCB over and located the pads for both the ON button and the OFF button. Once I knew where I needed to connect my relays, I then set up my soldering iron and proceeded to connect a six inch lead to two pads on each button and then put the remote unit back together.

Next I wired up my circuit:

ON Relay

  • Arduino PIN2 to relay PIN2
  • Arduino GRD to relay PIN6
  • Relay PIN1 to remote ON lead
  • Relay PIN7 to remote ON lead

OFF Relay

  • Arduino PIN3 to relay PIN2
  • Arduino GRD to relay PIN6
  • Relay PIN1 to remote OFF lead
  • Relay PIN7 to remote OFF lead

Now we need software to drive the circuit. The simple sketch below will tell the Arduino to engage our ON button relay, which should turn the fireplace on when 192.168.1.10/?RELAY=1 is called from an external application. Calling 192.168.1.10/?RELAY=2 will tell the Arduino to fire the off relay, which should turn the fireplace off.

#include <SPI.h>
#include <Ethernet.h>

// MAC address from Ethernet shield sticker under board
byte mac[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
IPAddress ip(192, 168, 1, 10); // IP address, may need to change depending on network
EthernetServer server(80);  // create a server at port 80

String HTTP_req;          // stores the HTTP request

void setup()
{
    Ethernet.begin(mac, ip);  // initialize Ethernet device
    server.begin();           // start to listen for clients
    Serial.begin(9600);       // for diagnostics
    pinMode(2, OUTPUT);       // relay on pin 2
    pinMode(3, OUTPUT);       // relay on pin 3
}

void loop()
{
      EthernetClient client = server.available();  // try to get client

    if (client) {  // got client?
        boolean currentLineIsBlank = true;
        while (client.connected()) {
            if (client.available()) {   // client data available to read
                char c = client.read(); // read 1 byte (character) from client
                HTTP_req += c;  // save the HTTP request 1 char at a time
                // last line of client request is blank and ends with \n
                // respond to client only after last line received
                if (c == '\n' && currentLineIsBlank) {
                    // send a standard http response header
                    client.println("HTTP/1.1 200 OK");
                    client.println("Content-Type: text/html");
                    client.println("Connection: close");
                    client.println();
                    // send web page
                    ProcessRequest(client);
                    Serial.print(HTTP_req);
                    HTTP_req = "";    // finished with request, empty string
                    break;
                }
                // every line of text received from the client ends with \r\n
                if (c == '\n') {
                    // last character on line of received text
                    // starting new line with next character read
                    currentLineIsBlank = true;
                } 
                else if (c != '\r') {
                    // a text character was received from client
                    currentLineIsBlank = false;
                }
            } // end if (client.available())
        } // end while (client.connected())
        delay(1);      // give the web browser time to receive the data
        client.stop(); // close the connection
    } // end if (client)

}

// process request
void ProcessRequest(EthernetClient cl)
{
    if (HTTP_req.indexOf("RELAY=1") > -1) {  // see if request is for the ON relay
        digitalWrite(2, HIGH);
        delay(1500);
        digitalWrite(2, LOW);
        cl.println("1");
    }
    
    if (HTTP_req.indexOf("RELAY=2") > -1) {  // see if request is for OFF relay
        digitalWrite(3, HIGH);
        delay(1500);
        digitalWrite(3, LOW);
        cl.println("2");
    }
}

That’s it!

If you have more than one fireplace, just add additional relays and modify the sketch accordingly.

Conclusion
This method worked like a charm! I didn’t have to remove the fascia from the fireplaces themselves to access and modify the electronic valve control system. This method also leaves the remotes fully functional even though they have a tethered connection to the Arduino. This allows me to use the remote to start a fire even if there is a power failure in the house and the HA system is inaccessible.

Last but not least, another benefit of this implementation approach is the fact that there is no permanent damage. When I decide to sell my home, I’ll just snip the leads off of each remote and the new owners can use the remotes the “old fashioned” way!

Until next time – GEEK OUT!

~GT~

 

I’ve worked with a LOT of genealogy software applications over the years and all of them have left me, for one reason or another, unsatisfied.

I started experimenting with The Next Generation of Genealogy Sitebuilding, also known as TNG, back in mid-2010, but really started digging deep into the application over the past few months. What makes TNG so unique is that it’s a web based app instead of a Windows or Mac fat-client application. I love this approach as it gives me total access to my data, and since the application is written in PHP and has a built-in Mod architecture and manager, it’s really, REALLY easy to extend the application to make it do things that it doesn’t do natively.

I’m currently editing a book for a particular line in my database and needed the Person and Group Sheets to include divorce information. Unfortunately the reports that ship with TNG 9, the latest version, do not support this. My first thought was to export a GEDCOM and import it into an application like Reunion, but without going into the details, I HATED the results. That led me to creating my own Mod to extend both the Person Sheet and Group Sheet PDFs to include divorce information.

To use the mod, save the code below or download this file to gt_sheet_v9.0.0.1.cfg in your tng/mods folder and then install like any other mod.

I’ve only tested the Mod with TNG V9, so I can’t speak to its compatibility with previous versions.

%name:GT Custom Sheet%
%version:V9.0.0.0%
%description:This mod will modify the person and group sheet pdf reports to add divorce information.%

%target:tngdblib.php%
%location:%
//Get most family data for a known spouse
function getSpouseFamilyDataPlusDates($tree, $spouse1, $spouse1ID, $spouseorder) {
    global $families_table;

        $query = "SELECT gedcom, husband, wife, familyID, marrdate, marrdatetr, marrplace, marrtype, living, private, branch,
                YEAR(marrdatetr) as marryear, MONTH(marrdatetr) as marrmonth, DAYOFMONTH(marrdatetr) as marrday, marrplace, sealdate, sealplace
                FROM $families_table
                WHERE $spouse1 = \"$spouse1ID\" AND gedcom = \"$tree\"
                ORDER BY $spouseorder";

    return dbExecuteQuery($query);
}

//Get most family data for a known spouse with unknown gender
function getSpouseFamilyDataUnionPlusDates($tree, $spouse1ID) {
    global $families_table;

        $query = "SELECT gedcom, husband, wife, familyID, marrdate, marrdatetr, marrplace, marrtype, living, private, branch,
                        YEAR(marrdatetr) as marryear, MONTH(marrdatetr) as marrmonth, DAYOFMONTH(marrdatetr) as marrday, marrplace, sealdate, sealplace
        FROM $families_table
        WHERE husband = \"$spouse1ID\" AND gedcom = \"$tree\"
        UNION
            SELECT gedcom, husband, wife, familyID, marrdate, marrdatetr, marrplace, marrtype, living, private, branch,
                                YEAR(marrdatetr) as marryear, MONTH(marrdatetr) as marrmonth, DAYOFMONTH(marrdatetr) as marrday, marrplace, sealdate, sealplace
            FROM $families_table
            WHERE wife = \"$spouse1ID\" AND gedcom = \"$tree\"";

    return dbExecuteQuery($query);
}
%end:%
%replace:%
//Get most family data for a known spouse
function getSpouseFamilyDataPlusDates($tree, $spouse1, $spouse1ID, $spouseorder) {
    global $families_table;

        $query = "SELECT gedcom, husband, wife, familyID, marrdate, marrdatetr, marrplace, marrtype, divdate, divplace, living, private, branch,
                YEAR(marrdatetr) as marryear, MONTH(marrdatetr) as marrmonth, DAYOFMONTH(marrdatetr) as marrday, marrplace, sealdate, sealplace
                FROM $families_table
                WHERE $spouse1 = \"$spouse1ID\" AND gedcom = \"$tree\"
                ORDER BY $spouseorder";

    return dbExecuteQuery($query);
}

//Get most family data for a known spouse with unknown gender
function getSpouseFamilyDataUnionPlusDates($tree, $spouse1ID) {
    global $families_table;

        $query = "SELECT gedcom, husband, wife, familyID, marrdate, marrdatetr, marrplace, marrtype, divdate, divplace, living, private, branch,
                        YEAR(marrdatetr) as marryear, MONTH(marrdatetr) as marrmonth, DAYOFMONTH(marrdatetr) as marrday, marrplace, sealdate, sealplace
        FROM $families_table
        WHERE husband = \"$spouse1ID\" AND gedcom = \"$tree\"
        UNION
            SELECT gedcom, husband, wife, familyID, marrdate, marrdatetr, marrplace, marrtype, divdate, divplace, living, private, branch,
                                YEAR(marrdatetr) as marryear, MONTH(marrdatetr) as marrmonth, DAYOFMONTH(marrdatetr) as marrday, marrplace, sealdate, sealplace
            FROM $families_table
            WHERE wife = \"$spouse1ID\" AND gedcom = \"$tree\"";

    return dbExecuteQuery($query);
}
%end:%

%target:rpt_ind.php%
%location:%
                if($rights['both']) {
                    $cite = reorderCitation($marriagerow['familyID']."_MARR", 0);
                    doubleLine($text['married'], displayDate($marriagerow['marrdate']), $text['place'], $marriagerow['marrplace'], $cite);
                }
%end:%
%replace:%
                if($rights['both']) {
                    $cite = reorderCitation($marriagerow['familyID']."_MARR", 0);
                    $citex = reorderCitation($marriagerow['familyID']."_DIV", 0);
                    doubleLine($text['married'], displayDate($marriagerow['marrdate']), $text['place'], $marriagerow['marrplace'], $cite);
                    doubleLine($text['divorced'], displayDate($marriagerow['divdate']), $text['place'], $marriagerow['divplace'], $citex);
                }
%end:%

%target:rpt_fam.php%
%location:%
        // married
        if ($frights['both']) {
            $cite = reorderCitation($familyID."_MARR", 0);
            dateLine($text['married'], displayDate($fam['marrdate']), $fam['marrplace'], $cite);
        }
%end:%
%replace:%
        // married
        if ($frights['both']) {
            $cite = reorderCitation($familyID."_MARR", 0);
            $citex = reorderCitation($familyID."_DIV", 0);
            dateLine($text['married'], displayDate($fam['marrdate']), $fam['marrplace'], $cite);
            dateLine($text['divorced'], displayDate($fam['divdate']), $fam['divplace'], $citex);
        }
%end:%

Until next time – GEEK OUT!

~GT~

© 2012 Geek-Tips Suffusion theme by Sayontan Sinha