2 Replies Latest reply on Apr 9, 2014 4:45 PM by mdelgert

    433Mhz RF transmitter module support & WiringPi

    mdelgert

      Hello,

       

      Previously a post was made regarding "RCSwitch for RF communication" https://communities.intel.com/message/212308#212308

       

      Has anyone used the Galileo for 433Mhz RF transmissions?

       

      Example projects https://github.com/ninjablocks/433Utils. This example uses wiringpi https://projects.drogon.net/raspberry-pi/wiringpi/download-and-install/

       

      Has anyone written an updated WiringPi for Galileo?

       

      My goal is to send 433Mhz RF signals to remote light, ceiling fans, garage door openers and other home devices using low cost RF chips like this project http://code.google.com/p/rc-switch/. Using example transmitter module http://www.dx.com/p/433mhz-rf-transmitter-module-receiver-module-link-kit-for-arduino-arm-mcu-wl-green-220194?tc=USD&gclid=CNT9hO38zr0CFQqEfgodFL4AMQ#.U0LqcfldW-0.

       

      433Mhz transmission should be achievable via GPIO or through the sound jack.


      Any advice or comments are appreciated in advance thank you,

       

      Matthew,

        • 1. Re: 433Mhz RF transmitter module support & WiringPi
          SpiderKenny
          433Mhz transmission should be achievable via GPIO or through the sound jack.


          There is no sound jack.

          433 MHz RF is a no brainer, most of the RF modules available have a very simple interface, VCC, GND and DATA and thats it. There are several UART pins available to Galileo. Hook up the RF Board to VCC, GND and one of the UART TX pins and you are done.   The boards in your attached image are the same ones I use - although I have not yet attached them to galileo.


          • 2. Re: 433Mhz RF transmitter module support & WiringPi
            mdelgert

            Hi SpiderKenny thank you for the reply.


            May you attempt to attach a RF module and share your code?


            From this site rc-switch - Arduino library to operate low cost 315 MHz / 433 MHz remote control devices - Google Project Hosting


            I am trying to run the examples below. The issue is with the include statements below.


            Arduino.h for Galileo does not reference wiring_digital.c.


            #if defined(ARDUINO) && ARDUINO >= 100

                #include "Arduino.h"

            #elif defined(ENERGIA) // LaunchPad, FraunchPad and StellarPad specific

                #include "Energia.h"

            #else

                #include "WProgram.h"

            #endif

             

            The following articles look close to achieving this.


            The Garage Lab :: Wireless Communications - 433MHz Modules

             

            Welcome to pySerial’s documentation — pySerial 2.7 documentation

             

            /*

              Simple example for receiving

             

              http://code.google.com/p/rc-switch/

             

              Need help? http://forum.ardumote.com

            */

             

             

            #include <RCSwitch.h>

             

             

            RCSwitch mySwitch = RCSwitch();

             

             

            void setup() {

              Serial.begin(9600);

              mySwitch.enableReceive(0);  // Receiver on inerrupt 0 => that is pin #2

            }

             

             

            void loop() {

              if (mySwitch.available()) {

               

                int value = mySwitch.getReceivedValue();

               

                if (value == 0) {

                  Serial.print("Unknown encoding");

                } else {

                  Serial.print("Received ");

                  Serial.print( mySwitch.getReceivedValue() );

                  Serial.print(" / ");

                  Serial.print( mySwitch.getReceivedBitlength() );

                  Serial.print("bit ");

                  Serial.print("Protocol: ");

                  Serial.println( mySwitch.getReceivedProtocol() );

                }

             

             

                mySwitch.resetAvailable();

              }

            }

             

            /*

              RCSwitch - Arduino libary for remote control outlet switches

              Copyright (c) 2011 Suat Özgür.  All right reserved.

             

             

              Contributors:

              - Andre Koehler / info(at)tomate-online(dot)de

              - Gordeev Andrey Vladimirovich / gordeev(at)openpyro(dot)com

              - Skineffect / http://forum.ardumote.com/viewtopic.php?f=2&t=46

              - Dominik Fischer / dom_fischer(at)web(dot)de

              - Frank Oltmanns / <first name>.<last name>(at)gmail(dot)com

             

              Project home: http://code.google.com/p/rc-switch/

             

             

              This library is free software; you can redistribute it and/or

              modify it under the terms of the GNU Lesser General Public

              License as published by the Free Software Foundation; either

              version 2.1 of the License, or (at your option) any later version.

             

             

              This library is distributed in the hope that it will be useful,

              but WITHOUT ANY WARRANTY; without even the implied warranty of

              MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU

              Lesser General Public License for more details.

             

             

              You should have received a copy of the GNU Lesser General Public

              License along with this library; if not, write to the Free Software

              Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

            */

            #ifndef _RCSwitch_h

            #define _RCSwitch_h

             

             

            #if defined(ARDUINO) && ARDUINO >= 100

                #include "Arduino.h"

            #elif defined(ENERGIA) // LaunchPad, FraunchPad and StellarPad specific

                #include "Energia.h"

            #else

                #include "WProgram.h"

            #endif

             

             

             

             

            // At least for the ATTiny X4/X5, receiving has to be disabled due to

            // missing libm depencies (udivmodhi4)

            #if defined( __AVR_ATtinyX5__ ) or defined ( __AVR_ATtinyX4__ )

            #define RCSwitchDisableReceiving

            #endif

             

             

            // Number of maximum High/Low changes per packet.

            // We can handle up to (unsigned long) => 32 bit * 2 H/L changes per bit + 2 for sync

            #define RCSWITCH_MAX_CHANGES 67

             

             

            #define PROTOCOL3_SYNC_FACTOR   71

            #define PROTOCOL3_0_HIGH_CYCLES  4

            #define PROTOCOL3_0_LOW_CYCLES  11

            #define PROTOCOL3_1_HIGH_CYCLES  9

            #define PROTOCOL3_1_LOW_CYCLES   6

             

             

            class RCSwitch {

             

             

              public:

                RCSwitch();

               

                void switchOn(int nGroupNumber, int nSwitchNumber);

                void switchOff(int nGroupNumber, int nSwitchNumber);

                void switchOn(char* sGroup, int nSwitchNumber);

                void switchOff(char* sGroup, int nSwitchNumber);

                void switchOn(char sFamily, int nGroup, int nDevice);

                void switchOff(char sFamily, int nGroup, int nDevice);

                void switchOn(char* sGroup, char* sDevice);

                void switchOff(char* sGroup, char* sDevice);

                void switchOn(char sGroup, int nDevice);

                void switchOff(char sGroup, int nDevice);

             

             

                void sendTriState(char* Code);

                void send(unsigned long Code, unsigned int length);

                void send(char* Code);

               

                #if not defined( RCSwitchDisableReceiving )

                void enableReceive(int interrupt);

                void enableReceive();

                void disableReceive();

                bool available();

                void resetAvailable();

             

                unsigned long getReceivedValue();

                unsigned int getReceivedBitlength();

                unsigned int getReceivedDelay();

                unsigned int getReceivedProtocol();

                unsigned int* getReceivedRawdata();

                #endif

             

                void enableTransmit(int nTransmitterPin);

                void disableTransmit();

                void setPulseLength(int nPulseLength);

                void setRepeatTransmit(int nRepeatTransmit);

                #if not defined( RCSwitchDisableReceiving )

                void setReceiveTolerance(int nPercent);

                #endif

                void setProtocol(int nProtocol);

                void setProtocol(int nProtocol, int nPulseLength);

             

              private:

                char* getCodeWordB(int nGroupNumber, int nSwitchNumber, boolean bStatus);

                char* getCodeWordA(char* sGroup, int nSwitchNumber, boolean bStatus);

                char* getCodeWordA(char* sGroup, char* sDevice, boolean bStatus);

                char* getCodeWordC(char sFamily, int nGroup, int nDevice, boolean bStatus);

                char* getCodeWordD(char group, int nDevice, boolean bStatus);

                void sendT0();

                void sendT1();

                void sendTF();

                void send0();

                void send1();

                void sendSync();

                void transmit(int nHighPulses, int nLowPulses);

             

             

                static char* dec2binWzerofill(unsigned long dec, unsigned int length);

                static char* dec2binWcharfill(unsigned long dec, unsigned int length, char fill);

               

                #if not defined( RCSwitchDisableReceiving )

                static void handleInterrupt();

                static bool receiveProtocol1(unsigned int changeCount);

                static bool receiveProtocol2(unsigned int changeCount);

                static bool receiveProtocol3(unsigned int changeCount);

                int nReceiverInterrupt;

                #endif

                int nTransmitterPin;

                int nPulseLength;

                int nRepeatTransmit;

                char nProtocol;

             

             

                #if not defined( RCSwitchDisableReceiving )

                static int nReceiveTolerance;

                static unsigned long nReceivedValue;

                static unsigned int nReceivedBitlength;

                static unsigned int nReceivedDelay;

                static unsigned int nReceivedProtocol;

                #endif

                /*

                 * timings[0] contains sync timing, followed by a number of bits

                 */

                static unsigned int timings[RCSWITCH_MAX_CHANGES];

             

             

               

            };

             

             

            #endif

             

            Attached is the sample code I am trying to run from rc-switch -  Arduino library to operate low cost 315 MHz / 433 MHz remote control devices - Google Project Hosting

             

            Any advice would be appreciated.