MIDI2VC+When I got my mini-midi-keyboard, I decided to add USB support to the MIDI2VC, since this is what most modern MIDI devices use. This new feature is quite complex to add. It needs and MCU with USB host capabilities. The simplest PIC I found with this feature was the PIC24FJ64GA004, which is a 44 pin 16-bit MCU. Obviously changing to this device will be a major change in the project, so I decided to name the new board MIDI2VC+. I'm working on the schematic and the layout right now, and as soon as I've sent the design to OshPark, I'll finish the MIDI2VC and release it as an open source hardware project.
I2C: 3.3V and 5V bus
When working on the new MIDI2VC+ design, I was bothered with the different supply voltage of the DAC and the new PIC. The new PIC is using CMOS (3.3V) levels and the DAC TTL (5V). This means a 3.3V I2C bus and a 5V I2C bus that needs to communicate. My first solution was using the PCA9517A, a bidirectional, level changing, bus repeater. This seemed all well and dandy, until I realised that I needed to order this part from RS Components, and the shipping would cost more than 10 times than the part. This went against my principle of making a project with cheap, and easy to source components.
After doing some research I understood that sometimes it's possible to run different I2C level buses on the same voltage bus. Here's how it works. The I2C bus is an open drain bus. This means that the bus has pull up resistors to the higher voltage level. So if no one does anything on the bus, the bus sits at its high level. As soon as any device on the bus wants to communicate, it sinks current from the bus, making it go low, to send a logic 1. For a logic 0 the device lets the bus go to the high level. The whole protocol is well explained on several places on the web...
Lets look at our to devices then:
The DAC is a five volt logic device. It sinks the bus down to 0.4V when signaling a low level. Thresholds are VIL = 0.3*5V = 1.5V and VIH = 0.7*5V = 3.5V.
The PIC is a 3.3V device, but it tolerates up to 5.5V on digital only pins (which we will use). It sinks the bus to 0V for a low level. It's thresholds are VIL = 0.3*3.3V = 0.99V and VIH = 0.7*3.3V = 2.31V.
Seems like the two devices can communicate over I2C despite the different logic levels!