Setup for home automation server

So, setup for house server on Orange Pi Zero 512kB using:


Ignore my previous posts where I use WIN32DiskImager.  Seems it has fallen out of favour (and might be the root of all the other problems I was seeing??!!).

Use Etcher as directed on the site, as well as a good quality Class 10 SD card.

On Windows you will get a fright because dopey Etcher does not nominate your SD card as a drive number (J: for example on my PC) – heaven forbid.   So it takes a while to work out it is happily point ONLY at your SD card.

Given all the warnings about using WIN32DiskImager (and trashing your computer) it was a bit arrgh! of the authors of Etcher.   I think they are trying to be hip *yawn*.


I just notice the windoze drive letter on Etcher.  You have to swipe your mouse over a tiny group of pixels accidently for a hovering text to show up.

Once I saw that I did go back to the drive selection to find a very light gray “j” over a dirty white background in contravention I suspect of accessibility laws – if not plain old simply human factors and HCI design rules.  I am 50+ and have glasses (often smudged) so what can I say … I easily miss things.


Login into distro for first time and set up root and user accounts.

Setup static IP for your Orange Pi Zero using nmtui or nmcli (for power users).

Reboot and  then run:

apt-get update

Grab binaries for nodejs and install them:

tar -xf node-v6.10.3-linux-armv7l.tar.xz --directory /usr/local \
      --strip-components 1

Check install with:

node -v
npm -v

Use npm to install node-red with:

npm cache clean
npm install -g --unsafe-perm node-red

Test node-red out with:


Then go to your OPiZ static IP with your browser on another computer in your network.

1880 node-red Port

Next we are going to setup PM2 so as to start node-red as a service on boot:

npm install -g pm2
whereis node-red
node-red: /usr/local/bin/node-red
pm2 start /usr/local/bin/node-red \
      --node-args="--max-old-space-size=128" -- -v
pm2 save
pm2 startup
export PM2_HOME="/root/.pm2" # because I installed in root 
reboot #takes a while after rebooting but it should come up

Then go to your OPiZ static IP with your browser on another computer in your network – you should see node-red running.  Be brave, close the browser tab and re-open it, or refresh it.

Now let’s add erlang with:

wget &&
dpkg -i erlang-solutions_1.0_all.deb &&
rm erlang-solutions_1.0_all.deb


apt-get update && sudo apt-get install erlang erlang-dev elixir

Note you can leave elixir at the end of the previous command but emqttd following will rebuild elixir blindly over the top – bad citizen!

Now fetch and build emqttd:

git clone
cd emq-relx && make

Try out emqttd with:

cd _rel/emqttd && ./bin/emqttd console


18083 MQTT dashboard port

Go to your OPiZ static IP with your browser on another computer in your network – you should see node-red AND emqttd running.

Now let’s set up emqttd to start on boot:

cp -R emq-relx/_rel /opt/emqtt/
mkdir /usr/lib/systemd/system
nano /usr/lib/systemd/system/emqttd.service

---- inside of nano ----

Description=emqtt daemon

ExecStart=/bin/sh /opt/emqttd/bin/emqttd start
ExecStop=/bin/sh /opt/emqttd/bin/emqttd stop


---- exit and save from nano ----

chmod +x /usr/lib/systemd/system/emqttd.service
systemctl enable emqttd.service

I copy the whole _rel directory over to /opt because I tried moving only the bin directory BUT when I tried running it came up with an error.

Go to your OPiZ static IP with your browser on another computer in your network – you should see node-red AND emqttd running without having to login!




6 Responses to “Setup for home automation server”

  1. tkaiser Says:

    The difference between Win32DiskImager and Etcher is simple: Win32DiskImager does no verify so it allows you to burn garbage to an SD card while Etcher notifies you of problems.
    Etcher exists only for this reason (the folks behind it do and were just tired of having the same support situation again and again: people using crappy SD cards that cause all sorts of troubles later).
    Etcher is able to catch most of these cases so from a ‘user experience’ perspective it prevents you and others wasting time (‘others’ since ‘burning gone wrong’ or SD card crappiness is a totally useless ‘support case’ happening daily without Etcher)

    • Yep. Sounds good. But I am still trying to reconcile the problems I saw with a “bad” burn. I had burned SD a number of times, using win 32di, with both orangepi distro and distro before the behaviour post insertion of expansion card. The loss of nmtui, for example, the eventual loss of connection​ on start up. The same problem turned up on a second SD so it’s hard to argue two SD fragged the same way. Still, it is also hard to work blind in these instances. I have two more opiz coming so I will try with new boards that haven’t had expansion board inserted to be thorough.

      • tkaiser Says:

        Getting a serial adapter to connect to the 3-pin header is IMO essential for doing serious work on SBC. Check Armbian forum for recommendations please.

        Back to SD card issues: I know it sounds aburd but I ran two times in burning troubles that were not related to the SD card itself but ‘burning gone wrong’. April 2016 I burned SD cards like crazy working on Armbian improvements and ran into all sorts of weird behaviour (no ‘doesn’t boot’ issues but simply Linux doing stupid things, it felt just like software being horribly broken).

        I discovered that the card reader built into my Linux build host was somewhat broken (took me only some days searching for software issues until realizing that). No problem: So I used an external USB card reader on the USB front port of my build host again burning with dd. Ran into troubles after few days (same symptoms). Tried it burning again with USB ports on the back of the PC and everything worked. Obviously some connection/shielding issues leading to some bit flips leading to all sorts of weird symptoms later.

        That was the time were I decided to never ever use dd again but only Etcher any more. It simply saves time due to the integrated verify process (there are also some rumours it burns differently but I’ve no idea whether that’s correct or not)

      • Yeah. Everyone keeps telling me that I need a 3 pin serial connecter for opiz? Don’t get me wrong, I have 3n5 volt versions. I even dusted one off but I found, powering the opiz from usb hub, I had serial port on the usb connection

        As for strange behaviour, yep. I will use etcher as recommended. It just sounded like a product placement the way it was presented. That, and I have had no probs with SD cards like this b4. In fact, my parallella is running fine on a SD card that wouldn’t run on opiz – burned with win32di.

  2. Yeah, all the Armbian builds for the really small IoT boards (also NanoPi Air for example) have a serial console via USB/OTG. You can log in there but you miss early boot stuff (especially messages about FS corruption).

    And yes, the device in question might also be a bit picky about SD cards (the incompatible OPi 2G-IoT seems to be even worse here) but at least for me every SD card burned with Etcher later on also booted on the device (I’ve to admit that after losing a lot of time with crappy SD cards I only use some Samsung and SanDisk any more)

    Just as a reference:

    • Yep, I will relent and connect my serial gadget as I will like to confirm the SD problem is FS. At the moment, given the implied effect of expansion board insertion (causation being a tricky problem) I want to discount one or the other. Although, in the home server application, I am not fussed with the expansion board as I just wanted the box to keep it tidy.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: