Main Site Documentation

How to read 433 mhz receiver module data from fez panda 2


#1

Hi, need to drive rf module to fez panda 2 but i do not have any sample code. Searched on google etc. Please help me, how to read rf signals. Thanks


#2

Hi and welcome to the forum.

Reading data from RF433Mhz receivers is not that easy because it is very noisy on their output, so decoding the correct packages will keep your panda pretty busy.

Tell us something more about what you are trying to accomplish.

Greetings


#3

Maybe you will find some info here:
http://www.tinyclr.com/forum/topic?id=6737&page=1


#4

@ EriSan500 (Eric) - Tried to get any data to receive but do not found any sample code or directive. Noise is not primary problem for my sequence. Can you share any simple code for reading clear(or noised) data from rf receiver?


#5

I think you’ll find the noise level on those things beyond tolerance unless you planning to operate within inches of the device or have a powerful transmitter. I had looked at them before and if I got half a meter before the noise was too much I’d be surprised.


#6

OK, understood. I need to sample code. Can anyone help me?


#7

What’s the transmitter you are trying to pick up?


#8

using this product’s remote control to control switches on my fez panda. http://www.conrad-uk.com/ce/en/product/640277/Home-Easy-Wireless-switch-and-dimmer-set-HE815S-Frequency-433-MHz/2805011&ref=list


#9

ok, so you want to control the switched with your panda, right?


#10

right


#11

So you do NOT need to receive on your Panda. Thats a good thing.

Try the code for this on code share.: http://www.tinyclr.com/codeshare/entry/35

It could be that you will have to experiment a bit with the rfdelay (Homeeasy = 375)

Eric


#12

Hımm, how can i detect remote control’s sending codes? Receive and detect before? Thanks


#13

Why do you want to do that?


#14

You can find the Home Easy protocol specifications here: http://homeeasyhacking.wikia.com/wiki/Simple_Protocol


#15

hi eric,
thanks for all. i could not understand the system and unit codes. the group of devices IV in me. for example, what code I need to send the number 2 key to turn?


#16

Are you familiar with an Arduino? If so, you can study this code: http://code.google.com/p/homeeasyhacking/source/browse/#svn/trunk/Arduino and convert it to C#


#17

Tried your code and google code(converted to c#) samples with 345, 350 and 375 rfdelay. nothing happens. my orginal remote control device is not running on fez panda 2 sending signal. tried any address code and channel code.

using port is di10. is following code means 4. address code and 3. channel to turn on? it is not worked for me.

rf.TransmitCode(“FFF0F”, “FF0FF”, true);

what should i do? thanks


#18

Open up the remote control, see what IC is inside, lookup up the datasheet of that IC and start to code :wink:
That is your best option.

Also, I think you have a set where the plugs need to learn the code from the remote, that will make it not easier.

Good luck.


#19

my IC is SC5262S. Found sample lib from arduino community and converted to c# for microframework. arduino link is bellow.

converted code is bellow:


#20

using System;
using Microsoft.SPOT.Hardware;

namespace tx1
{
    /// <summary>
    /// http://code.google.com/p/rc-switch/source/browse/tags/v0.5/RCSwitch.cpp?r=5
    /// </summary>
    public class OMR
    {
        public OutputPort Pin { get; set; }
        public int Delay { get; set; }

        public OMR(Cpu.Pin pin)
            : this(pin, 469)
        { }

        public OMR(Cpu.Pin pin, int delay)
        {
            Pin = new OutputPort(pin, false);
            Delay = delay;
            //pinMode(nPin, OUTPUT);
        }

        public void switchOn(int nAddressCode, int nChannelCode)
        {
            var s = getCodeWord(nAddressCode, nChannelCode, true);
            send(s);
        }

        void switchOff(int nAddressCode, int nChannelCode)
        {
            var s = getCodeWord(nAddressCode, nChannelCode, false);
            send(s);
        }

        void switchOn(String sGroup, int nChannel)
        {
            var s = getCodeWord2(sGroup, nChannel, true);
            send(s);
        }

        public void switchOff(String sGroup, int nChannel)
        {
            var s = getCodeWord2(sGroup, nChannel, false);
            send(s);
        }

        string getCodeWord(int nAddressCode, int nChannelCode, bool bStatus) {
            string[] code = { "FFFF", "0FFF", "F0FF", "FF0F", "FFF0" };

            if (nAddressCode < 1 || nAddressCode > 4 || nChannelCode < 1 || nChannelCode > 4) {
                return "";
            }
            
            return code[nAddressCode] + code[nChannelCode] + "FF" + (bStatus == true ? "FF" : "F0") + "S";
        }

        string getCodeWord2(string sGroup, int nChannelCode, bool bStatus) {
            string[] code = { "FFFFF", "0FFFF", "F0FFF", "FF0FF", "FFF0F", "FFFF0" };

            if (sGroup.Length != 5 || nChannelCode < 1 || nChannelCode > 5) {
                return "";
            }
        
            string sAddressCode = "";

            for (int i = 0; i<5; i++) {
                if (sGroup[i] == '0') {
                        sAddressCode += "F";
                } else {
                        sAddressCode += "0";
                }
            }
        
            return sAddressCode + code[nChannelCode] + (bStatus == true ? "0F" : "F0" ) + "S";
        }

        void send(string sCodeWord)
        {
            for (int nRepeat = 0; nRepeat < 10; nRepeat++)
            {
                for (int i = 0; i <= 12; i++)
                {
                    switch (sCodeWord[i])
                    {
                        case '0':
                            send0();
                            break;
                        case 'F':
                            sendF();
                            break;
                        case '1':
                            send1();
                            break;
                        case 'S':
                            sendSync();
                            break;
                    }
                }
            }
        }

        /**
         * Sends a "0" Bit
         *            _     _
         * Waveform: | |___| |___
         */
        void send0()
        {
            Pin.Write(true);
            delayMicroSec(Delay * 1);

            Pin.Write(false);
            delayMicroSec(Delay * 3);

            Pin.Write(true);
            delayMicroSec(Delay * 1);

            Pin.Write(false);
            delayMicroSec(Delay * 3);
        }

        /**
         * Sends a "1" Bit
         *            ___   ___
         * Waveform: |   |_|   |_
         */
        void send1()
        {
            Pin.Write(true);
            delayMicroSec(Delay * 3);

            Pin.Write(false);
            delayMicroSec(Delay * 1);

            Pin.Write(true);
            delayMicroSec(Delay * 3);

            Pin.Write(false);
            delayMicroSec(Delay * 1);
        }

        /**
         * Sends a "F" Bit
         *            _     ___
         * Waveform: | |___|   |_
         */
        void sendF()
        {
            Pin.Write(true);
            delayMicroSec(Delay * 1);
            Pin.Write(false);
            delayMicroSec(Delay * 3);
            Pin.Write(true);
            delayMicroSec(Delay * 3);
            Pin.Write(false);
            delayMicroSec(Delay * 1);
        }

        /**
         * Sends a "S" Bit
         *            _ 
         * Waveform: | |_______________________________
         */
        void sendSync()
        {
            Pin.Write(true);
            delayMicroSec(Delay * 1);

            Pin.Write(false);
            delayMicroSec(Delay * 31);
        }

        private void delayMicroSec(int microSeconds)
        {
            DateTime startTime = DateTime.Now;

            int stopTicks = microSeconds * 10;

            TimeSpan divTime = DateTime.Now - startTime;
            while (divTime.Ticks < stopTicks)
            {
                divTime = DateTime.Now - startTime;
            }
        }
    }
}