I have a Wowwee animatronic robot that I've been tinkering with, with the goal of hooking my arduino up to it so that I can control it from my computer.
The problem is, using a multimeter, I've tested that the voltage on the robot's control lines/pins is 3.3v; but the arduino outputs 5v through its pins.
Will hooking up the arduino and using its 5v pins damage the robot? And, realizing this is likely subjective to the robot's specific electronics, is there a way I can test/see/analyze if it would be ok to use 5v digital signal on its lines?
If not, I've been researching the feasibility of just putting a resistor on each of the arduino's output pins to bring the voltage back down to around 3.3v (although I'm not sure if I might need a more in-depth solution, as that would "corrupt" the digital signal?).
Answer
Arduino Outputs
Some controllers have "5V tolerant" inputs, so you can provide 5V from your Arduino and the robot will register a logic high and not be adversely affected by the over-voltage signal. I'm not sure if the robot has this feature; you'll probably have to check the datasheet for the microcontroller in the robot. If it does not have this feature, yes, you can get away with a 5V -> 3.3V converter using a voltage divider.
You need two resistors on each output pin, in this configuration:
\$V_{in}\$ is your 5V signal from the Arduino, \$V_{out}\$ needs to be 3.3V or less. These voltages are related by the equation:
$$ V_{out} = V_{in} * \frac{R_2}{R_1 + R_2} $$
I suggest that you could use \$R_2 = 33\mbox{ }k\Omega\$ and \$R_1 = 22\mbox{ }k\Omega\$ for a safe output of 3V. Other combinations, or higher-tolerance resistors, could get you closer to 3.3V or reduce the power these resistors consume, but that's probably not necessary.
Arduino Inputs
I'm not sure what the interface is on that robot (since you didn't provide a datasheet or schematic), but I'm guessing that there will be some signals that are output by the robot and are used as inputs to the Arduino.
The outputs from the robot will be at 3.3V or less, while the Arduino (according to the "DC Characteristics" table in the ATmega datasheet) expects that the following inequality will hold for input high voltage \$V_{IH}\$:
$$ V_{CC} + 0.5 >= V_{IH} >= 0.6 * V_{CC}$$
Practically, this inequality means that your Arduino requires 3V minimum inputs before it will register a logic-high signal. The robot's controller may meet these requirements, or it may not. (Note that the I2C bus requires \$0.7 * V_{CC}\$, or 3.5V, which will not happen).
For example, a 3.3V Arduino may only provide ~2.4V as a logic high. You can't connect a 3.3V Arduino to a 5V Arduino 2.4V on an input pin would be ignored by the 5V Arduino.
What to do
First and foremost, find and read the datasheets for the controllers on your robot and Arduino. The Arduino's ATmega32 datasheet is here.
If the robot controller tolerates 5V inputs, and provides 3V or greater outputs, then you're good to go.
If not, you need a level translation or level shifting circuit. This can be created from discrete elements like resistors and transistors (especially easy in the 5V -> 3.3V direction), from generic level translators like the 74ALVC, or from protocol specific translators like the PCA9306 for I2C.
Alternatively, use a microcontroller that runs at 3.3V. Sparkfun sells a 3.3V "Arduino Pro" board, or PJRC offers a 3.3V Teensy. If you're willing to step away from the Arduino world, there's a lot of processors that run at 3.3V.
No comments:
Post a Comment