Scene controller based on old x10 remote
-
I retrofitted old x10 remote (Model HR12A - can be had for under $10 on ebay) to work as scene controller for MySensors accompanied Vera setup.
What I learned with Vera is that some cheap Z-wave remotes will not work with it (yes, I'm talking about you, GE45600) and others can only use "scene on" half of the keyboard. With this custom puppy we have full 36 scene activation combinations.
I ran out of pins (only weirdos like A6 and A7 left) but there's also possibility to hook up the dial and report the battery status.
Controller and radio "deep sleep" all the time waking up on interrupt when button is pressed then transmits the code and falls back asleep. I followed LED & voltage regulator disconnection procedures described here so with this in mind the battery should pretty much die of natural causes before discharging. 8M/3.3V chip, obviously only two batteries go in the 4x bay.
Can't figure out how to post images here so here's the link: https://imgur.com/a/7EIqx
In last picture note there's 4pin connector to be able to program the remote without taking it apart. Serial pins there are: GND, TX, RX, DTR#include <MySensor.h> #include <SPI.h> #define CHILD_ID 0 #define PRESSDELAY 200 // pin assignments (0 terminates the arrays) const char a_keysHor[] = {A0, A1, A2, A3, A4, A5, 0}, a_keyVer[] = {8, 7, 6, 0}, n_irqPin = 3, n_ledPin = 4, n_pagePin = 5; // maps value to code calculated from key's coordinate const char a_keyMap[] = {1, 2, 4, 5, 3, 6, 8, 7, 10, 9, 11, 12, 15, 17, 18, 13, 14, 16}; char n_horLines, n_verLines, n_pageSize; MySensor o_gw; MyMessage o_sceneOn(CHILD_ID, V_SCENE_ON); void setup() { for (n_horLines = 0; a_keysHor[n_horLines]; n_horLines++) { pinMode(a_keysHor[n_horLines], OUTPUT); digitalWrite(a_keysHor[n_horLines], HIGH); } for (n_verLines = 0; a_keyVer[n_verLines]; n_verLines++) { pinMode(a_keyVer[n_verLines], INPUT); digitalWrite(a_keyVer[n_verLines], HIGH); } n_pageSize = n_horLines * n_verLines; pinMode(n_ledPin, OUTPUT); digitalWrite(n_ledPin, LOW); pinMode(n_pagePin, INPUT); digitalWrite(n_pagePin, HIGH); pinMode(n_irqPin, INPUT); digitalWrite(n_irqPin, HIGH); o_gw.begin(); o_gw.sendSketchInfo("MySensors Remote", "1.0"); o_gw.present(CHILD_ID, S_SCENE_CONTROLLER); } void loop() { char n_hor, n_key; for (n_hor = 0; a_keysHor[n_hor]; n_hor++) digitalWrite(a_keysHor[n_hor], LOW); o_gw.sleep(1, LOW, 0); for (n_hor = 0; a_keysHor[n_hor]; n_hor++) digitalWrite(a_keysHor[n_hor], HIGH); while (n_key = f_readKey()) { o_gw.send(o_sceneOn.set(n_key)); digitalWrite(n_ledPin, HIGH); delay(PRESSDELAY); digitalWrite(n_ledPin, LOW); } } int f_readKey() { char n_hor, n_ver, n_key = 0; for (n_hor = 0; a_keysHor[n_hor]; n_hor++) { digitalWrite(a_keysHor[n_hor], LOW); for (n_ver = 0; a_keyVer[n_ver]; n_ver++) { if (digitalRead(a_keyVer[n_ver]) == LOW) { n_key = a_keyMap[n_ver + n_hor * n_verLines]; if (digitalRead(n_pagePin) == HIGH) n_key += n_pageSize; break; } } digitalWrite(a_keysHor[n_hor], HIGH); if (n_key) return n_key; } return 0; }
I'll try to answer any questions here.
-
@tigra
Idiotic question.. That remote had a wireless thingy.. Why not use that?
-
@tigra said:
Can't figure out how to post images here so here's the link:
Just drag-n-drop the to composer. Max size 2 Mb.
-
@hek
Sometimes simple is just to complicated in a complicated world. Most of us are used to old forums format
-
@Vladut-Grecu said:
That remote had a wireless thingy.. W
Indeed it was RF based remote control, but it was for X10 protocol and it wasn't compatible with my existing system. There's somewhat painful way to hook x10 to Vera via Raspberry running Mochad driver, but I'm getting rid of x10 altogether.
Suggested Topics
-
ioBroker / NEW Controller Development / collection of FEATURES you/we need
My Project • 1 Feb 2016, 12:46 • maxtox 21 Mar 2016, 19:28 -
MyController 0.0.3.Alpha2 released!! :)
MyController.org • 29 Jul 2016, 19:53 • jkandasa 11 Oct 2016, 21:22 -
💬 MSMDLed
OpenHardware.io • 27 Dec 2018, 11:02 • openhardware.io 27 Dec 2018, 11:02 -
Node to node comunication with optional controller
Development • 20 Mar 2017, 06:53 • Doomic 24 Mar 2017, 10:17 -
MyController 1.2.0.Final version released
MyController.org • 23 Feb 2018, 05:15 • jkandasa 23 Feb 2018, 05:15 -
Serial Gateway as Controller
General Discussion • 2 Dec 2014, 13:46 • dzairo 2 Nov 2015, 16:33 -
pimatic-mysensors controller plugin
pimatic • 9 Jan 2015, 10:21 • Dheeraj 26 Jul 2019, 12:25 -
💬 OH MySensors RGBW Controller
OpenHardware.io • 15 Apr 2016, 21:44 • openhardware.io 10 Jul 2019, 12:12