I am trying to interface an optical mouse sensor (OM10B) with an Arduino Uno. The sensor is 3.3V and the Arduino runs at 5V, but also has the 3.3V source. I found this very detailed homepage , where someone has done this and I am trying to follow it. However he is not using an Arduino and I do not understand the final circuit well. Since he does not write at which voltage he is operating his ATMega (3.3V or 5V), I am unsure whether I can follow his instrcutions without modifications. Here is the circuit diagram from that homepage:

final circuit

I don't understand the usage of the Zener diodes at the bottom in combination with the 150 Ohm resistors for the SPI interface. Is this a logic level converter to connect it to an ATMega at 5V or what purpose does it serve? If it is not, how could I go about to connect it to my Arduino Uno?


migrated from arduino.stackexchange.com Mar 5 '15 at 23:51

This question came from our site for developers of open-source hardware and software that is compatible with Arduino.

  • 1
    \$\begingroup\$ Using Zener diodes is lousy electronic design (and not generally effective, although in a low speed circuit this is probably a quibble). Simple diode clamps would be cheaper (and more effective). From what you have presented it is difficult to judge. There seems to be little reason to believe this is a 3.3V circuit (most run on 5V). You won't damage the Arduino. If you really need level conversion proper bi-directional level converters are available inexpensively on eBay. \$\endgroup\$ – Milliways Mar 5 '15 at 12:14

The page says 'I've used Zener diodes(3V6) and 150 ohms current limiting resistor so as to clamp the 5V high level to 3.6 volts as per specs.', and this is indeed what they'll do. So it'll be OK to connect this to a Uno with 5V I/O.

It's odd that the page describes it as an 'SPI' interface, because it's certainly not SPI, it looks more like I2C. The SIO line is bidirectional (i.e. at some times the sensor drives it and the Arduino receives the data), and this means the OM10B will be driving 3.3V into the Uno's 5V logic input. This isn't going to damage anything, but 3.3V is right on the edge of what counts as a '1' for most 5V logic. You may find that, if there's lots of noise (e.g. long wires or poor grounding) the data starts getting corrupted.

If that happens, you can use a 3V3-to-5V bidirectional logic level converter circuit instead of the resistors and Zeners. Adafruit & others sell them, or google 'MOSFET level shifter' for circuits.

  • \$\begingroup\$ Oh, ouch. I had completely missed/forgotten that line. Anyway, thanks for the heads up and explanation. Never mind the SPI interface - also my misinterpretation. I will see whether it works, once I have fitting diodes to build the circuit. Thanks! \$\endgroup\$ – packoman Mar 5 '15 at 14:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.