Print This Post Print This Post

LEMS – A Leslie Speaker Emulation System

Updated: 16th July 2011 @ 3:02am
This post describes the design and construction of a Leslie Speaker Emulation System (LEMS) control unit, based around an 18F26K20 PIC Microcontroller. The unit is intended to be used to split an audio signal into 3 phases, amplitude modulate these and feed to a Leslie Speaker Emulation driver unit (a 3-channel audio amplifier The Brute), delivering power into a 3-phase speaker system (Treslie), the construction of which will form companion posts.

LEMS Prototype

LEMS Prototype

Companion posts are as follows:

Updated 29th January 2014.
You may also be interested in this: MIDIGEN – A (belated) LEMS postscript

This unit is currently in use by the author, but still subject to the whims of embellishment and ‘want that one’ moments. If I’d waited until all of my ideas regarding the unit had been explored, then no article would ever be published. I will be publishing updates/suggestions for augmenting the utility of the unit as time goes on.
As this is quite a long post, I have provided a link table below for quick access to each section:


Summary of unit:


Postulation

An attempt can be made to emulate the action of the revolving Leslie Speaker, by providing a number of speaker units, and feeding these in a controlled sequence with amplitude-modulated forms of the audio signal. I adopted a simplistic approach to my prototype and opted for a 3-channel unit. Despite this, the results are very good – giving a sound from my Guitars and keyboards, the like of which I have not been able to obtain so far with other electronic means. The following 2 diagrams outline the functionality of the prototype. First, a three-speaker system is built with the drive units facing out at external angles of 120 degrees thus:

3-Phase Speaker system

3-Phase Speaker system

Each phase is fed with the modulated audio signal so:

Note that the phase diagram shows the amplitude of the signals, not the actual signal itself, so that the lowest point on each waveform is zero output, with the highest full ouput.

The net (rough) result is that an audio signal comprising the averaged power input into the 3 speakers appears to have it’s point source rotated through 360 degrees. The speed of the rotation will depend on the frequency with which the signal is modulated.

3-Phase Audio signal

3-Phase Audio signal

Such a system is relatively simple to build using just hardware, but if we want to add a measure of control, it makes more sense to use a microcontroller. Hardware then consists of the microcontroller controlling the splitting and modulating of the audio input, accepting control over functionality from a keypad and/or MIDI interface, and displaying information on an LCD or LED display.
In addition to the control unit, a 3-channel audio amplifier and 3-phase speaker arrangement will be needed.


I could have designed the control unit as a single board – I didn’t, as the system developed ‘organically’, and in any case a modular approach leaves plenty of options for add-ons, and tweaks. The amplifier units I built are described in a separate post – The Brute, and are nothing special, being about 30watts per channel. The speaker system was home-made using cheap 8 inch high-compliance drivers available from my local stockist ESR. The following diagram gives an overview of the prototype system:

LEMS - Functional Diagram

LEMS - Functional Diagram


Emulation Modes (Menu ‘C’)

Emulation Mode Mode no. Description Menu MIDI
Leslie 1 Emulate Leslie Speaker ‘C’ 0xf0, 0×5c, ‘M’, 1, 0xf7
Sine 2 Three-phase sine modulation. (each phase +120 degs) ‘C’ 0xf0, 0×5c, ‘M’, 2, 0xf7
Triangle 3 Three-phase triangle modulation. (each phase +120 degs) ‘C’ 0xf0, 0×5c, ‘M’, 3, 0xf7
Tremelo 4 All 3 phases synchronised ‘C’ 0xf0, 0×5c, ‘M’, 4, 0xf7
Shimmer 5 2 phases active only, triangle modulation ‘C’ 0xf0, 0×5c, ‘M’, 5, 0xf7
Ping-Pong 6 2 phases active only, pulse modulation ‘C’ 0xf0, 0×5c, ‘M’, 6, 0xf7
Static 7 All phases on, no modulation ‘C’ 0xf0, 0×5c, ‘M’, 7, 0xf7
Version Not a mode – displays copyright and version information. ‘C’ Not applicable


Parameter Control (Menu ‘F’)

Parameter Description Default Menu MIDI
Ceiling Maximum Amplitude of all phases (127-255) 255 ‘F’ 0xf0, 0×5c, ‘C’, hi, lo, 0xf7
Floor Minimum Amplitude of all phases (0-127) 0 ‘F’ 0xf0, 0×5c, ‘F’, hi, lo, 0xf7
Velocity Speed of Rotation (1-248) Rotation speed will depend both on this value,
and the choice of ceiling and floor values.
48 ‘F’ 0xf0, 0×5c, ‘V’, hi, lo, 0xf7
DAC Value Amplitude for selected phase (STATIC mode only) 0-3.
For phases 1-3 enter 1, 2 or 3. To update all 3 phases enter 0.
NA ‘F’ 0xf0, 0×5c, ‘D’, phase-num, hi, lo, 0xf7
Rotation Toggle direction of rotation, clock-wise (PH1-PH2-PH3-PH1-etc.) or anti-clockwise clock-wise ‘F’ 0xf0, 0×5c, ‘R’, 0xf7
Halt Disable update of all DACs, ‘freezing’ outputs at current values. Not Halted ‘F’ 0xf0, 0×5c, ‘H’, 0xf7
Go Re-enable update of all DACs, allowing normal updates. Enabled ‘F’ 0xf0, 0×5c, ‘G’, 0xf7
Shimmer Select the two phases that will be used for SHIMMER and PING-PONG. 1 & 2 ‘F’ 0xf0, 0×5c, ‘P’, shim1-num, shim2-num, 0xf7
PRE/Bank Recall/Program a preset slot from the EEPROM Bank No preset selected ‘F’ 0xf0, 0×5c, ‘B’, preset-num, 0xf7
Note that only the selection, not the programming, of a preset slot is possible using MIDI.
MIDI Manufacturers ID Program a new MIDI Manufacturers ID for this unit. 0×5c ‘F’ Not applicable

Notes.
1. The ‘0×5c’ in the MIDI streams quoted above is the manufacturers id, for the sysex commands the unit will respond to. If this clashes with any of your existing equipment, it can be re-programmed to default to another (unused) id, as documented in the last table entry above.
2. Where a MIDI value of over 127 is required this is normally sent as 2 bytes. I’ve chosen the following format: 1st (hi) byte is left-shifted once (i.e. multiplied by 2, then the 2nd (lo) byte is added to it. This may differ from what you are used to, but does have advantages, the first being that numbers up to 127 can be sent as: 0, (0-127). Even numbers in the range 2-254 can be sent as: (1-127),0. It’s also correct from a logical viewpoint. (but that’s probably not going to be appreciated)
3. Letters in single quotes in the MIDI streams above should be sent as their ASCII equivalents e.g. ‘B’ = 0×42.


Single-item selection.
Various items available in the above menus are also available from additional (quicker) keypad entries. These are as follows:

Parameter Description Default Keypad Key MIDI
Toggle Halt/GO Disable/enable update of all DACs Not Halted ‘0′ N/A
Select parameter for continuous access Enables the selection of Velocity, Floor or Ceiling to be updated/changed quickly by using the ‘<<', '>>’, ‘7′ and ‘4′ keys.
Once a parameter has been selected, the action of specific keys is as follows:
‘<<' decrements the chosen parameter value by a default decrement of 10.
'>>’ increments the chosen parameter value by a default increment of 10.
‘7′1 decrements the chosen parameter value by a default decrement of 1.
‘4′1 increments the chosen parameter value by a default increment of 1.

No parameter selected ‘E’ N/A
Select a preset slot from the EEPROM Bank. Enables quick selection of preset slot from 0- MAX_SLOTS. No preset slot selected ‘B’ N/A

Notes. 1. An updated front panel bearing ‘<' and '>‘ under the ‘7′ and ‘4′ keypads is available in the Downloads section.


Presets
The PIC 18F26K20 has 1024 bytes of EEPROM space. Currently one preset ’slot’ contains 10 parameters. I’ve pre-programmed (in the source-code) 50 default presets, and defined the maximum (MAX_SLOTS) as 50. There is room for quite a few more – if you don’t need the space for anything else.
Be aware though, that I may add ’stuff’ as the result of further experiment.
The format of a slot is simple, and is as follows:

shimmer1, shimmer2, rotation, floor, ceiling, mode, sinecount, dacstatus, timer0HIVal, timer0LOVal.
I’ve pre-programmed some ‘example’ slots, the 1st of which comprises the following values:

1, 2, CLOCKWISE, DEFAULT_FLOOR, DEFAULT_CEILING, LESLIE_EMU, DEFAULT_SINCOUNT, RUNNING, 128, T0_LOW

At the risk of rendering this prose out-of-date, the above have the following values:
1 & 2 are the two phases used for SHIMMER and PING-PONG modes,
CLOCKWISE means that apparent rotation is: PH1->PH2->PH3->PH1 etc.
DEFAULT_CEILING is the maximum value give to any DAC, and is typically 255,
DEFAULT_FLOOR is set typically to 1.
LESLIE_EMU is Leslie-speaker emulation mode,
DEFAULT_SINCOUNT is a compensating interrupt count used when the sine table is accessed (in SINE mode only),
RUNNING is the chosen state at selection of the preset,
128 is the reload value given to TMR0HI, and finally,
T0_LOW is typically 0. (given to TMR0LO)

Much more information is in the source-code.

All preset values can be reprogrammed, either by editing, compiling and re-programming the PIC, or more simply by editing an existing preset. This is achieved using the ‘Bank’ menu, displayed after selecting ‘PRE’ in menu ‘F’.
The DEFAULT equates above, are defined in the source-code – feel free to change them, should you wish.


FX On/Off
Purists might demand that the audio path be completely disengaged when effects are switched off. With the unit as it stands, I simply ‘freeze’/'un-freeze’ modulation with the HALT/GO (Keypad ‘0′) functions described above. If you are a purist, then there is sufficient space in the small audio compartment of the case for a relay board, and 2 spare PIC port lines to control the re-routing of the audio signal direct to each of the 3 buffer amplifiers, avoiding the DACs altogether. I have no plans to do this, but encourage anyone interested in having a go.


Photographs of construction and the completed unit.
Unlike previous posts, I’ve confined most of the photos taken during construction to an album on my photo gallery site. If you are considering building something similar, a glance through these should clarify my remarks in this post.

I’ve embedded a Shockwave viewer to my photo collection for the unit below, or you can go direct to the site here: http://cullercoats.joebrown.org.uk/#34

http://cullercoats.joebrown.org.uk/#34

Description of Modules


Pequeno & 2-wire LCD
The Pequeno board I used is exactly as described in my original post ‘The Pequeno – An Arduino me-too-alike for PIC Microcontrollers‘, and this article also contains details of the 28-pin SOIC header for the PIC 18F26K20, and the 2-wire LCD. Note that the Arduino prototype shield is not required for this project.


DAC Board
The function of the DAC board is to give digital control over the amplitude of 3 audio signals. No doubt this could have been done with many of the specialised Digital Volume Control IC’s around, and with many other types of DAC. I used these simply because I had them. They are widely available, for about £5 (5 GBP) each.
My schematic is as follows:

DAC Board Schematic

DAC Board Schematic

The Control lines and 8bit data-bus are routed to the Pequeno board, whilst the DAC Audio input and outputs are taken to/from the Audio Buffer board.
The Interconnection table gives details of what goes where.
The DAC is used somewhat unconventionally, in that rather than outputting a current, part of the input voltage is tapped off (selected by D0-D7) and given as output thus:

Audio Connections to/from DAC

Audio Connections to/from DAC


More on this mode of connection is given in the datasheet which is here: http://joebrown.org.uk/images/ThreePhase/DAC0830.pdf


Audio Buffer Module
The schematic for the Audio buffer module is as follows:

LEMS Audio Buffer Module

LEMS Audio Buffer Module

The audio input is fed to X2,1 and amplified by up to 10X by IC1D. The 10K master gain pot is mounted on the rear of the unit. Output from IC1D is coupled via an electrolytic to the input of each DAC-based volume control via X3,1. The 3 amplitude-modulated channels from the DACs are connected to X3,2-4 respectively, where these signals can be optionally boosted with IC1A, IC1B and IC1C. Individual preset gain controls are located on the circuit board, to provide adjustment in the case of dissimilar gains of the audio power amplifiers.


MIDI and FTDI Firmware update Interfaces
Provision has been made in the firmware, to control both mode and parameter selection with the use of SYSEX commands, as noted earlier. I didn’t make a PCB for this, (although may in the future) but the schematic for the interface I used (built on a small piece of perfboard) is given here, which also shows connections to the optional FTDI interface:

MIDI Interface Schematic

MIDI Interface Schematic


Optional Interfaces.
Control of almost everything is via keypad and/or MIDI. It could be useful to bring out externally, certain keypad connections, to, for example, a footswitch. In this case, unused pins on the MIDI OUT connector are suitable. An alternative is to provide a foot-switch version of a ‘minimal’ keypad, duplicating only selected keys, and providing these on the floor for foot use. As there are 3 spare pins on the MIDI OUT socket, this is the approach I will be taking, although this was not done at the time of writing.


Keypad and Power Indicators

Keypad & Power Indicators Schematic

Keypad & Power Indicators Schematic

The keypad is a variation of a 16-key hexpad, configured to use a single ADC port on the PIC, rather than occupying a standard 8-bit interface.
The resistor set I used in the above schematic were all 1% metal film as follows, with the measured resistance in brackets:
R1 – 3K9 (3.87K), R2 – 3K3 (3.286K), R3 – 2K4 (2.39K), R4 – 1K3 (1.299K), R5 – 1K (0.996K), R6 – 390 (387.4ohms), R7 – 300 (299.1ohms), R8 – 200 (198.4ohms), R9 – 100 (99.7ohms).

Note that the code cannot, (and should not) check for an exact ADC match – even when you have ascertained, as I did, the values obtained for each switch depression. This is because occasionally, due to external factors, the value may vary plus or minus by up to 2. (my findings) Instead, the code always checks that an ADC value is above a certain value and then acts accordingly – check my code to see how this is done. A keypad calibration routine is also included in the source-code. This demonstrates how the EEPROM-code values I programmed were arrived at.
Another important point worth mentioning is debouncing. Too many examples of this type of interface are discussed without addressing this fairly important topic. Again, I refer you to the code (see ‘DoUI()’ ) to see how debouncing is achieved.

I used the 4 LEDs on the board to indicate the presence of the 15v +, and -, together with 5v+ and 3v3+ (not 12v as shown on the schematic) Suitable resistors should be chosen for the voltages you wish to monitor (and for the LEDs you use).
I achieved reasonable brightness for each LED with the following values of resistance:

R10/LED1/RED/15V+: 1K2
R13/LED4/GREEN/15V-: 1K2
R11/LED2/ORANGE/5V+: 800ohms
R12/LED3/YELLOW/3v3+: 330ohms


Interconnections
The following table summarises connections between the main processor board and the display, keypad and signal conditioning interfaces.

Interconnections
Unit Description Connector Designation Direction Unit Description Connector Designation
DAC Board Control
Pequeno RA0 SV5,6 >>> DAC Board CS1 – Chip Select for DAC1 X2,1
Pequeno RA1 SV5,5 >>> DAC Board CS2 – Chip Select for DAC2 X2,2
Pequeno RA2 SV5,4 >>> DAC Board CS3 – Chip Select for DAC3 X2,3
Pequeno RA3 SV5,3 >>> DAC Board ILE – Input Latch Enable for all 3 DACs X2,4
Pequeno RA4 SV5,1 >>> DAC Board XFER – Transfer Control X2,7
Pequeno RC0 SV4,8 >>> DAC Board WR2 – Write data in input latch to DAC register X2,6
Pequeno RC3 SV4,5 >>> DAC Board WR1 – Load data into input latch X2,5
DAC Board Data
Pequeno RB0 SV3,1 >>> DAC Board D0 X1,1
Pequeno RB1 SV3,2 >>> DAC Board D1 X1,2
Pequeno RB2 SV3,3 >>> DAC Board D2 X1,3
Pequeno RB3 SV3,4 >>> DAC Board D3 X1,4
Pequeno RB4 SV3,5 >>> DAC Board D4 X1,5
Pequeno RB5 SV3,6 >>> DAC Board D5 X1,6
Pequeno RB62 SV7,5 >>> DAC Board D6 X1,7
Pequeno RB72 SV7,4 >>> DAC Board D7 X1,8
DAC Board Audio
Audio Buffer Board Audio Out X3,1 >>> DAC Board Audio In (IOUT1 of each DAC) X4,2; X5,2; X6,2
Audio Buffer Board Phase 1 In X3,2 <<< DAC Board Phase 1 Out (VREF of DAC1) X4,4
Audio Buffer Board Phase 2 In X3,3 <<< DAC Board Phase 2 Out (VREF of DAC2) X5,4
Audio Buffer Board Phase 3 In X3,4 <<< DAC Board Phase 3 Out (VREF of DAC3) X6,4
DAC Board GND X4,5; X5,5; X6,5 <<< DAC Board IOUT2 of each DAC X4,1; X5,1; X6,1
DAC Board No Connection X4,3; X5,3; X6,3 DAC Board RFB of each DAC X4,3; X5,3; X6,3
DAC Board Power
Power Supply 15v+ >>> DAC Board VDD X3,1
Power Supply GND <<< DAC Board GND X3,1
2-Wire LCD
Pequeno RC1 SV4,7 >>> 2-Wire LCD LCD Clock SV3,2
Pequeno RC2 SV4,6 >>> 2-Wire LCD LCD Data SV3,3
Pequeno 5v+ SV6,3 >>> 2-Wire LCD VDD SV3,4
Pequeno GND SV6,4 <<< 2-Wire LCD GND SV3,1
MIDI/FTDI Serial
Pequeno TX/RC6 SV8,5 >>> MIDI/FTDI Output to 220 ohm resistor and FTDI RS232TTL (3v3) RX TX/RC6
Pequeno RX/RC7 SV8,4 <<< MIDI/FTDI RX/RC7 Output from Opto-coupler and FTDI RS232TTL (3v3) TX
Pequeno 3v+ SV7,2 >>> MIDI/FTDI Interface VDD SV3,4
Pequeno GND SV7,3 <<< MIDI/FTDI Interface GND SV3,1
Keypad
Pequeno RA5/AN4 SV5,2 <<< Keypad Analogue Keyval Out SV6,2
Pequeno 5v+ SV6,3 >>> Keypad Analogue VDD SV6,1
Pequeno GND SV6,4 <<< Keypad Analogue GND SV6,3
Rear Panel 15v+ SV6,4 >>> Keypad (Power Indicators) 15v+ Power Ind LED SV1,1
Rear Panel 15v- >>> Keypad (Power Indicators) 15v- Power Ind LED SV1,4
Pequeno 5v+ SV6,4 >>> Keypad (Power Indicators) 5v+ Power Ind LED SV1,2
Pequeno 3v+ SV6,4 >>> Keypad (Power Indicators) 3v+ Power Ind LED SV1,3
Audio Buffer
Rear Panel Audio In 1/4 inch Jack Socket >>> Audio Buffer Board Audio Input into Master Buffer X2,1
Rear Panel Audio In GND 1/4 inch Jack Socket >>> Audio Buffer Board GND X2,2
Rear Panel Phase 1 Out Multipin socket pin 1 <<< Audio Buffer Board Phase 1 Out to Audio Amp X4,1
Rear Panel Phase 2 Out Multipin socket pin 2 <<< Audio Buffer Board Phase 2 Out to Audio Amp X4,2
Rear Panel Phase 3 Out Multipin socket pin 3 <<< Audio Buffer Board Phase 3 Out to Audio Amp X4,3
Rear Panel GND Multipin socket pin 4 <<< Audio Buffer Board GND X4,4
Rear Panel 15v+ Power Supply Socket pin 1 >>> Audio Buffer Board VDD SV2,3
Rear Panel GND Power Supply Socket pin 2 <<< Audio Buffer Board GND SV2,2
Rear Panel 15v- Power Supply Socket pin 3 >>> Audio Buffer Board VSS SV2,1
Pequeno
Rear Panel 15v+ Power Supply Socket pin 1 via 150 ohm resistor >>> Pequeno VIN: +ve voltage supply, should be no more than about 11 volts. SV6,6
Rear Panel GND Power Supply Socket pin 2 <<< Pequeno VSS SV6,5
Rear Panel RESET Switch Pin 1 of small push-button switch >>> Pequeno MCLR SV6,1
Rear Panel RESET Switch Pin 2 of small push-button switch >>> Pequeno GND SV6,4
Spare (unused)
Pequeno RC4 SV4,4 ——- ——- ——-
Pequeno RC5 SV4,3 ——– ——– ——–

Notes:
1. RC6 & RC7 are shared with the UART interface to/from the PC.
2. RB6 & RB7 are routed to the PGD & PGC ICSP interface socket SV7, as they have no separate connection.
. All input socket GND returns are common-connected to supply GND (on the 3-pin DC IN chassis socket)


The Firmware.
The heart of any micro-controller system is, of course, the firmware. I do not propose to discuss this in detail here, as such a discussion would not suit a wider audience, but for students fresh to the PIC Microcontroller, the ‘C’ source-code may be of benefit in demonstrating the following:


Suppliers.

My local friendly Electronics store ESR can supply most of the electronics components, (with the exception of SMD) together with PCB laminate, TACT switches, MIDI sockets etc.

I obtained the PIC Microcontroller courtesy of Microchip Direct, as a sample.

The DAC030 is available from FARNELL (UK) for £3.74 (GBP) (plus the dreaded VAT) at the time of writing: http://uk.farnell.com/national-semiconductor/dac0830lcn-nopb/ic-8bit-dac-parallel-20dip/dp/1564697?Ntt=DAC0830

I obtained the SMD TL074 Op-Amps from RS Components, here in the UK. Surface mount resistor/capacitor kits are available on ebay for a few pounds (GBP).

The hand-nibbling tool I used to cut out the LCD aperture (see photos) is available from MUTR, here in the UK: http://www.mindsetsonline.co.uk/product_info.php?products_id=9047 (search for ’sheet metal nibbler’: http://www.mindsetsonline.co.uk/advanced_search_result.php?keywords=sheet+metal+nibbler&x=12&y=10)


Downloads.
The latest firmware, including source-code, for the LEMS project is available here: http://joebrown.org.uk/images/ThreePhase/ThreePhase_15July2011.zip
This will be updated from time to time, and the date of update given.
The TinyBld bootloader firmware project is here: http://joebrown.org.uk/images/ThreePhase/TinyBld18F26K20_15thJuly2011.zip

The FrontDesigner project for the LEMS front panel is here: http://joebrown.org.uk/images/ThreePhase/LEM_Frontpanel.FPL
and the back panel design project here: http://joebrown.org.uk/images/ThreePhase/LEM_Backpanel.FPL
High definition exports of each panel are here: http://joebrown.org.uk/images/ThreePhase/LEM_Frontpanel.JPG and here: http://joebrown.org.uk/images/ThreePhase/LEM_Backpanel_V2.JPG

The Eagle projects for the Pequeno, SOIC header and 2-wire LCD, are located in the Downloads section of: The Pequeno – An Arduino me-too-alike for PIC Microcontroller

The Eagle Schematic and PCB for the DAC board are here: http://joebrown.org.uk/images/ThreePhase/DAC_board.sch and here: http://joebrown.org.uk/images/ThreePhase/DAC_board.brd

The Eagle Schematic and PCB for the Keypad board are here: http://joebrown.org.uk/images/ThreePhase/REM_UI.sch and here: http://joebrown.org.uk/images/ThreePhase/REM_UI.brd

The Eagle Schematic and PCB for the Audio Buffer board are here: http://joebrown.org.uk/images/ThreePhase/Three-phase-split.sch and here: http://joebrown.org.uk/images/ThreePhase/Three-phase-split.brd

Copy the code below to your web site.
x 
  • Share/Bookmark
Create PDF    Send article as PDF   

You must be logged in to post a comment.