Silicon ChipBuild A MIDI Theremin, Pt.1 - April 2005 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Reader feedback is welcome
  4. Feature: Install Your Own In-Car Video by Gary Rollans
  5. Project: Build A MIDI Theremin, Pt.1 by John Clarke
  6. Feature: The Start Of Colour TV In Australia, Pt.2 by Keith Walters
  7. Project: Bass Extender For Hifi Systems by Rick Walters
  8. Project: Build A Professional Sports Scoreboard, Pt.2 by Jim Rowe
  9. Project: SMS Controller Add-Ons by Peter Smith
  10. Vintage Radio: The mysterious Monarch D671/32 from Astor by Rodney Champness
  11. Salvage It: A $5 variable voltage power supply by Julian Edgar
  12. Back Issues
  13. Advertising Index
  14. Outer Back Cover

This is only a preview of the April 2005 issue of Silicon Chip.

You can view 35 of the 104 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Items relevant to "Build A MIDI Theremin, Pt.1":
  • PIC16F88 firmware and accompanying software for the MIDI Theremin (Free)
  • PCB Patterns for the MIDI Theremin (PDF download) [01204051/2] (Free)
  • MIDI Theremin front panel artwork (PDF download) (Free)
Articles in this series:
  • Build A MIDI Theremin, Pt.1 (April 2005)
  • Build A MIDI Theremin, Pt.1 (April 2005)
  • MIDI Theremin, Pt II (May 2005)
  • MIDI Theremin, Pt II (May 2005)
Articles in this series:
  • The Start Of Colour TV In Australia, Pt.1 (March 2005)
  • The Start Of Colour TV In Australia, Pt.1 (March 2005)
  • The Start Of Colour TV In Australia, Pt.2 (April 2005)
  • The Start Of Colour TV In Australia, Pt.2 (April 2005)
Items relevant to "Bass Extender For Hifi Systems":
  • Bass Extender PCB pattern (PDF download) [01104051] (Free)
  • BASS Extender front panel artwork (PDF download) (Free)
Articles in this series:
  • Build A Professional Sports Scoreboard, Pt.1 (March 2005)
  • Build A Professional Sports Scoreboard, Pt.1 (March 2005)
  • Build A Professional Sports Scoreboard, Pt.2 (April 2005)
  • Build A Professional Sports Scoreboard, Pt.2 (April 2005)
  • Pro Scoreboard, Pt III (May 2005)
  • Pro Scoreboard, Pt III (May 2005)

Purchase a printed copy of this issue for $10.00.

Connect it to your computer (with sound card) or a MIDI synthesiser for a truly awesome array of sound possibilities. Using a computer, you can even record, save and playback your compositions. MIDI THEREM THERE Move over “Theremin” . . . the “MIDI Theremin” is here. While it’s based on the original concept of producing sounds using hand movement, it has now gone digital, taking the Theremin from the 20th to the 21st century! T he original Theremin, with a foot pedal to control volume and a switch mechanism to control pitch, was invented during World War One – in 1917, to be exact – in St Petersburg, Russia. It was named after its inventor, a young cellist and physics student, Lev Sergeivitch Termen. (It was also known as the Aetherophone or Etherphone, meaning “sound from the ether”). Termen’s life story is a kaleidoscope of intrigue itself. After demonstrating and playing his device throughout Russia and Europe (Lenin was said to have been very impressed), he travelled to the USA in 1927 and decided to stay, and married . . . much later, it was claimed he was in the US as a Russian spy. 24  Silicon Chip Lev Termen “playing” the RCA Theremin, first produced in 1929. But in 1938 he was kidnapped by the Russian NKVD (which later became the KGB) and clandestinely spirited back to Russia, where he was sentenced to a Siberian labour camp for “anti-Soviet propaganda”. After his “rehabilitation”, he apparently again found favour with Russian authorities and taught at the Moscow Music Conservatory up until his death in 1993, aged 97. In his later years he was again allowed to travel to the USA where he was introduced to the Beach Boys, who themselves made the Theremin famous in one of the most famous tracks of all time – Good Vibrations. We’ve immortalised Lev to some degree (who incidentally was known siliconchip.com.au Features • Sound outpu t via a compute r and speakers • Selection of 1 or a synthesiser 5 instrument ty pes with 8 vari • Record, save ations of each and playback u sing a compute • Volume plate r and pitch anten na • Auxiliary inpu t for pitch or no te change • Back-lit LCD shows instrum ent selection, vo • Selection of su lume, note and stain on or off pitch or setting • Adjustment fo s r discrete note or pitch glide ef • Selection of n fect between no ormal or wide n tes ote range • Selection of n otes with or wit h out sharps • Selection of an tenna operation from note chan and auxiliary in ge to pitch chan put from pitch ge glide to note ch • Midi out, gam ange es port or serial connections (U • Plug-pack po SB via a conve wered rter) MIN EMIN Part 1: by John Clarke siliconchip.com.au April 2005  25 This close-up of the completed MIDI Theremin shows the various controls on the front panel (fully explained in the text), along with the volume level plate (left) and the telescoped whip antenna (top), here shown in the “transport” position. in the west under the Gallic form of his name, Léon Théremin) by including a stylised image of him on the front panel of our design! The Theremin version we know today, using a volume plate and pitch antenna, was developed and first produced in 1920. A commercial Theremin was built by RCA in 1929 and comprised a large wooden box to house the valve electronics and included the volume plate (actually a wire loop) and pitch antenna. Moving the left hand closer to the sensor would reduce the volume level; conversely, taking the hand away would increase the level. Similarly, pitch could be controlled using hand movement around the antenna. The thinness of the antenna allowed for very fine pitch adjustment by only moving the fingers while keeping the hand still. Larger pitch changes could be accomplished by moving the hand inward to decrease the pitch and away from the antenna to increase the pitch. Somewhat unsuccessfully marketed as a replacement for a piano, RCA’s Theremin sold for $US175 in 1929. Oh, you wanted tubes (valves) and a loudspeaker with that? Another $71.50, please! (That was, of course, a lot of money in 1929). The sound produced by that Theremin (or by modern versions) is similar to the eerie sounds heard in many science fiction movies. In fact, it is the eerie sound heard in many science fiction movies! Although some may consider the Theremin to be just an electronic toy, it’s also regarded by others as a legitimate musical instrument. There have been countless professional performances using the Theremin , either alone or as part of an orchestra. From Theremin to synthesiser The Theremin concept lead to the development of electronic music, starting with the Moog (pronounced mogue, as in vogue) synthesiser (invented by Robert Moog in the 1960s). Today we have fully digital synthesisers and samplers that can produce just about any type of sound imaginable. Incidentally, any idea where Robert Moog got his interest in electronic music from? You guessed it, a home-made Theremin he built from a magazine article when he was 14 years old. The Theremin itself has also been updated in many forms over the past 80+ years to use transistors in the electronics instead of bulky and What is MIDI? MIDI is an acronym for Musical Instrument Digital Interface. It is a system for communicating between synthesiserequipped electronic musical instruments and PC-based sequencers. The communication is a series of codes that can control the synthesiser. Control codes can for example be sent to set the instrument sound, start or stop a note being played, vary the pitch of the note and set the volume. The code is sent as 10-bits with one start bit, eight code bits and a stop bit at a rate of 31.25k baud. The communication is asynchronous and is provided using a 5mA current loop. In more detail, a MIDI message can be defined as either a channel or system message. The channel message applies to a specific synthesiser channel from 1 to 16, while 26  Silicon Chip the system message applies to all channels. System messages include resetting, tuning and timing codes. Channel messages can be further broken down into voice or mode messages. The voice messages include turning a note on or off, the pressure (how hard a key on a keyboard is pressed), pitch blend (where the note frequency changes off key) and program change (to alter instrument). Mode messages affect the way the synthesiser will respond to a note being played. For example, the sustain effect can be switched on or off and the note can be selected to pan between the left, centre or right channels siliconchip.com.au power-hungry valves. Later designs used both transistors and then ICs – a design using ICs was published in the August 2000 issue of SILICON CHIP (the article is available via www.siliconchip.com.au). That design replicated the original Theremin in the way it produced sounds, using the pitch antenna and volume plate approach. The project remains very popular to this day, with Jaycar Electronics and Dick Smith Electronics still selling it as a kit. Although the August 2000 Theremin works well, it is only able to produce the original, characteristic Theremin sound – an almost pure sine wave, which is not overly musical. We reasoned that the Theremin would be more interesting to play and use if it could produce different sounds. So why not merge the old and the new and use a digital synthesiser to produce the sounds while keeping the original Theremin control format with the pitch antenna and volume plate? And that is exactly what we have done – produced a MIDI Theremin that has the volume plate and the antenna for volume adjustment and pitch control as in the original Theremin – but instead of providing an internal sinewave oscillator to produce the basic sound, we control an external synthesiser instead. Use of the synthesiser allows a huge selection of different instrument sounds that can be played, all under the control of the MIDI Theremin. And just in case you are wondering where you get a synthesiser from, it is available in just about every home in the developed world – in your personal computer. We take advantage of a now-universal standard, the Musical Instrument Digital Interface or MIDI and the myriad of software available for MIDI on the PC. More on this shortly! Accompany the computer with multimedia loudspeakers and you can begin to realise the possibilities of the sounds produced by the MIDI Theremin. And for even greater sound levels and deeper bass, connect the computer’s audio output to an amplifier and high fidelity speakers. In fact, if you want to reproduce the very low frequencies that can be generated via the MIDI Theremin setup, hifi speakers are a must. The MIDI Theremin is easy to siliconchip.com.au Specifications Note Range with Sharps (#) (reference: middle C is designated as C3 (261.626Hz): Wide C#-2 to G8 (126 notes, over 10 octaves) (8.662Hz to 12.544kHz) Normal C1 to C6 (61 notes, 5 octaves) (65.406Hz to 2.093kHz) Note Range without sharps (Natural or C Major scale): Wide D-2 to G8 (74 notes, over 10 octaves) (9.177Hz to 12.544kHz) Normal C1 to C6 (36 notes, 5 octaves) (65.406Hz to 2.093kHz) Pitch glide: 8 steps between notes for wide note range 16 steps between notes for normal note range Compensation of pitch between notes when there is no sharp in between the note (i.e. between E and F and B and C) Pitch glide range (calibration is synthesiser dependent): 0 to 255 for between notes that include a sharp 0 to 511 for between notes without sharps Pitch range when antenna is selected set for pitch variation: -500 to +500 (not calibrated) in steps of 1 Volume steps: >1000 steps from maximum level to off Volume display: 0 to 500 in steps of 1 (500 is maximum volume) Current consumption: 135mA with 9V DC in MIDI out: 5mA loop, galvanic isolation for games port (31.25k baud) Serial out: RS232 levels (38.4k baud) use. A liquid crystal display (LCD) screen shows what is happening. In fact, when the display is showing the volume level, note and pitch, it is possible to play the MIDI Theremin even without listening to it. Perhaps Beethoven would have appreciated the visual feedback of this unit, being totally deaf in his latter years! Sound differences The sound produced by the MIDI Theremin and synthesiser combination is not exactly the same as the original Theremin. While the original Theremin could produce a virtually infinite number of tones over its frequency range, a synthesiser can only play discrete notes. This effect goes against the Theremin “continuous frequency” concept, so we have incorporated a pitch glide feature where the pitch of a note changes for in-between note positions on the antenna. The glide feature is implemented in such a way that the change from note to note is less noticeable than without the pitch glide effect. There is still a distinct level change when another note begins but the effect is very good at simulating a continuous variation in tone. In particular, this is true when specific instruments are selected and if the hand movements are not extremely slow. The accompanying instrument table shows the instruments that can be used to best effect with this pitch glide feature to simulate the continuous tone variation of the original Theremin. The designated instruments are marked with an asterisk. Presentation The MIDI Theremin is housed in a small plastic box which is mounted on a sloping stand. The stand acts to raise the hand plate and antenna above the desktop (or wherever it is placed) so that the hand controls are not affected by the proximity to the mounting surface. The sloping face of the box also improves visibility of the LCD screen and the operation of the hand plate. The hand plate and antenna are spaced as far apart as possible and oriented so that the left and right hands operate in different planes. This prevents any interaction between the two controls. By the way, the antenna is normally used in its retracted, or closed, posiApril 2005  27 Instruments Instruments that thatcan can be be selected selected with the MIDI Theremin PIANO 1.Acoustic 5.Electric #1 2.Bright Acoustic 6.Electric #2 3.Electric Grand 7.Harpsichord 4.Honky Tonk 8.Clavichord 2.Glockenspiel 6.Xylophone 3.Music Box 7.Tubular Bells 4.Vibraphone 8.Dulcimer 2.Percussive 6.Accordian 3.Rock 7.Harmonica 4.Church 8.Tango Accordion 3.Electric Jazz 7.Distortion 4.Electric 8.Harmonic 2.Electric (Finger) 6.Slap #2 3.Electric (Pick) 7.Synth #1 4.Fretless 8.Synth #2 2.Viola 6.Pizzicato 3.Cello 7.Harp 4.Contra Bass 8.Timpani CHROMATIC PERCUSSION 1.Celesta 5.Marimba ORGAN 1.Drawbar 5.Reed GUITAR 1.Acoustic 2.Steel Acoustic 5.Electric Muted 6.Overdriven BASSapart 1.Acoustic 5.Slap #1 STRINGS 1.Violin 5.Tremolo* Synthesiser ENSEMBLE 1.String #1* 5.Choir Aahs* 2.String #2* 6.Voice Oohs 3.Synth Strings #1* 4.Synth Strings #2* 7.Synth Voice* 8.Orchestra Hit 2.Trombone 6.Brass Section 3.Tuba 7.Synth #1 4.Muted Trumpet 8.Synth #2 2.Alto Sax 6.English Horn 3.Tenor Sax 7.Bassoon 4.Baritone Sax 8.Clarinet 2.Flute 6.Shakuhachi 3.Recorder 7.Whistle 4.Pan Flute 8.Ocarina 2.Sawtooth 6.Voice 3.Calliope 7.Fifths Sawtooth 4.Chiffer 8.Bass 2.Warm 6.Metallic* 3.Polysynth 7.Halo* 4.Choir 8.Sweep* 2.Soundtrack 6.Goblins* 3.Crystal 7.Echoes* 4.Atmosphere 8.Science Fiction* 2.Banjo 6.Bagpipe 3.Shamisen 7.Fiddle 4.Koto 8.Shahnai 2.Agogo 6.Melodic Drum 3.Steel Drums 7.Synth Drum 4.Woodblock 8.Reverb Cymbal BRASS 1.Trumpet 5.French Horn REED 1.Soprano Sax 5.Oboe PIPE 1.Piccolo 5.Blown Bottle SYNTHESISER LEAD 1.Square 5.Charango SYNTHESISER PAD 1.New Age 5.Bowed* SYNTHESISER EFFECTS 1.Rain 5.Brightness ETHNIC 1.Sitar 5.Kalimba PERCUSSIVE 1.Tinker Bell 5.Taiko Drum Those marked with a * produce eerie sounds characteristic of the original Theremin, particularly when the pitch glide control is set correctly. 28  Silicon Chip tion. Extending it has the same effect as bringing the hand closer to the antenna. The LCD becomes the “window” to view the MIDI Theremin’s operation. It can show the selected instrument, effects settings, volume, note and pitch being played, plus other settings. Nine pushbutton switches are used to change the instrument, the effects and other settings. An auxiliary potentiometer control (used for different effects) is mounted on the righthand end of the box. You can make this an external control (eg, used with a foot pedal) via the stereo jack socket at the rear of the box. Other connectors at the rear of the box are the MIDI out, the serial connector, the games port connector and the DC power socket for the 9V DC plugpack attachment. A power switch selects power and the LED adjacent to the MIDI socket is for the MIDI invalid indication. More on this later. As mentioned, the MIDI Theremin cannot be used on its own; it needs to be connected to a synthesiser. By far the most common source of a synthesiser is inside a standard personal computer or laptop using the soundcard’s synthesiser. However, as MIDI itself is a standard, another source for a synthesiser is in a MIDI electronic instrument such as a MIDI keyboard. The MIDI Theremin can be used on either of these two synthesisers. Signals from the MIDI Theremin are sent as a series of codes in MIDI format that command the synthesiser to produce sounds. More detail on MIDI can be seen in the accompanying “What is MIDI” section. To connect the MIDI Theremin to a MIDI instrument you use a purposemade MIDI lead between the two. When connecting to a computer, you have the option of using either the games port outlet (which connects directly to the computer’s sound card), or to the serial outlet that connects to a serial port on the computer. The sound card input on the computer will accept MIDI signals directly and uses a DB15 connector. Many modern computers do not have a games input and so you will need to use a serial port instead. If you do not have a serial port or siliconchip.com.au effects are also available. We used a freely available sequencer program that can be downloaded from the Internet. The software works with Windows 3.1, 95, 98, Me, 2000, NT and XP. We will explain how to download, install and use the software in Part 2. Software for the serial port driver works with Windows 95, 98, Me, 2000, NT and XP. Presumably, if you are using Windows 3.1, this serial port driver will not be required since you will have the games port available. The serial-to-USB port driver works with Windows 98 through to XP. MIDI Theremin controls This inside shot gives a good idea of how it all goes together. There are two PC boards, the main one mounting in the case and the display board in the lid. They’re connected by an IDC cable. You’ll find construction details next month. games port, then the only way to use the MIDI Theremin is via the USB port on the computer. In this case, you will need to use a MIDI to USB converter or a serial port to USB converter. MIDI to USB converters currently cost around $140, while serial to USB converters are only around $40, so if you need to use USB ports on the computer we recommend the serial to USB option. In both cases, software will need to be installed in order for the USB ports to respond to the signals sent by the MIDI Theremin. program. This accepts the MIDI signal sent by the MIDI Theremin and directs it to the sound card’s synthesiser. The sequencer also provides many other functions such as the ability to record the music, store it and play it back. You can also multi-track record for up to 32 tracks and mix these together using individual volume level settings. Panning from left to right, instrument change, looping and quantisation By far the most-used control on the MIDI Theremin will be the Instrument/Note switch. This switch selects whether the display will show the current instrument selection or the volume, note and pitch value. Each pressing of the switch will toggle the selection from one to the other. To select an instrument, you press the Instrument/Note switch to bring up the word “INSTRUMENT” on the top line of the LCD. The second line will show the current instrument selection. Instruments are selected using one of four switches. To change the in- Houston, we have a problem! The signal at the MIDI Theremin’s serial (computer) output is not genuine MIDI standard. It’s 38.4k-baud vs MIDI’s 31.25k-baud. Consequently, this can only be used to drive a computer, NOT a MIDI instrument. In this case, a LED lights to indicate that the MIDI output is invalid. The oscilloscope waveforms of Fig.2 show the difference. At the top is the genuine MIDI signal with 31.25k-baud rate codes, while the lower trace shows the same code transmission at the 38.4k-baud rate suitable for the serial port computer connection. The lower trace also shows how the signal transmission is completed over a shorter time. Software Software is required when using the computer as the synthesiser source. The main software is the sequencer siliconchip.com.au Fig.2: these oscilloscope waveforms show the difference between a genuine MIDI signal (yellow trace) operating at a 31.25k-baud rate and a serial output signal (white trace) with the same code transmission but operating at a 38.4k-baud rate. The lower trace shows that the signal transmission is completed in a considerably shorter time than for the top trace, which is why this serial output is not MIDI compatible. April 2005  29 PLATE AMPLIFIER & LEVEL SHIFTER VARIABLE OSCILLATOR T1, Q1 BANDPASS FILTER T2, Q2 DETECTOR & LOWPASS FILTER D1, C1 IC1a, VR1 LCD AN0 ANTENNA AMPLIFIER & LEVEL SHIFTER VARIABLE OSCILLATOR T3, Q3 BANDPASS FILTER T4, Q4 Fig.1: the various functions are explained in detail in the text but in a nutshell, two separate variable oscillators change in frequency with hand movement. This change is converted to a DC level. The microcontroller monitors the hand plate and antenna voltage changes and converts these to MIDI signals. strument selection you can press the Instrument Up or Instrument Down switch to single step to the next instrument. Alternatively, you can use the step up or step down switches to select one of 15 various instrument groups. The Instrument Up or Down switch can then be used to select one of the eight variations available within the selected group. The instrument types available are Piano, Chromatic Percussion, Organ, Guitar, Bass, Strings, Ensemble, Brass, Reed, Pipe, Synthesiser Lead, Synthesiser Pad, Synthesiser Effects, Ethnic and Percussive. The LCD will show the selected instrument with these names, although some abbreviations are used for the DETECTOR & LOWPASS FILTER D2, C2 +5V 5k FOOT CONTROLLER (OPTIONAL) IC1b, VR2 SWITCHES S1 – S9 MICRO CONTROLLER IC2 AN1 +5V 5k OUT TO GAMES PORT MIDI OUT VR3 RS-232C CONVERTER IC4 AN2 AUX POTENTIOMETER CONTROL longer names. For example, synthesiser is abbreviated to “Synth”. Within each instrument group, the eight types are labelled from #1 to #8. There is a subtle difference between some of these types, particularly the piano selections. The full list of instruments, including the types and their numbers (from 1 to 8) that can be selected is shown in the table on page 28. For each instrument you can select the sound to come from the left channel (shown on the display as an <L>), the centre channel (both left and right channels), shown as a <C>, from the right channel as an <R>, or off <OFF>. These are selected using the < or > switches. The off position is useful when This rear-panel photo shows the telescopic whip antenna (top) and volume plate (right) but more importantly (left to right) the external foot switch jack socket, DC power socket, games port, RS-232C (serial) port with its non-MIDI warning LED and the MIDI socket. 30  Silicon Chip OPTO COUPLER IC3 SER OUT 6 SERIAL PORT OUT MIDI λ INVALID LED testing the Theremin response to the hand controls by using the LCD to show what is happening rather than listening to the synthesiser. Note that the < and > bracketing is an indication that the labelling within these can be changed using the < or > switch. These brackets are shown where you can change other settings available on the MIDI Theremin. The Note display is selected when the Instrument/Note switch is pressed again. The top line display shows the volume level setting, the note that is being played at the time and in which octave it is positioned. Volume is indicated with a loudspeaker cone and sound wave icon and the volume level as a number from 0-500, with 500 representing maximum. Notes are shown with a stylised notes icon and A to G labelling. Sharps are indicated with # to conform to musical labelling convention. The current octave being played is shown, with the lowest octave labelled as -2 through to the highest octave at number 8. The lower line on the LCD shows the pitch or pitch glide value but more about this later. The table opposite shows the possible notes that can be played using the MIDI Theremin. It shows the octave, siliconchip.com.au note and frequency for each. Middle C is defined as C3. Effects There are several note effects available when playing the MIDI Theremin. These include the pitch glide, sustain, and note range, sharps and inputs usage. The pitch glide controls the degree of pitch change between notes. It is adjustable from 0, when there is no pitch change between notes, up to 255 between a note and a sharp and up to 511 between standard notes. The actual pitch change depends on the synthesiser but in general the amount of pitch change adjustment is beyond the difference in pitch between notes. This means that it is possible to set the pitch range at less than maximum so that the pitch glides smoothly between notes, making note changes less abrupt. The pitch glide control is the auxiliary potentiometer. For knob settings between fully anticlockwise and halfway, the Note display will show the Pitch Glide as 0 – ie, no pitch glide – so the notes produced are discrete and distinct from one another. As the auxiliary control is turned further clockwise, the degree of pitch glide increases. The display shows the actual pitch being introduced as you play the Theremin. You will see the pitch value change as you sweep between notes. Setting the pitch glide to maximum will cause the pitch to change beyond that of the next note to produce a snap-on effect as the note changes. The sustain setting is selected by pressing the Effects switch. This brings up the word SUSTAIN on the top line and <ON> or <OFF> on the lower line. The setting is changed from on to off to on by pressing the < or > switch. After selecting the required sustain A screen grab of the software we use to drive the MIDI Theremin. The sequencer software can show the sequence of notes that were played during recording. They are displayed in the standard 5-line music format. setting, the Instrument/Note switch must be pressed before the MIDI Theremin can be played. Note that the “Sustain On” effect can only be used with naturally decaying note instruments, such as piano, guitar, bass and percussive, as well as some strings and others. Sustain causes the note to take a longer time to decay. Naturally note-sustaining instruments such as violin, organ, ensemble, brass, reed and effects types should not be set to include the sustain effect. If sustain is set for these instruments, then the notes played will continue until there is a crescendo of notes and the synthesiser becomes overloaded. Pressing the Effects switch and returning sustain to off will stop this if it happens. A second pressing of the Effects switch will show NOTE RANGE on the top line and <NORMAL> or <WIDE> on the lower line. You can select either of these using the < or > switches. The normal note range extends from C1 to C6. The wide note range is from D-2 to G8 when no sharps are selected and from C#-2 to G8 when sharps are selected. The normal note range when sharps are included corresponds to a standard 61-note organ keyboard. This covers the frequency range from 65.41Hz to 2,093.0Hz and should be adequate for most playing purposes. The wide note range is good for reproducing very wide-frequency range instruments (such as a pipe organ), as well as reproducing the high frequencies of instruments such as tubular bells. The next selection with the Effects switch is the note effects. In this case, NOTE EFFECTS will be displayed on the top line and <INC. SHARPS> or <NO SHARPS> will be shown on the second line. You can select one of these with the < or > switches. The NO SHARPS selection is some- Notes available with the MIDI Theremin (frequency in Hz). Middle C is C 3. Sharps are labelled with a #. Octave -2 -1 0 1 2 3 4 5 6 7 8 C 16.35 32.70 65.41 130.81 261.53 523.25 1,046.50 2,093.00 4,186.01 8,372.02 C# 8.66 17.32 34.65 69.30 138.59 277.63 554.36 1,108.74 2,217.46 4,434.92 8.869.84 siliconchip.com.au D 9.18 18.35 36.71 73.42 146.83 293.66 587.33 1,174.66 2,349.32 4,698.64 9,397.27 D# 9.72 19.45 38.89 77.78 155.56 311.13 622.25 1,244.51 2,489.02 4,978.03 9,956.06 E 10.30 20.60 41.20 82.41 164.81 329.63 659.25 1,318.51 2,637.02 5,274.04 10,54808 F F# G 10.91 11.56 12.25 21.83 23.12 24.50 43.65 46.25 49.00 87.31 92.50 98.00 174.61 185.00 196.00 349.23 370.00 392.00 698.46 739.99 783.99 1,396.92 1,479.98 1,567.98 2,793.83 2,959.96 3,135.97 5,587.65 5,919.91 6,271.03 11,175.30 11,839.82 12,543.85 G# 12.98 25.96 51.91 103.83 207.65 415.30 830.61 1,661.22 3,322.44 6,664.88 - A 13.75 27.50 55.00 110.00 220.00 440.00 880.00 1,760.00 3,520.00 7,040.00 - A# 14.57 29.14 58.27 116.54 233.08 466.16 923.33 1,864.66 3,729.31 7,458.62 - B 15.43 30.87 61.74 123.47 246.94 493.88 987.77 1,975.53 3,951.07 7,902.13 - April 2005  31 32  Silicon Chip siliconchip.com.au SC 2005 4 2 1 68pF 100k G Q1 2N5484 68pF 100k G Q3 2N5484 MIDI THEREMIN 390pF A K 100nF CERAMIC 100Ω 100nF CERAMIC 390pF 1N4148 S D S D 100Ω (ANALOG/USER INTERFACE CIRCUITRY) VARIABLE OSCILLATOR 3 2 1 ANTENNA VARIABLE OSCILLATOR 3 6 T3: WHITE 4 6 T1: WHITE HAND PLATE 680Ω 100k B 220k 680Ω 100k B 220k G E C E C 100Ω 100nF CERAMIC 2 1 D 2N5484 E T4: BLACK BANDPASS FILTER 560pF Q4 BC547 S 100nF CERAMIC 2 1 T2: BLACK BANDPASS FILTER 560pF Q2 BC547 100Ω B C 4 6 4 6 SLOPE DETECTOR 10k K 10k K SLOPE DETECTOR BC547 A D2 1N4148 A D1 1N4148 VR2 2k VR1 2k 2.2k 6.35mm STEREO SWITCHED JACK SOCKET TP3 TP GND EXTERNAL INPUT C2 2.2 µF C1 2.2 µF TP1 2.2k 10 µF 1k +5V 10 µF 1k +5V 100nF 220k IC1a 8 1 4 IC1b 100nF 220k 7 VR3 5k LIN 100nF LEVEL SHIFTER & AMPLIFIER 6 5 IC1: LM358 LEVEL SHIFTER & AMPLIFIER 2 3 10 µF TP4 TP2 C AUX INPUT +5V B A +9V SC 2005 2.2k A 2.2k 3 x 10k 33pF X1 8MHz A K 5 16 15 1 18 17 Vss (DIGITAL CIRCUITRY) S5 S6 S2 S3 4 RB5 RB0 RB1 RB4 RB3 RB7 RB6 11 6 S9 S8 S7 DB4 DB5 DB6 DB7 Rs E S10 POWER 12 7 11 13 10 14 4 13 9 6 100F 12 100nF 9V DC INPUT (150mA) S4 3 2 RA5 S1 RA4 IC2 PIC16F88 Vdd 14 RA3 OSC1 OSC2 AN2 AN1 AN0 MIDI THEREMIN +5V 33pF A K A K 470F D6 1N4004 +9V 220  GND OUT REG1 7805 IN K MIDI OUT INVALID A GND DB3 DB2 DB1 DB0 R/W CONT LED1 LCD MODULE V+ 1 2 10 9 8 7 5 3 10F 10F +5V 10k VR4 LED 220 Figs.3 & 4: the complete circuit for the MIDI Theremin. Because it occupies two pages it looks daunting but in reality it can be broken down into a few functional elements. The opposite page (Fig.3) has all the “analog” circuitry while this page (Fig.4) has the PIC microcontroller, the LCD module and the output devices. C B A 2.2k D3qD5 1N4148 K +5V 100k A K 1F 1F  6 5 4 3 1 11 5 6 8 15 1F 14 470 K A K 1N4148 A 1N4004 2 220 220 IC4 MAX232 16 7 IC3 6N139 +5V 1F 3 2 +5V 4 2 5 10F 1F 5 4 15 9 8 OUT GND IN 7805 5 8 7 6 4 1 2 DB9 SOCKET MIDI OUT TO SYNTHESISER 100nF 1 16-PIN IDC HEADER TO GAMES PORT TO SERIAL PORT siliconchip.com.au April 2005  33 The RS-232 converter changes the 0-5V signal from the microcontroller to a nominal ±10V signal for the serial port. When using the serial port connection, the MIDI invalid LED lights to indicate that the MIDI signal on the serial MIDI socket is not able to drive a synthesiser. The microcontroller also drives the LCD and monitors switches S1-S9. Oscillators The MIDI Theremin display board, which we will construct next month. times called the Natural or C Major scale. It has an effect similar to running your fingers up and down the white keys on a piano. Selecting sharps (the black keys on an organ or piano) increases the number of notes and reduces the distinctiveness between each note. There are no sharps between the B/C and the E/F notes. The final selection with the Effects switch is to change the function of the antenna and auxiliary input. The normal setting is shown as PLATE/ ANT./AUX. on the top line, indicating the hand plate, antenna and auxiliary inputs. The second line shows <VOL/ NOTE/PITCH>. This shows that the hand plate is for volume, the antenna for note and the auxiliary pot is for pitch glide adjustment. Pressing the < or > switch will change the settings to <VOL/PITCH/ NOTE>. The top line will remain as before with PLATE/ANT./AUX. shown on the top line. For this setting, the hand plate remains as the volume control, but the auxiliary potentiometer is now used to select the note. The antenna controls pitch over a small range. This is indicated when the Instrument/Note selection is showing Volume, Note and Pitch. Pitch can be varied over a -500 to +500 range in steps of 1. The actual values do not mean much since synthesisers are not calibrated as far as the pitch adjustment range is concerned. In practice, pitch varies by more than one note above and below the currently set note. It is important to set 34  Silicon Chip the auxiliary control so that the note will not skip to the next note. Port selection The Set Port switch is recessed within the box and needs to be accessed using a pen or similar object. It allows the MIDI Theremin to be set up to provide MIDI signals from the MIDI outlet and the games port or a pseudo-MIDI signal via the serial outlet. You can press the switch when the MIDI Theremin display is showing the instrument or note. The display will then show <DRIVE> VIA MIDI OUT & GAMES PORT or VIA SERIAL PORT ONLY. You can select one or the other using the < or > switches. The MIDI Invalid LED will light when the serial port is selected. Press the Instrument/Note switch to exit from the port setting mode. Block diagram Fig.1 shows the block diagram for the MIDI Theremin. A PIC microcontroller is used to monitor signals from the hand plate control section at its AN0 input, the antenna control section at its AN1 input and the auxiliary control at the AN2 input. In response to these signals, the micro produces a MIDI signal which is applied to an optocoupler (IC3), the MIDI output socket and the RS-232 converter. The optocoupler provides isolation between the MIDI Theremin and the computer connection via the games port. This prevents hum loops if the MIDI output is also connected to a synthesiser. There are two identical variable oscillators, one for the hand plate control and the other for the antenna control. The oscillators run at a nominal 455kHz, reducing in frequency as your hand moves closer to the plate or antenna. The frequency reduction is due to extra capacitance from your hand being applied to the oscillator circuit. The oscillator output is fed to a bandpass filter. When the frequency drops as your hand moves closer to the plate or antenna, the filter begins to attenuate the signal because the frequency moves out of the filter’s pass-band. The signal is detected (rectified) and filtered so that the bandpass filter output is converted to a voltage. This voltage is then amplified and level-shifted so that the amplifier output covers a 0-5V range. This voltage is then applied to the microcontroller. An auxiliary control can alter the voltage from 0-5V using potentiometer VR3. Alternatively, an external (eg, foot-controlled) potentiometer can be plugged in. If this is used, VR3 is automatically disconnected. Circuit details The circuitry for the MIDI Theremin can be divided into two sections: the hand interface circuit (Fig.3) comprising the hand plate, antenna and auxiliary sections; and the digital circuitry (Fig.4) comprising the microcontroller, LCD, switches and the MIDI output sections. Let’s start with Fig.3, the hand interface circuit. Both the hand plate and antenna control sections are identical and use standard intermediate frequency (IF) transformers as used in low-cost AM radios. Each transformer has a tapped winding with a capacitor connected in parallel, forming a tuned circuit. The variable oscillator for the hand plate comprises T1 and Q1 (a JFET), plus associated resistors and capacitors. The JFET drives the portion of the siliconchip.com.au coil between pin 2 and ground. The full winding signal is applied back to the gate of Q1 via a 68pF capacitor (positive feedback) to ensure oscillation. The hand plate is connected directly to the top of the T1 tuned circuit winding. As you move your hand near the plate, the extra capacitance across the tuned circuit reduces the oscillator frequency. A second winding on IF transformer T1 couples the oscillator signal to the base of transistor Q2, via a 390pF capacitor. Q2 drives IF transformer T2 to provide a bandpass filter centred on 455kHz. Because it has a sharp rolloff above and below 455kHz, it provides a signal output level that varies widely in response to small changes in input frequency. The 455kHz signal from T2 is rectified by diode D1 and filtered with the 2.2mF capacitor. This produces a DC level that is proportional to the hand plate oscillator. At this stage, the voltage levels are around 0.9V, dropping to around 0.83V when your hand is near the plate. This is amplified by op amp IC1a to give a 5V swing. Trimpot VR1 adjusts the output from IC1a so that it covers the range from above 5V down to 0V. The antenna circuit operates in exactly the same way as the hand plate section, using op amp IC1b, together with trimpot VR2. The auxiliary input is provided by potentiometer VR3, which is connected directly across the 5V supply. Therefore, the wiper of this pot can produce a variable DC level anywhere MicroVGA: between 0V and 5V, depending on its setting. VR3 is normally internal but can be made external (eg, used like a wahwah pedal) via a 6.35mm switched stereo jack socket. When the plug for the external potentiometer is inserted into the jack socket, the internal pot is switched out of circuit. Digital circuitry The digital circuitry comprises IC2, IC3, IC4 and the LCD module, as shown in Fig.4. IC2 is a PIC16F88 microcontroller from Microchip. It is a direct replacement for the PIC16F628A, with more memory and a 10-bit multi-channel analog-to-digital converter (ADC), making this device ideal for our MIDI Theremin. It also has a serial output that can produce MIDI format signals at a 31.25kHz baud rate, with the required stop and start bit. The serial output can also be set to provide the 38.4kHz signal suitable for the serial port on a computer. Either of these two baud rates is accurate when the microcontroller operates at 8MHz, as set by crystal X1, between pins 15 and 16. IC2 monitors the sensor signals from the hand plate, antenna and auxiliary potentiometer control, at its AN0, AN1 and AN2 inputs. Diodes D3, D4 and D5 are included to add to the existing internal clamp protection for these inputs, while the 2.2kW resistors provide input current limiting. The Enable and Register Select an idea whose time has come! You often wonder “Why hasn’t someone thought of that before . . .” MicroVGA is such a product: a graphics adaptor which allows you to display text and graphic patterns on any standard VGA monitor without the need to have a computer attached! Wonder no more: 4D Systems have done it! MicroVGA can be interfaced to any host microcontroller, embedded device, or a PC with a serial port. Predetermined programming commands can perform a multitude of tasks with high quality imagery in 64 colours, not just for graphics and text characters but also for the entire screen (background). If your application – consumer, industrial, control, in fact just about anything at all – calls for displayed text, graphics or a combination of both you must have a look at what 4D Systems’ MicroVGA can do for you! Call 4D Systems now for more information or a PDF of the User Manual! Features:  64 colours  252 (H) x 192 (V) pixel resolution  15pin standard VGA connector interface  128 standard ASCII built in character set  64 user defined (8 x 8) bitmapped characters siliconchip.com.au inputs on the LCD module are driven from IC2 using the RB6 and RB7 outputs. The data input lines are also driven by the RB0 to RB3 lines from IC2. The LCD module has eight data lines but we are only driving the upper four bits (DB7-DB4). This means that the data must be sent as two 4-bit blocks in order to drive the display. The Enable input and the Register Select input are control lines to place characters on the display and to set the character position. When the RB0 line is not driving the display, it drives the MIDI Invalid LED1 either on or off. If the LED is set to off, then the fact that the DB4 data line to the display is also being driven does not light LED1, since it happens in short bursts. RB5 from IC2 is the serial output. This provides the MIDI signal for optocoupler IC3 and the MIDI output socket. When the circuit is connected to the games port on a computer, pin 8 of IC3 is connected to the computer’s own 5V supply. IC4 provides the RS232 conversion for the serial signal. In short, the MIDI Theremin is a very powerful instrument in its own right and we imagine it will become very popular indeed with bands, orchestras and anyone interested in either playing or experimenting with synthesised music and sound effects. That’s enough to for this month. Next month, we’ll give the construction details and describe how the Midi Theremin is set up and used. SC  31 x 24 Text (8 x 8 font)  42 x 24 Text (5 x 7 font)  RS-232 serial interface  Auto Baud Rate detect, speeds from 300baud to 19.2kbaud Two versions of MicroVGA available: “Bare bones” version consisting of assembled PC board with all sockets and drivers. Ideal for $ embedding into other applications +GST 90 “Consumer” version with above PC board, complete in small (9 x 5 x 2cm) case, includes driver. Ideal for all end$ user applications. +GST 120 Proudly designed and manufactured by 4D Systems AND NOW AVAILABLE FROM: Dontronics (Melbourne): www.dontronics.com Optek Enterprises (Sydney) Ph: (02) 9979-2777 April 2005  35