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

Analog Input Help Needed


  • Please log in to reply
46 replies to this topic

#1 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 21 August 2010 - 10:26 PM

Alright so I have my Gadget shield and when I read from the analog input that is in charge of the visible light sensor it doesn't change values. I am changing the amount of light it gets but the values still stays on 1023! I have 3V3 soldered to Aref, there is a bug that is fixed like that, so it should work!. Please help soon :(

#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 22 August 2010 - 12:33 AM

oz, If you use a multimeter (connected to the analog pin from the gadget shield and any of the GND pins on the Netduino), what voltage do you read? Also, I'm assuming that you haven't set a range--correct? Chris

#3 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 22 August 2010 - 01:00 AM

oz,

If you use a multimeter (connected to the analog pin from the gadget shield and any of the GND pins on the Netduino), what voltage do you read?

Also, I'm assuming that you haven't set a range--correct?

Chris


I get: around 3.something .. this isn't the most accurate multimeter so I guess it should be 3.0 to 3.5

No, I just did a

AnalogInput a5 = new AnalogInput(blah)

while(true)
Debug.Print(a5.Read().ToString());

#4 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 22 August 2010 - 01:14 AM

I get: around 3.something .. this isn't the most accurate multimeter so I guess it should be 3.0 to 3.5

No, I just did a

AnalogInput a5 = new AnalogInput(blah)

while(true)
Debug.Print(a5.Read().ToString());


Are you sure that it's hooked up right? If you get a 3.something on your voltage meter, it's likely a ~3.3V reading, which would be a reading of ~1023--which is what you're seeing in code.

#5 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 22 August 2010 - 01:29 AM

Are you sure that it's hooked up right? If you get a 3.something on your voltage meter, it's likely a ~3.3V reading, which would be a reading of ~1023--which is what you're seeing in code.


yep i triple checked.

#6 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 22 August 2010 - 03:11 AM

yep i triple checked.


If you're getting a consistent 3.3V reading on the analog sensor--even when you change the light level--then the sensor is not working properly.

[If I'm misunderstanding your question and you're getting different voltages based on light level but the Netduino is not seeing them then we can certainly debug from there.]

#7 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 22 August 2010 - 03:27 AM

If you're getting a consistent 3.3V reading on the analog sensor--even when you change the light level--then the sensor is not working properly.

[If I'm misunderstanding your question and you're getting different voltages based on light level but the Netduino is not seeing them then we can certainly debug from there.]


Nope you are correct. What does the SetRange do? is it like the map method in arduino programming?
I'll contact rugged circuits' support and see if they can tell me what to do.

#8 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 22 August 2010 - 03:32 AM

Nope you are correct. What does the SetRange do? is it like the map method in arduino programming?
I'll contact rugged circuits' support and see if they can tell me what to do.


AnalogInput.SetRange maps the analog input values to a specified range of integres. If 0-1023 on your device maps linearly to 0-100, then AnalogInput.SetRange(0, 100) will cause the AnalogInput.Read() method to return those values instead.

You can also submit reverse values to SetRange, such as AnalogInput.SetRange(100, -100)--which would cause an analog reading of 0V to return 100 and an analog reading of 3.3V to read -100.

Chris

#9 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 22 August 2010 - 03:37 AM

AnalogInput.SetRange maps the analog input values to a specified range of integres. If 0-1023 on your device maps linearly to 0-100, then AnalogInput.SetRange(0, 100) will cause the AnalogInput.Read() method to return those values instead.

You can also submit reverse values to SetRange, such as AnalogInput.SetRange(100, -100)--which would cause an analog reading of 0V to return 100 and an analog reading of 3.3V to read -100.

Chris

Yeah thats what I thought. Well I hope the people at rugged circuits can help me! I would hate to have no light sensor... Thank you for your help :) .

#10 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 22 August 2010 - 03:45 AM

AnalogInput.SetRange maps the analog input values to a specified range of integres. If 0-1023 on your device maps linearly to 0-100, then AnalogInput.SetRange(0, 100) will cause the AnalogInput.Read() method to return those values instead.

You can also submit reverse values to SetRange, such as AnalogInput.SetRange(100, -100)--which would cause an analog reading of 0V to return 100 and an analog reading of 3.3V to read -100.

Chris


Wait.. also since the gadget shield had the issue that I had to connect the 3V3 to Aref [It is connected by wire, so it is fixed but-->], should I be using my multimeter probes on other pins?

#11 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 22 August 2010 - 05:08 AM

Wait.. also since the gadget shield had the issue that I had to connect the 3V3 to Aref [It is connected by wire, so it is fixed but-->], should I be using my multimeter probes on other pins?


If you probe the AnalogInput and GND pins to test for voltage, there's no harm in that.

Chris

#12 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 22 August 2010 - 05:40 AM

If you probe the AnalogInput and GND pins to test for voltage, there's no harm in that.

Chris


Thanks for the help, I tested those and they stay the same so I emailed rugged circuits. I hope they pay for the shipping too! I am very upset right now.

But THANK YOU and the rest of the team! Thank them for me, for making a great product, you have given me tons of new opportunities in the world of programming!

#13 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 22 August 2010 - 02:38 PM

If you probe the AnalogInput and GND pins to test for voltage, there's no harm in that.

Chris

They told me to check if the pull up resistor is on. How do I do this in the .net MF c#? Can I make an analog input an interrupt port and disable the pull up resistor like that?

#14 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 22 August 2010 - 02:43 PM

They told me to check if the pull up resistor is on. How do I do this in the .net MF c#? Can I make an analog input an interrupt port and disable the pull up resistor like that?


oz, pull the shield off your Netduino and connect the necessary wires (but not the analog wire). Then test the voltage with a multimeter and see if you still get the constant 3.3V signal on the sensor's analog wire. If it works properly off the Netduino, there might be something we can do in code.

Also just to make sure we don't have a glitch in the Netduino AnalogInput code, before you create the AnalogInput make the port an OutputPort with a resistor state of Disabled. Then dispose that OutputPort and create your AnalogInput.

Chris

#15 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 22 August 2010 - 03:07 PM

oz, pull the shield off your Netduino and connect the necessary wires (but not the analog wire). Then test the voltage with a multimeter and see if you still get the constant 3.3V signal on the sensor's analog wire. If it works properly off the Netduino, there might be something we can do in code.

Also just to make sure we don't have a glitch in the Netduino AnalogInput code, before you create the AnalogInput make the port an OutputPort with a resistor state of Disabled. Then dispose that OutputPort and create your AnalogInput.

Chris


O wow, you sir are a master of un-disaster :lol:
InterruptPort test = new InterruptPort(Pins.GPIO_PIN_A5, false, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeBoth);
            test.Dispose();

sensor = new AnalogInput(Pins.GPIO_PIN_A5);

and by doing that I get different values!.

#16 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 22 August 2010 - 03:10 PM

Okay, very happy that it's working for you now. I'll check and make sure that we're specifically disabling the (weak internal) pull-ups in the AnalogInput constructor code (including on the muxed GPIOs used on pins A4/A5 if necessary). If not, we'll make the appropriate changes in a firmware update. Chris

#17 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 22 August 2010 - 03:17 PM

Okay, very happy that it's working for you now.

I'll check and make sure that we're specifically disabling the (weak internal) pull-ups in the AnalogInput constructor code. If not, we'll make sure that we do so in the next firmware update.

Chris

Great. whats new or being fixed in the next update?

#18 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 22 August 2010 - 03:27 PM

Great. whats new or being fixed in the next update?


We have two updates in the works:

v4.1.0.3 (patch 3):
* Minor updates to deployment/reboot code

v4.1.1.0 (first feature update)
* SD card mounting, file system support
* Expanded PWM support (ability to set clock times, etc.)

A few other things that we're working on:
* Networking capabilities
* Drivers for a number of shields

Chris

#19 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 22 August 2010 - 03:32 PM

We have two updates in the works:

v4.1.0.3 (patch 3):
* Minor updates to deployment/reboot code

v4.1.1.0 (first feature update)
* SD card mounting, file system support
* Expanded PWM support (ability to set clock times, etc.)

A few other things that we're working on:
* Networking capabilities
* Drivers for a number of shields

Chris


Nice stuff, I can't wait till you get the ethernet shields to work!
Here.. someone gave me this code, maybe you can model the drivers around it so arduino users can transfer easily.
http://trac.nchc.org...ernet_web_admin

#20 Snipehunter

Snipehunter

    New Member

  • Members
  • Pip
  • 6 posts

Posted 22 August 2010 - 04:40 PM

AnalogInput.SetRange maps the analog input values to a specified range of integres. If 0-1023 on your device maps linearly to 0-100, then AnalogInput.SetRange(0, 100) will cause the AnalogInput.Read() method to return those values instead.

You can also submit reverse values to SetRange, such as AnalogInput.SetRange(100, -100)--which would cause an analog reading of 0V to return 100 and an analog reading of 3.3V to read -100.

Chris


I really should pay more attention to the methods that are available in each class. I wrote my one code to do that recently. ;)




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.