X10 Community Forum

💬General Category => General Discussion => Topic started by: dhouston on April 14, 2016, 09:52:27 AM

Title: A Friendlier ESP8266 Based Relay
Post by: dhouston on April 14, 2016, 09:52:27 AM
Here's yet another ESP8266 controlled relay that looks a bit more hacker friendly than Itead's Sonoff.
http://www.electrodragon.com/product/wifi-iot-relay-board-based-esp8266/  (http://www.electrodragon.com/product/wifi-iot-relay-board-based-esp8266/)

It seems to be fully documented. It should be possible to have local control as well as remote control w/o needing a cloud although there's an MQTT cloud that can be used.
http://www.electrodragon.com/w/ESP_Relay_Board (http://www.electrodragon.com/w/ESP_Relay_Board)

It may or may not be possible to add 310MHz X10 RF to it - it's not likely to fit within the standard enclosure. I'll explore as time permits. I've requested a schematic and ordered one via very slow boat.
Title: A Friendlier ESP8266 Based Relay
Post by: dhouston on April 14, 2016, 11:58:47 AM
On second thought (following a third or fourth look at the Electrodragon pictures) there's a header which, from the docs, appears to bring out ESP8266 pins. I can probably use these to add a 310MHz X10 compatible RF Receiver/MCU.

An MCU is necessary because the ESP8266 is too busy with WiFi book-keeping to handle receiving/decoding of an RF signal. I should be able to use the ESP8266 serial input (it can be disconnected to allow re-flashing the ESP8266) for pairing with a particular X10 RF code and for normal operation. There's an extra PB that might be usable to initiate pairing. 

Since there are two relays, we might even have a ménage à trois although silent relays might be preferred for this.  rofl
Title: Re: A Friendlier ESP8266 Based Relay
Post by: Tuicemen on April 14, 2016, 12:28:43 PM
I do like the ability to control two devices from the one unit.
Your adding lots to your plate! rofl
Title: Re: A Friendlier ESP8266 Based Relay
Post by: dhouston on April 14, 2016, 12:41:31 PM
Your adding lots to your plate!
True, but I can possibly finish 1 or 2 projects while awaiting that slow boat. This RF application is one I've done many times. And, I figure on leaving the smartphone and PC apps for others after I publish protocols.  ;)

This can be very, very simple. I already have PICBasic code to receive/decode X10 RF and report it via a serial link.
https://www.laser.com/dhouston/PIC-RX-TX.TXT (https://www.laser.com/dhouston/PIC-RX-TX.TXT)
We can let the pairing take place via the WiFi app - all that needs be done is assign the X10 addresses of each relay and communicate this to the small Receiver/MCU board. The latter can then send A (relay 1) or B (relay 2) On/Off messages upon receipt of applicable RF - eezy peezy. It should fit the standard enclosure (although safety might be better with everything within a more secure enclosure) and even leave room for the temp/humidity module.

Also, I can probably do this on a double-sided PCB (<1 sq. in.) that will fit within the CM15A enclosure in case I do need to offload the RF from the Arduino Mini Pro for the CM15A2Z. All I need is VDD, GND, RX, TX.

With Itead making the PCBs I'll still have lots of time to polish the final code while awaiting yet another slow boat. And, it can likely be used with their Sonoff and Slampher devices should they ever publish an SDK.
Title: Re: A Friendlier ESP8266 Based Relay
Post by: dhouston on April 14, 2016, 04:18:40 PM
I was wrong - the PCB is 1/4 sq. in. (1/2 in. x 1/2 in.) so it should fit.  :'
Title: Re: A Friendlier ESP8266 Based Relay
Post by: dhouston on April 15, 2016, 11:02:38 AM
Hmmm. Adding X10 PLC sensing is not beyond the realm of possibility.

I'll ponder this more once I have the Electrodragon dual relay hardware. PLC takes a bigger MCU so my tiny PCB will have some growing pains but there's ample example PIC code out there in the ether (e.g. AN236). It would be even more attractive if it could fit within the Slampher light socket as well.
Title: Re: A Friendlier ESP8266 Based Relay
Post by: dhouston on April 18, 2016, 11:04:17 AM
It turns out that Espressif Systems (they designed the ESP8266) have a User Manual showing how to use it for 32kHz Infrared IO using the NEC protocol. Given that X10 has used the NEC protocol (sans the 38kHz carrier) for RF IO worldwide for the past 40 years or so it should be possible to modify their example for both X10 RF and X10 PLC with a 120kHz carrier..
https://espressif.com/en/file/396/download?token=sXmVIx7P (https://espressif.com/en/file/396/download?token=sXmVIx7P)

While this may be over my head, I'm sure there are others whose heads are higher.
Title: Re: A Friendlier ESP8266 Based Relay
Post by: dhouston on April 18, 2016, 03:57:53 PM
I think this English language homepage is relatively new for Espressif (who make the ESP8266). There's a lot of info, including a link to their template for a cloudless smartphone app.
https://www.espressif.com/en (https://www.espressif.com/en)
https://www.espressif.com/en/products/software/espressif%C2%AE-iot-app/overview (https://www.espressif.com/en/products/software/espressif%C2%AE-iot-app/overview)
https://www.espressif.com/en/media_overview/news/latest-version-kolbans-book-esp8266 (https://www.espressif.com/en/media_overview/news/latest-version-kolbans-book-esp8266)
Title: Re: A Friendlier ESP8266 Based Relay
Post by: bkenobi on July 14, 2016, 03:40:24 PM
These look identical to the ones posted earlier.  The difference I see is that this one includes a tutorial on how to set everything up with HomeGenie.  I don't know what the conversion rate is but the numerical price looks high.   rofl

https://www.crazypi.com/raspberry-pi-home-automation
Title: Re: A Friendlier ESP8266 Based Relay
Post by: dhouston on July 14, 2016, 04:49:23 PM
I don't know what the conversion rate is but the numerical price looks high.
Even after currency conversion the price is crazyhi. :-[
http://www.xe.com/currencyconverter/convert/?Amount=1860&From=INR&To=USD (http://www.xe.com/currencyconverter/convert/?Amount=1860&From=INR&To=USD)

In fairness to CrazyPi they probably do not expect much of an export market and their prices reflect exorbitant import duties that India places on most electronic components/devices. An Indian web acquaintance from the days of comp.home.automation (and also PicBasicPro forums) built his own X10 devices using whatever components he could buy locally because of this.