Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. 433mhz outlet

433mhz outlet

Scheduled Pinned Locked Moved Troubleshooting
433mhz
27 Posts 10 Posters 25.9k Views 5 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • axillentA Offline
    axillentA Offline
    axillent
    Mod
    wrote on last edited by
    #5

    there is also a complete library RCSwitch to work with both transmitters and receivers
    https://code.google.com/p/rc-switch/

    in my case I'm using a cheap wireless 433MHz motion sensor from my security system to drive the light too

    sense and drive

    C 1 Reply Last reply
    0
    • J jribera

      @Dwalt

      Thank Dwalt, i have uploaded your sketch to one of my Nano's with a 433Mhz Transmitter and i can see it working. Ie using another Nano with a 433mhz receiver and the sample 433 receiver sketch i can see the various codes been received ie "419915".

      My problem is i don't quite understand how to update your sketch with the codes for my sockets. Using my 433 receiver nano i can see my remote sends the code 501601 to turn on socket 1. I thought i would just need to convert this to Binary, but that doesn't seem to work.

      Are you able to explain the code format for turning on/off sockets in your sketch ?

      Joseph

      DwaltD Offline
      DwaltD Offline
      Dwalt
      wrote on last edited by Dwalt
      #6

      @jribera How did you obtain your code (e.g."419915")? Did you use a library like RCSwitch or RemoteSwitch? If so, those libraries usually include sketches to retransmit the codes.

      My sketch above is essentially a relay sketch which creates 4 child sensors in Vera. The children show up as 4 separate on-off light switches within "Devices". For my situation, I sniffed the code with the 433 receiver hooked up to a computer running Audacity and deciphered the signal into a binary sequence. For example -> remote button #1 -"ON" = 0101000101010101001111000, repeated 6 times. This is not necessarily the code the remote is using, it is a binary representation of what the pt2262 encoder sends through the air to the receiver, which decodes it through a pt2272.

      The sketch mimics the timing and pattern of the signal by sending "highs" and "lows" of certain lengths at 433Mhz which arrive at the receiver looking similar to a signal sent from the programed remote. The sketch simply says put pin3 (the 433transmitter) to "high" then "delay" and then "low" to create the signal (static void ookPulse). The "pt2262Send" command determines whether the delay is long (500us) or short (160us) depending on whether the binary is a "1" or a "0" for each digit of the 'sniffed' binary code. The last digit is always a zero, so the pt2262send command repeats through a 16 digit code followed by an 8 digit code, adds the zero and then repeats the entire process 6 times. I should have used "uint32_t" instead of "uint16_t" and "uint8_t" for the 25digit codes. I was copying and pasting from different sources until it suddenly worked and then I didn't want to "fix" something that was working. I borrowed 'ookpulse' and 'pt2262send' from other sketches found online. I don't think it matters what they are named.

      Within "Setup" in the sketch, the node is established as a repeater node and the number of child sensors (outlets) is declared. Within "Loop", the sensor node listens for incoming commands for that node and triggers different binary codes (to be processed by the pt2262send action) for each child and whether the command is off or on (incomingLightState -> 0 or 1).

      Not the most elegant solution but it worked. I tried using some of the Libraries available from different sources and I could not get them to work with MySensors properly.

      -Dwalt

      Veralite UI5 :: IBoard Ethernet GW :: MyS 1.5

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jribera
        wrote on last edited by
        #7

        Thanks Dwalt, understood now. I had assumed the code i received from the rc-switch sniffer sketch, could be translated to binary and used in your sketch.

        Looks like i will need to build a different sniffer.

        DwaltD 1 Reply Last reply
        0
        • J jribera

          Thanks Dwalt, understood now. I had assumed the code i received from the rc-switch sniffer sketch, could be translated to binary and used in your sketch.

          Looks like i will need to build a different sniffer.

          DwaltD Offline
          DwaltD Offline
          Dwalt
          wrote on last edited by
          #8

          @jribera
          There are many different ways to control 433mhz devices (such as the RCSwitch and Remote Switch Libraries), mine is just one method.

          Veralite UI5 :: IBoard Ethernet GW :: MyS 1.5

          1 Reply Last reply
          0
          • axillentA axillent

            there is also a complete library RCSwitch to work with both transmitters and receivers
            https://code.google.com/p/rc-switch/

            in my case I'm using a cheap wireless 433MHz motion sensor from my security system to drive the light too

            C Offline
            C Offline
            C.r.a.z.y.
            wrote on last edited by
            #9

            @axillent Please can you share link of 433 motion sensor?

            axillentA 1 Reply Last reply
            0
            • C C.r.a.z.y.

              @axillent Please can you share link of 433 motion sensor?

              axillentA Offline
              axillentA Offline
              axillent
              Mod
              wrote on last edited by
              #10

              @C.r.a.z.y. said:

              @axillent Please can you share link of 433 motion sensor?

              with pleasure
              what exactly do you need?

              sense and drive

              C 1 Reply Last reply
              0
              • J Offline
                J Offline
                jribera
                wrote on last edited by
                #11

                Finally managed to get this working by modifying Dwalts sketch to use the rcswitch library.

                I found this much simpler to use as it allows you to learn your existing codes using a simple RF-Sniffer sketch (Sniffer.ino) ie no need to mess around with recording signals, binary codes etc. This sketch simply displays a decimal number which you can just send back to control your devices.

                ie

                define CODE_1On 0x5FF0DC //Sniffed code converted to Hex.

                Serial.println("Turn on Socket 1");
                mySwitch.send(CODE_1On, 24); // These codes are unique to each outlet
                delay(50);

                With this working i can now safely control a number of 240V devices around the home !

                D D 2 Replies Last reply
                1
                • DwaltD Dwalt

                  @jribera

                  Below is a simple sketch I use for controlling 433Mhz outlets (sockets) with MySensors. I am not very good at coding but this sketch worked for my setup, I assume it could be improved.

                  https://codebender.cc/sketch:67827

                  I created a sensor node with a nano connected to a 433Mhz transmitter which is on mains power so the sensor is always "listening". I used the 5V from the nano to power the 433 transmitter but I believe it could run off 3.3V. The node controls four cheap 433Mhz outlets. I only have four but this sketch could be expanded to control many more. These outlets do not give feedback so the sketch is somewhat simple in that regard. These outlets use the PT2262 encoder which is common but may not work with your sockets. If you have a remote with your sockets, your can take it apart to see what encoder is used.

                  -Dwalt

                  BulldogLowellB Offline
                  BulldogLowellB Offline
                  BulldogLowell
                  Contest Winner
                  wrote on last edited by BulldogLowell
                  #12

                  @Dwalt

                  Nice job, I want one now!

                  Much easier to copy the transmission data with that sketch than the other examples here...

                  To help simplify your code, you can try to add in arrays...

                  int rfMessageON[4][2]=
                  {
                    {0b0101000101010101, 0b00110011},
                    {0b0101000101010101, 0b11000011},
                    {0b0101000101010111, 0b00000011},
                    {0b0101000101011101, 0b00000011}
                  };
                  
                  int rfMessageOFF[4][2]= 
                  {
                    {0b0101000101010101, 0b00111100},
                    {0b0101000101010101, 0b11001100},
                    {0b0101000101010111, 0b00001100},
                    {0b0101000101011101, 0b00001100}
                  };
                  

                  to make a much simpler function...

                  void loop() 
                  {
                    gw.process();
                  }
                  //
                  void incomingMessage(const MyMessage &message) 
                  {
                    if (message.type==V_LIGHT) 
                    {
                      Serial.print("Outlet #: ");
                      Serial.println(message.sensor);
                      Serial.print("Command: ");
                      Serial.println(message.getBool());
                      pt2262Send(message.getBool()? rfMessageON[message.sensor - 1][0],rfMessageON[message.sensor - 1][1]: rfMessageOFF[message.sensor - 1][0],rfMessageOFF[message.sensor - 1][1]);
                    }
                    delay(50);
                  }
                  

                  (not tested)

                  1 Reply Last reply
                  0
                  • axillentA axillent

                    @C.r.a.z.y. said:

                    @axillent Please can you share link of 433 motion sensor?

                    with pleasure
                    what exactly do you need?

                    C Offline
                    C Offline
                    C.r.a.z.y.
                    wrote on last edited by C.r.a.z.y.
                    #13

                    @axillent Motion sensor ; brand, model, which chip in it?

                    I have an remote like this (attached) and it didnt work with RC-Switch. (RC-Switch works with SC5262 / SC5272, HX2262 / HX2272, PT2262 / PT2272, EV1527, RT1527, FP1527 or HS1527 chipsets)

                    If my remote is working with other chipset, how can i read and transmit it?

                    How can i find this remote's chipset?
                    ----PIC16F630 ---update http://ww1.microchip.com/downloads/en/devicedoc/40039f.pdf

                    image1.JPG

                    1 Reply Last reply
                    0
                    • J jribera

                      Finally managed to get this working by modifying Dwalts sketch to use the rcswitch library.

                      I found this much simpler to use as it allows you to learn your existing codes using a simple RF-Sniffer sketch (Sniffer.ino) ie no need to mess around with recording signals, binary codes etc. This sketch simply displays a decimal number which you can just send back to control your devices.

                      ie

                      define CODE_1On 0x5FF0DC //Sniffed code converted to Hex.

                      Serial.println("Turn on Socket 1");
                      mySwitch.send(CODE_1On, 24); // These codes are unique to each outlet
                      delay(50);

                      With this working i can now safely control a number of 240V devices around the home !

                      D Offline
                      D Offline
                      dayve218
                      wrote on last edited by
                      #14

                      @jribera mind posting your completed code?

                      D 1 Reply Last reply
                      0
                      • D dayve218

                        @jribera mind posting your completed code?

                        D Offline
                        D Offline
                        dayve218
                        wrote on last edited by
                        #15

                        @dayve218 said:

                        @jribera mind posting your completed code?

                        nevermind, i figured it out!

                        1 Reply Last reply
                        0
                        • axillentA Offline
                          axillentA Offline
                          axillent
                          Mod
                          wrote on last edited by axillent
                          #16

                          @C.r.a.z.y. my sensors are none brand)) all using PT2262
                          was purchased from here http://ru.aliexpress.com/item/-/1953282784.html?recommendVersion=1
                          I have PIR sensors, door sensors, water leakage and gas leakage sensors.
                          I also have a remote similar to your.

                          Remote is easily recognized using radio 433MHz receiver connected to arduino and RCSwitch library

                          It is also a plan to create a gateway from 433MHZ to NRF24 network - this can help me to build vera3 automation using a security sensors without purchasing z-wave or building mysensors sensors

                          sense and drive

                          C 1 Reply Last reply
                          0
                          • axillentA axillent

                            @C.r.a.z.y. my sensors are none brand)) all using PT2262
                            was purchased from here http://ru.aliexpress.com/item/-/1953282784.html?recommendVersion=1
                            I have PIR sensors, door sensors, water leakage and gas leakage sensors.
                            I also have a remote similar to your.

                            Remote is easily recognized using radio 433MHz receiver connected to arduino and RCSwitch library

                            It is also a plan to create a gateway from 433MHZ to NRF24 network - this can help me to build vera3 automation using a security sensors without purchasing z-wave or building mysensors sensors

                            C Offline
                            C Offline
                            C.r.a.z.y.
                            wrote on last edited by
                            #17

                            @axillent Thank you. Do you have dip switches in your sensors?

                            I found a comparasion table maybe this could help people like me;

                            http://www.hkvstar.com/technology-news/the-difference-between-fixed-code-pt2262-and-learning-code-ev1527.html

                            If my remote is not a fixed code, how can i read and transmit it?

                            1 Reply Last reply
                            0
                            • axillentA Offline
                              axillentA Offline
                              axillent
                              Mod
                              wrote on last edited by
                              #18

                              @C.r.a.z.y. some sensors do have dip switches, some have preprogrammed radio code

                              if you have RF receiver you can try to get a code from your remote using example receiver sketch from RCSwitch library. I build a custom arduino with RF receiver and a button which I use to program the first received code into arduino EEPROM. Later this code is used to identify which sensor should light up my leds.
                              IMG_1880.JPG

                              sense and drive

                              C 1 Reply Last reply
                              1
                              • axillentA axillent

                                @C.r.a.z.y. some sensors do have dip switches, some have preprogrammed radio code

                                if you have RF receiver you can try to get a code from your remote using example receiver sketch from RCSwitch library. I build a custom arduino with RF receiver and a button which I use to program the first received code into arduino EEPROM. Later this code is used to identify which sensor should light up my leds.
                                IMG_1880.JPG

                                C Offline
                                C Offline
                                C.r.a.z.y.
                                wrote on last edited by
                                #19

                                @axillent OK i understand fixed codes are fine with RCSwitch.

                                How can i transmit this data ?

                                1100 0011 0010 0010 0011 0000 1100 1000 1000
                                1100 0011 0001 0010 0011 0000 1100 0100 1000

                                axillentA 1 Reply Last reply
                                0
                                • C C.r.a.z.y.

                                  @axillent OK i understand fixed codes are fine with RCSwitch.

                                  How can i transmit this data ?

                                  1100 0011 0010 0010 0011 0000 1100 1000 1000
                                  1100 0011 0001 0010 0011 0000 1100 0100 1000

                                  axillentA Offline
                                  axillentA Offline
                                  axillent
                                  Mod
                                  wrote on last edited by
                                  #20

                                  @C.r.a.z.y. Open any transmitting example from RCSwitch
                                  I never did it but I think send() function is designed for this
                                  https://code.google.com/p/rc-switch/wiki/HowTo_Send?tm=6

                                  sense and drive

                                  C 1 Reply Last reply
                                  0
                                  • axillentA axillent

                                    @C.r.a.z.y. Open any transmitting example from RCSwitch
                                    I never did it but I think send() function is designed for this
                                    https://code.google.com/p/rc-switch/wiki/HowTo_Send?tm=6

                                    C Offline
                                    C Offline
                                    C.r.a.z.y.
                                    wrote on last edited by
                                    #21

                                    @axillent Thank you i know you are very helpful. I tried to copy my remote to an universal remote learner(which has no name chipset) but it didnt copy. It is hard to understand and solve for a newbie.

                                    I simply tried to send 10101010codes with this sketch https://code.google.com/p/rc-switch/wiki/HowTo_Send?tm=6 and didnt work.

                                    Something interesting i found while tranmitting,
                                    If i remove the delay () than signal is always sent. I made a jammer! :) Any of my 433 remotes didnt work!

                                    I want to learn if any universal remote learner with EV1527 Chipset works with RCSwitch?
                                    My plan is to copy some remote codes to EV1527 universal remote and read the code from serial with RCSwitch-rfSniffer.

                                    Now i will try IR SENDER-RECEIVER http://www.mysensors.org/build/ir maybe i can get new ideas for 433mhz things..

                                    1 Reply Last reply
                                    0
                                    • J jribera

                                      Finally managed to get this working by modifying Dwalts sketch to use the rcswitch library.

                                      I found this much simpler to use as it allows you to learn your existing codes using a simple RF-Sniffer sketch (Sniffer.ino) ie no need to mess around with recording signals, binary codes etc. This sketch simply displays a decimal number which you can just send back to control your devices.

                                      ie

                                      define CODE_1On 0x5FF0DC //Sniffed code converted to Hex.

                                      Serial.println("Turn on Socket 1");
                                      mySwitch.send(CODE_1On, 24); // These codes are unique to each outlet
                                      delay(50);

                                      With this working i can now safely control a number of 240V devices around the home !

                                      D Offline
                                      D Offline
                                      diggs
                                      wrote on last edited by
                                      #22

                                      @jribera Been try to get this happening myself. Can you provide the sketch you ended up using to get this happening so I can try it. I know what all my codes are, just need to get a sketch happening to interface back to my controller (Domoticz Serial)

                                      Cheers

                                      1 Reply Last reply
                                      0
                                      • J Offline
                                        J Offline
                                        jribera
                                        wrote on last edited by
                                        #23

                                        This is the sketch i'm using for controlling a number of sockets around the house.

                                        /*  RF433Mhz Transmitter node:
                                            This sketch allows On-Off-Keying (OOK) control of four 433Mhz relay outlets
                                            which utilize the common PT2262 encoding chip for signal transmission. The sketch could
                                            be easily expanded to include additional outlets.  The sensor node consists of a nano 
                                            connected to a NRF24L01 and a 433Mhz transmitter connected to pin 3, 5V and Gnd.  The 
                                            transmitter can run off of 3.3V as well. 
                                            
                                            The sketch is based on the MySensors project (http://www.mysensors.org). 
                                            Submitted by Dwalt.
                                        */ 
                                        
                                        //  Include related libraries
                                        #include <MySensor.h>
                                        #include <SPI.h>  
                                        #include <RF24.h>
                                        #include <RCSwitch.h>
                                        
                                        //  Define Constants
                                        #define RF433_CHILD_ID 0
                                        #define NUMBER_OF_OUTLETS 4 // Each outlet will have 2 OOK codes
                                        //#define SEND_DATA 3
                                        
                                        #define CODE_1On 6287582
                                        #define CODE_1Off 6287574
                                        #define CODE_2On 6287580
                                        #define CODE_2Off 6287572
                                        #define CODE_3On 6287578
                                        #define CODE_3Off 6287570
                                        #define CODE_4On 6287577
                                        #define CODE_4Off 6287569
                                        
                                        MySensor gw;
                                        
                                        RCSwitch mySwitch = RCSwitch();
                                        
                                        void setup() 
                                        {
                                          
                                        
                                        mySwitch.enableTransmit(3); 
                                          
                                         Serial.begin(115200); // Not sure why this was included
                                        
                                         //  The node is mains powered, so why not make it a repeater.
                                         gw.begin(incomingMessage, AUTO, true);
                                         
                                         // Send the sketch version information to gateway
                                         gw.sendSketchInfo("RF433", "1.1");
                                         
                                         // Register outlets to gw (they will be created as child devices)
                                         for(int i=0; i<NUMBER_OF_OUTLETS;i++) {
                                           gw.present(i+1, S_LIGHT);
                                        
                                         }
                                            
                                        }
                                        
                                        void loop() {
                                          gw.process();
                                        }
                                          void incomingMessage(const MyMessage &message) {
                                          
                                          if (message.type==V_LIGHT) {
                                          int incomingLightState =  message.getBool(); 
                                          int incomingOutlet = message.sensor;
                                          
                                          Serial.print("Outlet #: ");
                                          Serial.println(message.sensor);
                                          Serial.print("Command: ");
                                          Serial.println(message.getBool());
                                         
                                         if (incomingOutlet==1) {
                                         if (incomingLightState==1) {
                                            // Turn on  socket 1
                                            Serial.println("Turn on Socket 1");
                                         mySwitch.send(CODE_1On, 24); // These codes are unique to each outlet
                                         delay(50); 
                                         }
                                         if (incomingLightState==0)  {
                                            // Turn off socket 1
                                         Serial.println("Turn off Socket 1");
                                        mySwitch.send(CODE_1Off, 24);
                                        delay(50); 
                                         }
                                         }
                                         if (incomingOutlet==2) {
                                         if (incomingLightState==1) {
                                            // Turn on  socket 2
                                            Serial.println("Turn on Socket 2");
                                        mySwitch.send(CODE_2On, 24);
                                         delay(50); 
                                         }
                                         if (incomingLightState==0)  {
                                            // Turn off socket 2
                                         Serial.println("Turn off Socket 2");
                                        mySwitch.send(CODE_2Off, 24);
                                        delay(50); 
                                         }
                                         }
                                         if (incomingOutlet==3) {
                                         if (incomingLightState==1) {
                                            // Turn on  socket 3
                                            Serial.println("Turn on Socket 3");
                                        mySwitch.send(CODE_3On, 24);
                                         delay(50); 
                                         }
                                         if (incomingLightState==0)  {
                                            // Turn off socket 3
                                         Serial.println("Turn off Socket 3");
                                        mySwitch.send(CODE_3Off, 24);
                                        delay(50); 
                                         }
                                         }
                                         if (incomingOutlet==4) {
                                         if (incomingLightState==1) {
                                            // Turn on  socket 4
                                            Serial.println("Turn on Socket 4");
                                         mySwitch.send(CODE_4On, 24);
                                         delay(50); 
                                         }
                                         if (incomingLightState==0)  {
                                            // Turn off socket 4
                                         Serial.println("Turn off Socket 4");
                                        mySwitch.send(CODE_4Off, 24);
                                        delay(50); 
                                         }
                                         }
                                          }
                                         delay(50);
                                         }    
                                            
                                           
                                            
                                        
                                        
                                        
                                        
                                        
                                        J 1 Reply Last reply
                                        0
                                        • T Offline
                                          T Offline
                                          treb0r
                                          wrote on last edited by
                                          #24

                                          @jribera Your sketch works perfectly :)
                                          I am trying to add also 433 receiver to allow domoticz update states of the switches is the Socket is switched on or off by remote control. Does anybody know how to do that? After receiving certain code change the state of the corresponding socket.
                                          treb0r

                                          P 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          13

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.1k

                                          Posts


                                          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular