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.

mohammad's Content

There have been 53 items by mohammad (Search limited from 29-March 23)


By content type

See this member's


Sort by                Order  

#50064 Electrit Microphone Sensor

Posted by mohammad on 28 May 2013 - 07:05 PM in General Discussion

According to the comments on the Sparkfun page https://www.sparkfun.com/products/9964, [color=#008000;]I could solve the problem[/color]. Somebody recommended to write a tight loop (e.g. 100ms) to get the min and max values. The difference between the two will give us the volume (sound pressure) during that time.




#50032 Electrit Microphone Sensor

Posted by mohammad on 27 May 2013 - 06:03 PM in General Discussion

Hi,

 

Is there anyone who has already worked with Electret Micrphone Sensor? I need to detect the noise in my room, so I wired the sensor simply to my Netduino Plus (5v, GND, Analog Pin 0), and I am getting random values (70 to 130) which are independent to the existing noise.

 

-My code:

    public class Program    {        public static void Main()        {            SecretLabs.NETMF.Hardware.AnalogInput inp = new SecretLabs.NETMF.Hardware.AnalogInput(Pins.GPIO_PIN_A0);                        while(true)            {                Debug.Print(inp.Read().ToString());                Thread.Sleep(100);            }            }    }



#49930 Software reset

Posted by mohammad on 24 May 2013 - 05:37 PM in Netduino 2 (and Netduino 1)

I'm sure you can find a watchdog IC that is available in DIP8 - just stick it down the breadboard, connect 2 wires (plus power) and you're good.

 

Thanks for your information. I will try to buy one. Since I am not expert, is there any specific name/ID for the IC your mentioned?




#49858 Software Reboot for Netduino Plus

Posted by mohammad on 23 May 2013 - 07:50 PM in Netduino Plus 2 (and Netduino Plus 1)

Thanks Khmesmer.

I am working with Netduino Plus (or generally microcontroller programming) since 2012. I recommend you to follow the "getting started with the nternet of Things" book, first. Then, try to implement codes and ask your questions in this forum. To be honest, this forum and its members :) helped me a lot in my projects and learning.

If you have any questions, feel free to let me know.

 

Good Luck




#49857 Software reset

Posted by mohammad on 23 May 2013 - 07:46 PM in Netduino 2 (and Netduino 1)

The code you attached before would restart the device repeatedly between 10:00 and 11:00 AM, effectively rendering it unusable during that time. Am I right?

 

Yes, you are right :), but by using the Timer class, you can implement it more effectively.

 

Personally, I think there's no such thing as a software watchdog. You can't write software to check if another piece of software has locked up. If I remember correctly it's one of those NP complete problems within the theories of complexity. :)

I partially agree with you ;), you know in multi-threading world, sometimes one thread blocks all its processes (e.g., this problem), and the problem is solved by a simple reboot. At this time, one thread can be in charge of software reboot, and the other threads are doing their tasks. If any fail or error situation occurs, the reboot thread can perform its task :)




#49855 Hardware watchdog on Netduino Plus

Posted by mohammad on 23 May 2013 - 07:39 PM in Netduino Plus 2 (and Netduino Plus 1)

That's not a watchdog, it's a scheduled reboot.

 You are right, so I should not consider them interchangeably.

 

have you tried out my firmware build?

No, since the firmware of your library was different from mine.

 

 

What are the problems you mention in the other thread ('I had a problem for 1 month to use a Watchdog mechanism in Netduino Plus') ?

The watchdog problem :) to reboot the Netduino Plus after a specific time.




#49749 How to reboot netduino + from code on a socket exception?

Posted by mohammad on 22 May 2013 - 03:16 AM in Netduino Plus 2 (and Netduino Plus 1)

This link might be useful to reboot the Netduino Plus by software http://forums.netdui...lus/#entry49735

 

Good Luck,

Mohammad




#49740 Socket Exception 10050 after an hour

Posted by mohammad on 22 May 2013 - 12:17 AM in Netduino Plus 2 (and Netduino Plus 1)

Hi all,

 

After spending 2 months on this problem, finally I could solve it. It was fixed by using a watchdog solution: http://forums.netdui...lus/#entry49735

Now, my device is working well and continuously for 10 days.

 

Good Luck




#49739 Netduino Plus stops running after a while

Posted by mohammad on 22 May 2013 - 12:13 AM in Netduino Plus 2 (and Netduino Plus 1)

Hi all,

 

Just to keep you updated, my problem was fixed by using a watchdog solution: http://forums.netdui...lus/#entry49735

Now, my device is working well and continuously for 10 days.

 

Thanks all specially Ziggurat29 for your valuable comments.




#49738 Netduino Plus Network dies

Posted by mohammad on 22 May 2013 - 12:08 AM in Netduino Plus 2 (and Netduino Plus 1)

Hi all,

 

My "network die problem" was solved after spending 2 months on it :) Now, I am so happy. The solution I used was software watchdog developed by my own. If you are interested in the solution, take a look at this link: http://forums.netdui...lus/#entry49735

I will later publish a post to elaborate the whole procedures and solutions that were useless except the software watchdog.

 

Good luck :)




#49737 Software reset

Posted by mohammad on 22 May 2013 - 12:06 AM in Netduino 2 (and Netduino 1)

Thanks Chris for your comment. Finally, I figured it out: http://forums.netdui...lus/#entry49735




#49735 Software Reboot for Netduino Plus

Posted by mohammad on 21 May 2013 - 11:58 PM in Netduino Plus 2 (and Netduino Plus 1)

Hello,

 

I had a problem for 1 month to use a Watchdog mechanism in Netduino Plus. FYI, the "Watchdog" acts as a software reboot with a predefined timer.

The watchdog functions have been already developed in C# Micro Framework, but they never work. Based on the comment I got from Chris: "No watchdog implemented in the gen1 hardware.  We're currently designing a software update for gen2 hardware which would enable it."

Finally, I created my own watchdog function which works well to reboot the Netduino after a fixed time (e.g., 5h).

public class MainFrame{        const Int32 wdDelay = 1000 * 60 * 60 * 5;   // 5h        static Timer wdtimer = new Timer(watchdog, null, wdDelay, 0);                public static void Main()        {            // Write your codes here        }        public static void watchdog(object state)        {            PowerState.RebootDevice(false);     //Watchdog.Enabled = true;        }}

I hope it helps you in your project :)




#49734 Hardware watchdog on Netduino Plus

Posted by mohammad on 21 May 2013 - 11:46 PM in Netduino Plus 2 (and Netduino Plus 1)

 

This might be useful for your watchdog prodecures: http://forums.netdui...-netduino-plus/ (although it is a software reboot).




#49443 Hardware watchdog on Netduino Plus

Posted by mohammad on 14 May 2013 - 07:47 PM in Netduino Plus 2 (and Netduino Plus 1)

Latest version is much more stable, thanks ToniA!

 

Unfortunately my SD Card that worked fine in 4.1, doesn't work in 4.2 :(

Throws the Unsupported Exception in System.IO

 

Is your SD card more than 2GB? The firmware 4.2 only knows the SD cards 2GB and 1GB.




#49437 Software reset

Posted by mohammad on 14 May 2013 - 06:41 PM in Netduino 2 (and Netduino 1)

Hi Chris,

 

Thank you so much for your response. Does the following code act like what Watchdog does?

namespace WatchdogSimulation{    public class WatchdogSimulation    {        public static void Main()        {            while (true)            {                Debug.Print(DateTime.Now.Hour.ToString());                if (DateTime.Now.Hour > 10)             //Watchdog.Timeout = 10h                    PowerState.RebootDevice(false);     //Watchdog.Enabled = true;                Thread.Sleep(300000);                   //Wait 5min            }        }    }}

The purpose of mine is to simulate the reboot button pressing every 10 hours.




#49401 Software reset

Posted by mohammad on 13 May 2013 - 11:43 PM in Netduino 2 (and Netduino 1)

Is the watchdog usable now ?

 

Actually, I have the same question for Firmware 4.2.0.0 (RC 5), since the following code doesn't work and the debugger always prints 00:00:00 for the Watchdog.Timer.

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.NetduinoPlus;namespace NetduinoPlusApplication1{    public class Program    {        public static void Main()        {            Debug.Print(Watchdog.Timeout.ToString());            TimeSpan t = new TimeSpan(0, 0, 1);            Watchdog.Timeout = t;            Debug.Print(Watchdog.Timeout.ToString());            Watchdog.Enabled = true;            Thread.Sleep(3000);            Debug.Print("not rebooted yet!!!");        }    }}



#49271 Problem using AnalogInput

Posted by mohammad on 09 May 2013 - 12:23 AM in Netduino Plus 2 (and Netduino Plus 1)

Hi FVN.Net,

 

I exactly have the same problem. Could you solve the problem? I followed this post and tried everything Kem said (Thanks Kem), but all failed.

I really appreciate if you help me solve it.

 

Thanks,

Mohammad




#49270 AnalogInput: Sometimes works, sometimes doesn't

Posted by mohammad on 08 May 2013 - 10:34 PM in Netduino Plus 2 (and Netduino Plus 1)

FYI. I copy and paste the code from my notebook to PC. The only diff between my notebook and PC is about the SDK version (I am not sure whether it matters). As long as the code hasn't been changed (e.g. type a character which needs a new software build), the code works properly. Whenever I change the code and build it again, the errors appear.




#49269 AnalogInput: Sometimes works, sometimes doesn't

Posted by mohammad on 08 May 2013 - 10:29 PM in Netduino Plus 2 (and Netduino Plus 1)

Hi Chris,

 

Thank you so much for your quick reply, but I didn't understand what I should dispose.

For your information, I deleted that project, and copied and created a new one. The new code worked properly once :) For the second time, it threw the exception. It seems it restores a file or attribute in the project folder.

 

Cheers,

Mohammad




#49266 AnalogInput: Sometimes works, sometimes doesn't

Posted by mohammad on 08 May 2013 - 09:54 PM in Netduino Plus 2 (and Netduino Plus 1)

Hi All,   I developed a code to get the temperature readings from TMP36 sensor. My Netduino was working properly. After 5 hours, I started debugging again, but it throwed exceptions (on the line voltagePort = new SecretLabs.NETMF.Hardware.AnalogInput(Pins.GPIO_PIN_A1)):

A first chance exception of type 'System.ArgumentException' occurred in Microsoft.SPOT.Hardware.dllAn unhandled exception of type 'System.ArgumentException' occurred in Microsoft.SPOT.Hardware.dll

The code of mine is here:

using System;using Microsoft.SPOT;using Microsoft.SPOT.Hardware;using SecretLabs.NETMF.Hardware;using SecretLabs.NETMF.Hardware.NetduinoPlus;namespace TMPSensor{    public class Sensor:Constants    {        //Microsoft.SPOT.Hardware.AnalogInput voltagePort;        SecretLabs.NETMF.Hardware.AnalogInput voltagePort;        OutputPort lowPort, highPort;        public Sensor()        {            //Temperature sensor           //voltagePort = new AnalogInput(AnalogChannels.ANALOG_PIN_A1);           voltagePort = new SecretLabs.NETMF.Hardware.AnalogInput(Pins.GPIO_PIN_A1);           lowPort = new OutputPort(Pins.GPIO_PIN_A0, false);           highPort = new OutputPort(Pins.GPIO_PIN_A2, true);        }        public double read()        {            double rawValue = voltagePort.Read();            double value = (rawValue * maxVoltage) / maxAdcValue;            double result = (((value - 0.5) * 1000) / 10) - 4;            return result;        }    }}

The firmware of my Netduino Plus is 4.2.0.0 (RC5), and the SDK is MicroFrameworkSDK_NETMF42_QFE2. Any help or comment is highly appreciated.   Mohammad




#49202 Netduino Plus 1 Firmware v4.2.0 (update 1)

Posted by mohammad on 08 May 2013 - 12:47 AM in Netduino Plus 2 (and Netduino Plus 1)

Hi Chris,

 

Thank you so much for your reply and your attention.

The line I get those exceptions is this one:

mem = new FileStream(path, FileMode.Append, FileAccess.Write, FileShare.None, 512);

In addition, I didn't try it with any lower-capacity card.

 

Cheers,

Mohammad

 

 

Hi all,

 

The problem was solved by Micro SD 2GB. It seems the Firmware 4.2.0.X doesn't know the Mirco SD 4GB and up.




#49201 Netduino Plus Network dies

Posted by mohammad on 08 May 2013 - 12:41 AM in Netduino Plus 2 (and Netduino Plus 1)

First of all, the watchdog functionality is not there in the stock firmware. All the interfaces are there, but no functionality.

 

If you would want to use the firmware I built, look at this message, it has a code sample: http://forums.netdui...ge-2#entry47334

 

Hi ToniA,

 

Thanks for your reply. It is a bit rediculous that the interfaces and methods are available, but they are fake :D

Anyway, I gave up to use watchdog for now, but I will surely use your firmware someday.




#49132 Netduino Plus Network dies

Posted by mohammad on 07 May 2013 - 02:49 AM in Netduino Plus 2 (and Netduino Plus 1)

Hi there,

 

I am going to use software Watchdog to reboot my Netduino after a constant time. I know it is a simple question, but may I ask your help to do it?

The code that I developed is like that, but it doesn't work:

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.NetduinoPlus;namespace NetduinoPlusApplication1{    public class Program    {        public static void Main()        {            bool error = true;            Watchdog.Timeout = new TimeSpan(0, 1, 0);       //Timeout = 1 minute.            Watchdog.Enabled = true;            Debug.Print(Watchdog.Timeout.ToString());            while (error)            {                Debug.Print("There is a systematic error, so the system needs to reboot");                Thread.Sleep(2000);            }        }    }}

and the  Debug.Print(Watchdog.Timeout.ToString()); prints "00:00:00".

 

Thanks in advance,

Mohammad




#48974 Netduino Plus stops running after a while

Posted by mohammad on 03 May 2013 - 06:55 AM in Netduino Plus 2 (and Netduino Plus 1)

fwiw, mohammad,  I have had a similar problem; in my case with ethernet.  an easy way to stimulate it:

 

*  have a persistent connection to my server.  this runs in a separate thread.

*  in the absence of other traffic, periodically I send heartbeat, and if connection is lost or non-responsive, it loops around to restore the connection, with appropriate backoff, etc.  this code is all thoroughly tested when running on desktop.  I can unplug cables, take interceding routers and server process up and down, and things are resilient.

*  if, however, I am running the same code on the netduino, if the server process it taken down

*  the netduino will detect it, try to reconnect (to the not-yet-back-up server process)

*  and hang forever

*  but only the thread that is handling the ethernet server connection is affected.  my other threads are lively.

*  I confirmed that, while in the fail mode with the locked ethernet thread, I can successfully issue a PowerState.RebootDevice() and at least restart the system.

 

The lockup you are experiencing seems to be similar, but I don't know what stimulates the problem in your case, so maybe it is different.  Anyway, here is what I have done to cope with it -- and mind you I haven't finished implementing yet because I'm on other things just now, so fair warning, but initial testing makes me confident that it works:

 

*  the netduino chip has a hardware watchdog, but it is not really available to us, alas.  so, in lieu of that....

*  I made a software watchdog.  (I also added a MAX824 (-compatible; I think it is actually a diodes inc chip) to my PCB, but that was last minute and I haven't written code for it)

*  the software watchdog works like this:

  *  all my various 'app services' (worker thread that do stuff, like handling the ethernet connection to my infrastructure)

  *  call a 'checkin' function with my 'watchdog service'.  that checkin() says 'reboot if you don't hear back from me in XXX ms, and oh please call this method if you reboot because someone else failed'

  *  a checkin discards any previous outstanding checkin

  *  the watchdog service periodically checks for expired checkin()s (Kentucky Fried Checkins?) and if any were found, it will issue the reboot

 

In my case, I did it this way because I already had all these app services coded, so I needed to retrofit to that impl.  They did handily have idle() methods which I could use those to do the checkin(), but the duration needed to vary because some activities would normally block for up to 3 min in some cases (like cranking up GSM).  The particulars of your design my mean you can do it more simply that I was able to do or think of.

 

hth; dave

 

 

Hello,

 

I just want to let you know that there is firmware with software watchdog added:

 

http://forums.netdui...o-plus/?p=47334

 

Maybe it will solve your problem.

 

Regards

 

 

Hello again Mohammad,
I really think you should read carefully what the other two guys just wrote, but in answer to your question, a watchdog normally listens to some kind of "alive beacon", "heartbeat" or "check-in" (like the others wrote). When the watchdog has not seen/heard the beacon for some pre-defined time (timeout), it issues a reset causing a "reboot". This way, a watchdog could keep your application from locking up.

Watchdogs are for the situations where you can't actually figure out why things eventually go wrong and so instead of trying to solve the actual issue, you simply restart the whole thing. This is a "when all else has failed" type of thing to do but sometimes it's the only thing to do. Personally, I would never trust a software watchdog, instead I want someone to "pull the plug" and then reinsert it again afterwards.

 

Hi All,

 

Thanks for your valubale comments. I am exactly doing as the same as Ziggurat29. Based on my understanding, I should reboot my Netduino after some time (e.g. 10 hours). At this time, the only thing I did was a software reboot by means of Powerstate.RebooteDevice(false). Is it right?

 

Thanks,

Mohammad




#48865 Netduino Plus stops running after a while

Posted by mohammad on 30 April 2013 - 12:35 AM in Netduino Plus 2 (and Netduino Plus 1)

Hi!

 

The problem could be such that it won't show as an exception but simply lock up. Could be you run out of memory in such away that there's not enough memory to even be able to fire and exception.

 

Here are a few questions for which answers might help you in trouble shooting:

 

1. Are you debugging the Netduino for the whole duration of the test?

2. Does it run for a longer time or about the same when not debugging?

3. Does it run for a longer time when not attached to USB but using an external power source?

4. What do you have to do in order for the Netduino to run again - is a soft reset enough or do you have to cycle power (i.e. USB)?

5. Can you talk to the Netduino from MFDeploy when it has stopped?

 

For this kind of long running "critical" stuff you could use a watch dog. I don't know if you can access the integrated watch dog from managed code but if not, there are watch dog modules/chips that you can connect externally. A watchdog could automatically restart your Netdunino every two hours or whatever as appropriate by power cycling (most reliable) or by issuing a reset.

 

Hi Hanzibal,

 

Thanks a lot for your valuable reply. The reason that I am replying late is becasue I was testing my Netduino+ based on your comments.

1. It is not dependent of my debugging. I have the same problem when I also run it in a non-debug environment.

2. Almost the same (the working time is not constant in both situation).

3. I didn't try.

4. Soft reset is enough.

5. I haven't tried it yet.

 

Honestly, I have no watch dog module. How does it understand when it should restart? Can I implement it in my code? Any advice would be appreciated.

 

Thanks again,

Mohammad





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.