4
\$\begingroup\$

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?).

\$\endgroup\$
7
\$\begingroup\$

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:

enter image description here

\$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.

\$\endgroup\$
  • 1
    \$\begingroup\$ Fantastic, in-depth info; much appreciated. \$\endgroup\$ – Coldblackice Feb 26 '12 at 12:10
2
\$\begingroup\$

The best thing would be to look in the datasheet for the robot. It should say what the min and max logic high input levels are. For example, some 3.3V systems have "5V tolerant" inputs. However, without any definitive data you have to assume that it can't handle more than the 3.3V it is putting out.

No, a single resistor is not sufficient since you don't apparently have a guaranteed minimum current draw spec for a digital input at logic high. You therefore can't know how much voltage a single series resistor will drop. What you need is two resistors in a voltage divider configuration. 3.3V is close to 2/3 of 5V, so 1 kΩ in series followed by 2 kΩ to ground should do the trick. The resistor divider will draw 5V / 3 kΩ = 1.7 mA from the arduino output. I expect that is well within its capabilities, but that's for you to check.

\$\endgroup\$
  • \$\begingroup\$ Ahh, great to know; this helps to better understand the answer below that I've been trying to reason through theoretically. Excellent, thanks for the prompt answers! I begin my digital journey in search of the illusive datasheetage :) \$\endgroup\$ – Coldblackice Feb 26 '12 at 12:29
  • \$\begingroup\$ PS -- any reason my lines/paragraphs aren't spacing correctly? I'm new here, but after reading through the Markdown info, shouldn't a double-space at the end of a line space out a new line? Do I have to enable Markdown usage somewhere? \$\endgroup\$ – Coldblackice Feb 26 '12 at 12:32
  • 1
    \$\begingroup\$ @Coldblackice - Comments are for short replies; they don't support newlines. The Markdown that is enabled for comments is just a short subset of the full capabilities: You have [link](http://example.com), _italic_, **bold**, and `code`. See the comment formatting for more information. \$\endgroup\$ – Kevin Vermeer Feb 27 '12 at 0:31
2
\$\begingroup\$

Which Wowee robot do you have.
There are a significant number and their internal circuitry may vary.

Here is a video and page on interfacing to the Woweee Elvis Robot - looks useful.

Also a video here

There is no certainty that a 5V signal can be used in a 3V3 system and it may cause damage. You can convert from 5V to 3V3 with a two resistor divider.
R1 from Arduino to Wowee pin.
R2 from Wowee input pin to ground.
R1 drops (5-3.3) = 1.7V.
R2 drops 3.3V - assuming the Arduino input resistance is high (which it quit likely is.
R1:R2 = 1.7: 3.3 ~= 1.65:3.3 = 1:2.

So if R1 is slightly more than R2/2 the 5V will be divided to somewhat less than 5V. eg

1k2 : 2k2. Vout = 5 x 2.2 / (1.2 + 2.2) = 3.24V. Equally 12k:22K 1k5:2k7 = 3.21V equally 15k:27K. etc

If you use 1% resistors you will probably be close enough to these values.

Single resistor:

Use of a single input resistor will probably not work. Two resistors share a common current and so share the total voltage in proportion to their resistances in accordance with Ohm's law.

  • V = I x R.

BUT if the Arduino ADC has infinite (or very high) input resistance then the very high resistance will represent most of th resistance aso drop most of the voltage. As we do not know what the Aruino ADC input resistance is it is assumed to be "highish" as that is the normal aim woth an ADC, and we "swamp" this with a low voltage dividier. The voltage DIVIDES the voltage in the ratio of the voltages. A single resistor is not a DIVIDER so does no good.

Water example: If you apply 100 psi at one end of a 100 metre water pipe and cap the far end, if there is no flow then the pressure at the far end will STILL be 100 psi regardless of whether the pipe is 0.5" or 3" or 12 " in diameter. BUT if you allow current flow then pressure drop will occur. Water current flow through pipe resistance causes water pressure drop. Here current flow causes voltage drop. If the flow is such that say 50 psi drop occurs across the pipe then half way along the drop will be about 25 psi and 20% of the way along it will be about 5 psi

Elvis page - links to here?

\$\endgroup\$
  • \$\begingroup\$ Thanks for the info. It's the Elvis that I have. Why would you need two resistors, out of curiosity? Wouldn't the first resistor from arduino->Elvis take care of all the work, cutting the voltage back to 3.3v? What would another resistor to ground be needed for? And while the math of your explanation was simple to follow, my electronic rustiness got lost in the "what/why" -- What's the reasoning of ratios between resistors? Thanks for the help. By the way, as for the two Elvis articles linked above -- are they missing info? Were you commenting that they appear to have been truncated? \$\endgroup\$ – Coldblackice Feb 26 '12 at 12:23
  • 1
    \$\begingroup\$ @Coldblackice - See addition at end of answer. \$\endgroup\$ – Russell McMahon Feb 28 '12 at 1:48

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.