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.

zee's Content

There have been 47 items by zee (Search limited from 24-May 23)


By content type

See this member's


Sort by                Order  

#46998 Beginner needs Help with Netduino & PIR Motion Detection!

Posted by zee on 11 March 2013 - 01:56 AM in General Discussion

Doh!!! - I assumed the black was the ground wire but you are right! It now works.. Thanks alot for your info. Excellent stuff. I have also cleaned up the code and removed references to EnableInterrupt() and ClearInterrupt()

 

 

Hi Waxie,

 

You mind pasting your codes here?

 

I am actually wondering how do you test your device, is there anything around your sensor device? It is because when i try to test, i placed the device in a box and still the outcome stated 'Motion detected'.

 

 And,when u test the program does the outcome stated Motion Detected even though we did not hover above the device? 




#48283 Dead USB, can't deploy, connect or reset...

Posted by zee on 11 April 2013 - 02:09 AM in Netduino 2 (and Netduino 1)

Hi Chris,

 

Yes, I did few times holding down the pushbutton, and the LED does not turn off too. The LED stays on. There is nothing appear on the PC. Did alot of different ways to overcome this problem but to no available.  :(




#48240 Dead USB, can't deploy, connect or reset...

Posted by zee on 10 April 2013 - 07:23 AM in Netduino 2 (and Netduino 1)

Hi,

 

I have the same problem. Even though i did the re-flash few times before, but this time is quite strange for me. The USB cable cannot detect to the PC, its not even to the bootloader mode. Tried on other PC and used other cables, but the problem still the same. Is there any other way to reset/erase the Netduino Plus 2?




#48872 Delay interruption handling

Posted by zee on 30 April 2013 - 05:21 AM in Netduino Plus 2 (and Netduino Plus 1)

Hi,

 

I have 2 questions regarding about PIR Sensor. I am using Netduino Plus 2.

 

1) Is it a need to have a resistor on it? Because, if i set it to Disabled, I need to wave a lot of times over the sensor for it to detect and after detecting it, it will keep on going print out the output even when i stop waving. If i set it to PullUp with 1K resistor without wave over it, it will automatically print the output.

 

2) I have insert the interrupt handling together with it, and the outcome seems to be ongoing even if I have stop waving over it. I want it to print out the output once upon detecting the motion, and stop, and print once again upon the next waving.

 

 

Here are my codes. I got it from this forum.

using System;using System.Net;using System.Net.Sockets;using System.Threading;using Microsoft.SPOT;using Microsoft.SPOT.Hardware;using SecretLabs.NETMF.Hardware;using SecretLabs.NETMF.Hardware.Netduino;using System.Collections;namespace Motion_Sensor{    public class Program    {        static OutputPort led = new OutputPort(Pins.ONBOARD_LED, false);        static InterruptPort PIR =             new InterruptPort(Pins.GPIO_PIN_A0, false, ResistorModes.PullUp, InterruptModes.InterruptEdgeLow);public static void Main()        {            // write your code here            Debug.Print("Wave!");            Thread.Sleep(1000);            PIR.OnInterrupt                 += new NativeEventHandler(motion_OnInterrupt);              Thread.Sleep(-1);        }        static void motion_OnInterrupt(uint data1, uint data2, DateTime time)        {            PIR.DisableInterrupt();            Debug.Print("Found movement ");            led.Write(true);                        Thread.Sleep(3000);            led.Write(false);            Thread.Sleep(3000);            PIR.EnableInterrupt();        }}}



#46873 Error: No response from device (HELP!!!)

Posted by zee on 08 March 2013 - 07:27 AM in General Discussion

Hi Chris,

 

I managed to solve the problem. Yup,thanks for the help Chris! :)




#46864 Error: No response from device (HELP!!!)

Posted by zee on 08 March 2013 - 02:04 AM in General Discussion

Hi Black Rose, When you power on your Netduino Plus, does the blue LED go out after a few seconds (indicating that it has booted)? If so, try to erase your current Netduino app: 1. Unplug your Netduino Plus and all components 2. Open up MFDeploy on your computer, select USB transport 3. Hold down the pushbutton on your Netduino Plus. This will force it into bootloader mode. 4. Connect your Netduino Plus to your PC (and keep holding the button). 5. Within 2 seconds, press the ERASE button in MFDeploy. Does that fix things for you? Also...after that, I'd recommend upgrading to the lasest firmware (v4.1.0.6 or v4.1.1 alpha 7+). Chris

 

 

Hi Chris,

 

I have the same problem too, after ive upgraded the firmware to 4.2,2. But when plugged into the USB, the LED is not blinking. However there is an error message saying that "There were deployment error. Continue?" and error output message " Unable to communicate with device - USB:Netduino"..

 

I encountered this problem before. The first was i need to change the hardware. So,i am afraid if the problem i faced is similar like before.

 

Your help is kindly appreciated! :)




#48206 Honeywell HIH-4030 Humidity Sensor

Posted by zee on 09 April 2013 - 09:32 AM in Project Showcase

I did follow what u had mention earlier on but I could not get to the output. There was no error when i run it.

Could you show me how to code? Sorry for the trouble

 

Hi zee.

 

Since there aren't any static methods in the class and the class itself is not static, you must create an instance.  And you create it using the only constructor provided.  That constructor takes in one argument which is an analog pin.  The code in the constructor initializes the _sensor AnalogInput property.  So once you instantiate the class, _sensor will not be null.




#48165 Honeywell HIH-4030 Humidity Sensor

Posted by zee on 08 April 2013 - 02:01 AM in Project Showcase

Hi phantomtypist

 

I had a Humidity Sensor - HIH 4030 and decided to try it out for my research lab. Unfortunately, i faced with an error on this ( 'HumiditySensor.HIH4030._sensor' is never assigned to, and will always have its default value null ) I did change some of the code into SecretLabs. The red font is the error i am facing. Could you tell me what is the problem.

 

 

public class HIH4030 : IDisposable
    {
[color=#ff0000;]        private SecretLabs.NETMF.Hardware.AnalogInput _sensor;[/color]
        private bool _disposed;
 
        protected virtual void Dispose(bool disposing)
        {
            // Check if Dipose has already been called.
            if (!_disposed)
            {
                if (disposing)
                {
                    _sensor.Dispose();
                    _disposed = true;
                }
            }
        }
 
        ~HIH4030()
        {
            Dispose(false);
        }
 
        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this); // tell the GC not to finalize.
        }
 
        public HIH4030(Cpu.Pin analogPin)
        {
            SecretLabs.NETMF.Hardware.AnalogInput _sensor = new SecretLabs.NETMF.Hardware.AnalogInput(analogPin);
            _sensor.SetRange(0, 3300);
        }
 
        /// <summary>
        /// Calculates the relative humidity with temperature compensation.
        /// </summary>
        /// <param name="temp">Current temperature in Celsius.</param>
        /// <returns>Returns the relative humidity as a percentage.</returns>
        public double RelativeHumidity(float temp)
        {
            // Get the humidity sensor reading.
            int sensorReading = _sensor.Read();
 
            // Calculate the humidity sensor voltage.
            double sensorVoltage = (((double)sensorReading / 3300) * 3.3);
 
            // Define the voltage the sensor returns at 0% humidity.
            double zeroVoltage = 0.528;
 
            /* It has been observed that some sensors are consistently 
             * inaccurate and off by a certain voltage than what they 
             * should be.  Use this variable to compensate for what the 
             * voltage should be if needed. */
            double calibrationVoltage = 0.00;
 
            /* Determine the maxium voltage of the sensor with 
                temperature compensation. */
            double maxVoltage = (2.1582 - (0.004426 * temp));
 
            /* Determine the temperature compensated relative humidity 
                as a percentage. */
            double rh = ((sensorVoltage + calibrationVoltage - zeroVoltage) / maxVoltage) * 100;
 
            return rh;
        }
 
Thanks!

This is code for the Honeywell HIH-4030 humidity sensor (SparkFun SKU: SEN-09569).

Please note that the sensor is supposed to be used with 5v input, but it works just fine with 3.3v input because the output is linear.

The code below is tailored to 3.3v input.
 

    /// <summary>    /// Honeywell HIH-4030 humidity sensor (SEN-09569).     /// Please note that the sensor is supposed to be used with 5v input,     /// but it works just fine with 3.3v input because the output is linear.    /// The code below is tailored to 3.3v input.    /// </summary>    public class HIH4030 : IDisposable    {        private AnalogInput _sensor;        private bool _disposed;        protected virtual void Dispose(bool disposing)        {            // Check if Dipose has already been called.            if (!_disposed)            {                if (disposing)                {                    _sensor.Dispose();                    _disposed = true;                }            }        }        ~HIH4030()        {            Dispose(false);        }        public void Dispose()        {            Dispose(true);            GC.SuppressFinalize(this); // tell the GC not to finalize.        }        public HIH4030(Cpu.Pin analogPin)        {            _sensor = new AnalogInput(analogPin);            _sensor.SetRange(0, 3300);        }        /// <summary>        /// Calculates the relative humidity with temperature compensation.        /// </summary>        /// <param name="temp">Current temperature in Celsius.</param>        /// <returns>Returns the relative humidity as a percentage.</returns>        public double RelativeHumidity(float temp)        {            // Get the humidity sensor reading.            int sensorReading = _sensor.Read();            // Calculate the humidity sensor voltage.            double sensorVoltage = (((double)sensorReading / 3300) * 3.3);            // Define the voltage the sensor returns at 0% humidity.            double zeroVoltage = 0.528;            /* It has been observed that some sensors are consistently              * inaccurate and off by a certain voltage than what they              * should be.  Use this variable to compensate for what the              * voltage should be if needed. */            double calibrationVoltage = 0.00;            /* Determine the maxium voltage of the sensor with                 temperature compensation. */            double maxVoltage = (2.1582 - (0.004426 * temp));            /* Determine the temperature compensated relative humidity                 as a percentage. */            double rh = ((sensorVoltage + calibrationVoltage - zeroVoltage) / maxVoltage) * 100;                        return rh;        }            }



#48234 Honeywell HIH-4030 Humidity Sensor

Posted by zee on 10 April 2013 - 12:59 AM in Project Showcase

Here's the program.  

Sorry again..




#48232 Honeywell HIH-4030 Humidity Sensor

Posted by zee on 10 April 2013 - 12:57 AM in Project Showcase

Here's the attached of the program. Sorry again..

Attached Files




#48233 Honeywell HIH-4030 Humidity Sensor

Posted by zee on 10 April 2013 - 12:58 AM in Project Showcase

Here's the attached of the program. 

Sorry again..




#48235 Honeywell HIH-4030 Humidity Sensor

Posted by zee on 10 April 2013 - 01:01 AM in Project Showcase

Here is the code of the program. 

Sorry again.




#48201 Maxbotix Distance/Proximity Sensor Code

Posted by zee on 09 April 2013 - 03:24 AM in Project Showcase

Hi Omar,

 

I followed your C# for analog but when run the program, it stop by itself. Is there anything that i missed out??

Btw, where should i print out the distance?




#47070 mscorlib.dll error

Posted by zee on 12 March 2013 - 09:07 AM in Netduino Plus 2 (and Netduino Plus 1)

Sorry.. the PWM i editted it to SecretLabs.NETMF.Hardware.PWM speaker = new SecretLabs.NETMF.Hardware.PWM(Pins.GPIO_PIN_D5);




#47069 mscorlib.dll error

Posted by zee on 12 March 2013 - 08:58 AM in Netduino Plus 2 (and Netduino Plus 1)

Hi Stefan,

 

Here's the code below:

 

 

 

public static void Main()
{
// write your code here
 
// store the notes on the music scale and their associated pulse lengths
System.Collections.Hashtable scale = new System.Collections.Hashtable();
 
// low octave
scale.Add("c", 1915u);
scale.Add("d", 1700u);
scale.Add("e", 1519u);
scale.Add("f", 1432u);
scale.Add("g", 1275u);
scale.Add("a", 1136u);
scale.Add("b", 1014u);
 
// high octave
scale.Add("C", 956u);
scale.Add("D", 851u);
scale.Add("E", 758u);
 
// silence ("hold note")
scale.Add("h", 0u);
 
int beatsPerMinute = 90;
int beatTimeInMilliseconds =
60000 / beatsPerMinute; // 60,000 milliseconds per minute
int pauseTimeInMilliseconds = (int)(beatTimeInMilliseconds * 0.1);
 
// define the song (letter of note followed by length of note)
string song = "C1C1C1g1a1a1g2E1E1D1D1C2";
 
// define the speaker
PWM speaker = new PWM(Pins.GPIO_PIN_D5);
 
// interpret and play the song
for (int i = 0; i < song.Length; i += 2)
{
// extract each note and its length in beats
string note = song.Substring(i, 1);
int beatCount = int.Parse(song.Substring(i + 1, 1));
 
// look up the note duration (in microseconds)
uint noteDuration = (uint)scale[note];
 
// play the note for the desired number of beats
speaker.SetPulse(noteDuration * 2, noteDuration);
Thread.Sleep(
beatTimeInMilliseconds * beatCount - pauseTimeInMilliseconds);
 
// pause for 1/10th of a beat in between every note.
speaker.SetDutyCycle(0);
Thread.Sleep(pauseTimeInMilliseconds);
 
}
 
Thread.Sleep(Timeout.Infinite);
}
 
 
 
Thanks for your help! :)



#47063 mscorlib.dll error

Posted by zee on 12 March 2013 - 07:06 AM in Netduino Plus 2 (and Netduino Plus 1)

Hi,

 

I got an error when deploy piezo. An error message box pop up "An unhandled exception of type 'System.Exception' occurred in mscorlib.dll".. Can anyone please help me where is the problem?




#47071 mscorlib.dll error

Posted by zee on 12 March 2013 - 09:17 AM in Netduino Plus 2 (and Netduino Plus 1)

Sorry Stefan.. My typo error.. Instead of 'i', I accidentally typed '1'..

 

instead of :

 

string note = song.Substring(i, 1);
int beatCount = int.Parse(song.Substring(i + 1, 1));
 
 My silly mistakes:
string note = song.Substring(1, 1);
int beatCount = int.Parse(song.Substring(1 + 1, 1));

 

Sorry for the Inconveniences cause..




#46745 Netduino Plus 2 - AnalogInput & SetRange errors

Posted by zee on 06 March 2013 - 10:08 AM in Netduino Plus 2 (and Netduino Plus 1)

Hi and welcome to the Netduino forums!

 

The book describes the Netduino API, I think your problem would be fixed if you'd remove the reference to Microsoft.SPOT.Hardware.AnalogInput.dll and add a reference to SecretLabs.NETMF..Hardware.AnalogInput.dll

 

After following your instructions, there are more errors.. Anyway i am new to this Netduino Plus 2.. Could you please explain to me in detail? Thank you.

 

 

Error 1 'AnalogInput' is an ambiguous reference between 'Microsoft.SPOT.Hardware.AnalogInput' and 'SecretLabs.NETMF.Hardware.AnalogInput'
 
Error 2 'AnalogInput' is an ambiguous reference between 'Microsoft.SPOT.Hardware.AnalogInput' and 'SecretLabs.NETMF.Hardware.AnalogInput'
Error 3 The best overloaded method match for 'Microsoft.SPOT.Hardware.AnalogInput.AnalogInput(Microsoft.SPOT.Hardware.Cpu.AnalogChannel)' has some invalid arguments
 
Error 4 Argument 1: cannot convert from 'Microsoft.SPOT.Hardware.Cpu.Pin' to 'Microsoft.SPOT.Hardware.Cpu.AnalogChannel'
 
Error 5 'Microsoft.SPOT.Hardware.AnalogInput' does not contain a definition for 'SetRange' and no extension method 'SetRange' accepting a first argument of type 'Microsoft.SPOT.Hardware.AnalogInput' could be found (are you missing a using directive or an assembly reference?)
 
Error 6 Cannot implicitly convert type 'double' to 'int'. An explicit conversion exists (are you missing a cast?)
 



#46799 Netduino Plus 2 - AnalogInput & SetRange errors

Posted by zee on 07 March 2013 - 12:44 AM in Netduino Plus 2 (and Netduino Plus 1)

Refer to the attached.

 

error on measuring volt.JPG

 

 

 

 




#47008 Netduino Plus 2 - AnalogInput & SetRange errors

Posted by zee on 11 March 2013 - 05:55 AM in Netduino Plus 2 (and Netduino Plus 1)

How was the problem solved? I'm facing the exact same problem now.

 

number 6 seems to be just a matter of changing int potValue=0; to double potValue=0;

 

 

I include the SecretLabs.NETMF.Hardware.AnalogInput command infront & add reference 'SecretLabs.NETMF.Hardware.AnalogInput..

 

eg:

SecretLabs.NETMF.Hardware.AnalogInput pot = new SecretLabs.NETMF.Hardware.AnalogInput(Pins.GPIO_PIN_A0);




#46724 Netduino Plus 2 - AnalogInput & SetRange errors

Posted by zee on 06 March 2013 - 03:38 AM in Netduino Plus 2 (and Netduino Plus 1)

Hi,

 

I am using Netduino Plus 2 and I followed the steps from 'Getting Started with Netduino' pdf on Chapter 5. I encountered few problems on the coding. There are 4 errors. Please help me!

 

 

 

Error 1 The best overloaded method match for 'Microsoft.SPOT.Hardware.AnalogInput.AnalogInput(Microsoft.SPOT.Hardware.Cpu.AnalogChannel)' has some invalid arguments
 
Error 2 Argument 1: cannot convert from 'Microsoft.SPOT.Hardware.Cpu.Pin' to 'Microsoft.SPOT.Hardware.Cpu.AnalogChannel'
 

 

Error 3 'Microsoft.SPOT.Hardware.AnalogInput' does not contain a definition for 'SetRange' and no extension method 'SetRange' accepting a first argument of type 'Microsoft.SPOT.Hardware.AnalogInput' could be found (are you missing a using directive or an assembly reference?)
 
Error 4 Cannot implicitly convert type 'double' to 'int'. An explicit conversion exists (are you missing a cast?)

 

Looking forward to your speedy response. Thank you!




#46809 Netduino Plus 2 - AnalogInput & SetRange errors

Posted by zee on 07 March 2013 - 07:30 AM in Netduino Plus 2 (and Netduino Plus 1)

Problem solved ! Thank you ! :)




#48056 Oz-Solutions Tutorial: RGB LED

Posted by zee on 05 April 2013 - 03:32 AM in Netduino 2 (and Netduino 1)

Hi..

 

I have a problem with the LED color. I am still unsure what is the problem. After typed out all the codes with no error and run the program, the red LED did not even light up at all, the green LED color is so little which hardly to see it, and the blue LED is so bright. I used 100 ohm resistor on red, 105 ohm resistor on green and 250 ohm variable resistor on blue. I have try to swap the resistor but the outcome is still the same. Could anyone please guide me what is the problem here? :(




#48166 Oz-Solutions Tutorial: RGB LED

Posted by zee on 08 April 2013 - 02:02 AM in Netduino 2 (and Netduino 1)

You are correct in that the resistors will vary for different color LEDs but they can also vary for different types of LEDs.  What RGB LED are you using?  May need to look at the specs and recalculate the resistors.  Additionally what power source are you using? 3v? 5v? 12v? and are the LEDs common cathode or common anode?

 

I am using the RGB Diffused Common Cathode [https://www.sparkfun.com/products/9264]. I did not connect any power source when running the program. I did the same thing as the diagram given. Is my resistor value correct? Connect to red with resistor of brown, black, brown, gold. Connect to green with resistor of brown, black, green, gold. Connect to blue with 250 ohm variable resistor. I have another resistor i have not try which is red, black, orange, gold.

 

Your guidance are really appreciated :)




#48203 Parallax Ping))) Ultrasonic Sensor

Posted by zee on 09 April 2013 - 04:05 AM in Project Showcase

Hi Dave,

 

I have changed the output type, and it exit the program by itself immediately. The Main() method is suppose to comment out or uncomment?

If i comment out, there is an error saying does not contain static Main. If i uncomment, it exit the program.





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.