Un altro telecomando TV per smartphone Android

Sì, l’ho fatto ancora. In un mio precedente articolo descrivevo come costruire una interfaccia da collegare al telefonino per poterlo usare come telecomando per il TV. L’applicazione Android permetteva, in quel caso, di controllare un TV di modello Sony Bravia, che utilizza un protocollo a infrarossi di tipo NEC. Ora non ho più quel televisore ed ho un piccolo Telefunken, che però usa un protocollo a infrarossi di tipo RC5, che è completamente diverso. Allora ho scritto una nuova applicazione, mantenendo sempre la stessa interfaccia hardware. E’ da notare che la distanza di funzionamento di questa versione è inferiore alla precedente. Purtroppo, la frequenza generata col sistema descritto nella pagina citata a inizio articolo è sempre di 38.4 KHz che è molto vicina ai 38 KHz “standard” del protocollo NEC, ma purtroppo è un po’ distante dai 36 KHz canonici del protocollo Philips RC5. Comunque, funziona lo stesso, dato che il notch filter del ricevitore non è proprio così stretto in frequenza, ma ha una “campana” ampia a sufficienza per tollerare questo errore in frequenza… Per la corretta temporizzazione delle fasi di “pieno / vuoto” ho utilizzato i pattern che derivano da 11 bytes di valore 0x5B per il “pieno” (burst di frequenza) e 11 bytes di valore 0x00 per il “vuoto” (pausa). Durante la trasmissione di 11 bytes di valore 0x00 si avranno comunque dei “glitches” di 8.68 uS attivi alti, perché questi sono gli “stop bits” della trasmissione che non posso eliminare. Per fortuna, i circuiti di ricezione presenti nei TV hanno una funzione di “filtro” che elimina questi disturbi. I filtri sono indispensabili perché alcuni tipi di illuminazione domestica (specie i tubi al neon) emettono disturbi nello spettro dell’infrarosso con una potenza notevole (provare per credere). Senza una “ripulita” del segnale, i telecomandi sarebbero poco efficienti. Comunque, i prossimi controlli remoti per TV saranno via radio, con i soliti 2.4GHz che ci stanno rendendo le case simili a forni a microonde… 🙂

Perché il tutto funzioni, è necessario che la versione Android sia in grado di gestire le periferiche USB, naturalmente. Nella figura sottostante potete vedere lo screenshot del programma in funzione.

Il programma in funzione: iRemUSB-RC5

Il programma in funzione: iRemUSB-RC5

La App iRemUSB-RC5.apk è scaricabile gratuitamente dalla mia pagina di Google Play.

Switch relays On/Off with WhatsApp messages

I recently installed the famous messaging application “WhatsApp” on my smartphone. After a while, I decided to create a device that can remotely switch two relays On or Off using messages sent through WhatsApp. Obviously, you must have two active accounts (and two smartphones) for remotely control the relays. In this description we call them the transmitter and the receiver. This device needs for a specific circuit (the relays board) and for a special Android application that works together with WhatsApp on receiver smartphone. Let’s start with the description of the circuit (the hardware), then the Android application (the software) will follow.

The hardware

The hardware is based on PIC12F635 microcontroller from Microchip. It’s a small 8 pin device. In the picture you can see the prototype, realized on a 50x70mm proto board. The smd micro has been placed on small adapter (the red one on the left).

The working prototype

The working prototype

The schematic is relatively simple. We have the micro, a DTMF tone decoder (MT8870), a couple of relays and a switching regulator from 12V to 5V. That’s all.

Schematic diagram; click to enlarge

Schematic diagram; click to enlarge

If you want a more readable copy, download the PDF file at this link. Please note the switching regulator module KIS-3R33S. I purchased a lot of (used) modules on ebay, at very low price. The problem is that the module is rated for 3.3V -3A max output, but I need for 5V out, so I modified the module removing a couple of components: one zener diode and one 51K resistor. It’s a very simple operation, please look at the picture:

The switchin regulator and the parts that must be removed.

The switching regulator and the parts that must be removed. (click to enlarge)

This switching regulator is needed only if you want to have an USB output that can recharge the smartphone that you use as receiver. In other cases, you can simply use a 5V linear regulator capable of 100-200 mA output current. A reduced (easy) schematic will be like this: (please, note that also ICSP section has been removed, that means you must program the micro off-board).

A reduced (easy) version of the schematic (click to enlarge)

A reduced (easy) version of the schematic (click to enlarge)

A pdf version of this schematic can be downloaded at this link.

The circuit detects a sequence of four DTMF tones. The first three tones are “the activation key” and are fixed to ‘1’, ‘3’, ‘7’, while the fourth tone is “the command” and can have the values: ‘2’ for R1-ON R2-OFF, ‘5’ for R1-OFF R2-ON, ‘6’ for R1-ON R2-ON and finally ‘8’ for R1-OFF R2-OFF. Once built up, the circuit can be tested with every device capable of playing MP3 files. The test files 1372.mp3, 1375.mp3,1376.mp3 and 1378.mp3 can be downloaded as a zip file from this link. Connect a stereo jack from the circuit to the player and play one at a time the 4 files. The relays will follow the combination presented as DTMF tones.

To make hardware work, you must program the PIC micro with the .hex file that can be downloaded from this link (updated version:150409 – changed red LED behaviour and implemented timeout after valid key received). The Configuration Bits for the PIC12F635 in this application is shown here:

The configuration word for PIC12F635

The configuration word for PIC12F635 (click to enlarge)

Using the ICD2 programmer under MPLAB, you can receive a warning like this:

ICD2 warning (click to enlarge)

ICD2 warning (click to enlarge)

On my prototype the device is correctly programmed if you click the “OK” button.

The software

The WhatsApp (I will use WA abbreviation from now on) protocol is proprietary and I don’t want to hack the received text messages; so… how to decode a command for relays activation ? I have seen on my smartphone there is a folder named WhatsApp/Media/WhatsApp Images. When you receive an image as attachment to a message sent via WA, a copy of that image is saved on this folder. So, my way to control the relays is simply to poll that directory to see if a new IMG file is present, then I load that file in an imagebox of my Android App and analyze the contents in order to decode the relays command; after that the image is renamed (next polling doesn’t find it again). This way to operate is non-intrusive and co-operative with WA application.

The transmitter doesn’t need any additional application; you just need to store the command images on a folder that’s visible for WA when you try to send an image as attachment ( I use the Downloads folder on main storage). The commands are four (all the combinations of two relays) and are small and simple images:

The images that will be used as attachments for sending commands

The images that will be used as attachments for sending commands

The lower part is for the user (human readable), while the upper part will be read by the Android application. Note that the left two bits are the complement of the right two, this is just to have a validity check while analyzing the image. You can download all the files zipped at this link. Finally, when you want to activate a relay on the receiver, simply send from transmitter a WA empty message with one of the previous command images as attachment.

The receiver is a little bit more complicated. You must download, first of all, a special ringtone, that is the “key” to assign the receiver to a specific transmitter. After downloading the ringtone from this link (right button mouse click to download the ringtone if your browser tries to play it directly), you must store the audio file on the receiver smartphone, in a folder that makes it visible under the phone’s ringtones. On my old A5000 smartphone (Android Version 2.2.1) I created a folder on the main storage (/sdcard/) named Media/audio/ringtones, and inside that folder I stored the new ringtone named 137.ogg; after this operation and after rebooting, the file appeared in the list of ringtones. When this new ringtone is in the list, you must assign it to the specific contact (or contacts) in your phonebook that is (are) authorized to play with relays; then you must set WA preferences to play the notification tone using the contact’s ringtone. To test this settings, send a WA message from transmitter to receiver and hear if the played notification tone is the one just assigned. After this, send a WA message from another phone (not authorized) to the receiver and verify that the notification tone is different (or absent).

Now it’s time to load and install the WhatRelay application from my page on Google Play Store. Once installed, at first run, the program asks for the working directory of WA. On my devices (both of them) this folder is on the main storage (/sdcard/) with this path: WhatsApp/Media/WhatsApp Images/ (take care of capital letters and last slash). Insert this path and accept. Please, note that all files IMG-xxxx.jpg already present on such folder will be renamed by the application in .IMG-xxxx.jpg (hidden), one every 5 + 2 seconds. If you want to preserve such files from renaming, move them to a new folder. In any case, every IMG-xxxx.jpg file present will be loaded and analyzed by the program, then renamed in .IMG-xxxx.jpg, so remove all such files before starting the App, or you will see them appear in the imagebox, be analyzed, then renamed at 5 + 2 seconds steps. The application sets the phone to stay always ON. Click the “quit” button to exit the application and restore the normal auto-turn-off time.

First run of WhatRelay App

First run of WhatRelay App

When the default path is set, the application starts, polling every 5 seconds the working directory to look if any IMG-xxxx.jpg file has been received. In the picture below, there is a screenshot of what happens when an IMG file is found. The image is copied in the small box at the right and after 2 seconds the program analyzes the picture to attribute a code. If the code is valid, a DTMF tone is played. In any case (valid image or not) the IMG-xxxx.jpg file will be renamed in .IMG-xxxx.jpg.

Program running: one IMG file has been received

Program running: one IMG file has been received

So, when WA receives a message, plays the notification tone that is the 137.ogg audio file, containing three DTMF tones that are the “key” to enable the circuit, then the WhatRelay App detects a new image, decodes it and plays the fourth DTMF tone (after less than 15 seconds) and the electronic circuits has received the key and the command, so can switch the relays. Job done.

Please, note that this is a release 0.1. This release will be revised many times. Look at this page or on Google Play Store to see if there is something new (and better). A special note regarding the volumes: remember that the circuit connects to the smartphone headphone plug, so put the volumes around 2/3 of the maximum and remove any notification that isn’t needed for the relays control. Do some tests without connecting the circuit, just to hear if all the tones are played with a good audio level. Use the local command buttons for other tests or for manual control of relays.

Circuito di test per display LCD basato su controller NEC µPD7225G

Questo articolo è stato già pubblicato sul mio vecchio sito, che ora non esiste più. Ho notato che ci sono diversi link su Internet che puntano a quel vecchio documento, così ho deciso di metterlo nuovamente on-line sul mio blog. Eccolo di seguito:

Circuitino di test per accendere un display LCD basato sul controller NEC µPD7225G.

Il prototipo montato e funzionante

Il prototipo montato e funzionante

Il microcontrollore utilizzato è un ATmega48 in package DIP.
Lo schema è visibile nella figura sottostante (cliccare l’immagine per una visione ingrandita):

sch131Ho disegnato anche un piccolo circuito stampato per usi generali (vedi sotto) :

cs131comp131Per una stampa precisa, utilizzare il file nel formato PDF che si trova nello zip scaricabile.

Il display utilizzato per il test ha 12 caratteri da 7 segmenti più numerosi segnalatori.
I segmenti sono mappati secondo la tabella sottostante:

disp131mapIl file sorgente in C contiene le routines di gestione del controller e un piccolo programma di prova che accende, uno alla volta, tutti i segmenti del display.
Per chi non ha il compilatore, c’è anche il file HEX già pronto per essere scaricato nel micro.

Il file ef131.zip contiene:

  • cs131.pdf – il disegno del master in PDF stampabile in scala 1:1
  • main.c – il file sorgente in C del programma di test
  • upd7225.hex – il file compilato pronto per essere trasferito sul micro

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 ef161.zip 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 dtmfremote_cab.zip. 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 dtmfremote.cab 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 fba_dtmf_cab.zip (as usual, is a zipped CAB with password ; you must unzip it using password eficara and have your fba_dtmf.cab 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 FBA_folder_dtmf-remote.zip, 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

Clock with binary display / Orologio con display in binario

Binary Clock, built with Microchip PIC16F676 (or PIC16F630).
The hours are displayed with 4 LEDs which are (from left to right) 8,4,2,1; so hours are shown from 1 to 12 (no am and pm).
The minutes are displayed with 5 LEDs that are (from left to right) 40,20,10,5,0; in practice, they show in 5 to 5 way and the exact hour (minute 00) turns ON led 0, because I don’t like to have the minutes row completely OFF.
For viewing the time, press shortly the button. Hours and minutes are shown for 3 seconds, then the LEDs are off.
To adjust the time, press and hold down the button until the top row only turns ON and leds begin a binary counting from 1 to 12.
When you reach the desired time, release the button. After a time of 5 seconds, the display automatically shows the minutes and pressing the button, they advance with the binary counting (5 min steps). When you reach the desired minutes, release the button.
Again, after a time of 5 seconds both the led rows turns ON to show hours and minutes (the seconds are cleared automatically), and everything is shut down. The time has been set. The file binwatch.zip contains the wiring diagram in PDF format and the object file (Hex) to program the micro.

The C source was compiled with CC5X Version 3.2I, Copyright (c) B Knudsen Data,Norway 1992-2005 (free edition). If you want to take a look at C source code, click this link.

The prototype: back and front views

This is the PCB diagram (just small image, but a link to PDF 1:1 scale is provided)

For a full size 1:1 PDF, click this link

Note that the circuit uses conductive vias.

Orologio con display binario, realizzato con Microchip PIC16F676 (oppure PIC16F630).
Le ore vengono visualizzate con 4 led che valgono (da sinistra a destra) 8,4,2,1; vengono mostrate quindi le ore da 1 a 12 (niente am e pm). I minuti sono visualizzati con 5 led che valgono (da sinistra a destra) 40,20,10,5,0 . In pratica i minuti vengono mostrati di 5 in 5 e lo scoccare dell’ora (minuti 00) fa accendere il solo led 0, questo perché mi sembra brutto lasciare del tutto spenta la riga dei minuti. Per ottenere la visualizzazione dell’orario, si preme brevemente il pulsantino. Le cifre vengono mostrate per 3 secondi, quindi i led vengono spenti. Per regolare l’ora si tiene premuto a lungo il pulsante fino a quando si accende solo la riga superiore (ore) e i led cominciano un conteggio binario da 1 a 12. Quando si raggiunge l’ora desiderata, si lascia il pulsante.
Trascorso un tempo di 5 secondi, il display mostra automaticamente i minuti e premendo nuovamente il pulsante, questi avanzano con il conteggio binario (si regola, quindi di 5 min in 5 min). Quando si raggiunge il minuto desiderato, lasciare il pulsante. Dopo un tempo di 5 secondi i led si accendono a mostrare ore e minuti (i secondi vengono azzerati automaticamente) e infine tutto si spegne. L’orario è stato regolato.
Il file binwatch.zip contiene lo schema elettrico ed il file oggetto .hex per programmare il micro.

Il codice sorgente in C è stato compilato con CC5X Version 3.2I, Copyright (c) B Knudsen Data,Norway 1992-2005 (free edition). Se desiderate dare un’occhiata al codice sorgente in C dell’applicazione, cliccate questo link.

binwatch_sch

schematic diagram ; click the image to enlarge. A PDF version is included in the downloadable ZIP file

 

Roman numerals clock : orologio LCD con numeri romani

Questo circuito che vi propongo, basato su micro ATtiny2313, realizza un orologio LCD con numeri romani.

Il prototipo del circuito, realizzato su una scheda millefori.

Il prototipo del circuito, realizzato su una scheda millefori (segna le 17:20)

Alla prima accensione mostra una schermata lampeggiante con la scritta “Tempera tempus” per ricordare che si deve effettuare la regolazione.

Le fasi della regolazione dell'ora

Il display in fase di richiesta regolazione (prima riga) e nelle fasi di visualizzazione (ultime due righe). La scritta “et” lampeggia con cadenza 1 secondo.

La regolazione si effettua mediante questa procedura :

1) Premere e tenere premuto il pulsante per circa 3 secondi ; sullo schermo appaiono le ore ; rilasciare il pulsante.
2) Premere nuovamente il pulsante e tenerlo premuto ; le ore avanzano da “I” a “XXIV” ; rilasciare il pulsante sull’ora giusta.
3) Attendere circa 3 secondi ; sullo schermo appaiono i minuti.
4) Premere nuovamente il pulsante e tenerlo premuto ; i minuti avanzeranno da “nulla” a “LIX” ; rilasciare il pulsante sui minuti giusti.

Non essendoci una batteria, l’orologio non mantiene l’ora se va via la corrente. Ogni volta che si stacca l’alimentazione, alla riaccensione verrà visualizzato il messaggio che ricorda di effettuare la regolazione. Nella figura sottostante potete vedere lo schema elettrico. Per una visione più dettagliata, scaricate il PDF dal link indicato nella didascalia.

il file PDF può essere scaricato da questo link

Cliccare l’immagine per ingrandirla ; il file PDF può essere scaricato da questo link

Il display LCD che ho utilizzato, purtroppo, necessita di una tensione negativa su Vo per ottenere il massimo contrasto. Ho usato un pin del micro per generare un’onda quadra e il circuito in basso a sinistra nello schema (transistor, condensatori e diodi) per ottenere tale tensione. In caso di display LCD “normali”, cioè in grado di funzionare bene anche con sole tensioni positive, tale circuito diventa inutile e può essere eliminato.

Nel file ef162.zip scaricabile a questo link sono contenuti :
– schematic.pdf , lo schema elettrico del circuito
– roman.hex , il file HEX per la programmazione del micro
– fuses.txt , il file di testo con la configurazione dei fusibili del micro per questa applicazione.

Se desiderate dare un’occhiata al codice sorgente in C dell’applicazione, cliccate questo link.

RxMet1 – ricevitore per sensore esterno Hygro-Thermo a 433 MHz

Questo circuito permette di ricevere i dati trasmessi da un sensore Oregon Scientific modello THGR228NF (visibile nella figura sottostante) in radiofrequenza a 433 MHz.

sensor-THGR228NFIl circuito è stato pubblicato (a mio nome) sulla rivista CQ Elettronica nel numero di Settembre 2007 (consultare la rivista per maggiori dettagli).

Il microcontrollore utilizzato è un Atmel ATtiny2313 ; lo schema è visibile qui sotto:

Per una visione nitida, scaricare il PDF da questo link

Cliccare l’immagine per ingrandirla ; il file PDF può essere scaricato da questo link

Nella prossima immagine si può vedere il prototipo del circuito con i componenti montati :

rxmeteoIl circuito stampato è visibile nell’immagine qui sotto ; ovviamente, per realizzare un circuito mediante fotoincisione, bisogna stampare l’immagine in scala 1:1 e pertanto è opportuno scaricare il file PDF raggiungibile tramite il link nella didascalia dell’immagine.

stampato

Il file PDF in scala 1:1 può essere scaricato da questo link

Infine, nella prossima immagine si può vedere la disposizione dei componenti sul circuito.

montaggio

Il file contenente l’elenco dei materiali, il codice HEX da scrivere sul micro ed i batch files per settare il clock esterno e per effettuare la programmazione dell’ATtiny2313 (tramite il programma freeware SP12), può essere scaricato da questo link. Se desiderate dare un’occhiata al codice sorgente in C dell’applicazione, cliccate questo link.

I dati in uscita dal circuito sono “grezzi”, cioè rappresentano in Ascii l’insieme di bits ricevuti dal sensore, raggruppati in notazione esadecimale. Nella figura sottostante, i dati ricevuti dal sensore sono mostrati nel riquadro a sfondo verde (quello in alto, per i daltonici..) mentre la “traduzione” in temperatura e umidità sono nel riquadro a sfondo blu (quello in basso).

Screenshot del programma su PC per la visualizzazione dei dati

Screenshot del programma su PC per la visualizzazione dei dati

Ho realizzato il programma in VB6 ; chi fosse interessato può scaricare il file d’installazione da questo link. Ricordo che il programma è offerto gratuitamente a scopo di test e non ha alcuna clausola di garanzia e nessuna assunzione di responsabilità da parte mia per eventuali danni o malfunzionamenti.

Il “cuore” di questo programma è una DLL (libreria) scritta da me per decodificare il protocollo di trasmissione del sensore. Chi volesse scrivere un proprio programma per visualizzare i dati forniti dal sensore, potrà usare liberamente tale DLL scaricandola da questo link e inserendola nel proprio programma. Di seguito, un esempio di come utilizzare la DLL in un programma VB6 per decodificare la stringa di dati “grezzi” ricevuti dal sensore in valori leggibili di temperatura e umidità:

// declare the convert function
Private Declare Function RawConvert Lib "meteo.dll" (ByVal text As String) As String

// use the function
//  rxraw contains the full ascii string received from RxMet1
//  rxd contains the decoded Temperature and Hygro
dim rxd as string
dim rxraw as string

    rxd = RawConvert(rxraw)

Nota: questo materiale fu già pubblicato su un mio vecchio sito (ora cancellato) e venne citato da “Hack-a-day” nel settembre del 2007.

Oscillogio – orologio su oscilloscopio

Questo progettino consiste in un orologio digitale che ha la particolarità  di avere come display un oscilloscopio ! Viene utilizzata SOLO la modulazione sull’asse Y, quindi si può utilizzare qualsiasi tipo di oscilloscopio, anche uno vecchio (e stanco). Questo progetto è stato pubblicato (a mio nome, naturalmente !) sul numero di Giugno 2007 della rivista CQ Elettronica (Edizioni CD). Il circuito è basato sul micro Atmel ATtiny2313 oppure AT90S2313 (vecchia versione). Se si usa la nuova versione, bisogna avere l’accortezza di programmare i “fuses” interni affinché venga utilizzato l’oscillatore quarzato esterno e non quello libero interno.

Ecco il circuito con l’alimentazione a 3V ricavata da due normali batterie AA.

Nel documento zip scaricabile da questo link troverete i files “batch” per programmare memoria flash e “fuses” del micro usando il programma freeware SP12.

Il file giugno07.zip contiene:
– schema.pdf – lo schema elettrico in PDF
– stampato.pdf – il circuito stampato in scala 1:1 formato PDF
– lista_materiali.txt – la lista dei materiali
– montaggio.jpg – lo schema di posizionamento dei componenti
– ckscope.hex – il file HEX per programmare il micro
– tinySetClock.bat – il file “batch” per programmare i “fuses”
– wrProg.bat – il file “batch” per programmare la flash

Aggiornamento 20 Ago 2017: nel vecchio articolo pubblicato a questo link: http://ficara.altervista.org/pages/ef_avroscillo/avroscillo.htm troverete anche il codice del programma sorgente in C.


Digital clock that uses a single channel oscilloscope as display. Only the ‘Y’ axis modulation is used, so every old (and tired) oscilloscope can be used. This project was published (by me, of course !) on the 2007 June issue of italian magazine “CQ Elettronica”. The circuit is based on popular ATtiny2313 or AT90S2313 microcontroller. If you plan to use the new one (the ATtiny2313) please remember to program the fuses for external xtal oscillator. In the downloadable zip document at this link you can find the batch files to program the memory and the fuses of the microcontroller using the SP12 free tool.

File giugno07.zip contents:
– schema.pdf – the electric schematic in PDF format
– stampato.pdf – the PCB layout in 1:1 scale
– lista_materiali.txt – the bill of materials
– montaggio.jpg – the components mounting map
– ckscope.hex – the HEX file to burn the micro
– tinySetClock.bat – the batch file for micro’s fuses programming
– wrProg.bat – the batch file for micro’s memory programming

Update Aug, 20, 2017: in the old article published at this link: http://ficara.altervista.org/pages/ef_avroscillo/avroscillo.htm you can find the souce code of the program in C.


RFID reader for 125 KHz tags, RS232 output (also works as electronic lock)

This circuit, based on Atmel micro ATtiny2313, reads RFID tags at 125 KHz. The code of the first tag read after micro burning is stored in the internal earom and then causes a pulse of about one second on relay contacts every time that tag is placed near the reader. This makes it possible to realize a simple and touchless electronic lock. The stored tag, and every other tag that’s placed near to the reader, also cause the serial output of the inside code, in ASCII format, allowing to implement a generic reader for access control. This circuit was published by me on the magazine CQ Elettronica in the May 2009 issue and entitled “RFID reader 125KHz”; consult the magazine for more details on the circuit and implementation.

Want to take a look at C source file ? Click here

To burn the micro, the freeware SP12 has been used, in the versions for WinXP or Win2K. The batch files included in downloadable ZIP require the use of this software for programming the micro (you can easily find it with a Google search). If you have another tool for micro burning, the configuration for fuses in the application described is the following :

// CONFIGURATION Fuses: Ext = 0xFF High = 0xC9 Low = 0xDF
// Note: SP12 High Fuses used in only 6.1 bits, so 0xC9 (11001001) becomes 0x24 (100 100)

The downloadable file EF150.zip contains:
–  schematic.pdf – electric schematic in PDF format
– top.pdf – Printed circuit board layout (single sided) in PDF 1:1 scale
– topprint.pdf – layout of components on the circuit
– rfid.hex – compiled HEX file ready to be burned into the micro
– wrFuses.bat – batch file to program the micro fuses
– wrProg.bat – batch file to start the firmware programming
– wrEarom.bat – batch file to overwrite the earom (stored tag)
– ef150pic.jpg – photos of the circuit mounted
– interfaces.gif – a couple of circuits to interface the card to a PC or a micro
– earom.txt – text file containing the 5 bytes to erase key tag in earom

Added Ago 30 2009
Coil has 105 turns of 0.2mm wire wound on 30mm diameter support; in the prototype I used the neck of a plastic bottle, visible in the figure.

Added Feb 28 2010
Note: The driver SN75176 is used ONLY as power driver, but the circuit works even if you remove the chip and simply put a jumper between pins 4 and 6 of the 8 pin socket. Obviously, the driver makes more “relaxed” the microcontroller’s output pin PB2.
Added Mar 1 2010
Note: You can browse the SP12 AVR programmer project at this site/url:
http://www.xs4all.nl/~sbolt/e-spider_prog.html.
Added Mar 2 2010
Oops, someone noticed that the circuit’s picture shows an ATTiny2313V-10PU cpu; well, the right chip is the one that’s in the circuit’s schematic diagram: the ATTiny2313-20PU. The last one, in fact, can run with the 16 MHz crystal needed by the application, while the first one is guaranteed only up to 10 MHz. The reason for the 10 MHz version mounted on board is (simply) that I didn’t own the fast version and tried (successfully) with the slow one. Ok, DON’T LOOK at the picture, look at the schematic diagram !!!

Added Sep 10 2010
The active range is about 3 cm with the coil shown in figure. Better results can be obtained modifying the coil diameter (and the number of turns, obviously).

Recently, I have done a personal version of RS232 (or USB-RS232 converter) programmer for ATtiny2313 micro using only 74HC00 as active part; if you like to use my own Atmel AVR programmer for ATtiny2313 burning, this is the map for fuses :

P.O.V. – Auguri rotanti

Questo circuito genera la scritta “AUGURI” a matrice di punti, ma utilizzando solo una striscia di 7 (oppure 8) LED. Grazie alla P.O.V. (Persistence Of Vision), cioè l’effetto ottico di persistenza delle immagini sulla retina, basta far roteare la scheda (fissata, come si vede, su un bastoncino di legno con un perno in forndo), per vedere “apparire” la scritta. E’ possibile personalizzare il messaggio modificando in modo opportuno i valori scritti nella memoria dati. Pubblicato a mio nome sulla rivista CQ Elettronica Aprile 2007 con il titolo “Auguri rotanti”; consultare la rivista per maggiori dettagli.

Il microcontrollore utilizzato è un ATtiny2313 in SMD; lo schema in formato PDF è disponibile nel file scaricabile a questo link , insieme al resto della documentazione.

Il file Aprile07.zip contiene :
– sch.pdf – lo schema in formato PDF
– cs.pdf – il disegno del master in PDF stampabile in scala 1:1
– striscia.hex – il file compilato pronto per essere trasferito sul micro
– earom.txt – il file che contiene i dati per accendere la scritta AUGURI
– wrDati.bat – il file batch per avviare la programmazione dei soli dati (scritta)
– wrProg.bat – il file batch per avviare la programmazione del firmware e dei dati