alf45tar / PedalinoMini

Wireless and Bluetooth MIDI Foot Controller
GNU General Public License v3.0
505 stars 89 forks source link

3V3 Logic on ESP device #12

Open prisme60 opened 5 years ago

prisme60 commented 5 years ago

Hello Alf45tar,

First Thank you for your project. I was thinking about a similar project than yours. My goal is only MIDI IN / MIDI OUT from / to Wifi network midi.

I am a professional software programmer, but I'm not an electronic engineer. I see 6N137 (High Speed Optocoupler) is powered by 5 V (the Vcc seems OK for me), but the pin 6 (Vo) of the 6N137 component is directly connected to the ESP.

I suppose that you "transpose" the electronic of the Pedalino project to the Pedalino mini, and you forget that Arduino HWs are 5V, but ESPs are 3V3 and not 5V tolerant.

I think you need to adapt the output of the pin 6 (Vo) of the 6N137. If you have an oscilloscope, it should be possible to check it.

alf45tar commented 5 years ago

Technically speaking you are right. Practically speaking it works.

I used the 6N137 coming from Pedalino. As you noted it should be replaced by somenthing that works at 3.3V like a 6N138. If you want to propose and improved circuit it will be appreciated.

prisme60 commented 5 years ago

Which schematic editor are you using? In your github project, you just provide the SVG exports. I will be easier to me to start with your schematic project.

Before submit an improved circuit, I need to test it myself (I am still waiting to receive DIN connectors), and I record you that I am a "newbie" in electronics ("my" answer will be built from solution found by others on the Internet).

This site seems to have a correct and tested solution : http://10rem.net/blog/2012/03/31/midi-module-assembly-instructions

alf45tar commented 5 years ago

I am using EasyEDA. Here attached the link the project source file.

https://easyeda.com/editor#id=|29d4a1b85ae64276ad0eff88e8fdee0d|e760a5d776174bcda2c870520d9c9332|dfcbfd3e075647c3b81704f302e61d13|8744b22c13f94633bc80251eca18fb8f

prisme60 commented 5 years ago

Here is a draft proposal. Be very critical on the schematic. It is not tested for the moment. I reject all responsabilities of possible hardware destruction. Be aware, it is not my formation.

https://easyeda.com/christian.foucher/pedalinomini-3v3-with-6n138-and-bss138 <-- Should not be used (this file has the #30 issue)

Schematic_PedalinoMini-3V3-with-6N138-and-BSS138_Sheet-0_20190823090030.svg.zip <-- Should not be used (this file has the #30 issue)

Remarks : You can use the "MC74VHC1GT08" (2-Input AND Gate/CMOS Logic Level Shifter) like it was proposed in http://10rem.net/blog/2012/03/31/midi-module-assembly-instructions instead of the BSS138 level shifter if you prefer but it seems to be more difficult to buy.

marosell commented 5 years ago

Apologies, I am neither a professional programmer or electronics designer. However, I see that power coming into the MIDI-IN optional zone is now 3.3V but the power coming into the MIDI-OUT optional zone remains 5V. Were you not proposing that the entire system move to 3.3 as the ESPs are not necessarily designed to be 5v tolerant? The screen runs on 3.3 anyways, not sure why it's worth keeping track of a second voltage?

There is also an old reference to 5V on the ESP32 pin 15.

Can you clarify the Level Converter section? Is that section only needed if adding MIDI-IN? You can have MIDI-OUT without this?

Also, change the REV number in the title block and put your name on it! 😄

alf45tar commented 5 years ago

The screen runs on 3.3 anyways, not sure why it's worth keeping track of a second voltage?

Good point. I think the MIDI-OUT port can be converted to 3.3V replacing the 220 ohm resistors with a 10 and a 33 ohm resistors. This solution can avoid the level converter.

I will update my schematic with 6N138 for MIDI-IN and 10/33 ohm resistors for MIDI-OUT.

marosell commented 5 years ago

Ugh. Actually, I'm not sure you can do this, as Midi is a 5v protocol, so on output other devices are expecting 5v. Does that sound right? I don't even know.

Alternatively, you can just add the 10rem.net Midi Module to the parts list as a breakout board for anyone who needs midi-in and midi-out, with pin outs to the corresponding header on the breakout board 😄

prisme60 commented 5 years ago

There is also an old reference to 5V on the ESP32 pin 15.

I'm agree, The ESP32 should not be powered by 5V. Edit: DevelopmentBoard-ESP32 can be supplied with 5V on the Vin of the board connector.

I think the MIDI-OUT port can be converted to 3.3V replacing the 220 ohm resistors with a 10 and a 33 ohm resistors. This solution can avoid the level converter.

Like Marosell, I think adaptation of voltage level is needed. For the moment, I can't test it for the moment, I have all components, except my 5-pins DIN connectors and USB-MIDI converter (I have been waiting for 75 days! it seems to be lost during shipping!). I don't want to start the test with my Yamaha CLP120 keyboard.

alf45tar commented 5 years ago

According to the following schematic https://www.dropbox.com/s/jefwxxtufgwg0ex/esp32_Schematic%20Prints.pdf?dl=0 you can apply 5V to Vin. It is an alternative power source instead of USB.

However my intention is not to power supply ESP32 using Vin pin but it is to drain 5V from Vin for MIDI. PedalinoMini need to be connected to an USB power source (or battery) to power all the accessories.

MIDI has been recently update to works with 3.3V and now 3.3V is on the standard. The value of the 2 resistors (10 and 33 ohm) for a MIDI-OUT are in the standard schematic (https://forum.arduino.cc/index.php?action=dlattach;topic=566442.0;attach=272586).

prisme60 commented 5 years ago

According to the following schematic https://www.dropbox.com/s/jefwxxtufgwg0ex/esp32_Schematic%20Prints.pdf?dl=0 you can apply 5V to Vin. It is an alternative power source instead of USB.

Sorry for my mistake, you are right. I mix DevelopBoard ESP32 and the ESP32 itself. You can apply 5V to Vin of the DevelopBoard, but the Vin is not directly connected to the ESP32 chip, there is the voltage regulator NCP1117 (look at the Power Part) that transforms 5V to 3.3V and gives the signal labeled VDD3V3 on pin2 of the ESP32.

prisme60 commented 5 years ago

MIDI has been recently update to works with 3.3V and now 3.3V is on the standard. The value of the 2 resistors (10 and 33 ohm) for a MIDI-OUT are in the standard schematic (https://forum.arduino.cc/index.php?action=dlattach;topic=566442.0;attach=272586).

Thank you for your information source. I will try when I have all the hardware.

Psychlist1972 commented 5 years ago

Hi All. Mike contacted me and pointed me here.

MIDI over DIN is a 5v standard. There are times when you can get 3.3v to work, but that is highly dependent upon the receiving end. It will not work with all devices. You're relying on the receiving end's opto isolator to trigger at 3.3v logic levels, which is not guaranteed. There are also lots of bad MIDI references out there. There are also synthesizers and other small devices that are inline MIDI, with no other power supply, and which rely on the 5v. It's questionable as to whether or not those are in-spec, but they exist.

The IC I used for level shifting was picked specifically because of the voltage ranges it supports for in/out. It's running at 5v, but the input signal is based on that from a 3v3 MCU. So it needed to be able to take a low enough ON value (3v3 logic level). There may be others than can be substituted, but I didn't find any at the time. You'll need to compare the specs for minimum "on" signal. It's a small SMD package, but it's easy to hand-solder if you leave large enough pads in your design.

Here's the one I used. If you look at page 3, you can see it will trigger at 2v when supplied with between 4.5 and 5.5 volts VCC. https://www.onsemi.com/pub/Collateral/MC74VHC1GT08-D.PDF

If you want to use this for MIDI out, all you need is

Basically, just the bottom half of my schematic. This:

MIDI Out

Good luck on this project. Looks super cool! I hope my design helped.

Pete

alf45tar commented 5 years ago

Thanks Pete for sharing your experience.

marosell commented 5 years ago

All, I included the above information in my test board, which I have sent to production and am waiting to receive.

Test board proposes MIDI Out via:

Will report back once tested.

prisme60 commented 5 years ago

Correction of the proposal in order to take into account of the MIDI out inverted connector pin 4/5 detected in #30 .

https://easyeda.com/christian.foucher/pedalinomini-3v3-with-6n138-and-bss138-midi-out-pin4-5-now-ok

image

marosell commented 5 years ago

Correction of the proposal in order to take into account of the MIDI out inverted connector pin 4/5 detected in #30 .

https://easyeda.com/christian.foucher/pedalinomini-3v3-with-6n138-and-bss138-midi-out-pin4-5-now-ok

You sure the BSS138 will trigger on 3.3v? I didn't have a problem sourcing the M74VHC1GT08DTT1G, available at both Mouser and LCSC without a problem. But up to you on whichever you want to use.

prisme60 commented 5 years ago

BSS138 will adapt 3.3V to 5V without trigger effect. For example :

It is a well known bi-directional level shifter, like I explain in one of my first message : Sparkfun, Adafruit. Sourcing M74VHC1GT08DTT1G at Mouser costs 20$ of handling fee / shipping cost. Sourcing M74VHC1GT08DTT1G at LCSC costs 7$ of handling fee / shipping cost. The reason that I choose this component is :

I think I should also proposed the alternative of M74VHC1GT08DTT1G on the schema.

Remark : If it works well with BSS138, I won't buy M74VHC1GT08DTT1G, sorry I am "stingy".

romakrau commented 4 years ago

Hi Guys, I found some different information concerning MIDI Spec 2014 (see enclosed picture). On MIDIin side is a current sink needed. IMHO no Level shifter on MIDIout nessesary. # 2014 MIDI Output Circuit

Greetings Roman

alf45tar commented 4 years ago

Using Vtx = 3.3V and Ra=33 ohm and Rc=10 ohm resistors is in the standard since 2014 but according to Psychlist1972 (see above post) is not working an all devices.

athlonwai commented 4 years ago

I've test MIDI OUT with 33ohm and 10ohm circuit with my USB Midi Interface(CME WIDI X8) as well as my Kemper, it does work normally.