Archive

Posts Tagged ‘automation’

This $8 USB Transceiver Can Add 433 MHz Device Support to your Home Automation Gateway

May 23rd, 2017 5 comments

With the advent of WiFi and Bluetooth IoT, 433 MHz devices are becoming less popular but are still used for doorbells, motions sensors, windows/door sensors, etc… If you have such devices at home, one way to integrate those into your home automation system is to use an ESP8266 WiFi to 433 Mhz bridge between your gateway and 433 MHz capable products. However, you don’t even need the middleman if you use a USB 433 MHz transceiver connected directly to the gateway. Nathan Chantrell found such USB dongle on Banggood for about $8, and managed to make it work with his Debian Gateway using Node-RED.

433 MHz USB dongle and features:

  • Connectivity
    • 433 MHz transceiver
    • Range – up to 30 to 100 meters (Line of Sight)
    • Tx and Rx for PT2262, PT2260, PT2264, PT2240, EV1527, HS2303-PT codes
    • Can transmit multiple signals independently
  • Control interface – Serial over USB @ 9600 bps
  • Power Supply – 5V via USB port
  • Power Consumption – 15 mA @ 5V in standby mode; 35 mA @ 5V during Tx
  • Dimensions – 8.1 x 2.5cm (excluding antenna); antenna length: 3cm

There’s very little information about the stick on the web, and most information below is from Nathan who focused his work on PT2262 “very basic, low security encoding chip for RF or IR transmission” and found in ultra cheap Chinese security devices, older alarms, and garage door controllers. He found out the dongle has an 8-bit limitations instead of 12-bit for the original PT2262 chip, which limits the total number of codes to 6,561.

He also opened it up to find a CH340 USB-TTL chip, an internal black wire coil. The PCB label is YS-UTR2 for reference. A search for the latter does not bring anything interesting, except a 315 MHz version is also sold on Taobao.

You can send and receiver hex code over serial using a 9600 8N1 connection. Nathan described the receive and transmit bitstream in this blog post, and tested with various devices including Energenie ENER002 plug in sockets  / ENER010 power strip, VStarcam AF117 magnetic door/window contacts with a button, some PIR movement sensors, Semic CS5211DGO smoke alarm, and more. Most device based on the PT chips mentioned in the specifications should work.

He added support in Node-RED with a serial in and out as follows:

The input node will then give me a payload of [ 253, 81, 53, 213, 112, 223 ] which is a decimal representation of our orginal hex fd 51 35 d5 70 df (confused yet?). I just use a function node to concatenate the two parts of the address with the data (all in decimal) eg. 8153213 and use that as the unique code to identify the device.

For transmission just create a buffer with the hex required and send it to the serial out node.

AIY Projects Voice Kit Transforms Raspberry Pi 3 Into Google Home, Comes Free with Raspberry Pi Magazine

May 5th, 2017 11 comments

We’ve just reported about the preview release of Google Assistant SDK that works on the Raspberry Pi 3, and other boards with a microphone, speakers, and access to Internet. The Raspberry Pi foundation and Google have now made it even easier, as they launched AIY Projects Voice Kit with a Google Voice HAT, a speaker, a stereo microphone Voice HAT board, a button, a few cables, and a cardboard case.

You’ll just need to add your own Raspberry Pi 3, follow the instructions to assemble kits, load and setup the software. Once this is all done, you’ll be able to press the top button, asking anything you want to Google Voice, including the weather.

Price? Sort of free, as it comes with MagPi 57 magazine, where you’ll also find detailed instructions for the kit. Google AIY Projects got its name from a mix between (DIY) and artificial intelligence (AI), and considering it’s “Projects” and not just “Project”, we can expect more kits in the future.

Google Assistant SDK Turns Your Raspberry Pi 3 into Google Home

May 3rd, 2017 7 comments

Google Home allows you to select music, control your home automation system and more with voice commands, but now you can do the same with a Raspberry Pi 3 as Google released a developer preview (alpha v1) of the Google Assistant API that works on Raspberry Pi 3, and other development boards running Debian or Ubuntu.
Functionalities are limited right now, with RPC API and Python sample code, but it only works with English language, and features such as timers & alarm, playing music, news, or podcasts, and precise location are not supported. Location is determined using your IP address only, and if you’re using some third party services / products such as Uber or Hue, you’ll need an actual Google Home device for initial setup.

Google has provided instructions to use Google Assistant SDK with Raspberry Pi 3 board. First you’ll need a USB microphone ($5.99 on Amazon), and speakers connected via USB or the 3.5 mm audio jack. After installing Raspbian on the board, you’ll need to configure a developer project and account settings, configure and test audio (with arecord/aplay), and finally install Python and the Assistant API sample:

Once this is done, authorize and run the sample:

Press Enter, ask something, and your Raspberry Pi 3 board should answer.

Since you just need audio and network working on the hardware, this should also work on other development boards, and Google has indeed provided instructions for other platforms too. Basically the same steps, but less detailed, except for the authorization part which seems a little more complicated.

Thanks to Harley for the tip.

Karl’s Home Automation Project – Part 4: MQTT Bridge Updated to Use YS-IRTM IR Receiver & Transmitter with NodeMCU

April 20th, 2017 1 comment

In a previous article, I wrote about an MQTT bridge by 1technophile. I added a DHT temperature and humidity sensor as well as a light sensor. Previously it included a software decoder to decode the IR signal. I never did test the IR transmitter on the gateway, as I didn’t have the parts. But thanks to IC Station, who sent me over a small YS-IRTM hardware based decoder and NodeMCU that I am writing about today. I have replaced the software based version with the YS-IRTM module in the latest update.

Click to Enlarge

Click to Enlarge

I found this project challenging. I admit I am a little weak in my programming skills. It was difficult to find documentation but I found a forum talking about this device and basics of how it works. When an IR code is recognized it sends 3 hex codes via serial connection on the transmit pin. To transmit, it expects 5 hex codes: A1,F1,xx,xx,xx. A1,F1 tells it to send the following codes. You can also set the baud rate but I left default 9600.

It is simple wiring wise. It only takes 4 dupont wires. It took a bit of coding to get it working but I finally got it to communicate via software serial. I started on a Arduino Uno with the code and then migrated it over to the ESP8266 board. I did have a little trouble when I first moved to the ESP board. I initially thought I might need a level shifter but that didn’t help. I am a little surprised I didn’t need a level shifter because the ESP needs only 3.3 volts. I was getting some weird responses and finally figured out I had to put in a slight delay. Maybe the ESP’s speed comes into play.

The way to use this is fill out your SSID and password and your MQTT server with credentials. Flash the device. You will need to add the necessary libraries. 1technophile has good documentation in his wiki.

Once flashed and ready to find your IR codes you will need to subscribe to the topics with the Windows command below. Give the gateway a moment to connect and point your IR remote at the sensor and press a button to find out code.

In your window, you will get something like this “home/sensors/ir 4,fb,8,” which is my power button for my TV. To test the code:

With this code, the TV will toggle on and off.

Click to Enlarge

After this you can use your favorite home automation project and control your IR devices with automations. You can omit any sensors that you don’t need. You will get some erroneous MQTT data if not all sensors are used. Below are the bits of Arduino code added for the IR module, and here’s the link to the github code:

I plan on 3D printing an enclosure with CR-10 I am reviewing, and I will remove the IR LED, and move it to a more suitable position, as both facing the same way isn’t ideal for my setup.

I would like to thank IC Station for sending the NodeMCU ($5.81 shipped) and IR transmitter and receiver ($3.39 shipped) for review. You can get 15% discount with coupon Karics. I finally have a complete gateway.

ESPurna-H is a Compact Open Source Hardware Board with ESP8266 WiSoC, a 10A Relay, HLW8012 Power Monitoring Chip

April 9th, 2017 7 comments

ESPurna is an open source firmware for ESP8266 based wireless switch as such Sonoff POW, which I’ve been personally using to monitor my office’s power consumption. The developer, Xose Pérez (aka tinkerman), has now developed his own hardware with ESPurna-H board, as existing wireless switches with power monitoring functions would not fit into a gang box.

ESPurna-H board specifications:

  • WiFi Module – ESP12 with Espressif ESP8266 WiSoC
  • Relay – Songle SRD-05VDC-SL-C 10A relay with NO and NC connection
  • Power Monitoring – HLW8012 chip as found in Sonoff POW
  • Expansion – 2x 5-pin header with the programming GPIOs, and two connections for external button and LEDs
  • Misc – Reset button
  • Power Supply
  • Safety – Optical isolation between the logic circuit and the relay circuit
  • Dimensions – 50x50x20mm

Xose designed the board with Eagle 8.0 and released the schematics, PCB layout, BoM and other hardware design files under the Creative Commons Attribution-ShareAlike 3.0 Unported License (CC-BY-SA 3.0). You’ll find the files on github.

ESPurna-H with Custom 3D Printed Plate before Installation in Gangbox – Click to Enlarge

The board is not for sale, but you could purchase the PCB on OSH Park, purchase the components separately, and finally do the soldering yourself. Since this is a hobby project, not specific safety testing has been done, and you’d better understand what you are doing since the board is meant to be connected to the mains. Even companies do it wrong from time to time. If there’s a design flaw with the board it could overheat melting the plastic around, and in the worst case even start a fire.

Xose completed the setup with a capacitive touch switch attached to the cover, in order to turn on and off the light, and the final results above looks quite neat.

Cambrionix PowerPad 15S is a 15-Port USB Hub with 2.1A Output, Control API, Serial Console, Power Consumption Monitoring

April 8th, 2017 8 comments

Many development boards are powered over USB, usually via a micro USB ports, and if you have one board, you’d just use a 5V USB adapter with the right amperage, and it will work fine as long as you have a low resistance USB cable (AWG20 cables recommended for higher loads).  But when you start to running multiple boards using power strips with USB adapter start to take space, so USB hubs are much more convenient. However, you need to find one that delivers enough power, is reliable, and possible allows per port power control. The guys at LAVA (Linaro Automated Validation Architecture) are using a lot of boards to validate software developed by Linaro and their members, with the boards having to run 24/7, and they had various misfortunes with USB hubs, but as Dave Pigott reports they’ve now found that USB hub of their dream with a 15-port USB hub from Cambrionix which should be their PowerPad 15S model.

Cambrionix PowerPad15S technical specifications:

  • 15x USB port supporting charge and sync with up to 2.1A per port
  • 1x USB host port
  • Control Interface – Cambrionix API, Terminal Command Session, SSH, Minicom
  • Charging Method – Cambrionix VIC “Very Intelligent Charging Protocol”
  • Power Supply – 180W external power supply
  • Certifications – CE, FCC, Underwriters Laboratory (UL), WEEE and RoHS

Each port of the USB Hub can be controlled individually (charging, syncing, or off modes), allows retrieval of VID/PID data, and records power consumption (amps, charging time, total power consumed).  The hub can be monitored and controlled using LiveViewer App for Window or Mac OS, but if you want to automate the USB port, for example to power cycle a board that does not answer to ping request, you may want to use the Cambrionix API available for Linux x86/ARM, Windows, and Mac OS.

When Dave connect the HUB to his (Linux) laptop he noticed it was detected as  a serial device only, and after configuring ser2net, he could login via telnet, and help listed a bunch of commands to control each port. As he connected a Hikey boar, he found a command to check all the ports status with their current draw, so he wrote a Python script to control the port as he wanted.

They also found EtherSync Hub from the same company with that’s running Linux, and can be controlled from the network over Ethernet. LAVA team has been running both types of hubs for a while and found them to be reliable, and will update the complete lab with them.

Cambrionix has other USB charging product with various number of ports, and form factor, including a USB charging 1U rack, or a 54-port data transfer USB hub. Check out their products page for details. Those are all nifty USB hubs, but as expected price is pretty high with PowerPad 15 sells for $660 on Amazon US (that’s $44 per USB port), and while there are some other cheaper Cambrionix models on Amazon UK, they probably lack advanced functions like power monitoring. [Update: I’ve been informed model PowerPad 15C (notice the extra C) is much cheaper, as it sells for £159 ex vat (~$200) on Multipad UK. The main difference is that it does not support sync mode compared to PowerPad 15S model].

Karl’s Home Automation Project – Part 3: Adding Light Detection to a Motion Sensor

March 27th, 2017 No comments

This is the 3rd part of my Home Automation light project. In the first part, I wrote about basic setup with basic Sonoff Wifi MQTT switches and setting them up. In the second one, we added some 433 MHz motion sensors and a 433 MHz to MQTT bridge. And finally in part 3, we are going to modify the 433 MHz motion sensors to only work when it is dark in the room.

Motion Sensor

Click to Enlarge

The motion sensor I linked in part 2 is run by a common chip called a BISS0001. We are interested in pin 9. If voltage is below .2v it will not trigger a motion. This solves the problem discussed in part 2, when we have a gloomy day or if blinds are closed etc.

By adding an GL5537 LDR (Light Dependent Resistor) shown as R3 in the diagram above, you will achieve the desired effect. Extend the LDR with some wires and solder between ground and pin 9.

The GL5537 is extremely sensitive. You can adjust your sensitivity by placement. I put mine right next to the PIR sensor so it sees outside the window. It works perfectly. If you wanted it to get a little darker you can use the mounting hole on the back or make a new on the top or sides. Direct access to the outside light would mean it would need to be darker in the room for it to trigger. You have to be careful with the motion sensor placement or your light being triggered might cause the motion sensor not to trigger because there is too much light. I get this if the motion sensor is too close to the lamps I am triggering.

Home Assistant

Before modifying we had 2 automations one for before sunrise and one for after sunset:

Now that we’ve added the logic for light and dark at the motion sensor itself, we can simplify these 2 down to one automation, and only specify the time. The rest of the home assistant configuration can be found in 2nd article here.

That is all I have for now. If you have an idea or a product that you feel that meets the cheap and DIY criteria leave a comment below. I will test it out. I know you can do a ton of things with Home Assistant and a lot seem over the top. I want to focus on mundane things like turning off lights. I am also going to get some 433 MHz moisture sensors for my house to place in crawl spaces, and under the sink but that is pretty basic.

Continue reading “Part 4: MQTT Bridge Updated to Use YS-IRTM IR Receiver & Transmitter with NodeMCU“.

Xiaomi 6-in-1 WiFi & Zigbee Smart Home Kit Works with Domoticz Home Automation Software

March 24th, 2017 11 comments

Xiaomi “Mijia” 6-in-1 smart home (security) kit is an home automation set with a WiFi & Zigbee multi-functional gateway with RGB light and speaker, a wireless switch, a window/door sensor, a  human body sensor, temperature & humidity sensor, and a smart socket.

The key features of each item are as follows:

  • Multifunctional Gateway Remote Control
    • WiFI and Bluetooth connectivity
    • Built-in speaker
    • Light sensor and 18x RGB LED for notifications potentially trigerred by connected sensors: body sensor, door sensor, IP camera…
    • Online radio support
  • Window / Door Sensor Set
    • Light and rings the gateway when opened or closed
    • Away from home mode: can trigger IP camera recording
    • Power – CR2032 cell battery that should last for 2 years
  • Smart Wireless Switch
    • Programmable one key switch to turn off all lights/applicance, turn on one light at night, etc…
  • Human Body Sensor
    • Motion sensor allowing you to control other devices through the gateway
    • Power – CR1632 battery
  • Smart Socket
    • Zigbee connectivity to gateway
    • Reports actual power consumption
    • Overload protection
    • Set timing turn on and turn off
  • Temperature Humidity Sensor
    • Triggers alarm if the temperature and/or humidity are out of normal range
    • Log data over time via Gateway
    • Power – CR2032 battery

You’d normally use this kit using MiHome app from the Apple Store or Google Play, but if the rather mixed user reviews scare you off, the good news is that the Xiaomi gateway (Aqara) is now supported by Domoticz (Beta). Note that there appears to be multiple hardware versions of the gateway, and Domoticz will only work with version 2.0 or greater.

Domoticz integration still requires you to install MiHome app, as you need to enable developer options, specifically “LAN functions” to set a fixed IP address. Once this is done you’ll be able to select “Xiaomi Gateway” in Domoticz web interface, and input the IP address. After getting back to the Android / iOS app again to setup the sensors, Domoticz should automatically detect them.

Click to Enlarge

Once this is done, you should not need to access Xiaomi’s mobile app anymore, and can manage and control your devices with Domoticz web interface or/and Android app.

Support for Xiaomi Smart Home gateway was merged on Github last December, and if you want to find others experiences, there’s a long thread about it on Domoticz forums. The kit described above can be purchased from GearBest for $74.5 shipped. You’ll also find the kit on other shops such as DealExtreme with various options  (4-in-1, 6-in-1, gateway only, etc…), as well as Aliexpress.

Thanks to Harley for the tip.