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 18-May 23)


By content type

See this member's


Sort by                Order  

#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?




#49405 Sparkfun PIR motion sensor

Posted by zee on 14 May 2013 - 02:44 AM in Project Showcase

Hi,

 

Need help here!

What's the problem here?  :wacko:  :unsure:

Connected to 10K Ohm & PullUp.. But it keep prompts me this error.

 

Attached Thumbnails

  • PIR Error.jpg



#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 :)




#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? :(




#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.




#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




#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.




#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..




#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..




#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;        }            }



#46999 Yet another supported shield question (GPS)

Posted by zee on 11 March 2013 - 03:04 AM in Netduino 2 (and Netduino 1)

P.S.

Here's some very rough test code I put together to make sure we were getting data from the GPS receiver. You might want to put this in an event handler-based class which parsed the data out and raised events whenever a new location was received.

But this will show you your GPS data stream Posted Image I've put a 100ms delay in between each iteration of the loop so that we're not getting and printing one byte of data at a time.

I plugged TX, RX, and PWR into pins D0, D1, and D2. This corresponds to serial port 1 (COM1) and a "powerpin" of D2.
 

using System;using System.IO.Ports;using System.Threading;using Microsoft.SPOT;using Microsoft.SPOT.Hardware;using SecretLabs.NETMF.Hardware;using SecretLabs.NETMF.Hardware.Netduino;namespace GpsLogger{    public class Program    {        public static void Main()        {            // write your code here            SerialPort serialPort = new SerialPort("COM1", 4800, Parity.None, 8, StopBits.One);            serialPort.Open();            // pin D2 off = gps module turned on            OutputPort powerPin = new OutputPort(Pins.GPIO_PIN_D2, false);            while (true)            {                int bytesToRead = serialPort.BytesToRead;                if (bytesToRead > 0)                {                    // get the waiting data                    byte[] buffer = new byte[bytesToRead];                    serialPort.Read(buffer, 0, buffer.Length);                    // print out our received data                    Debug.Print(new String(System.Text.Encoding.UTF8.GetChars(buffer)));                }                Thread.Sleep(100); // wait a bit so we get a few bytes at a time...            }        }    }}

 

Hi Chris,

 

May i know what will be the output like?

There's no error but im just wondering how will the output like?

Sorry for my noob question. Im soooo new to this sensor device.. :)




#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? 




#47869 ToggleButton sample

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

Hi zee, Your button class isn't being used in your main program, so the button is acting as a software reset button (its default state). Chris

 

 

Hi Chris,

 

But it works as it stopped the song and continue it automatically after few seconds. Could you guide me how should i put the Button class in Program.cs? Is it supposed to be in 2 different classes as shown above or all in one class?




#47614 ToggleButton sample

Posted by zee on 27 March 2013 - 02:39 AM in Project Showcase

Put your song code in a separate thread.  Start and stop the thread using the button toggle code.

 

Hi Dave,

 

You mind explain to me the steps? I am soooo noob in this netduino. Really new to me. Is it add new class or add new project?

I did tried to add both, but received few errors. Putting them in a different project, no errors but how to link? Add class, received lots of errors.

Appreciate your help :)




#47578 ToggleButton sample

Posted by zee on 26 March 2013 - 01:20 AM in Project Showcase

Hi Dab,

 

Is there any way that piezo speaker can be on/off too upon pressing the toggle button? I have a project to do, where song will be play through piezo if the button is been press & led on, and the song will be stop when the button been press again & led off.




#47615 ToggleButton sample

Posted by zee on 27 March 2013 - 05:17 AM in Project Showcase

Program.cs 

 

 

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.IO.Ports;
using System.Text;
 
namespace PushButton_OutputMusic
{
    public class Program
    {
        private static SecretLabs.NETMF.Hardware.PWM speaker = new SecretLabs.NETMF.Hardware.PWM(Pins.GPIO_PIN_D5);
 
        static System.Collections.Hashtable scale = new System.Collections.Hashtable();
 
        public static void Main()
        {
 
            while (true)
            {
                GetSound();
             
            }
        }
 
        private static void GetSound()
        {
             
            //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);
            scale.Add("F", 191u);
            scale.Add("G", 170u);
            scale.Add("A", 153u);
            scale.Add("B", 136u);
            scale.Add("C2", 127u);
 
            // 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);
 
            string song = "C1C1C1g1a1a1g2E1E1D1D1C2h"; //old macdonald
            song += "C1C1G1G1A1A1G2F1F1E1E1D1D1C2h"; //twinkle little star
 
            while (true)
            {
 
                for (int i = 0; i < song.Length; i += 2)
                {
                    //song loop
 
                    string note = song.Substring(i, 1); 
                    int beatCount = int.Parse(song.Substring(i + 1, 1)); 
 
                    uint noteDuration = (uint)scale[note];
 
                    speaker.SetPulse(noteDuration * 2, noteDuration); 
 
                    Thread.Sleep(beatTimeInMilliseconds * beatCount - pauseTimeInMilliseconds);
 
                    speaker.SetDutyCycle(0); //set to 0, turn the piezo off momentarily
                    Thread.Sleep(pauseTimeInMilliseconds);
 
                } 
 
               Thread.Sleep(1000);
 
            }
        }
 
     
    }
}

 

Next, Button.cs

 

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;
 
namespace PushButton_OutputMusic
{
    class Button
    {
        InterruptPort button;
        OutputPort led;
        bool ledState;
 
        public void buttonToggle()
        {
        ledState = true;
 
            led = new OutputPort(Pins.ONBOARD_LED, ledState);
            button = new InterruptPort(Pins.ONBOARD_SW1, false, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeLow);
 
            //bind the interrupt handler to the pin's interrupt event
            button.OnInterrupt += new NativeEventHandler(SwitchInterruptHandler);
 
            while (true)
            {
 
                Thread.Sleep(Timeout.Infinite);
             
            } 
        }
 
        public void SwitchInterruptHandler(UInt32 data1, UInt32 data2, DateTime time)
        {
 
            button.DisableInterrupt();
 
            //invert the previous state of the LED
            ledState = !ledState; 
 
            //set the LED to its new state
            led.Write(ledState);
 
            button.EnableInterrupt();
        }
    }
}

 

 

Is this correct? The song auto play after i deploy. Then i pressed the button, the song stop and it starts automatically in few seconds. My objective is to make the song start and stop when pressing the button on Netduino..




#48199 Parallax Ping))) Ultrasonic Sensor

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

Hi Afulki,

 

There are no errors in the coding but i received this error when running the program.

 

'The project must have either an output type of Console Application', or an output type of Class Library and the start action set to a valid .NET MicroFramework application'

 

What does the error means? Your guidance are really appreciated :) Thanks..




#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.




#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();        }}}



#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

 

 

 

 




#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!




#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);




#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 ! :)





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.