Create project Need help?
Show more (4)
ClemensValens

J2B Synthesizer [140182]

Status: Finished
16880
13
votes
July 9, 2014
140182-j2b-synth-lasercut-3s.jpg

This is a port of the Soulsby Atmegatron 8-bit monophonic synthesizer to the Elektor J2B LPC1343 ARM Cortex-M3 board. The Atmegatron is quite a nice design with everything you need fitting in 32KB of flash memory.

Get all the files at GitHub.

New firmwares Atmegadrum, Atcyclotron & Delayertron (see below)!

The original Atmegatron is based on an 8-bit, 32 KB flash memory ATmega328 and the firmware is available as an open source Arduino sketch. The J2B board has a 32-bit LPC1343 ARM Cortex-M3 processor with 32 KB flash memory.

The Atmegatron has two rotary encoders, eight potentiometers and a pushbutton. Two potentiometers are for volume and bass boost, the others control the synthesizer itself. The J2B board can have up to nine rotary encoders, or eight plus a pushbutton.

The Atmegatron uses a bunch of bi-color LEDs to interface with the user. The J2B can have an LCD.

The Atmegatron uses PWM to produce its sound, the J2B has excellent PWM capabilities.

Based on the previous observations, porting the Atmegatron to the J2B should not be a huge task, which is why I started doing it. The most daunting task was to replace the analog potentiometers by rotary encoders while keeping the same feel. Two rotary encoders replicate the Atmegatron encoders, six others simulate the potentiometers. The bi-color LEDs are replaced by a 2x16 LCD, but I added two bi-color LEDs to indicate the red/green modes of the synthesizer.

The port of the firmware is almost completed. The synth engine works fine, but I  still have to add EEPROM interfacing and I want to improve the way the values of the six "potentiometers" are displayed.

The photo below shows my prototype with the MIDI input sticking out from under the LCD. The prototyping PCB has a basic anti-aliasing filter that drives a small loudspeaker.

I designed a PCB that plugs onto the back of the J2B. The main reason for this is that the encoders on the J2B are too close together for a comfy control surface. On this mother PCB I have also placed a fifth-order Chebychev filter, an amplifier with volume control (I ditched the bass boost), a MIDI interface (in/out) and an EEPROM because the LPC1343 does not have one. It is needed to store patches. The sandwich is supposed to fit in a cheap plastic enclosure (but I will get a hard time drilling it properly).

A cool thing of the J2B is its built-in USB capabilities making it possible to update the firmware from any Windows PC simply by copying a file to the board which is seen as an external drive. No programmer needed at all.

PWM capabilities of the LPC1343 are a bit better than those of the ATmega328, which allowed me to increase the sample frequency and gain a bit, making it a 9-bit synthesizer. So, in theory, the sound quality of the J2B synth should be a little better than the Atmegatron.

I have not yet tried to implement USB serial port or MIDI functions, but I might do that later to simplify patch storage on a computer. Now it uses MIDI sysex for that.

Since I started porting the Atmegatron, Soulsby released new firmware for a drum machine on the same platform. I guess I will have to port that too (even though I don't like the way it sounds too much).

The PCB has been ordered.

Of course, once finished, the J2B Synthesizer will be open source too.

Update 23/7/2014

The PCB has arrived and I have started assembling it. Being a cheapskate I made an effort of designing a single-sided PCB, which is great. Except for one thing: single-sided PCBs don't have solder pads on two sides, which is very inconvenient when you have to solder many pin headers on the solder side... 

I must be honest, the mechanical situation is horrible. First of all, I didn't take into account the height of the MIDI connectors and now they interfere with your fingers when you manipulate two encoders. 3D modelling could have avoided this.

Secondly, there are so much connections between the encoder board and the J2B board that it makes assembly almost impossible. I sort of expected this, but not that it would be that bad.

A third problem is the limited height of the encoders compared to the height of the LCD, making it pretty hard to find a good enclosure where the encoders stick out enough for fitting a knob and where the LCD is flush. Finding compatible encoders with longer shafts or shaft extenders is very hard.

Because of this mechanical disaster I have decided to start from scratch. Instead of trying to use the J2B board at all cost I will do a new design that integrates everything on one PCB. Well, not everything, I will do a small second PCB for the MIDI connectors so that it can be mounted lower.

The new design will be SMD instead of through-hole and I will probably move to an LPC1347FBD48 because it has twice the flash memory and 4KB of EEPROM. It features the same USB thumb drive method for firmware programming as the LPC1343 on the J2B board.

For the LCD I have found a thinner (and cheaper and slightly smaller) solution in the shape of an I2C LCD (Farnell 2063208) that is only 6.3 mm thick.

I have attached the Eagle files and LPCXpresso project of my first attempt. This should work on a J2B board. If you don't care about the tight spacing of the encoders I suggest you mount them on the J2B board.

On to version 2...

Update 21/8/2014

Back from holidays, I have redrawn the PCB and ordered it at Eurocircuits. Actually there are two PCBs now, one small PCB with the MIDI interface on it and a bigger PCB with the rest of the circuit.

The MCU is now an LPC1347 and I added an audio channel hoping that the MCU can cope with it. This would make the synthesizer in a 2-channel PWM audio platform. The single channel LM386 output amplifier has been replaced by a two-channel TDA1308.

Feature creep made me change the way I connected the rotary encoders. They have now RC glitch filters (from the datasheet) that should allow me to simplify and speed up the keyboard scanning algorithm. But, more important, on six of them there are now jumper resistors so that the encoders may be replaced by potentiometers connected to the MCU's AD inputs 0, 1, 3, 5, 6, 7.

The new design files are attached below.

Update 1/9/2014

PCB V2 has arrived, see photographs below. At a first glance there do not seem to be many obvious mistakes.

BTW, I renamed the synth to J:B (instead of J2B) where the two dots of the colon (':') represent the 2. But what the heck does J2B stand for??? Ideas, anyone?

Update 2/9/2014

Completed the assembly of the PCB V2, see photographs below. I found a few small footprint errors and the silk screen needs some rework to improve its clarity.

Now I need to find some screws to fix the assembly in the enclosure and drill the top cover. That's a tough one for me as I am not a very precise mechanic.

First connection to the PC is promising. The LEDs came on together with the backlight of the LCD and the PC started installing the driver for the MCU. It was slow, but after a disconnect-reconnect a new thumbdrive became visible. This means that I now can start working on the firmware.

ToDo: I²C LCD driver, EEPROM storage of parameters, second audio channel (will it be possible?), etc.

Update 3/9/2014

Validated the mechanical side of the project (see photos below). I am more than pleasantly surprised by the result of my drilling. If I can pull this off, anyone can. 

The pushbutton turned out to be the most difficult as it is a bit higher than the rotary encoders. With the cap it is even higher. The cap has to go under the cover otherwise it will fall off (it has a special rim for that). Luckily the enclosure is 2.5 mm thick there which leaves enough room to drill the hole larger on the inside than on the outside allowing a perfect fit.

I used 3x25 mm screws from Castorama (Diall single thread woodscrew yellow passivated steel, round head, pozidrive, ref 50.34.20) to fix the PCB in the enclosure. As standoffs I cut four nylon screw plugs to 17mm and two to 15mm.

Update 11/9/2014

Almost finished porting the software from V1 (LPC1343) to V2 (LPC1347). Since these controllers are in the same family one might think that this would be a trivial task, but it appears that the LPC1347 is closer to the LPC11U family than to its elder brother LPC1343. As a consequence some registers no longer exist and are replaced by others. Once you know this, it is not a big problem, but it means going through the code and fixing things.
 
I ran into the strange problem that (floating point) code that would run in time from my systick ISR on the LPC1343 needs more time on the LPC1347 and didn't fit anymore, causing system crashes. Comparing the compiled code it was identical. Go figure. I need to investigate this.
 
Anyway, I have now sound and vision, it works pretty well and it is realy fun to play with (it is great with the arpegiator). Still to do:
  • implement EEPROM patch storage
  • create clever LCD characters to clearly show which control does what
I will post a video soon.
 
I also discovered that the LPC1347 has on-chip USB drivers for the audio device class. This opens the perspective of creating a VST-plugin compatible synthesizer. Wouldn't that be cool?

Update 12/9/2014: video!

 
Update 18/9/2014
I have finished the first version of the software. Everything works fine. Of course there is always room for improvement, for th emoment I consider it done.
Now that I know the controls a bit better, I can get more different sounds out of it.
I fixed a small bug in the rotary control driver and now they work perfectly fine without glitches. I am also quite satisfied with the solution I found to display the values of the six (+ four) "live" controls.
To push things a bit I added a second audio channel. Currently it does nothing more than output a phase-shifted version of the other channel, but that is good enough to create spatial effects. In any case it shows that the PWM ISR can handle a second audio channel. Now all there is to do is to add some useful sound to it.
The next step is to correct the PCB for the mods I have come up with during the last weeks.
 
Update 8/10/2014
I have applied the PCB modifications that I had identified and ordered two new boards. The updated Eagle files are available below, including the complete BOM.
 
The software is also there, so you can start building your own. Note that the software consists of three projects that have to be loaded in LPCXpresso (Eclipse) together. Two projects compile into libraries that are used by the third project.
 
New photos show my completed prototype. As you can see, rectangle cutouts are not my specialty.
 
Update 6/11/2014
The fablab near me has invested in a laser cutter and so I invested some time in a design for a laser cutable enclosure. I am quite satisfied with the result (see photos below), but it can be improved. One problem is that where I live it is pretty hard to find 40mm M3 bolts. The design consists of a few SVG files adapted for this particular laser cutter. I don't know if it is standard. Lines with a width of 0.01 mm are considered vectors, everything else will be engraved. Give it a try if you like, the files are below.
 
Update 25/11/2014
Forgot to upload the drawings for milling the Hammond enclosure that I used initially (1597DGY, Farnell 1876944). These files are now available too.
 
 
Update 30/04/2015
I have ported Atmegadrum v1.2 drum computer software to the J2B Synthesizer. You can download it below as V2.0. The archive includes compiled executables in the Release folder so you can try it without compiling first.
 
This version was also upgraded to Atmegatron v1.4 allthough it hasn't changed a lot since most mods concern the LED user interface that the J2B Synthesizer does not have.
 
In the file config.h you can choose between Atmegatron and Atmegadrum. The other options are for the future.
 
The sound quality of the default drum samples is not spectacular, but the sequencer works fine and it is fun to play with. You can find a sample creator tool on the Soulsby website so you can make your own samples.
 
A good extension would be to add MIDI output so you can use it as a MIDI sequencer and pattern chaining into a song. Also it would be nice to be able to adjust the pattern length so 3/4 measures are possible too.
 
Update 02/05/2015
I had forgotten to test pattern saving and loading. That has been done now and it is working fine. Unfortunately this requires an update, see below. This update also slightly improves the sound quality by modifying the mixing algorithm.
 
Short user manual
The function encoder (on the left of the LCD) selects the instrument (1-16) and at the same time the pattern to save or load. Turning the encoder changes the instrument, pressing it for less than 2 seconds will load a pattern and pressing it for more than 2 seconds will save the current pattern. 
 
The value encoder (on the right of the LCD) moves the cursor (a small cross) through the pattern. By pressing it you can insert or delete a hit of the selected instrument.
 
The six live controls adjust (from left to right) the following parameters:
  • Tempo (60-255 bpm)
  • Pitch (0-255), pressing it will get you 119, which corresponds to a sample rate of 8 kHz.
  • Pitch LFO level (0-255), setting this value too high together with the pitch will crash the synthesizer because there is not yet a pitch limiter.
  • Pitch LFO speed (0-15)
  • Instrument delay (0-7), this is a per instrument value. It adds an echo to the instument, quite a nice effect 
  • Insturment volume (0-7), this is a per instrument value and allows you to mix your drum kit.
 
The red/green function button in between the two bicolor LEDs is the start/stop button. The LEDs are red when stopped, and green when playing. Pressing down this button for more than 2 seconds will erase the current pattern.
 
The display shows on
  • line 1: instrument name, volume and delay
  • line 2: hits for the selected instrument
When a live control is used its function is briefly displayed on line 2.
 
Update 06/05/2015
Completed ports of Atcyclotron and Delayertron. Everything (source code and executables) can be found below (v3.0).
 
Short descriptions
Atcyclotron: a period of a waveform in this case is made up of four different shapes, wave1 to 4, that are repeated 1 to 32 times. The waveform cycling can be modulated. This leads to interesting timbres.
The filters are gone. Envelope1 (pitch & cycle modulation) no longer has individual A, D/R and S parameters, but consists of 16 default curves.
 
Delayertron: a waveform consists of 256 samples instead of 16 and a real (short) delay is added. The sample rate of the delay is controllable and can be modulated which can result in duophonic sounds and other weird things. The filters are reduced to a basic 6 dB/octave low-pass and high-pass filter without resonance.
 
Update 04/06/2015
 
Read the full post
Show less
Products

Attachments


Images
Proof of concept
V1.0 looks nice at first sight
V1.0 back side with the J2B board
V1.0 the MIDI connectors are too big. Note the 5 mm cap.
V1.0 a forest of connecting wires.
PCB V2 as a panel.
PCB V2: the MIDI board fits nicely under the main board.
PCB V2 mechanical check. All seems well...
V2 top view
V2 connector view.
V2 with drilling template
V2 side view
Finished prototype top view
Finished prototype top view close up
Finished prototype side view
Laser cut 3mm orange plexiglass - top
Laser cut 3mm orange plexiglass
Schematics
PCBs
Software
Other
Loading comments...