Motor Shield Analog Input Issue

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
toddh98
 
Posts: 7
Joined: Thu Mar 06, 2014 9:05 pm

Motor Shield Analog Input Issue

Post by toddh98 »

*Reposting since original post went to wrong forum *

I am using the Arduino Uno with the Motor Shield with stackable headers, and I cannot get good readings on A4 and A5. Basically I am reading the analog signal from emitter/detector pairs and everything works great on A0-A3. I have ensured that the shield is seated snug onto the uno, swapped out emitters/detectors, wire leads and nothing seems to work. While A0-A3 correctly reads the emitter/detectors (around 20-30 to start) A4 and A5 always start out at 500 or so when hooked up. Do I have a defective motor shield? Any help would be very much appreciated. Thanks!

User avatar
adafruit_support_bill
 
Posts: 88139
Joined: Sat Feb 07, 2009 10:11 am

Re: Motor Shield Analog Input Issue

Post by adafruit_support_bill »

A4 and A5 on the UNO are also SDA and SCL or the I2C bus that is used to communicate with the shield. You cannot use these as analog pins when they are used for communication with any I2C devices.

toddh98
 
Posts: 7
Joined: Thu Mar 06, 2014 9:05 pm

Re: Motor Shield Analog Input Issue

Post by toddh98 »

Ahhh. So that is why I can use AO-A05 directly on the uno but A4 and A5 aren't available when the motor shield is stacked. So do you have a recommendation on how I can use 5 analog inputs then since I am also using motors for my project (hence why I got the motor shield)?

Thanks!

User avatar
adafruit_support_bill
 
Posts: 88139
Joined: Sat Feb 07, 2009 10:11 am

Re: Motor Shield Analog Input Issue

Post by adafruit_support_bill »

We have 4-channel ADC breakouts. These can share the i2c bus with the Motor shield and are addressable. You can use up to 4 of these breakouts to give you as many as 16 extra analog channels.

https://www.adafruit.com/products/1083
https://www.adafruit.com/products/1085

toddh98
 
Posts: 7
Joined: Thu Mar 06, 2014 9:05 pm

Re: Motor Shield Analog Input Issue

Post by toddh98 »

Before I purchase an ADC breakout, in looking at the Uno R3, there are SDA and SCL pins near the AREF pin. Why can't the Uno use those for communication when a motor controller is stacked instead of A4 and A5? If the answer is no, is another option to have them unstacked and just run wires between the Uno and Motor Shield from SDA - SDA and SCL - SCL so I then can use all 6 analog inputs directly on the Uno?

Thanks!

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Motor Shield Analog Input Issue

Post by adafruit_support_mike »

Those slots in the header connect to the same microcontroller pins as A4 and A5. You can confirm it with a multimeter.

The ATmega328P has multiple alternate functions for most of its GPIO pins. The two that have the I2C hardware can also serve as inputs for the ADC. The new slots in the Uno's header are a convenience for shield designers, but they don't change the underlying hardware.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”