Watson: elementary relay switch with instant message.

This is the second version of the project. The first was based on my App resident and running in “cooperation” with WA and a small circuit based on micro PIC12F635 with the addition of a DTMF tone decoder MT8870. If you want, you can read the article at this link: http://ficara.altervista.org/?p=2682. It is a bit old (Apr 2015) and the new one is much more simple.

The first step was to remove my own cooperative App. The second, to eliminate the DTMF decoder. Well, it worked. The result is a small circuit that can be connected via audio jack to any smartphone that runs the famous instant messaging App. The circuit and the AVR micro firmware are currently set to control just one relay ON and OFF, but it’s possible to extend them in order to indipendently control up to 16 relays. This is the schematic (the PDF version is in the zipped project folder)

The circuit is driven by sounds, but not DTMF. Now, I used a “protocol” to send multiple tones and create 16 possible commands. I used Audacity, a great open source sound editor, to create the sound sequences. Here is an example:

A “command” is composed by a “start” tone (1200Hz) and four bits starting from the most significative. The “ones” are 1600Hz, while the “zeroes” are 800Hz. In the picture is represented the code 1010. A full “transmission” is always 500mS. Every sound has 50mS duration, followed by 50mS pause. For sound file output, I used the format “ogg” because is compatible with Android and iOS smartphones.

Such protocol has been taken from my old project “Pedrone” (Jun 2015) that you can find at this link: http://ficara.altervista.org/?p=2859.

Here is the oscilloscope screen with a test, while I was modifying the circuit:

How it works

First, you have to prepare the phone that runs the messaging App to play the right notification sound:

1) store the .ogg file (in this case, 1010.ogg) in a folder that contains the sounds for notifications. In my case it was on “phone memory/ringtones” folder.

2) on the instant messaging App go to the profile of the person that you want to drive the relay and set “use personalyzed notifications”, then in the list of available sounds, check the 1010.ogg (if you extend/modify the FW, you can use one of 16 available in the zip download)

Now, when that person sends you a message, you will hear the 1010.ogg sound. Good.

Note that you have to set the notifications volume on your phone. Make some tests until you find an affordable level. On my one, it is about 70%, but it depends on the phone hardware.

Ok, but what about turning the relay ON or OFF? It’s elementary, WatsON! When the circuit receives the sound command via audio jack, it tries to decode it. If the code is recognized the relay is turned OFF and a time window (currently 6 seconds) starts. If in such time there is a new message then the relay is turned ON. So, if you want to turn relay OFF, simply send ONE message (text is not important); otherwise if you want to turn the relay ON, send TWO messages in the time window (less than 6 seconds).

Here is the folder compressed in the file WAremote_220805.zip:

- main.c - the C source file. I compiled it with the IAR AVR Kickstart

- schematic.pdf – the schematic in PDF format

- waremote.hex – the hex file to burn the micro (fuses map in the C source)

- 4bits-oggs – a folder with 16 sounds (commands) in ogg format

This is just an experiment, the first release. If necessary, I will make some modifications, or you can do it, because the commented C source is available!

Have fun…