Analog input heavily influenced by motor shield.

Hi all,

When I run the example sketch "01.Basics" -> "AnalogReadSerial" on the Arduino Uno (without shield). I get a nice, almost linear sweep from 0 to 1023.

When I do the same when the Uno is combined with a motor shield, I get a heavily skewed sweep from 11 to 750. With skewed I mean that the first 95% of the rotation makes the value sweep from 11 to 30 and the last 5% makes the value go from from 30 to 750. When I leave the potentiometer all the way up, the value slowly makes its way to about 790. Faster at first and then slower, like when you load a R-C cicuit.

There's a bipolar stepper attached to the motor shield, but it's not instantiated nor triggered in the code, since I'm using the example code for printing analogRead() to the serial monitor.

I get the same results when fed from just USB as well as from external power supply. Since I'm not driving any load, I thought it was OK to test without the external PS.

Attached is a picture of my setup.

Could my motor shield be broken?

Best regards, Marv

IMG_2795[1].JPG|1600x1200

Once a had a circuit and a solenoid. Circuit and solenoid were ulimately powered by the same power source, but not directly connected. that was enough for the solenoid to strongly interfere with my circuit with its inductivity.

I think your problems might vanish as soon as u stricktly seperate powers like by using 2 transformators for power

maybe that part is interesting too: "You can measure the current going through the DC motor by reading the SNS0 and SNS1 pins. On each channel will be a voltage proportional to the measured current, which can be read as a normal analog input, through the function analogRead() on the analog input A0 and "

Hey lax123,

Thank you for your quick response. The results are exactly the same when I attach an external power supply.

Best regards, Marv

Hi, sorry havent had a motor shield so i have no actual clue how its exactly working.

try this, as is my previous post "To avoid possible damage to the Arduino board on which the shield is mounted, we reccomend using an external power supply that provides a voltage between 7 and 12V. If your motor require more than 9V we recommend that you separate the power lines of the shield and the Arduino board on which the shield is mounted" Just the part about seperating sources but for reducing possible interferences

Hey lax123,

I'm powering my board with a 5V PS, because my stepper is rated 4.5V.

Could this be posing any problems?

Best regards, Marv

sry i dont know enough about this to really help. but i know usually mixing inductive loads like motors, relays with circuitry is usually not a good idea.

Powering by usb with 5V or with powerjack 5V? For powerjack it should be atleast 7V but i guess u already considered that.

I power with power jack 5V.

Does the motor shield require more to function properly? I was thinking that the motorshield drives the motors with the voltage it gets from the power supply. This in mind I thought it was a bad idea to supply a voltage much higher than the rating for the stepper, no?

I'll ask this in the motors board.

Best regards, Marv

"To avoid possible damage to the Arduino board on which the shield is mounted, we reccomend using an external power supply that provides a voltage between 7 and 12V. If your motor require more than 9V we recommend that you separate the power lines of the shield and the Arduino board on which the shield is mounted"

i guess that motor shield has a voltage regulator just like the arduino. voltage regulators need usually a minimum of 2V higher input then they output or it will probably output less then 5V.

then that might be the case here. I'll monitor the current through the stepper coils to see if that becomes excessive due to the higher voltage.

Thx! Marv

I found the culprit.

A0 and A1 analog inputs are reserved for current sensing when using the motor shield, and therefore cannot be used to attach a potmeter to.
When I attach the potmeter to A5 everything is just fine.

To be on the safe side I cut the “Vin Connect” connection on the board. It took me a while to understand from documentation that I was supposed to run a knife between the pads on the back of the shield. (see attached image)

Hope this helps someone with the same problem.

Best regards,
Marv

Arduino_MSv3_back.jpg

lol

read my first post again:

maybe that part is interesting too:
"You can measure the current going through the DC motor by reading the SNS0 and SNS1 pins. On each channel will be a voltage proportional to the measured current, which can be read as a normal analog input, through the function analogRead() on the analog input A0 and "

* Marvelade facepalms :blush:

Marvelade: I found the culprit.

A0 and A1 analog inputs are reserved for current sensing when using the motor shield, and therefore cannot be used to attach a potmeter to. When I attach the potmeter to A5 everything is just fine.

To be on the safe side I cut the "Vin Connect" connection on the board. It took me a while to understand from documentation that I was supposed to run a knife between the pads on the back of the shield. (see attached image)

Hope this helps someone with the same problem.

Best regards, Marv

Hi Marv,

thank you so much. I had the same prob, but your post was the right solution :-)

nice weekend to you and all other 8)