free web tracker


technical description of the "Midi-Stick"


- page last update october 2007 - (página en castellano)
The entire project, including all electronic schematics, the ASM and the HEX source files of the PIC 16F877 and PIC 16F628A microcontroller, as well as the PDF of the SRF02 (ultrasonic sensor) and ER400xxx can be downloaded as a ZIP file at the bottom of the page.


MIDI-STICK   with SRF02, ER400TS-02, 16F628A and MAX712 batterie charger
Midi-Stick: envia datos por aire de 0x08 a 0xff SRF02 cargador del "Midi_Stick" vista general del "Midi-Stick"

The SRF02 is an ultrasonic range finder that works with a single transducer. Using only one transducer to both transmit the ultrasonic burst and to receive the echo of the same, reduces the size of the unit to only 20x24mm. The small size allows it to be easily incorporated in a tube with a diameter of 25mm.
The SRF02 features both I2C and a Serial Interface. (see PDF SRF02). The Serial Interface is a standard TTL level UART format at 9600 baud,1 start, 2 stop and no parity bits, and may be connected directly to the serial ports on any microcontroller. Up to 16 SRF02's may be connected together on a single bus, either I2C, or serial. The measurement rank is about 15cm to 600cm, so the received results are between 0x08 and 0xFF hexadecimal.
Taking advantage of the “dead” zone (0x00hex to 0x08hex) allows the direct sending of commands to the "Host". An ER400TRS module connected to the UART using a Pic 16F877A receives the data stream from the Midi-Stick, converting it with a serial program routine to midi messages, sending it to PortA, RA4. To have the ability of sending program- or control change messages, increases the performer’s possibilities to create and manipulate sounds. Only two bytes have to be sent to get a result from the SRF02. The first it is the address (between 0 and 15) and the second is the command itself. For example 0x00 (address 0), 0x55 (command): Initiates a new measurement - the result is transmitted automatically from the SRF02 in microseconds by TX.
To control the sensor and both push bottoms the circuit uses Pic 16F628A. The Pic has an UART and the ability for LVP (low voltage programming). IC 74HCT573 is the interface to the Parallel Port of a PC and is used to program the Pic. The ability to program the Pic "in circuit" helps greatly in developing the program. (see programming "in circuit")
Transistor (T1) switches VCC of the ER400TS (Easy-Radio) and VCC of the 74HC4066. After 5 minutes without detection of a new measurement the circuit enters "sleep" mode. This explains the need for the transistor T1. Pressing push bottom S1 wakes the up. A VARTA rechargeable battery, 4,8V 80mA/H is used for the circuit. The charging is done with a MAXIM, MAX712. The circuit is calculated to charge the battery in approximately 3 hours.

Midi_Stick with VARTA 4/V80H, SRF02, 16F828A, 74HCT573 & ER400TS-02 Midi_Stick bottom with MAX712 & 74HC4066
diagrama de bloque del
diagrama de bloque del



HOST receiver with 16F877A, ER400TRS-02 and an In Circuit Programmer using the 74HCT573

Incorporated in the PCB (Printed Circuit Board) of the Host is a microcontroller 16F877A. The Pic controls the receiver (ER400TRS-02) and sends the Midi Data with a serial program routine to PortA. RA4. The ER400TS-02 and the ER400TRS-02 are made by LPRS (Low Power Radio Solutions). The company offers evaluation software (Easy Radio Evaluation Software) to program the modules. This software uses the serial port RS232. Connecting the modules to RS232 it is important to put a level shifter, MAX232 to avoid the destruction of the same because of different voltage levels. The ER400TRS-02 has a "fast ACK" available. In this way, instead of responding with text code "ACK", the answer is a single byte of 0x06hex, that is the ASCII value of ACK. In this way the changes of the configuration of the ER400TRS-02 accelerates remarkably. Like the SRF02 the Easy Radio modules have the speed set as default to 9600 bauds. Incorporated in the PCB of the Host is again a 74HCT573 to have the ability for ICSP (in circuit programming). As the Ports are connected to plugs and PortC is used for indication LEDs, the Host PCB can be used for other applications.

diagrama de bloque del
diagrama de bloque del


ICSP LVP In Circuit Low Voltage Programmer

The ICSP LVP programmer (In Circuit Serial Programmer, Low Voltage Programmer) or low voltage in circuit programmer was designed by Byron Jeff. For the necessities of this project the circuit is slightly modified. (See electronic schematics above). Using free-software WinPic for Windows the ICSP works without any problem. The file “LVP.INI” has to be copied to the subfolder "interfaces" of the WinPic program. The LVP.INI is included in the ZIP file that can be downloaded from this page. The AC terminator with C1 (100pF) and R2 (100 ohm) is important. The resistance, R5 (390 ohm) has a pull down function at the PGM (Pin 36, 16F877A or Pin 4, 16F628A) and stabilises the Pic’s after they have been programmed.

LVP.INI file to be copied into the subfolder "interfaces"

Purpose=LVP.INI PIC programmer interface for ICSP LVP programmer de Byron Jeff.
Remarks=Prepared for WinPic by Martin Hug.


open related links in new window. (only Internet Explorer)


The "" includes all schematics, HEX, ASM files, the file for the MPLAB (developement tool from Microchip) and the Data Sheets for the Ultrasonic Range Finder SRF02, the Easy Radio module ER400xxx-2 etc.