Main Site Documentation

Send over 433 MHZ


#1

Hi together,

i am working on a project where i want send some data over a 433 MHZ sender.
i want to send some data to a power socket. i use this components: FEZ Spider, http://www.watterott.com/de/RF-Link-Sender-434MHz, http://www.watterott.com/de/RF-Link-2400bps-Empfaenger-434MHz.

i have used audacity to read the code from the remote control and get this code for “ON”: 011100001000
now i want to use the sender to send this code to the power socket. can anyone explain me what i need to do?

I have tried the “Write” and the “WriteByte” Method from the SerialPort Class but i dont realy work.
Sender and reciver are ok.


#2

hey thanks for reply.
now a little bit more details:
most of this i catch from other sites becouse i am a softwaresoftware engineer but a noob in hardware engineering

i use socket 4 on my fez spider board for the extender modul.
on the extender modul i put a 433 MHZ Sender module (http://www.watterott.com/de/RF-Link-Sender-434MHz)
i use for Tx pin 4 on the extender modul for the sender.

i had build me with a 433 mhz reciver and my soundcard a “Poor man oscilloscope”. that works very well and i had read the codes from the remote control from the power socket. you see the ouput on my picture. from that i build this code for “ON”: 011100001000
from audacity i record this with a frequency from 48000 Hz.

thats the code in initialize my serialport.:

SerialPort m_serial = new SerialPort(h, baudrate, Parity.None, 8, StopBits.One);       

thats the code to send data:
the breaks i calculate from the sequence points from audacity. The “x” is for sync. on the second pic you see my output with a baudrate from 2400

 public void SendData(char code)
        {
            switch (code)
            { //nun gucken wir was i ist
                case '0':
                    { //Der Code fuer '0'
                        m_serial.WriteByte(1);
                        DelayMicroSec(312); //da die Pausen x*350us lang sind, machen wir daraus eine Funktion
                        m_serial.WriteByte(0);
                        DelayMicroSec(541);
                        m_serial.WriteByte(1);
                        DelayMicroSec(312);
                        m_serial.WriteByte(0);
                        DelayMicroSec(541);
                        return;
                    }
                case '1':
                    { //Der Code fuer '1'
                        m_serial.WriteByte(1);
                        DelayMicroSec(739);
                        m_serial.WriteByte(0);
                        DelayMicroSec(166);
                        m_serial.WriteByte(1);
                        DelayMicroSec(739);
                        m_serial.WriteByte(0);
                        DelayMicroSec(166);
                        return;
                    }
                case 'x':
                    { //Der Code fuer x(sync)
                        m_serial.WriteByte(0);
                        DelayMicroSec(312);
                        m_serial.WriteByte(1);
                        DelayMicroSec(7290);
                        return;
                    }

            }

For more infos ask me :wink:


#3

So I suspect your problem might be the delay function. Remember, netmf is NOT real-time, so getting accuracy here is not possible unless you step into RLP.

The simple test should be that you send data from one end, and you can receive that data at the other end. So send a test sequence and check reception. Also can you explain how you confirmed that both modules are OK?


#4

I have tested it to send bytes from the sender to the receiver. communication between the both was ok but dont tested it with delays.


#5

Just continuing this questioning. You said you sent data successfully from one module to the other. Was that in a Gadgeteer application? If so, then you’ve proven everything works; so when you run the same test with your “real” code, and read that on a PC still, does the comms look right? What do you think looks wrong with it?


#6

i have tested it in a gadgeteer application.
i have no knowledge about frequencys and baudrates etc. i think thats my error is in the send method. i say for example: if there a “1” then send 1 byte - wait - send him 0 bytes - wait - etc. so can it be that i must send only 1 bit and not 1 byte?


#7

Great question. What does your PC oscilloscope show you ? Perhaps to effectively test that you’ll need to write a big batch of 1’s and pause a second, then a batch of 1/0/1/0, and then a batch of 0xAA (a sequence of 10101010).

If you need to send it “native” then you need to just use the Tx pin as an output rather than using the serial port. Then, you toggle the pin, wait your pre-determined time, toggle again. But as I said, this requires you to “own” the full process and that means stepping into RLP to do this (or thinking about it, isn’t there a Premium library feature for doing this, originally used for IR? OutputCompare?)


#8

Found the SignalGenerator, i try this.
but next question which GPIO Pin i must use? :wink: SignalGeneratorneed this.


#9

the pin you have connected to your sender module :slight_smile:


#10

but there are Cpu.Pin.GPIO_PIN0 to Cpu.Pin.GPIO_PIN15. should i use pin 4 then?


#11

No, you need to get the Socket object using the socket number, then you need to get pin 4 from the socket object which will give you correct Cpu.Pin.


#12

Great! Big thanks to Brett and Architect. Looks good now. tomorrow i try to send my code on this way. post my status then.


#13

hey! its me again.
works very well with the SignalGenerator!

must play a lil bit with the times and now i can put my power socket on and off.

thats the code i use for it:

bool initValue2 = false; // pin is low
            SignalGenerator sig = new SignalGenerator(socket.CpuPins[6], initValue2, 2);
public void SendOn()
        {           
            sig.SetBlocking(true, new uint[] { 280, 541, 280, 541, 739, 250, 739, 250, 739, 250, 739, 250, 739, 250, 739, 250, 280, 541, 280, 541, 280, 541, 280, 541, 280, 541, 280, 541, 280, 541, 280, 541, 739, 250, 739, 250, 280, 541, 280, 541, 280, 541, 280, 541, 280, 541, 280, 541,280 }, 0, 49, 500, false);
          
        }
        public void SendOff()
        {           
            sig.SetBlocking(true, new uint[] { 280, 541, 280, 541, 739, 250, 739, 250, 739, 250, 739, 250, 739, 250, 739, 250, 280, 541, 280, 541, 280, 541, 280, 541, 280, 541, 280, 541, 280, 541, 280, 541, 280, 541, 280, 541, 280, 541, 280, 541, 280, 541, 280, 541, 280, 541, 280, 541, 280 }, 0, 49, 500, false);

        }

thanks again!


#14

awesome news !