Feed on
Posts
Comments

Yup, you heard it right, version 1.2u of OpenSprinkler will debut at Maker Faire Bay Area on May 19 and 20. If you are going to Maker Faire, you are welcome to drop by and see our live demos. I started working on v1.2u shortly after releasing v1.1, and we were lucky to get the PCBs and components just in time for Maker Faire. The PCBs and components are shipped directly there, so it is not yet available for online purchase until May 23. But it is available for purchase at the Maker Faire and will be available online shortly after that.

So what’s new in this version? The main improvement is an on-board USB programmer. Specifically it’s a USBtiny ISP programmer built on a pre-programmed ATtiny45. USBtiny is one among many choices to directly program an AVR microcontroller without using a bootloader. The main advantages are that it is low cost (costs just a couple of dollars) and it enables the entire program space on ATmega328 (since no bootloader is needed). It is based on a post by Tequals0 and this version makes use of the internal clock and PLL on ATtiny45 to implement USBtiny with only three external resistors. Very elegant. With the on-board USB programmer, you don’t need any external programmer any more. Note that this version is named v1.2u, where u refers to the USB connectivity.

The second change is that some components have been replaced to adopt more common parts, including the switching regulator, the Ethernet jack, and the LCD. Also, there is now a rain sensor screw terminal, and a pinout for sensing power loss. The program will be updated to support these features soon. Another change is that the LCD pin assignment is slightly modified to free up analog pin 1, which is useful for talking to sensors. Finally, the extension board connector is also updated to use more common 2×3 pin header and cable. Note that this is still compatible with the previous version of extension board. If you have the previous version of extension board, it still works with v1.2u by switching a pin on the extension cable.

If you are interested, check the detailed release notes here and the release video below.

Update: check out the RFToy — an easy-to-use standalone gadget to control remote power sockets. Also, support for remote power sockets have been added to OpenSprinkler firmware 2.1.1.

Note: the RF transmitter used in this article is available for purchase in the shop page.

In a previous post I described a way to use an Arduino to interface with remote controlled power sockets. The idea was to make use of the original remote control, and a high-side transistor switch to simulate button presses. This approach is generic: you don’t need to know how the remote control signal is encoded, instead, just treat the remote control as a black box and simulate the button presses. However, the downside of this approach is that it requires soldering wires and components to the remote control, which is quite a bit of work.

Update: check out the RFToy — an easy-to-use standalone gadget to control remote power sockets. Also, support for remote power sockets have been added to OpenSprinkler firmware 2.1.1.

Recently, inspired by the JeeLabs KAKU remote switch article, I figured out a new way to interface with these remote power switches. The method published by JeeLabs uses an RFM12B transceiver, which is cool because my OpenSprinkler design has a reserved spot for RFM12B. Unfortunately after many experiments I was unable to get it to work with my switches. However, I did succeed by using a 433MHz RF transmitter purchased from SparkFun. So below I document the process of how I did it.

To begin, I took apart the remote control. The goal is to reverse engineering the signal sent from the remote control, so that I can use an Arduino to simulate the same signal. This will allow me to use a program to control the power sockets. The schematic of the remote control circuit can be found in the previous post. Basically it consists of an encoder IC (HT2262 or PT2262) and a 433MHz RF transmitter circuit.

By connecting an oscilloscope to the circuit I was able to analyze the signal patterns. Details can be found in the video attached at the end of this post. Below are the patterns I observed when button 1 is pressed (corresponding to power socket 1).

The signal consists of two basic patterns: a short HIGH followed by a long LOW, which I call a ‘0’ all together, and a long HIGH followed by a short LOW, which I call ‘1’. The long part is roughly 500us and the short part is roughly 160us (so it’s about a 3:1 ratio). Each signal sequence consists of 25 bits: the first 16 bits are always ‘0000 1111 0101 0101’, which I call the ‘signature’; and the next 8 bits are the ‘command’, which correspond to the index of the power socket; finally, there is always an ending ‘0’.

For example, the entire sequence to toggle socket 1 is

0000 1111 0101 0101 1100 0001 0

the entire sequence for socket 2 is:

0000 1111 0101 0101 0011 0001 0

and for socket 3 it is:

0000 1111 0101 0101 0000 1101 0

Again, a ‘1’ means a 500us HIGH followed by a 160us LOW, and a ‘0’ means a 160us HIGH followed by a 500us LOW. When a button is pressed, the sequence is repeated several times, for robustness I guess.

Interestingly, you can OR the command part in order to toggle two or three sockets at the same time. For example, the sequence below will simultaneously toggle socket 1 and 2:

0000 1111 0101 0101 1111 0001 0

Next, to simulate the remote control signal using an Arduino, I used a 434MHz RF transmitter from SparkFun. This transmitter has only 4 pins: Gnd, Vcc, Antenna, and Data. The data pin can be connected to any digital pin on the Arduino in order to send the control sequence as analyzed above.

For demonstration, I used Arduino pin 10 to send the control sequence through the Data pin. The connection is as follows: VCC->+5V, GND->GND, DATA->Digital 10, ANT->a short wire. The supply voltage for the RF transmitter can be anywhere between 1.5V to 12V. The higher the voltage, the longer the transmission range. Normally 5V should be good for at least 15-20 meters. If you want the highest range, use a +12V power adapter to power your Arduino, and connect the RF transmitter Vcc pin to the Arduino VIN pin. Alternatively, you can add a voltage boost converter to bump +5V to +12V.

Below you can download the Arduino program I wrote. The code should be easy to follow.

If you have a different remote controlled power switch, you can follow the same procedure to find out the control sequence, then modify the program accordingly. A video demo is provided below:

Credits: the method is based on JeeLabs KAKU remote switch and the code is based on the kaku_demo sketch included in their RF12 Arduino library.

Note: the RF transmitter (434MHz) is available for purchase in the shop page.


Update 1: apparently if you look at the datasheet of PT2262, which I found a copy here, it explains how the encoding pattern is computed. The ‘signature’ part has to do with the status of each pin from A0 to A7 on PT2262 – whether the pin is connected to GND, VCC, or floating, and the ‘command’ part is determined by the status of each pin from D0 to D3. I compared the circuit with the datasheet and verified that the pattern I observed from the oscilloscope matches the calculation. Also, according to the datasheet and the resistor value I found on the remote control, it looks like the long delay should be about 400us and short delay 133us, which is a bit different from the 500us and 160us observed from the oscilloscope. Also, the ending ‘0’ in my sequence turns out to be a ‘sync’ bit, which is 133us high followed by 4200us low. The fact that my original sketch has worked means there is a some level of tolerance in the timings. So they do not have to be highly accurate.

Update 2: new version of remote control. A reader of this post, Chuck, sent me a question that the sketch doesn’t seem to work with his remote control. After researching this issue, we found that the new version of the remote has changed to use SMT components and also has changed the coding pattern. Chuck sent me an image of the back of the PCB. From the image and the datasheet of PT2262, I figured out the new coding pattern. Basically, the ‘signature’ part of the code has been changed from

0000 1111 0101 0101

to

1101 0111 0101 0101

More technically, the coding pattern can be derived from the connections of Pins 0-7 of PT2262. In the newer version (from the PCB image on the left), the first 4 pins are connected as HIGH, FLOAT, FLOAT, HIGH, whereas the older version is connected as LOW, LOW, HIGH, HIGH. Here HIGH means connected to Vcc, LOW means connected to Ground, FLOAT means unconnected. Taking a look at the datasheet, you can easily figure out the actual code: LOW -> 00, HIGH -> 11, FLOAT: 01.

Chuck sent me his modified code, which you can download here.


You heard it right: we are going to this year’s Maker Faire at San Mateo, California on May 19 & 20!

Maker Faire 2012

We will be giving live demonstrations of the OpenSprinkler, AASaver, and two exciting upcoming open-source projects: OpenSprinkler Bee (battery-operated sprinkler controller), and SquareWear (a compact wearable electronics platform). If you are planning to go to Maker Faire, please make sure to drop by our booth (Maker # 7870). If you haven not decided, Maker Faire is a really fun event. You won’t regret it. So make your travel plan today!

Arduino Encounter

I went to a local cafe for brunch today, and I couldn’t be more delighted to see this poster at the cafe:

So is this where the name ‘Arduino’ came from? Not really. According to Wikipedia, the name of the open-source microcontroller Arduino comes from the following:

Founders Massimo Banzi and David Cuartielles named the project after Arduin of Ivrea, the main historical character of the town.[8] “Arduino” is an Italian masculine first name, meaning “strong friend”. The English version of the name is “Hardwin”.[9]

The poster is actually an advertising poster made by Italian artist Leonetto Cappiello. The painting was done in 1922 for La Victoria Arduino. There are apparently multiple posters, which you can find here. In any case, a pleasant surprise to find the name of my friend ‘Arduino’ on the poster 🙂

OpenSprinkler v1.1 Released

After several weeks of hard work, I am excited to announce that OpenSprinkler v1.1 is now available!

So what’s new in this version? The biggest improved feature is hardware support for arbitrary (>8) number of stations through extension boards. This was actually quite easy to implement: the main hardware change is added pinouts for the 74HC595 shift register, which allows cascading additional shift registers to expand the number of stations. The latest software has also been updated to generically support any number of stations. So this leads to a very economic way to expand the number of stations, which is often very expensive with commercial sprinkler timers.

Another change is that the station terminals now use a common wire + individual station wire design, compatible with commercial sprinkler timers.

Other minor changes include an added 750mA fuse for current protection, and added RTC pinouts to support external I2C RTC breakout board.

Check detailed Release Notes here. The kit is now available in my hobby shop. You can get it either as a DIY kit, or a fully assembled and tested product. Detailed assembly instructions can be found here.

V1.1 Update Video

Link to the previous (v1.0) release video.


« Newer Posts - Older Posts »