02/20/2015 at 04:44 •
Today we finished coding changes to use Autoflower with our fancy new wireless outlets. Here's a quick demonstration of me setting up a wireless outlet using Autoflower. First, we set up a new "light" device. After you add the device, you click the "pair" icon. Autoflower will repeatedly send out an on code for approximately 10 seconds after you click the button. Then you hold down the button on the wireless outlet until it goes into learning mode. Almost immediately it will receive the code and flash.
Some problems did arise during this because Autoflower needs to cycle through current device states and send out switching codes. If you were to put the outlet into learning mode during normal operation, it would learn the first of these codes that happened to be sent. Since the server and main program are separate threads, we just put a lock around the outlet switching code, so when the server gets a post to "/pair" the main program waits until it is finished repeating the code we want associated with the outlet.
02/18/2015 at 00:32 •
The wireless outlets use a very trivial protocol. We grabbed some codes from the rfoutlet project. After converting the codes into binary, and some trial and error, the pattern becomes apparent.
The protocol is a 20bit "identifier" followed by the ON / OFF code (0011 / 1100, respectively). The outlets can learn from either an ON or an OFF code. Each code is paired with its significant other automagically.
So, for example, the lowest code pair that works is:
000000000000000000010011 (ON Code) (19) 000000000000000000011100 (OFF Code) (28)The largest being:
111111111111111111111100 (OFF Code) (16777212) 111111111111111111110011 (ON Code) (16777203)
We tested this with rfoutlet's codesend.cpp, using a pulsewidth of 189.
- The codes are passed as an argument in decimal, while the outlets are in "Learning Mode".
- The outlets can be put in "Learning Mode" by holding down the button on the side until the red light starts blinking (about 3 secs).
- The code needs to be sent while the light is blinking ( > 10 sec window).
- The light will blink rapidly and the outlet will go into OFF mode after it has learned the code.
02/17/2015 at 20:54 •
The Smakn 433Mhz receiver and transmitter arrived today, as well as the wireless outlets. It turns out that the outlets can "learn". I tried to get them to make me dinner, but they're not that smart. Because the outlets can learn, the receiver to listen to their controllers probably isn't necessary. We just need to get some info on the protocol they use and mimic it. Then we can just generate random codes when a device entry is created within the Autoflower program, and have the outlets learn them.
02/17/2015 at 06:24 •
We did a bit of pricing for our preferred features. The decision to go with the RFu-328 over the URF(XRF with USB for easy flashing) was pretty easy once the documentation became available online again. The RFu-328 is just an XRF paired with a little Arduino. For just a little extra, you can program your sensor's "personality" over the air without ever touching the radio firmware. We also came to the conclusion that it may be worthwhile to have a common environmental sensor module(temperature, humidity, etc.), rather than having every sensor use a separate RFu-328, regulator, battery set, and case. Secondary sensors, like moisture sensors or CO2, are, well... secondary. Some sensors are required less often as a part of a grow room, need to be able to be moved around the space, or can be used several times in the same room. I.e., the common sensor would handle macro-environmental sensing, secondary sensors would handle micro-environmental sensing and special cases. Still haven't been able to find out if the Slice of Radio can escape its intended protocol to switch outlets, but with the 433 Mhz transmitter/receiver kits running around $5 it's not a proportionally large issue.
More diagrams and an explanation of how these sweet-and-simple serial wireless protocols work are on their way.
02/15/2015 at 14:21 •
Whipped up a little diagram for your viewing pleasure:
Of course, sensors and outlets aren't limited to 8, but you get the point. Still haven't found out if the slice of radio is capable of sending signals to switch the wireless outlets or if it's stuck with Ciseco's protocol. The Openmicros site is down at the moment, so no support for me. If it is the case that it can handle this task, we'd get rid of the 433 mhz kit. Another alternative would be scrapping the slice of radio and using the 433MHZ kit instead, but I'm too lazy to make that work with Cisecos modules when the slice of radio is so simple.
02/14/2015 at 15:23 •
We've decided to scrap hardwired relays and sensors and go all wireless. I'm not sure if there's an RF module with cross compatibility between 433 mhz wireless outlets and Ciseco's RFU 328s or XRFs. I'd like to use all RFU 328s, but they'd be quite a bit more expensive to use for mains relays. Hopefully the slice of radio is capable of sending the outlet signals, but we ordered a smakn 433mhz kit as well.