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.

dbay

Member Since 09 Mar 2011
Offline Last Active Dec 26 2014 08:30 PM
-----

Posts I've Made

In Topic: Kalman Filters

02 April 2011 - 09:30 PM

I am normaly working on automation project where I sometimes are using an algorithm from "Principles and Practices of Automatic Process Control" by Smith & Corripio. Perhaps some of you can use this quite simple aproach. I have only tried i out here in my workshop and i don't know if it will work in real life. But for me it seems to work fine. here is the Class: using System; using Microsoft.SPOT; /******************************************************************************** * Digital filter for noisy analogue signals. This equation is a standard * exponential filter taken from "Principles and Practices of Automatic Process * Control" by Smith & Corripio * * Equation: FltrPv = alpha * OldFltrPv + (1 - alpha) * RawPv * * where: * alpha = (tau / (tau + st)) * tau = time in sec for output to reach 63% of RawPv (Damping_time) * st = scantime, also update rate of equation * RawPv = variable to be filtered * FltrPv = filter variable * OldFltrPv = FltrPv (st - 1) ********************************************************************************/ namespace Netduino_PT100 { class Filter { const Int64 ticks_per_msec = System.TimeSpan.TicksPerMillisecond; float tau; float oldFltrPv; DateTime oldScantime = DateTime.Now; public Filter(float Tau = 10.0F) { tau = Tau; } public float Tick(float RawPv) { float st = (DateTime.Now.Subtract(oldScantime).Ticks / ticks_per_msec) * 0.001F; oldScantime = DateTime.Now; float alpha = (tau / (tau + st)); oldFltrPv = alpha * oldFltrPv + (1 - alpha) * RawPv; return oldFltrPv; } public void Set_tau(float Tau) { tau = Tau; } } } and here is the main program: using System; using System.Threading; using Microsoft.SPOT; using Microsoft.SPOT.Hardware; using SecretLabs.NETMF.Hardware; using SecretLabs.NETMF.Hardware.Netduino; namespace Netduino_PT100 { public class Program { public static void Main() { AnalogInput ain_1 = new AnalogInput(Pins.GPIO_PIN_A0); ain_1.SetRange(-40, 1040); Filter ain_1_filter = new Filter(); while (true) { Thread.Sleep(200); Debug.Print("Temperatur Filter:" + ain_1_filter.Tick(ain_1.Read() * 0.1F).ToString("N2")); Debug.Print("Temperatur Raw :" + (ain_1.Read() * 0.1F).ToString("N2")); } } } } /dennis

In Topic: Serial.read via USB? yu know like on the good ol Arduino.

12 March 2011 - 11:30 PM

Unfortunately, as it's a joint endeavor (Atmel+Microsoft+Secret Labs) I don't know 100% for sure. We're _really_ close...but it's that last 1-10% that seems to take forever.

Chris


Hi all
Thangs for a great toy. Only missing one thing. Comms trougth the usb port.
Is there any news about this?

Dennis

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.