Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Another Analog Input Question


  • Please log in to reply
8 replies to this topic

#1 dyadica

dyadica

    Member

  • Members
  • PipPip
  • 17 posts

Posted 24 August 2010 - 08:11 PM

Hi, I have wired up a sparkfun Triple Axis Accelerometer Breakout ADXL335 to the netduino as follows: x - PIN_A0 y - PIN_A1 z - PIN_A2 VCC - 3V3 && Aref GND - Gnd All works ok when I only try to read a single port, however if I try to read all 3 as detailed below the netduino drops out during the while statement and then I have to do a manual erase of the program via MFDeploy before I can successfully deploy to the device again. My program is as follows: using System; using System.Threading; using Microsoft.SPOT; using Microsoft.SPOT.Hardware; using SecretLabs.NETMF.Hardware; using SecretLabs.NETMF.Hardware.Netduino; namespace accelerometer { public class Program { // Define our accelerometer inputs static AnalogInput accX; static AnalogInput accY; static AnalogInput accZ; public static void Main() { // Create the Inputs accX = new AnalogInput(Pins.GPIO_PIN_A0); accY = new AnalogInput(Pins.GPIO_PIN_A1); accZ = new AnalogInput(Pins.GPIO_PIN_A2); // Output the values ??? while (true) { // When alone works fine Debug.Print("accX: " + accX.Read().ToString()); // This (multiple) doesn't // Debug.Print("accX: " + accX.Read().ToString()); // Debug.Print("accY: " + accY.Read().ToString()); // Debug.Print("accZ: " + accZ.Read().ToString()); } } } } I have tested the accelerometer via just running the single input code and swapping in the respective wire for x,y,z. The likelihood is that I am missing something obvious due to inexperience etc so with that in mind a few questions: I have assumed that I can wire in multiple analog inputs which can be read concurrently. Is this correct? Drawing upon peoples vaster pools of knowledge do I seem to have I wired up the system correctly? Does the Aref only cater for a single input? Cheers dyadica

#2 pascal06

pascal06

    Advanced Member

  • Members
  • PipPipPip
  • 95 posts
  • LocationFrance

Posted 24 August 2010 - 08:40 PM

Hi, I have wired up a sparkfun Triple Axis Accelerometer Breakout ADXL335 to the netduino as follows:

x - PIN_A0
y - PIN_A1
z - PIN_A2
VCC - 3V3 && Aref
GND - Gnd

All works ok when I only try to read a single port, however if I try to read all 3 as detailed below the netduino drops out during the while statement and then I have to do a manual erase of the program via MFDeploy before I can successfully deploy to the device again.

My program is as follows:

using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;

namespace accelerometer
{
public class Program
{
// Define our accelerometer inputs
static AnalogInput accX;
static AnalogInput accY;
static AnalogInput accZ;

public static void Main()
{
// Create the Inputs
accX = new AnalogInput(Pins.GPIO_PIN_A0);
accY = new AnalogInput(Pins.GPIO_PIN_A1);
accZ = new AnalogInput(Pins.GPIO_PIN_A2);

// Output the values ???
while (true)
{
// When alone works fine
Debug.Print("accX: " + accX.Read().ToString());

// This (multiple) doesn't
// Debug.Print("accX: " + accX.Read().ToString());
// Debug.Print("accY: " + accY.Read().ToString());
// Debug.Print("accZ: " + accZ.Read().ToString());
}
}
}
}

I have tested the accelerometer via just running the single input code and swapping in the respective wire for x,y,z. The likelihood is that I am missing something obvious due to inexperience etc so with that in mind a few questions:

I have assumed that I can wire in multiple analog inputs which can be read concurrently. Is this correct?
Drawing upon peoples vaster pools of knowledge do I seem to have I wired up the system correctly?

Does the Aref only cater for a single input?

Cheers dyadica


Did you have update the firmware with patch 2, which include a fix regarding multiple analog use ?

Pascal

#3 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 24 August 2010 - 08:46 PM

There was a bug in the AnalogInput code. We fixed it in the v4.1.0.2 (patch 2) firmware about a week ago, so it's likely that your Netduino is running older firmware. Download the firmware update here: http://forums.netdui...e-v410-patch-2/ Does that fix things up for you? Chris

#4 dyadica

dyadica

    Member

  • Members
  • PipPip
  • 17 posts

Posted 24 August 2010 - 08:54 PM

Hi, Id missed that due to the panic of my netduino not working and having to do a manual erase etc Ill give it a go thank you both for the info, dyadica

#5 dyadica

dyadica

    Member

  • Members
  • PipPip
  • 17 posts

Posted 24 August 2010 - 10:13 PM

Yep that did it thanks again :)

#6 Driver A

Driver A

    Member

  • Members
  • PipPip
  • 13 posts

Posted 16 November 2011 - 03:19 AM

There was a bug in the AnalogInput code. We fixed it in the v4.1.0.2 (patch 2) firmware about a week ago, so it's likely that your Netduino is running older firmware.

Download the firmware update here:
http://forums.netdui...e-v410-patch-2/

Does that fix things up for you?

Chris


Is the fix included in update 6? I'm trying a similar hookup with my ADXL335 without much success. I also noticed that all my analog ports read the same value when I have a single potentiometer hooked up to the first Analog pin.

#7 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 16 November 2011 - 12:44 PM

Hi Driver A, Yes, this bug was fixed a while ago and the bugfix is included in all recent version of firmware. Do you have your analog device hooked up to 3.3V, GND, and the analog pin? What happens if you tie all other analog pins to GND (after opening them up as AnalogInputs in code)? Chris

#8 Driver A

Driver A

    Member

  • Members
  • PipPip
  • 13 posts

Posted 16 November 2011 - 03:21 PM

Hi Driver A,

Yes, this bug was fixed a while ago and the bugfix is included in all recent version of firmware.

Do you have your analog device hooked up to 3.3V, GND, and the analog pin? What happens if you tie all other analog pins to GND (after opening them up as AnalogInputs in code)?

Chris


Hi Chris,

I will try that later today and let you know.

Thanks,
Dan

#9 Driver A

Driver A

    Member

  • Members
  • PipPip
  • 13 posts

Posted 17 November 2011 - 03:58 AM

Hi Driver A,

Yes, this bug was fixed a while ago and the bugfix is included in all recent version of firmware.

Do you have your analog device hooked up to 3.3V, GND, and the analog pin? What happens if you tie all other analog pins to GND (after opening them up as AnalogInputs in code)?

Chris


Hi again,

So I've tried two things.

Firstly, I tried a single potentiometer on analog pin 1, grounded the rest of the analog pins and measured all the values. Everything works as expected: pin 1 gives me the voltage provided by the potentiometer, and all the others (2 - 6) give me 0. If I remove the ground from either of them the value is bogus.

Secondly, I tried with the ADXL335:
- VCC -> 3.3V + AREF
- GND -> GND
- X -> A0
- Y -> A1
- Z -> A2
and A3, A4, A5 -> GND

... with the same result as before. The only pin that seems to give me anything useful is Z (A2). The other two give me very low numbers. I measured the voltages between the analog pins and the ground and the results seem to concur with what I'm reading in the software: just over 0 volts on X and Y, and ~2.7 volts on the Z.

I'm starting to think I broke the ADXL, unsure how though. I will take a better look at the specs.

Cheers,
Dan




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.