electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Articles  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links  |  Store
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
Live streaming at radio.electro-music.com

  host / artist show at your time
  mosc Live music with Twyndyllyngs - Bill Fox and Howard Moscovitz
Please visit the chat
 Forum index » DIY Hardware and Software » Arduino
MIDI2CV Project + PCB files
Post new topic   Reply to topic
Page 1 of 1 [23 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
himijendrix



Joined: Apr 16, 2012
Posts: 15
Location: Germany

PostPosted: Wed Aug 14, 2013 5:33 am    Post subject:  MIDI2CV Project + PCB files
Subject description: Complete and verified project for building a Midi2CV interface, using the Atmel Atmega 168/328.
Reply with quote  Mark this post and the followings unread

Hello,

I built a MFOS Mini Synth Mark II.
For my other Synthesizer I use the MCV876 from Marc Bareille, which has more features, but also has the tendency to crash with some reasons.
I'm still searching for the problem.

So a different interface was needed, and I found a project based on the Atmega 168 uC. It is based on a project from Wolf Schuster
http://wolf.schuster.ws/?page_id=156 (It's in German Exclamation)

I added the DIP Switch, fixed some bugs in the Software and created a PCB file.

Features are:
- Midi In, Midi Thru
- Channel selection by DIP switch
- 1 V/oct Out
- Velocity Out
- Trigger Out
- Gate Out
- Clock Output + Clock Divider Pot

All Outputs are set to 5V but can be easily increased to 10V by editing the Software. For the Power Supply +/- 12V are needed.

For the Panel i used Aluminium Dibond (direct UV Print, 3mm)
There is also the technique of printing on photo paper and using a foil (lamination) to stick it to the aluminium dibond. But i ordered a sample and it wasn't so hard and didn't look good. The foil will also come off if you drill many holes.


I ordered them from http://www.digitaldruck-fabrik.de/werbeschilder/kalkulieren-bestellen.aspx for cheapy 3,50€.
The bigger faceplate for my minisynth (33x24 cm) cost around 7,30€ + porto. The Layout was done with Front designer http://www.abacom-online.de/html/frontdesigner.html

This is the PCB, but the DIP Switch must be vice versa. The settings are explained in the Code comments of the Firmware. It can be opened with the Arduino IDE.

The RAR File contains all the Eagle files, the Parts Layout, schematic, Code and PCB Layout (which is very tight, so if you think about using the Iron Transfer method for making your own PCB, you might have to change the layout size in eagle!):
http://electro-music.com/forum/download.php?id=35530

It should all work, i tried it and even a mass of fast Midi Input didn't crash it. But if you find any mistakes, please write me.
For the Future there could also be:
- Pitchbend
- DIN Sync Output for Roland Drum Machines
- Learn Button (Instead of the Dip Switch)
- A second CV/Velocity Output
- Controller Message Output


Faceplate.JPG
 Description:
 Filesize:  583.66 KB
 Viewed:  81 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.

Faceplate.JPG



Circuit.JPG
 Description:
 Filesize:  1.13 MB
 Viewed:  59 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.

Circuit.JPG



Dibond.JPG
 Description:
The Aluminium Dibond. 3mm is perfect for the Potentiometers and isn't very flexible at all!
 Filesize:  121.21 KB
 Viewed:  53 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.

Dibond.JPG



Midi2CV v1.0.rar
 Description:

Download
 Filename:  Midi2CV v1.0.rar
 Filesize:  225.37 KB
 Downloaded:  68 Time(s)


Last edited by himijendrix on Sun Feb 16, 2014 5:35 am; edited 3 times in total
Back to top
View user's profile Send private message
elmegil



Joined: Mar 20, 2012
Posts: 1475
Location: Chicago
Audio files: 14

PostPosted: Wed Aug 14, 2013 6:56 am    Post subject: Reply with quote  Mark this post and the followings unread

Very nice work, thank you for sharing it!
Back to top
View user's profile Send private message
LFLab



Joined: Dec 17, 2009
Posts: 191
Location: Rosmalen, Netherlands

PostPosted: Thu Aug 29, 2013 5:56 am    Post subject: Reply with quote  Mark this post and the followings unread

Pretty cool way to make frontpanels, and quite cost effective.
So, in your opinion the UV direct print is best? Is it durable?
About 7-8 euros for a 14TE eurorack frontpanel, nice!
Back to top
View user's profile Send private message
PHOBoS



Joined: Jan 14, 2010
Posts: 1703
Location: Moon Base
Audio files: 346

PostPosted: Thu Aug 29, 2013 6:33 am    Post subject: Reply with quote  Mark this post and the followings unread

did you paint the nuts of those 1/4" sockets yourself or did they come in those colors ? Shocked
I know someone here has painted them before,. maybe that was you. Anyway it looks great! Razz

_________________
"My perf, it's full of holes!"
http://phobos.000space.com/ http://www.acidtrash.com/ Stickney Synthyards
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
himijendrix



Joined: Apr 16, 2012
Posts: 15
Location: Germany

PostPosted: Mon Sep 02, 2013 12:21 am    Post subject: Reply with quote  Mark this post and the followings unread

@LFLab
Yes, the UV direct print is the best solution in my opinion.
I think it's hard enough for this application. I'm not sure if the colour will fade a bit whithin some years, but i think it should stay like this if not exposed directly to sunlight for years...

@PHOBoS
I got them from here ... http://www.musikding.de/Ampstyle
Back to top
View user's profile Send private message
scriptstyle



Joined: Jan 22, 2008
Posts: 250
Location: nj

PostPosted: Sun Feb 02, 2014 11:20 pm    Post subject: Reply with quote  Mark this post and the followings unread

i have only glanced at the sketch for this, my understanding is that you pick what midi channel you want to transmit over to the DACs. do you think that it would be possible to extend all 16 channels with separate DACs for each channel(access through an analog switchs or rotary). I am aware the ATmega328 limit of 14 digital I/O pins, and 6 analog. the ATmega2560 has 54 digital I/O and 16 analog. that sounds like i could build something like this around that? also this sketch weighs in around 5.5kb what do you guys think the estimated size of said sketch? I/O stuff aside i do not think a sketch this size would fit on a 32kb micro controller...

Am i missing something simple? the last few days i have been full speed on Midi like its a new thing again. Hello world 2014
Back to top
View user's profile Send private message
himijendrix



Joined: Apr 16, 2012
Posts: 15
Location: Germany

PostPosted: Mon Feb 03, 2014 6:10 am    Post subject: Reply with quote  Mark this post and the followings unread

So do you want to receive and convert Midi at all Channels simultaneously?
Because you are writing that you want to use a rotary switch, and I don't completely understand for what?

If you want to use them in parallel, the sketch wouldn't definitely not become too huge for the Atmega328, and if you want to use 16 DACs you can chain them in an i2c bus, so they will only need 2 digital pins, like before.

But then you will have to use the MAX519 as an DAC, because it has 4 inputs for setting the adress (each input connects either to 5V or to ground (High, Low)) which gives you 2^4 = 16 different addresses. So 16 Max519 can share one i2c bus.
See the Datasheet on page 8:
http://pdf1.alldatasheet.com/datasheet-pdf/view/73502/MAXIM/MAX517BCPA.html

But you should consider that the MAX Dac isn't so cheap, and depending on what you want to do, this is maybe an overkill. Do you want to control 16 Synths at one time? Or just switch lights or something else by midi?

greetings, himi
[/url]
Back to top
View user's profile Send private message
scriptstyle



Joined: Jan 22, 2008
Posts: 250
Location: nj

PostPosted: Mon Feb 03, 2014 1:24 pm    Post subject: Reply with quote  Mark this post and the followings unread

Quote:
So do you want to receive and convert Midi at all Channels simultaneously?


yes

Quote:
Because you are writing that you want to use a rotary switch, and I don't completely understand for what?


you are right i think i was getting ahead of myself with the rotary, I was thinking of a ways around the dip to enable active channels...

Quote:
If you want to use them in parallel, the sketch wouldn't definitely not become too huge for the Atmega328, and if you want to use 16 DACs you can chain them in an i2c bus, so they will only need 2 digital pins, like before.


this sounds good what needs to be changed in the sketch? And as for DACs i want to start with just two channels 1 and 2. and then add channels maybe thats when i started thinking about rotary encoders and what not haha.
Back to top
View user's profile Send private message
gdavis



Joined: Feb 27, 2013
Posts: 153
Location: San Diego

PostPosted: Mon Feb 03, 2014 1:51 pm    Post subject: Reply with quote  Mark this post and the followings unread

Another option might be a multichannel DAC. I'm using the ATMega328 (Arduino Nano) to drive an 8 channel serial DAC through the SPI interface. Two of these DACs would require 4 digital pins - shared data and clk plus one enable pin for each DAC. Or you can just get a 16 channel DAC.
_________________
My synth build blog: http://gndsynth.blogspot.com/
Back to top
View user's profile Send private message
scriptstyle



Joined: Jan 22, 2008
Posts: 250
Location: nj

PostPosted: Mon Feb 03, 2014 3:25 pm    Post subject: Reply with quote  Mark this post and the followings unread

I like the idea of using 2-8 channel serial DACs, but would this would tie up the serial spi correct? I have plans for 2X16 LCD or an OLED... scratch
Back to top
View user's profile Send private message
mosheen



Joined: Jun 19, 2013
Posts: 19
Location: NC

PostPosted: Mon Feb 03, 2014 4:00 pm    Post subject: Reply with quote  Mark this post and the followings unread

Not really. You just have to have an available digital output on the arduino to select between each device.
Back to top
View user's profile Send private message
scriptstyle



Joined: Jan 22, 2008
Posts: 250
Location: nj

PostPosted: Mon Feb 03, 2014 10:39 pm    Post subject: Reply with quote  Mark this post and the followings unread

what do i need to change in the sketch to have all 16 channels? I am going to try and give it a good look tonight and see what i can come up with
Back to top
View user's profile Send private message
mosheen



Joined: Jun 19, 2013
Posts: 19
Location: NC

PostPosted: Mon Feb 03, 2014 11:11 pm    Post subject: Reply with quote  Mark this post and the followings unread

You'll have to see how it loops through all the values and add your extra channels into the loop. You'll have to toggle the different chip select pins for each write to each SPI device.
Back to top
View user's profile Send private message
scriptstyle



Joined: Jan 22, 2008
Posts: 250
Location: nj

PostPosted: Tue Feb 04, 2014 12:20 am    Post subject: Reply with quote  Mark this post and the followings unread

ok this makes sense I need to gather my thoughts and see if what i want to do is feasible. I looked at the sketch and now the DIP switch makes sense very clever, i might still build one like this but for what i am trying to work out it would make sense that it looks something like this :

CHANNEL1->CV1->DAC1
CHANNEL1->VEL1->DAC1
CHANNEL2->CV2->DAC1
CHANNEL2->VEL2->DAC1

I want this as a basic starting point. i have 4 MAX517s so I will try with these for now and see how it goes.

Last edited by scriptstyle on Wed Feb 05, 2014 3:22 am; edited 1 time in total
Back to top
View user's profile Send private message
xpmtl



Joined: Aug 10, 2007
Posts: 158
Location: Brussels, Belgium

PostPosted: Tue Feb 04, 2014 11:29 am    Post subject: Reply with quote  Mark this post and the followings unread

Can you repost the files RAR?

Archive link is broken for some reason.

Thanks

_________________
http://sdiy.xpmtl.net
Back to top
View user's profile Send private message
himijendrix



Joined: Apr 16, 2012
Posts: 15
Location: Germany

PostPosted: Tue Feb 04, 2014 11:54 am    Post subject: Reply with quote  Mark this post and the followings unread

@xpmtl
It should work now again.

@scriptstyle
Now I'm curios, 16 Synthesizers at one time? When you are finished I want to hear some samples Very Happy
Back to top
View user's profile Send private message
himijendrix



Joined: Apr 16, 2012
Posts: 15
Location: Germany

PostPosted: Sun Feb 16, 2014 4:23 am    Post subject: Optocuppler resistor bug Reply with quote  Mark this post and the followings unread

I found a little bug ...

R25 (3,3k) which acts as a pullup resistor in the Midi input section, right after the optocuppler can be left out. Because the Atmega 328 already has an internal 10k pullup resistor, so this would be too much in some cases (for example if the current provided to the LED inside the optocuppler by the MIDI input signal is too low, the phototransistor wouldn't switch properly and couldn't ground the signal with a too small pullup resistor...)

You should also replace R24 (220 ohm) with a smaller resistor. 220 ohm is often used in the Midi input schematics, but in fact for a 4N28 it is too high.
In the datasheet you can see that the 4N28"s internal LED needs 1.3V@50mA which gives a series resistor of 74 Ohms, so 100 Ohm works fine.

P.S.
This problem was only notable when I used my Midi Thru expander box (1 Input, 5 Outputs). It uses a schmitt trigger to buffer and sharpen the signal, but unfortunately schmitt triggers have a rather low output current, which was not enough to drive the optocupplers LED. with the reistor change it works again. I will also try to add a second schmitt trigger ontop of the first one (Parallel) for increasing the maximum Output current.

... and another bug in the code, where the Trigger wouldn't go low after a short time. I fixed that and uploaded a new rar package.


PPS:
If you are looking for a really clever designed and simple Midi -> device you should have a look at this:
http://mutable-instruments.net/modules/cvpal
I built it and it works very well. The DAC is doesn't even need a trimmer. Everything is calibrated by software, and even the non linearity of the DAC+Trimmer (higher notes tend to be slightly out of tune) is corrected by its software.
Back to top
View user's profile Send private message
YashN



Joined: Jun 27, 2011
Posts: 64
Location: Canada

PostPosted: Tue Feb 25, 2014 1:24 am    Post subject: Reply with quote  Mark this post and the followings unread

I would recommend the latest MIDI v4.0 library and structure your code with callbacks. You could also use a high-resolution timer in the fast modes for listening to MIDI messages.

Well done!
Back to top
View user's profile Send private message
himijendrix



Joined: Apr 16, 2012
Posts: 15
Location: Germany

PostPosted: Wed Jul 09, 2014 2:41 am    Post subject: Reply with quote  Mark this post and the followings unread

I had some trouble with the optocoupler recently, where some midi keyboards didn't worke with the circuit.
The problem is not the LED resistor, it's rather the fact that an 4N28 (passive) is crap in midi applications.

You should use an 6N137 or 6N138 which is an active coupler and requires a Vcc Connection.

Here they discuss the same problem: http://mutable-instruments.net/forum/discussion/5276/midi-input-with-optocouplers/p1
Back to top
View user's profile Send private message
capicoso



Joined: Nov 19, 2012
Posts: 127
Location: Argentina

PostPosted: Thu Jul 10, 2014 12:24 pm    Post subject: Reply with quote  Mark this post and the followings unread

himijendrix wrote:
I had some trouble with the optocoupler recently, where some midi keyboards didn't worke with the circuit.
The problem is not the LED resistor, it's rather the fact that an 4N28 (passive) is crap in midi applications.

You should use an 6N137 or 6N138 which is an active coupler and requires a Vcc Connection.

Here they discuss the same problem: http://mutable-instruments.net/forum/discussion/5276/midi-input-with-optocouplers/p1

If you can't get the 6n138(like me, here I get only the 6n136) just put a transistor at the output
http://acidotunismo.com/wp-content/uploads/2013/10/midi_in-arduino-uno-low-gain-opto_schem21.png
Back to top
View user's profile Send private message
himijendrix



Joined: Apr 16, 2012
Posts: 15
Location: Germany

PostPosted: Fri Jul 11, 2014 6:09 am    Post subject: Reply with quote  Mark this post and the followings unread

Hi capicoso, I also did this (You should change R4 to some higher value like 10k when using a stanalone microcontroler, because in this example pin 0 of the AVR on the arduino board is also connected to the USB Serial chip, that's why R4 has to be so low in this case)

The problem is that with a very cheap Midi Keyboard (Kawai Datacat) it still receives faulty Midi signals.

I tried to switch it to an 6n138, but it still fails (It's also too slow I think).

My better Midi Keyboard (Aturia) works. I think it provides a more stable Midi signal.

The best solution seems to be the 6n137.
I have an Shruti_1 Synthesizer, which uses this one together with an AVR and it all works fine.
Back to top
View user's profile Send private message
capicoso



Joined: Nov 19, 2012
Posts: 127
Location: Argentina

PostPosted: Fri Jul 11, 2014 1:20 pm    Post subject: Reply with quote  Mark this post and the followings unread

Weird, i thought the 6n138 was the "best" opto for this...
My modular has a mcv628 from bareille, it uses 6n136, and it worked with everything, until I bought a casio cz5000, with that one it doesn't work. On the other hand, my arduino sequencer has midi in for transpose, with 4n28 and it works with everything i have, luck i guess heh
Back to top
View user's profile Send private message
Blue Hell
Site Admin


Joined: Apr 03, 2004
Posts: 20536
Location: The Netherlands, Enschede
Audio files: 147
G2 patch files: 318

PostPosted: Fri Jul 11, 2014 3:19 pm    Post subject: Reply with quote  Mark this post and the followings unread

It is also possible to damage optos with heat .. best to set the iron hot and do it quickly .. or socket 'm .
_________________
Jan
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic
Page 1 of 1 [23 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » Arduino
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
e-m mkii

Please support our site. If you click through and buy from
our affiliate partners, we earn a small commission.


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use