Posts Tagged ‘automation’

Dell Edge Gateway 3000 Series Are Powered by Intel Bay Trail-I SoCs for Automation, Transportation, and Digital Signage

March 17th, 2017 No comments

Dell has recently introduced Edge Gateway 3000 series with three models powered by Intel Bay Trail-I processor, running Ubuntu Core 16 or Windows 10 IoT, with each model targeting respectively general-purpose automation, transportation & logistics, and digital signage and retail.

The specifications for the three models can be found in the table below.

Dell Edge Gateway 3001
Model for General-Purpose Automation
Dell Edge Gateway 3002
Model for Transportation & Logistics
Dell Edge Gateway 3003
Model for Media & Retail Kiosks
SoC Intel Atom E3805 dual core processor  @ 1.33 GHz (3W TDP) Intel Atom E3815 single core processor @ 1.46 GHz with GPU @ 400 MHz (5W TDP)
System Memory 2 GB DDR3L-1066
Storage 8 or 32 GB eMMC flash
Industrial-grade Micro-SD card: 8GB / 16GB / 32 GB / 64 GB
Connectivity 1 x 10/100 Fast Ethernet (RJ-45)
with PoE (15.4W)
WiFi 802.11 b/g/n
Bluetooth 4.0 LE
Optional ZigBee module.
2x 10/100 Fast Ethernet (RJ-45), main port supports PoE (15.4W)
WiFi 802.11 b/g/n
Bluetooth 4.0 LE
Integrated Zigbee/802.15.4 module for mesh
2 x 10/100 Fast Ethernet (RJ-45).
Main port supports PoE (15.4W)
WiFi 802.11 b/g/n
Bluetooth 4.0 LE
Optional ZigBee module
Cellular Connectivity 3G or 4G LTE for select countries, US/Canada 4G LTE with AT&T or Verizon
Video & Audio DisplayPort 1.1 up to 2560×1600@60Hz
3.5mm Line Out/Line
In; RealTek codec
Serial Interfaces 2x RS-232/422/485.
GPIOs 8x channel, independently
programmable, DAC, ADC.
CAN Bus CAN2.0 A/B/FD 1Mbps (CAN2.0), 5Mbps (CAN-FD)
USB 1x USB 2.0, 1x USB 3.0
GNSS Integrated GPS
Sensors Accelerometer, Pressure, Temperature and Humidity
Power Supply 12V-57V wide DC input;
PoE compliant with IEEE standard up to 15.4 W, 48 V over existing Ethernet infrastructure, no
modifications required.
Dimensions 125 mm x 125 mm x 51 mm
Weight Around 1.1 kg

While all three models can run Ubuntu Core 16 and Windows 10 IoT Enterprise LTSB 2016, the latter requires a 32GB eMMC flash. Each gateway also comes with a Trusted Platform Module (TPM) 2.0, secure boot, BIOS password and I/O port disablement, and a fleet of gateway can be managed via Dell Edge Device Manager (EDM) cloud-based manageability suite (sold separately).

Gateway 30001 used for Mining Operations – Click to Enlarge

The gateway can be used for all sort of applications from mining management systems as shown above, to 18-wheelers, and revenue generating city fountains.

Dell Edge Gateway 3000 series will start selling this May for $399 and up. More details can be found on Dell website.

$12 AI Light ESP8266 based WiFi RGB Light Bulb Supports MQTT via ESPurna Open Source Firmware

March 3rd, 2017 20 comments

AI-Thinker is famous in the maker world for their ESP8266 modules, but they’ve also recently launched a WiFi RGB light bulb that sells for about $12.5 and up on Ebay and Aliexpress (here and there). Some people noticed, and bought samples online, including Xose Pérez (aka Tinkerman), ESPurna open source firmware developer, who could confirm ESP8266 was used in the light bulb, did some investigations, and eventually added the light bulb into ESPurna, which means it can be managed using MQTT or a web interface.

AI Light looks very similar to Philips Hue, but comes with WiFi instead of Zigbee. AI Light “M1636” key features:

  • RGBW LED E27 bulb with 16.7M colors
  • Connectivity – 802.11 b/g/n WiFi
  • Encryption – AES
  • Voltage Range – 110-240V
  • LED Power – 5 watts
  • WiFi Power Consumption – ≤0.3W
  • Temperature Range – -5~45degree
  • Humidity – ≤80%
  • Certifications – FCC, CE, ROHS

If you’re going to use the stock firmware, you can control the LED with Tuyasmart Android app. You’ll find the user’s manual and more photos on the FCC page for the light bulb. But there are already plenty of Wifi light bulbs on the market,  and what makes this light bulb interesting is that it’s based on ESP8266, and you can have full control over it using open source firmware.

The bulb cap is allegedly very easy to pop out, as it’s not glued to the board.A close up on the board itself reveals it’s indeed powered by Espressif ESP8266EX WiSoC connected to a 1MB Winbond 25Q80BVSIG flash, and MY-Semi MY9291QD LED driver.

Click to Enlarge

If you look from the bottom left to middle left of the inner circle, you’ll see 3V3, GND, RX, TX and IOO pads, which we can use after soldering some wires, and connect a USB to TTL board in order to flash the firmware. Note that IOO must be connected the GND to enter flash mode, you can remove the wire after flashing, in order to check the serial output during a normal boot.

After further investigation, Xose found out that there’s already some software implementation for MY9291 driver in Noduino OpenLight project, made by the developers who designed Noduino ESP8266/ ESP32 boards, and are likely the developers of AI Light. All needed source code can be found in Noduino-SDK released under a GPLv3 license, and includes a driver written in C language for MY9291 LED driver chip. Xose wrote a wrapper to make the driver work with Arduino ESP8266, and released the code on Github.

The code sample below shows how to set the LEDs to RED color at 100% duty cycle:

Ai-Thinker Ai Light / Noduino OpenLight have now been added to ESPurna 1.6.8 firmware, and you can turn the light on and off, select the color from the web interface, and/or control it via MQTT.

ESPurna installed on AI Thinker Light Bulb – Click to Enlarge

Karl’s Home Automation Project – Part 2: 433 MHz / WiFi MQTT Bridge, Door & PIR Motion Sensors

March 2nd, 2017 11 comments

Karl here again for part 2 of my home automation project. We will be looking at how to automate your lights based on time of day and motion. In the first part we setup Home Assistant and uploaded firmware to basic Sonoff Wifi switches. Today we will setup a 433 MHz to MQTT bridge and some sensors.

433 MHz

Depending on your country 433 MHz is an open frequency to use to communicate with. There are hundreds of different types of devices that use 433 MHz to communicate information. We will be focusing on 2 today from Gearbest: WMS07 motion sensor (left) and WDS07 door/window sensor (2 parts, right).

I am not taking the door/window sensor apart, since it is super basic, but I’ve included some photos of the PIR motion detector.

Click to Enlarge

Click to Enlarge

433 MHz Bridge

While contemplating how to get presence on a per room basis I ran across this project. It monitors 433 MHz signals and publishes it to the MQTT server. It is a really an easy project. It also has an IR to MQTT feature. I did have an IR receiver and tested it but have not implemented it. He has some good instructions on his page so I won’t go over too much. You can do the bare bones version and just leave off the unused sensors. I also went an extra step and added a light intensity sensor and DHT sensor to the project. It can be found here. I am not going to add those to this write up because trying to keep costs down.

What you will need is

  1. NodeMCU $5.69
  2. H3V4F Receiver Module $1.21
  3. Prototyping board $2.88

That is all that is needed. For about $10 you have an inexpensive 433 MHz bridge. You can put in a box if you want and hide it in a central location away from interference. I would suggest soldering headers to your board just in case something goes bad. I didn’t at first and made my life a pain. There are a ton of 433 MHz receivers. I purchased all the ones on Gearbest and this is by far the best. I did upgrade to a superheterodyne but I am not sure it is any better. I upgraded because I wanted to put the door sensor on my mailbox and get a notification when the mail was delivered. It is about 200’ away and is a little spotty even with a new 433 MHz receiver. I used this antenna design (see picture on right), as it seemed to work the best

Coverage is the biggest concern.  I have a brick single story ranch style home about 2000 square feet and it covers the inside with ease and a lot of the area around the house. If you have a multi-story house or would need multiple receivers you would need to change the MQTT topics to avoid getting duplicates. Below is the final project. To be honest temperature is really the only thing that is useful to me, but wanted to see what could be done. I purchase the DHT11 and the readings are not good. If you want to do this go with the DHT22. Below is a mostly loaded bridge. I don’t have an infrared transmitter yet. I have a different one coming that does the encoding/decoding on a chip and will follow up when I receive it. I am hoping it will be easier/better than using the Arduino library.

Motion Sensor

The motion sensor itself is really easy to setup with jumpers. I suggest turning the LED off, and the time to 5 min after finished setting up with the jumpers. If you notice there is a micro switch in the top left of this picture. It is meant to be a tamper switch but I use it as a toggle switch to quickly turn off the lights. The motion sensor is meant to be used for a security system but I just have them sitting on night stands and corner tables. It works really well to override or turn a light on when Home Assistant ignores the motion. A little squeeze of the box and the light will toggle states on or off.

After your bridge is set up and connected take the motion sensor out and put some batteries in it. Run your batch file to see what code is being sent. For this one we need 2: motion and tamper. Write these codes down.

Home Assistant

Below is the YAML code that I am using with Home Assistant. I made it find and replace friendly. If you copy and find the 4 items below it should work. I think it is relatively easy to follow. It is the typical timed lamp on motion that is on Home Assistant website with some slight modifications. I had to add the turn off motion script because the motion sensors only sends when it senses motion. I also had to add the tamper toggle switch. When you are adding multiple sensors you can only have one “binary_sensor:” group and one “automation:” group etc.

Find/Replace Explanation
generic use livingroom or masterbedroom etc no spaces
5555555 use the motion number you found earlier
8888888 make up a number around your tamper/motion number
9999999 use the tamper number you found earlier.


Door Sensor

For the mailbox sensor here is an example. Same thing on this one run the batch file and find the open and closed codes. I have it send me a notification via pushbullet.

Almost there

We are almost there. Lights are turning on and off magically. Life is good. But there is one situation where it’s not so good. The gloomy day. With the automations above we cannot determine if the blinds are pulled or it is gloomy. We still need the lights to come on under those circumstances to make it really cool. In the next installment we are going to take the motion sensors above and add a light intensity sensor to them. We will be able to do this cheap. We still have a pretty good budget. With the bridge above you open yourself to a bunch of battery operated sensors. You can also control devices, as well, with a transmitter. Any of the transmitters should work on GearBest. You can get the one linked and throw away the receiver. It’s only $1.25.  If you have any questions or concerns feel free to leave a comment.

Item Qty Price Total
Initial Setup Sonoff Basic 5 $4.85 $24.25
Headers 1 $1.50 $1.50
USB to TTL 1 $2.54 $2.54
Motion Sensors NodeMCU 1 $5.69 $5.69
H3V4F Receiver 1 $1.21 $1.21
Prototyping board 1 $2.88 $2.88
Motion Sensor 4 $7.03 $28.12
Grand Total $66.19

Karl’s Home Automation Project – Part 1: Home Assistant & YAML, MQTT, Sonoff, and Xmas Lights

February 27th, 2017 24 comments

Karl here. I am here to write about my home automation project. First thing I want to say is that I am very cost conscious and I don’t mind putting in extra effort into the setup of things to keep costs down. I did invest a lot of time and had to do a lot of reading to get my project going. It took while and I received a lot of groans from my wife while testing. I am still in the process of tweaking things.

I started watching a series of videos on YouTube from Bruh Automation. He introduced me to Home Assistant. It got me really excited. He uses a Raspberry Pi as a server but I already had a Wintel Pro CX-W8 Smart TV Box which I use as a server. I run 3 Minecraft Servers, Emby Server, iSpyConnect DVR (2 IP Cameras), Unifi wifi controller, and now MQTT Server, and Home Assistant. Below is screenshot of mostly idle.

If it weren’t for iSpy it would be around 5-10% most of the time. Emby transcoding is the only thing that is stressful and it is not used much. The reason I mention this is because after purchasing a Raspberry Pi with power supply and case, you are not far off from getting a z8300 box. Only downfall is dreaded Windows update auto reboot. I finally looked into it and disabled it. If you decide to use a Windows box, I would make sure you are running 64bit windows. One advantage to using a Raspberry Pi is there is an image on Home assistant with the basics pre-configured and just need to write it to an SD card.

Server side Setup

I won’t go into too much detail on server side, as I installed Python, Mosquitto, and Home Assitant (I followed the guide on their site for Windows)

Python was a breeze to install and just ran the executable and went with defaults. I already had it installed for something else and I am running 3.5.2 64-bit. There are newer versions now. Mosquitto was the most difficult. I followed this guide but substituted Win32OpenSSL_Light-1_0_2j.exe approx 2MB. A k version is available now. Home assistant was easy and used pip.

Christmas Lights

It was a little before Christmas when I started researching home automation. I had been reading about these inexpensive Sonoff devices here on CNX and I found a project on Github for some custom firmware by arendst that enabled them to be controlled by MQTT. (While getting the link it looks like a new project has started with some additional features here). My wife really likes decorating for Xmas and we have 3 trees and lots of lights. She mentioned getting some timers and boom I had my opportunity and ordered them the same night. After receiving It took me a couple nights and I had a simple automation turning Xmas lights on and off at specific times and life was good. I got an extra one to play with until Xmas was over. I redeployed the rest  around the house after Xmas.


I really had no idea what this was and it took me a while to grasp. You can use a cloud based MQTT if you would like, but I prefer to run my own. MQTT is a service that relays messages between devices. There are 2 main items topics and payloads. To be able to tell a switch to turn on you send payload “on” to a topic, for example, “cmnd/testbench/power”. The light turns on and it replys back to a topic “stat/testbench/POWER” confirming that the light is on and the message is received. Because we are sending “on” to the topic each device using MQTT will need its own topic. Topics are case sensitive. I made a batch file to subscribe to all topics for troubleshooting so I could monitor the messages. The # indicates all sub topics.


I picked the Sonoff basic but there are also different varieties that add additional features which are supported by arendst software.

Arendst  has been very active with this project and adding/tweaking daily. When I first flashed the device, I did find a defect and notified him and he had it fixed and uploaded within the hour. He has very detailed instructions on the Wiki. First step before flashing is soldering headers. (I link to bent headers…which I initially thought I made a mistake but turned out it was good. They are easy to straighten) A USB to TTL adapter is also needed to upload from Arduino IDE. I recommend one like this because it provides both 3.3 and 5V.  After downloading and setting Arduino up, I only set my WiFi password and SSID in the sketch. After it boots the first time, it connects to your wireless network. Find the IP address in your router, and pop the IP address in your browser to finish the configuration. Set the MQTT server credentials and topic and your done. I never setup credentials on the MQTT server so it accepts any login. Finally after everything is programmed you need to connect it to mains. Beware do not connect mains while TTL is connected.  I bought some extension cords locally. Cut them in half and stripped back a ¼ inch of the insulation. Extension cords use stranded wire so I tinned them with solder to avoid any stray strands from shorting out. Then I screwed them down on the terminals making sure polarity was correct.

Click to Enlarge


YAML is unforgiving. It is the formatting that you configure Home Assistant in. A single space will stop Home Assistant from starting. Luckily on this last update if you restart Home Assistant through the browser it will test the configuration file before actually restarting. I purposefully put an extra space on line 54 to show it is easy to find any mistakes.

Click to Enlarge

I also recommend Notepad++ for editing in windows. You can break your configuration down into different files but I like one. Notepad ++ allows you to collapse the parts you aren’t currently working on.

I recommend adding one thing at a time and restarting to make it easier to find errors. And making a copy of the last working config before adding more. In the config below there are 5 sonoff’s and an automation to turn the lights on and off at specific times. This is extremely basic. I also recommend setting up one new device and be conscious of naming. When you get your config working properly on your first new device I copy the config to a new blank text window and do a find/replace.

Below is the screen capture of collapsed parts, and and full config (minus personal info).

Notice the test bench is on later firmware and the MQTT topic is slightly different

Next Steps

So now I have a smart home, right? Not in my opinion. I can turn lights on and off with a schedule or with my smart phone or at the light by pressing the button on the Sonoff. To me this is not smart. Setting a schedule is OK, but then you have the lights on unnecessarily and wasting electricity. Only real option is to press a button on the Sonoff but what difference is that than flipping a switch. Taking your phone out takes way too long, and I feel like it is going backwards. Below are estimated costs so far. By far the Windows Box will be the most expensive part if you choose to go that way. You can re-purpose just about anything that runs Linux to be a server. One other option is to run Linux on an S905x.

Money Spent

Cost of server not included nor shipping.

Item Qty Price Total
Sonoff Basic 5 $4.85 $24.25
Headers 1 $1.50 $1.50
USB to TTL 1 $2.54 $2.54
Total $28.29

If you find this entertaining or want me to go more in depth on a specific aspect let me know in the comments. I have been finding my time setting it up very satisfying. I am able to do some hardware and software work. I hope this might get your interest in home automation going, and find out it is not hard nor expensive. I would like to state none of the products linked were provided by the sites. I purchased with my own money.

The plan right now is to do a 3 part post. In the next post, we will integrate some inexpensive motion sensors and door sensors using 433mhz, then finally modifying the sensors to include a light intensity sensor.

22€ Olimex ESP32-EVB ESP32 Development Board Features an Ethernet Port and Relays

February 10th, 2017 3 comments

We already have a good choice of ESP32 development boards, but none of the ones I’ve seen make use of the Ethernet MAC interface found in Espressif ESP32 SoC. Olimex has changed that with their ESP32-EVB featuring ESP32-WROOM32 module as well as one Fast Ethernet port and two relays.

Olimex ESP32-EVB specifications:

  • Wireless Module – ESP32-WROOM32 module with 802.11 b/g/n WiFi and Bluetooth LE
  • Wired Connectivity – 10/100M Ethernet RJ45 port
  • External Storage – micro SD slot
  • Relays – 2x 10A/250VAC relays
  • Expansion
    • 40-pin GPIO female header (2.54mm pitch)
    • UEXT connector for sensors and modules
  • Misc – 2x user buttons
  • Power Supply
    • 5V power jack
    • LiPo charger and step up converter allowing ESP32-EVB to run from LiPo battery

The company still have to write software samples, and do some testing to make sure the board work before going into mass production. Once everything is cleared, the board will be sold for 22 Euros.

Barionet 1000 DIN Rail Programmable I/O Controller Runs OpenWrt

February 9th, 2017 1 comment

Barix, a Swiss company specializing IP- based communications and control technology, has introduced a new Barionet programmable I/O controller with Barionet 1000, the first model of the company to run Linux, and in this case OpenWrt, and to offer WiFi and USB connectivity.

Barionet 1000 specifications:

  • Processor – Undisclosed
  • System Memory – 64MB RAM
  • Storage – 16MB flash
  • Connectivity – 10/100M Ethernet, Wi-Fi 802.11 b/g/n; IPv4 & IPv6 support.
  • USB – 2x USB Host Ports
  • Serial – 1x DB9 RS-232 serial port
  • User programmable I/Os
    • 2x relay outputs (30 VDC max, 5 A)
    • 4x open collector digital outputs (4 x 24 VDC, 0.3 A)
    • 8x contact closure inputs (0 – 15 V), including 4x 12-bit analog inputs (0 – 15 V)
    • 1-wire interface for 18DS20 temperature sensor
  • Misc – 11 LED status indicators
  • Power Supply – 9 to 30V DC (2.5 Watts max)
  • Dimensions –  103mm x 85mm x 31mm; plastic DIN Rail Case
  • Temperature Range – Operating: 0 to +50°C; Storage: 0 to +70°C
  • Certifications – CE (A&B), RTT&E, FCC (A&B), RoHS

They also have another similar model, named Barionet 1100, which adds RS-485, an RTC clock, Wiegand capability, and “future optional internal interface” for LoRa. Hardware & software documentation appears to be missing for now, but they’ll certainly update their Wiki, like they did for their previous models.Typical applications for the system include access/door control, environmental monitoring, photovoltaic power management, temperature monitoring & logging, and HVAC control.

Pricing and availability of Barionet 1000 have not been announced, but for reference, the older Barionet 50 is currently selling for $189, so the new model should cost more with the extra features. Barionet is currently showcasing their products at ISE 2017 (Integrated Systems Europe) in Amsterdam, Stand 8-N270. Further details may be found on the product page.

Via LinuxGizmos

How to use Sonoff POW with ESPurna Firmware and Domoticz Home Automation System

January 21st, 2017 10 comments

Sonoff POW is an ESP8266 based wireless switch with a power meter that comes pre-loaded with a closed-source firmware that works with eWelink app for Android or iOS by default. But we’ve also seen Sonoff POW, and other Sonoff wireless switches from the same family, can be flash with open source firmware supporting MQTT (Message Queuing Telemetry Transport) lightweight messaging protocol such as ESPurna, and I initially sent data from Sonoff POW to ThingSpeak via an MQTT broker (mosquitto) to draw some pretty charts. I did that with the switch connected to a lightbulb, but I’ve since installed Sonoff POW in my office to measure the room’s power consumption minus the ceiling light and aircon as shown below.

Wall Mounted Sonoff POW WiFi Switch – Click to Enlarge

Sonoff cable mechanism is really a pain for hard copper wires, as they are hard to push inside the mechanism, and something come out. I finally managed by it took longer than expected to install. I had to cut the mains cable, and rewire the gang box too. The good thing is that I did not need to drill a hole in my wall, as the device is very light.

I could see the power value updated in ESPurna web interface, depending on the load on my computer, and whether I turned on or off other devices. That’s all good, but instead of using ThingSpeak, whose open source implementation is not updated, I decided to try Domoticz, and already wrote a short guide showing how install Domoticz in NanoPi NEO ARM Linux development board. I had not gone through the setup yet, as I had to study a little more, and upgrade Sonoff POW firmware first. I also planned to use vThings CO2 monitor with Domoticz, but canceled since it can’t be configured remotely, and a USB connection is needed.

ESPurna OTA Firmware Update

So I’ll focus only on Sonoff POW in this post, and first we need to update the firmware since Domoticz support is only recent. I’ll assume you have already followed the post entitled How to Build and Flash ESPurna Open Source Firmware to Sonoff POW Wireless Switch.

First we need to update platformio and ESP8266 development platform to the latest version otherwise we’ll get some build issues:

I updated the source code with git pull, but for whatever reasons the build failed, even after cleaning the code. So I did what any developer with enough experience would do in that case: start with a fresh check out ;), and rebuild the OTA firmware from there:

In order to update the firmware over the network, you’ll need to change sonoff-pow-debug-ota section in platformio.ini with your own IP address (upload_port) and password (in upload_flags) used in ESPurna web interface:

Once it’s done, you can upgrade the firmware, and then the file system as follows:

The Sonoff POW will reboot, and cut the power for about 2 seconds after both updates. My Sonoff POW is controlling my computer power, but that’s OK since I’m behind a UPS. Now I can access the web interface, and one of the improvement is that you’re being asked to setup a new password right after the update.

Click to Enlarge

I was then redirected to the Status page showing power, voltage (a bit low?), current, and power factor.

Click to Enlarge

I then jumped to MQTT menu to set the IP address to my NanoPi NEO board, and clicked Update.

Click to Enlarge

There’s a new DOMOTICZ menu which we’ll check out a little later.

Installing and Configuring MQTT in Domoticz

ESPurna communicates with Domoticz via MQTT, so the first task was to follow and adapt Domoticz MQTT wiki.

First login to your Domoticz server (NanoPi NEO) and access a terminal window to update the packages, install npm, node.js, Node RED, and mosquitto:

We then need to go to the Hardware page in Domoticz and configure a new “MQTT Client Gateway with LAN Interface” as shown in the screenshot below.

Click to Enlarge

We can test whether it works or not by creating a new Dummy device in the same Hardware section

Then click on Create Virtual Sensors, to add a new Temperature sensor which we’ll call Fictive Temp.

Now go to the list of Devices (Setup->Devices) to check the idx value (1 in our case), and a publish a MQTT message to update the temperature value of our virtual sensor:

The temperature switch from 0 to 25°C. Our installation is working. Great!

Using Sonoff POW with Domoticz

In theory, we should be able to get two type of data for Sonoff POW: relay status and power levels. However, after looking at ESPurna source code, domoticz.ino only seems to handle the relay status that can be changed from Domoticz web interface, but the power values are only send in pow.ino to the MQTT server, with data not directly compatible with Domoticz. Maybe I missed something as Tinkerman – ESPurna developer – can use Sonoff SC to send temperature data to Domoticz. Alternatively, it might be possible to convert that data somehow with Node RED, but that’s something I’ll try later. So today, I’ll only try to control the switch from Domoticz.

To do so, I created another Dummy device called Sonoff POW Switch, and from there, another Virtual Sensor of Switch type.

Click to Enlarge

Click to Enlarge

We’ve already configured MQTT in ESPurna web interface, and from the screenshot above,we can see that “Sonoff POW Switch” Idx is 3, a value we need to update in the DOMOTICZ section of ESPurna web interface.

Now I can go Domoticz interface in my phone, and not my computer since my office’s Ethernet switch will be turned off, click on the Switch tab, and turn on and off Sonoff POW by clicking on the lightbulb as shown below.

Click to Enlarge

It works fine, however note that the initial switch status was wrong (off instead on on), despite the switch sending regular updates to the MQTT server.

NanoPi NEO Power Adjustments and Installation

Normally, at this stage, it should be easy simply install NanoPi NEO outside the office close to my router in the living room. But I’ve come across a few issues doing so, which I’m going to report.

First I decided to make a very short Ethernet cable to connect NanoPi NEO directly to my router. I have done a couple of Ethernet cables in the past a few meters long, and they all work. I tested my ultra short straight Ethernet cable connections with a multimeter, and the 8 wires were properly connected, however, when I connected NanoPi NEO to the router with that cable it failed to get a link. Maybe there was aonther issue with the cable, so I made another one just as short… Another fail. It turns out very short Ethernet cables may cause issues, which are normally solved by twister pairs, but with such short cables the length of the twisted pairs is also extremely short, maybe 2 to 3 cm which may not be sufficient. So I ended up using a “normal” 1.5 meter cable, not as neat but it works.

The power strip close to my router was full, and since I did not want to add another, I decided to use the spare USB port on my modem router in order to power NanoPi NEO board. A USB 2.0 port can only deliver 2.5W max, so I was clearly looking for problems here. In order to avoid an issues, I made use of h3consumption script to adjust the behavior of CPU cores and disable unused peripherals.

Let’s check NanoPi NEO current settings in a terminal:

h3consumption allows us to change the following settings:

So I decided to disable USB, and use two CPU cores at most in order to limit the board’s power consumption, and avoid random reboots:

The changes were properly applied after a reboot.

I powered the board with my modem router, and could use it without issue. I’ll monitor NanoPi NEO’s uptime to check if this works.

How to Install Domoticz Home Automation System in NanoPi NEO and Other ARM Linux Boards

January 19th, 2017 7 comments

I’ve recently started experimenting with IoT projects, and the first hurdle is to select the hardware and software for your projects are there are simply so many options. For the hardware your first have to choose the communication protocols for your sensors and actuators, and if you are going to go with WiFi, ESP8266 is the obvious solution, used together with your favorite low cost Linux development board such as Raspberry Pi or Orange Pi to run some IoT server software locally or leveraging the cloud. But the most difficult & confusing part for me was to select the server software / cloud services as there are just so many options. I prefer having a local server than something running only in the cloud, as my Internet goes a few hours a month, so I started with a solution combining ThingSpeak with MQTT gathering data from Sonoff power switches running ESPurna firmware and vThings CO2 monitor. This works OK, but while cloud service is continuously update, its open source version has not been updated since mid 2015. Among the many service and software framework available, one seems to have come more often than other, is supported by vThings air monitoring platforms, and recently been added to ESPurna. I’m talking about Domoticz described as:

a Home Automation system that lets you monitor and configure various device like lights, switches, various sensors/meters like temperature, rain, wind, UV, Electra, gas, water and much more. Notifications/Alerts can be sent to any mobile device.

The system can run on Linux, Mac OS, Windows on x86 platform, but also on 32-bit and 64-bit ARM Linux boards such as Raspberry Pi and Cubieboard with just 256MB memory recommended, and 200MB free hard disk space. It can also generate charts from the data like the ones below.

Click to Enlarge

On top of that, the forums appear to be very active, and the last stable version was released in November 2016, and the last beta release yesterday according the download page.

I’m going to take it slow, so today I’ve just tried to install it on NanoPi NEO since it’s compact and runs Linux. However, it does not appear to be officially supported by Domoticz, so we’ll have to see whether it’s possible to install it on the board.

Domoticz is not a Linux distributions but a framework, so first we need to install a Linux distributions on the board, and the obvious choice for NanoPi NEO is to use the latest Armbian release either Debian Jessie or Ubuntu Xenial.

I downloaded Debian, extracted the image, and flashed it to a micro SD card on a Ubuntu computer:

Replace /dev/sdX with your own SD card device, which you can find with lsblk command.  If you are a Windows user, you can flash the firmware like you’d do for a Raspberry Pi using Win32DiskImager after uncompress Armbian firmware.

Now we can insert the micro SD card into the board, and connect the power to start the board. If you have not connected the serial console to your board, please be patient for the first boot as the system may take around 3 to 4 minutes to boot before you can login to it, as it expands the micro SD card to full capacity, and creates a 128MB emergency SWAP file.

Once it’s done we can login through the serial console or SSH using root / 1234 credentials. The first time, you’ll be asked to go through the first setup, changing the root password, and creating a new user with sudo privileges.

So now that we have Linux running on the board, and after login again as the new user, we can follow the instructions for Raspberry Pi board and other ARM boards to install domoticz with a single command line that works on systems running Debian/Ubuntu:

After a minute or two, as the system update the packages, and download domoticz, the setup wizard should start.

At some points we’ll need a fixed IP address, either by configuring Linux with static IP, or setting a permanent IP linked to the board MAC address in the router. The second option is usually my favorite option. Nevertheless, let’s click on OK to proceed.

You’ll be asked whether you want to enabled HTTP or/and HTTPS access. I selected both for now, but it’s probably a good idea to only select HTTPS for better security.Next is the HTTP port number set to 8080 by default, followed by the HTTPS port number to 443 by default (no screenshot), and finally the installation folder which defaults to ~/domoticz. You should now have reached the Installation Complete! window, and you can click Ok to exit the installation wizard.
Wow.. That was easy, and no errors. But does it work? Let’s access from a web browser.

We have a “Your Connection is not secure” error, but it’s expected as Domoticz simply generated a self-certificate, you can safely add exception to your browser to avoid this issue next time. Your data will still be encrypted, but if you plan to access your Domoticz setup from the Internet, you should probably install an other certificate using Let’s Encrypt certificate authority for example.
Once we have added an exception to the web browser we can indeed access Domoticz web interface, so the installation worked, but it will only show “No favorite devices defined…” Again that’s normal, because we need to configure it for example by clicking on the Hardware link.

Adding Hardware to Domoticz – Click to Enlarge

This will allow you to configure the system with MQTT, local I2C sensors, all sort of gateways, and even Kodi Media Center.  I’m pretty sure all devices working over the network or USB should work, but things like “Local I2C Sensors” which may be connected directly to the board may or may not work. Anyway, that looks promising, but I’ll stop here for today, as I have a lot more to study before going further, including upgrading Sonoff firmware, and configuring vThings CO2 monitor for Domoticz.