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.

Zoot

Member Since 06 Dec 2011
Offline Last Active Jan 02 2015 02:56 AM
-----

#61121 5V sensor with netduino 2

Posted by Zoot on 02 January 2015 - 02:49 AM

Don't think of it as losing 2V.  You aren't really losing any of the span and accuracy of the sensor output signal, you're just scaling it into a voltage that the Netduino can understand and work with.  It pretty common to do this in the analog to digital world, where some of the analog voltages are outside the range at which ADC chips can work.  The input signals have to be adjusted for the ADC chip to use them.  That's exactly what is happening here.  5V becomes 3V, and 0V is still 0V.  You're taking the output range and compressing it slightly, but you still have all of the range represented in the 0 - 3V span of the signal.

 

You'll have to do some translation tricks in the code, like using a correction factor to arrive at the actual value represented by the new voltage, but that can be arrived easily enough by using the ratio of voltages.  In this case 3V/5V = a 0.6 correction factor.  If, in a 5V span, the sensor puts out 3.3V, the new circuit would display that 3.3V signal as 3.3 * 0.6 = 1.98V.  You just have to interpret that in your code the right way.  So if your sensor is saying that it is at 10 PSI when putting out 3.3V, your Netduino will read that same 10 PSI pressure reading at approximately 2V, you just have to teach your Netduino code to understand what that means.

 

To obtain your correction factor, take 5V and apply it to the top of the voltage divider with the divider connected to the Netduino pin.  Measure the voltage on the resistor leg at the Netduino pin.  Take that voltage and divide it by 5 Volts.  Presto, you now have a scaling, or correction factor to use in your code.  To scale downward, multiply by the correction factor.  To scale upward, multiply by the inverse of the correction factor (1/correction factor).




#58940 Netduino 1 internet/PC connection

Posted by Zoot on 28 June 2014 - 05:03 PM

Yes, you can do something like that.  The Visual studio programming environment also lets you write Windows programs, so you could write a program with a button in it using C# (the same language that the Netduino uses).  You would need to use the serial port on the PC (if you have one), or else an Ethernet connection to talk to the Netduino.  To use Ethernet, you will need an Ethernet shield for the Netduino 1 so that it can talk to the Internet, or just between the PC and the Netduino.  The Netduino 1 doesn't natively support Ethernet without some extra hardware.

 

The serial port is a little easier, because there is no special hardware involved (actually, to use a native serial port on a PC, you would need a serial shield, or some sort of translator to change the voltage levels from the serial port to something that the Netduino can handle.  So there would be hardware involved to use the serial port), other than a serial port on the PC.  The easiest way to use a serial port is to use an FTDI USB to serial cable to talk to the Netduino.  The only tricky part is having a Windows program use the serial port.  There are serial classes for C# in Windows that you can use, and you can find plenty of examples on the web on how to use these classes to communicate with your projects.

 

Things to search for on the 'net:

 

"Using a serial port in C#"

"C# serial port"

"C# Ethernet"

"FTDI USB to serial cable"

 

This is a good start:

http://msdn.microsof...serialport.aspx

 

http://stackoverflow...port-in-c-sharp

 

 

A little research and some programming, and you'll have LEDs blinking to Windows button presses in no time.  Check out some of the information and post back.  Once you understand a little more, you'll have a clearer idea of where you need to go, and we can help you get there. :)




#25380 Intellisense Anyone?

Posted by Zoot on 11 March 2012 - 04:22 PM

I'm also missing this but maybe it has to do with keeping flash requirements to a minimum?

In general, I think documentation is poor, but I could be missing something here.

I'll agree that the documentation is poor, but hopefully that will improve.

The Intellisense information doesn't go into flash, I wouldn't think. It's based on sets of XML comments in the raw C# code which are omitted from the code image at compile time, or when the DLL is compiled. We see them, but the Netduino would not.

Here's a partial example from Microsoft's Unity Framework source code. It's just the Intellisense XML and the method signature to illustrate my point:
/// <summary>
        /// Register a type with specific members to be injected.
        /// </summary>
        /// <param name="container">Container to configure.</param>
        /// <param name="t">Type this registration is for.</param>
        /// <param name="injectionMembers">Injection configuration objects.</param>
        /// <returns>The <see cref="UnityContainer"/> object that this method was called on (this in C#, Me in Visual Basic).</returns>
        [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "t")]
        public static IUnityContainer RegisterType(this IUnityContainer container, Type t, params InjectionMember[] injectionMembers)
All of the information on how to use the method is there in the XML comments. When you're editing this code in Visual Studio, that is the info that pops up when you hover over a method name.


#25372 Intellisense Anyone?

Posted by Zoot on 11 March 2012 - 01:00 PM

Here's a suggestion for Chris, or anyone else that would like to take a shot at it. Even me. I've noticed when using the Secret Labs SDK functions, that a description of the function and its' parameters doesn't show up in Intellisense. You get the name and arguments, but no small description, like "Writes byte to serial port" or "Toggles specified pin true or false." Chris, maybe you could add this to the next release of the SDK, please? If you and your staff don't have the time, maybe we can make this a community effort, though it would be better if SL did it due to familiarity with the code. It's only XML commentary in the source code, after all. Thoughts?


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.