Search This Blog

Wednesday 1 November 2017

Testbed 4 - more sub-assemblies: temp and rf433

This one has the (very "bouncy") tact button that all my IOT devices have on GPIO0
  • quick press: switch on / off
  • medium: reboot
  • long: factory reset


It also has the TMP36 temperature sensor and the output module to transmit RF codes to my "el cheapo" sockets: These are what I bought for the 300+ year old farmhouse before I had the (insane) idea to replace everything with a fully-fledged WiFi IOT Home automation system.


Being one who doesn't have a lot of cash to splash, I wondered if I could re-use them...Then I found the wonderful rcswitch library https://github.com/sui77/rc-switch and I found some ridiculously cheap RX/TX pairs on ebay (buy similar here) 5 sets for eu2.79 or 56c a pair. So the TX you see here set me back - what - 28c? I love cheap.

Setting it up was easy: The rcswitch lib has an example that uses the RX to read the codes of the handsets. I was short of Wemos D1s at the time, so I dragged a dusty old Arduino UNO out of a drawer and had the code running in about five minutes flat. I captured all the codes from my four handsets for on and off. I then knocked a little transmit library for the Wemos with a few "hard-coded" values and no-one was more surprised than me to hear the happy sound of clicking less than an hour or so after I started! Tweaking the code, removing the hard-coded values and setting up the automatic re-configuration then occupied me for the next few days, of course...

Now my system uses these as "slaves". Each "truc" or Wemos-controlled "big box of sensors" reads MQTT configuration data at startup to see which RF switches are linked to it. When it next switches on or off, it automatically sends the RF codes to make all its "slaves" match. In the real world, the main box would be wired in with the overhead light in each room, and the el-cheapos would be floor lamps, or corner lamps. When commanded either by touch or remote MQTT, all go on/off at once.





No comments:

Post a Comment