Main Site Documentation

Is this the right platform for my project?


Hi all,

at the moment i have some arduino’s for my project but running against it’s limitations.

I would like to know if any of the FEZ boards can handle the following:

  • count pulses from 3 sensors (sensors are electricity / gas / water)
  • ethernet access to the counters (i want to pull them into a db every 5 secs)
  • some sort of communication between FEZ boards
  • send events over ethernet to a .net app (like status change of an input port)
  • onewire sensors

Many thanks


Yep, FEZ can handle all of that with ease.


All those you asked for are official features with GHI supported commercial drivers


Yup, FEZ can easily do that. Let us know if you need to know more ;D


While the FEZ can easily do all of your required functions, there is a limitation on the number of interrupts per second that can be handled. You would count pulses with an interrupt.

I have been doing some studies on this subject and have found that if the interrupt rate is too fast, memory will be gobbled up until the system runs out of memory.

On a Domino, a sustained rate of around 3500 interrupts per second will crash the system within a few seconds.

I have not looked at the Cobra, where there is lots of memory.


Well, i was planning on using interrupts.

counter 1 would have max 1 interrupt every 10 secs
counter 2 would have max 3 interrupts every second
counter 3 would have max 5 interrupts every second

i guess that won’t be a problem?

What will happen if pulses on 2 counters come in at the exact same time ? Will they both be seen ?



The rates you specified seem very reasonable, depending upon how much processing you need to do on each interrupt.

I would suggest putting the interrupt data into a queue and processing the data with a seperate thread. You want to minimize the time in the interrupt handler.

Multiple interrupts at the same time should be handled fine.

There is a delay between the time that a signal changes and when it appears at the interrupt handler. The interrupt contains an accurate timestamp, which represent when the signal changed. The delay is in milliseconds.

FEX is not a real-time system. I don’t think this is an issue if you are just counting pulses.


The interrupt is stamped at real time so the pulse are real time :wink:


I’m still not sure if I’ll go for a Cobra board to handle everything, or split up tasks over multiple connected Domino’s or Panda’s.

Besides the interrupt counters, I also want to have events send over Ethernet when for example the thermostat switches on/off, when the heating turns on/off, when the garage door opens/closes. I’m also looking at integrating RF433/868 communications to have also events/statuses of open doors/windows and switch outlets either on command or based on events and or time. Motion detection will also be part of the setup.

What I’m trying to build is some sort of home controller (domotica).

Any suggestions are highly appreciated.

PS. Is there a driver for the HopeRF RFM12B module?



Ohw domotica, that sounds great! if I got my panda’s I’m going to try to build something like that too, maybe not so complex, but a more simple version. Great!


This is probably a stupid question but what triggers the interrupt? Is it a threshold value set on your sensors, or is the frequency of the sensor output?
If the aim of the project is to track how the values for electricity / gas / water changes over time, wouldn’t it be better to read the values in a loop with individual timing threads if need be?



There are no stupid questions, only stupid answers :smiley:

it’s the frequency of the sensor outputs. I just count them and pass them to my .Net app and do various calculations there to offload the Fez.

Could you post some pseudo code?

Many thanks for the help so far.



As I dont know how your sensors are interfaced, analogue line, I2C, UART
I can only give you a rough example. The only thing I have resembling a sensor is a I2C compass. Not all that useful for you if your house isnt on the move… :slight_smile:

namespace psudo
    public class Program
        public static void Main()
            SensorElec Elec = new SensorElec();
            SensorGas Gas = new SensorGas();
            SensorWater Water = new SensorWater();
            I2C_Compass Compass = new I2C_Compass();

            while (true)
                double CurrentElec = Elec.Value;
                double CurrentGas = Gas.Value;
                double CurrentWater = Water.Value;
                string Heading =  Compass.ReadHeading.ToString("F0");

                //do something else...



    public class I2C_Compass : IDisposable
        const ushort HMC6352_ADDRESS = 0x21;
        const int CLOCK_FREQ = 100;
        const int DELAY = 50;

        //Write Buffer
        byte[] A = new byte[] { 0x41 }; // A command

        //Read Buffer
        byte[] inBuffer = new byte[2];

        //Init I2C Device Config
        I2CDevice.Configuration config = new I2CDevice.Configuration(HMC6352_ADDRESS, CLOCK_FREQ);

        //Init I2C Device & Read/Write Transactions
        I2CDevice cmp;
        I2CDevice.I2CWriteTransaction writeTrans;
        I2CDevice.I2CReadTransaction readTrans;

        public I2C_Compass()
            cmp = new I2CDevice(config);
            writeTrans = I2CDevice.CreateWriteTransaction(A);
            readTrans = I2CDevice.CreateReadTransaction(inBuffer);

        public void Dispose()
            config = null;
            writeTrans = null;
            readTrans = null;

        public double ReadHeading
                //Execute Both Transactions and Return Heading as float with 0.1 deg resolution
                I2CDevice.I2CTransaction[] transactions = new I2CDevice.I2CTransaction[] { writeTrans, readTrans };
                cmp.Execute(transactions, DELAY);
                int heading = inBuffer[0] * 256 + inBuffer[1];
                double realHeading = (double)(heading / 10.0f);
                return realHeading;


Thanks for the sample.

The sensors are 2 hall effect sensors (outputs high or low) and 1 open collector sensor.




you shouldn’t need to pass all your details to the pc to do process, there’s no reason you can’t do it on the fez and then just put the calculated results over to the PC.

I’m doing some very complex maths and able to read an analogue pin, process the value with some complex maths then run filtering, averaging, and selection on the samples over 2500 times a second.