Activate relays with your smartphone (no BT or WiFi, just sounds)

Old smartphones (Pocket PC, Windows Mobile 5 and 6) can be purchased at very low price, and even if old, are really powerful. In addition, you can write and distribute your own applications / games for free, being not in the slavery of “App Markets” of any sort.

In 2009 summer (August and September), I was in France for a “sabbatic” time. I was in city of Albi, relatively far from the sea and the “usual” way to spend summer time (swimming or walking or looking for funny alternatives). France is fantastic for restaurants, aperitives and wine, so that period was very creative for me. The best “fuel” for brain are good food and wines ; if you add that I was are completely alone and without any job duty, you can understand that such condition was very near to the perfection.
Obviously, a minimal “worklab” was part of my baggage: just few things… a solder iron, soldering wire, some indispensable electronic components, a small netbook PC and my smartphone (Samsung SGH-i600). Note that the smartphones like Android and iPhone wasn’t available in that period and the Windows Mobile (5 or 6) was the “modern” OS (surely less intrusive in your privacy than the ones you’re running today). Some time before this journey, I purchased a software tool called PPL (as alternative to Embedded Visual C) and downloaded a free IDE called FBA Creator (you can find a reference to this software gem under my favourite links). I started to realize applications for WM5 / WM6 in the quiet afternoons time, a little step every day. One of the interesting things produced in this learning time, was a program to turn ON/OFF relays using simply DTMF tones played by the phone (under keyboard control). The main idea was to put the phone on a simple “rover” and then write a small webserver to receive commands by any browser, and produce DTMF tones (related to HTTP GET commands) to activate relays, so left and right motors could move the rover and photos taken after every move could be sent via the Internet to my netbook PC. I realized a video that was posted, initially, on youtube. After monster G (Google) acquired youtube, I decided to remove all my videos, ‘cause I was negatively impressed by the growing power of that company, with all the new terms of use of their services ; shorting it, I removed my pages on google space and the videos from youtube. Recently I reloaded some videos on DailyMotion (hoping that this will not be eaten by monster G). If you want take a look at this video, click the player below here and sorry for my horrible english pronuntiation and also for my tragic english writing (NO google translator help, here).

dtmf_remote di robotop

Now, here is the electric diagram of this device. There are 3 relays, the microcontroller (ATMEL ATtiny2313) , one serial interface for  PC connection and analog circuitry to get sounds (thru microphone) and convert them to digital data, by means of specialized decoder IC.

click to enlarge ; PDF copy is included in the downloadable zip

click to enlarge ; PDF copy is included in the downloadable zip

Using this circuit, you can activate / deactivate 3 relays with the DTMF tones emitted by your smartphone / PocketPC. In the downloadable file you can find:
– schematic.pdf , the electric diagram
– dtmf.hex , the Intel-Hex formatted file to burn the micro
– fuses.txt , the fuses configuration used for microcontroller in this application

If you want to take a look at the C source file, click this link
Someone asked me how to indepently control two motors (running CW and CCW) with 3 relays, so here is a state table:

ABC | motor status (0=relay off,as shown in figure; 1=relay ON)
--- | ---------------------------------------------------------
000 | M1 & M2 stop
001 | M1 stop, M2 run clockwise
010 | M1 run clockwise, M2 stop
011 | M1 & M2 run clockwise
100 | M1 & M2 run counterclockwise
101 | M1 run counterclockwise, M2 stop
110 | M1 stop, M2 run counterclockwise
111 | M1 & M2 stop

and a MAD (manually assisted design) schematic…

twomotorsYou can generate DTMF tones directly with your phone keyboard (setting DTMF as default sound for keys) or can use my own program This one is supplied as CAB compressed in ZIP with a password. Such strange arrangment comes from limitations of the hoster to uploading of executable files. When you download the file, you have to unzip it (the password is: eficara) and then you have the that can be directly installed on your WM5 or WM6 device. Note that my Samsung WM6 phone has a full qwerty keyboard, but not a touch screen, so all the commands are activated using the cursor keys and the OK button. You can also activate a sequence of pre-recorded commands ; such sequence has to be stored in a file called sequence.txt , that must reside on the same working directory of the executable. You can create / edit such file with the default Notepad. On every text row there are two numbers, comma separated (no spaces, please). First number is the bitmap of the 3 relays, so can be a number from 0 to 7 ; a number greater than 7 indicates the end of the sequence (it will loop again from the first row). The second number is the time to wait after setting the relays, prior to jump to next sequence step. This number is expressed in mS (milliSeconds) and can range from 100 to 9999. Lower numbers can’t work, ‘cause the DTMF tone needs for a minimal time to be correctly decoded by hardware.
I also wrote another program to play DTMF, using the free tool FBA Creator ; this application is called (as usual, is a zipped CAB with password ; you must unzip it using password eficara and have your ready to be installed on WM5 or WM6 device). The only difference with the previous program (written in PPL) is that the sequence player isn’t included, but the whole working directory, with sources (LUA language) can be downloaded and modified with the FBA tool. IMPORTANT NOTE: if you download and install “FBA the Creator” on Win7 or newer, please create a shortcut to the executable and set this shortcut to be executed by default as administrator. If you don’t do that and launch the executable without administrator rights, you can experience a recursive pop-up error window, that’s very hard to stop. This is just a little problem in a big, genial software, written by an italian author some years ago (in the times of WinXP). Note that all the IDE sources for FBA are also downloadable from the main site. If you look in the forum, you can find some old post by user robotop ; it’s me…

Here is a short presentation video for the FBA IDE I made some time ago for my friends. It’s in Italian, but may be useful just to take a look at the working environment and how it’s easy and powerful (and free…)

FBA-Video_2011-11-23 di robotop

Finally, here is the full working folder (sources and resources) of the DTMF program written under the FBA environment. After downloading the file, you must expand it in a directory ; I suggest a new folder under documents, named FBA with subfolders for this and (may be) your future apps. At this point, if you have the FBA environment installed on your PC, just click the file dtmfrem.fbp to start the IDE and… happy mobile phone programming 🙂

View a short video of this application running in the IDE default emulator…

dtmfrem di robotop

Tombolara: la tombola di E.Ficara

Prima di tutto, tanti auguri per Natale e anno nuovo. Poi, un piccolo regalo… Se volete giocare a tombola, ma avete perso il sacchetto con i numeri, oppure solo qualche numero, potrete ugualmente farlo. Ecco qui un semplicissimo “cartellone” da tombola elettronico, che potrete installare sul vostro smartphone Android.


Immagine del gioco in funzione (in rosso i numeri usciti)

Appena lanciata l’applicazione, sentirete una voce “elettronica” che dice: “Tombola” (vi consiglio di mettere al massimo il volume della sezione multimediale, cosa che potrete fare accedendo alle impostazioni -> audio). Potrete iniziare il gioco premendo “Estrai” per ogni nuovo numero. Le estrazioni avvengono con assoluta casualità e non c’è il rischio d’imbrogli. Volendo, si potrebbe fare anche con gli imbrogli, ma io non sono la persona giusta. Nel caso in cui qualche giocatore si sia distratto e non abbia sentito il numero, potrete premere “Ripeti” e l’ultimo numero verrà nuovamente pronunciato dalla solita voce sintetica. Faccio notare che l’applicazione è scritta per smartphone in modalità portrait (verticale) e utilizza il motore TTS (Text To Speech) per pronunciare frasi e numeri, quindi è necessario abilitare questa funzione sul proprio dispositivo, possibilmente aggiornando anche il dizionario dei fonemi dopo aver selezionato la propria lingua. E’ poi necessario regolare il volume delle applicazioni multimediali, che in diversi telefoni è settato per default al minimo.

L’applicazione è disponibile gratuitamente su Google Play.

Smartphone WM6 – GPS tracker

GPS Tracker: crea un file .kml con le coordinate ricevute da un GPS

Questo programmino serve a visualizzare le coordinate GPS del punto dove ci si trova e per creare un file .kml (google maps) con la traccia del percorso. Il file minigps.kml generato nella directory My Documents, può essere visualizzato con google maps sullo smartphone o sul PC una volta trasferito su di questo. Nota importante: assicuratevi di avere una connessione internet “flat” sul cellulare se volete usare Google Maps o Google Earth ! Altrimenti, il vostro credito telefonico ne soffrirà parecchio…
Per ricevere le coordinate GPS si può utilizzare un ricevitore esterno Bluetooth o uno interno, se disponibile (sul mio Samsung i600 non c’è). Attenzione: la funzione “Stop Log / Save” salva i dati sempre sullo stesso file (minigps.kml), quindi se vi interessa conservare un tracciato, copiate il file salvato su uno nuovo, con un altro nome.
Il file .cab contenuto nel file .zip disponibile per il download è autoinstallante. Una volta estratto e trasferito sullo smartphone WM6, basta cliccarlo per avviare l’installazione ; vi verrà richiesta l’autorizzazione a procedere perché l’autore è sconosciuto a Micro$oft, ma l’autore sono io 🙂 Una volta eseguita l’installazione, troverete una nuova icona nell’elenco programmi, con il nome MiniGps. Se le impostazioni della porta seriale non corrispondono a quelle del vostro sistema, editate con blocco note il file minigps.ini

Compatibilità: Smartphone WM6 (Windows Mobile 6)

screenshot applicazione

screenshot dell’applicazione ; la scrissi in Francia, come si evince dalle coordinate che appaiono in figura…

Nota per il download : non viene fornita nessuna garanzia implicita o esplicita di funzionamento del programma. Non mi assumo nessuna responsabilità per eventuali problemi si dovessero presentare sul dispositivo dove l’applicazione verrà installata. Il programma è un “dimostrativo” e non viene fornita assistenza, né supporto di alcun genere. Scaricando ed installando il programma, accettate implicitamente le mie condizioni di non assunzione di responsabilità. Se non siete d’accordo, non scaricate il file e non installatelo !

Ho letto e compreso la nota, voglio scaricare il file (475 KB)
(ultimo aggiornamento: V1.03 25/08/09) il file .zip contiene il .cab per l’installazione diretta