Weird voltage behavior

Hi guys,

Using Arduino Uno, i'm trying to get 5v from digital output, or -5v (current under 30mA);

int Handle2Pos = 9;
int Handle2Neg = 10;


void setup() {
  // put your setup code here, to run once:
  pinMode(Handle2Pos, OUTPUT);
  pinMode(Handle2Neg, OUTPUT);

  digitalWrite(Handle2Pos, LOW); // sets the digital pin 13 on
  digitalWrite(Handle2Neg, LOW);  // sets the digital pin 13 off

  delay(2000);

  digitalWrite(Handle2Pos, LOW);
  digitalWrite(Handle2Neg, HIGH);

  delay(2000);

  digitalWrite(Handle2Pos, HIGH);
  digitalWrite(Handle2Neg, LOW);

  delay(2000);

  digitalWrite(Handle2Pos, LOW);
  digitalWrite(Handle2Neg, LOW);

Connected to a scope, in LOW LOW i get straight line on 0V (good), in LOW HIGH i get +5V (good) BUT in HIGH LOW i get very distorted signal at about 0v (not good).

it almost seems like a bad ground, tried to replace pins several times, no luck.

any advise?

thanks.

You are not connecting two pins defined as OUTPUT together, one HIGH and one LOW, are you ?

On most 'scopes, the probe ground connection is tied to the chassis which is connected to the power line ground wire. Many users have learned this the hard way! You may be shorting one output to circuit ground!

The way to make a "floating reading" on a scope, is to set one channel to A+B and set B to "invert". Make sure the channel gains are identical. Then connect the tip of probe A and the tip of probe B to the device under test.

Connected to a scope, in LOW LOW i get straight line on 0V (good), in LOW HIGH i get +5V (good) BUT in HIGH LOW i get very distorted signal at about 0v (not good).

I don't get what you're saying but the datasheet says output-high should be 4.4V or higher and output-low should be 1V or less. (depending on current and temperature).

Noise (distortion?) is OK as long as the voltages stay within that range... That's the beauty of digital... High is high and low is low, and as long as you stay out of the undefined range everything works perfectly!

The digital input limits are a bit wider so as long as your output is a valid-high or valid-low the data will be read correctly. (i.e. The inputs have a narrower undefined range.)

Thanks for the replys.

  1. I'm trying to drive a micro dc motor using the outputs, so - i connect two output pins to the two terminals. My thinking is that LOW HIGH will spin the one way, and HIGH LOW will spin the other, but it only turns one way (LOW HIGH).

It's okay that the ouput will be 4V to 5V, it will spin the motor slower, but it should still spin..

Never seen a motor with a (stall) current of 30mA. Better show us, with a link to the product.

Not very wise to drive a motor from signal pins anyway. Leo..

Indeed stall amperage is greater, but i will handle it with current sensing afterwards.

the operating current is 20mA, and stall current of 360mA.

it's a POL-1596.

Better use a motor driver (H-bridge). Or have a stack of spare Arduinos handy. Leo..

but i will handle it with current sensing afterwards.

The output pins will die first, or maybe the entire Arduino will die from the motor voltage spikes.

Got it, drivers..

thanks anyway!