How to change pin for RF transmitter for arduino pro 2560 ?

i am going to use Rf 433 mhz red pair .

i want to connect RF transmitter to Arduino pro 2560.
Arduino pro 2560

my problem ,,,i have sholdered pin (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23)
and pins( 32,33,34,35,36,37,38,39,40,41) , Pin ( A(0) ).
above pins are not free. i can not use them.

can i use Pin A(1) for transmitter by modification in library files.

or can i use other Pin for transmitter by modification in library files.

if possible please reply , which pin ?? ,, how to edit library file ?? and How??

libray i downloaded to test below.
RadioHead-1.41.zip (275.5 KB)

Please link to it instead of offering a zip file for download. Zip files are inconvenient (people posting from phones/tablets etc.) and potentially have security issues.

Get the link please.
Library

Well done,
Instead of a zip file which we don't like, you now give us a link to a zip file.
:scream:

I didn't get any help answer. You can also give your own library link, what you trust or you have tested,,, thank you

OK, so it's this one: RadioHead: RadioHead Packet Radio library for embedded microprocessors
Which was forked by Sparkfun at some point here: GitHub - sparkfun/SparkFun_RadioHead_Arduino_Library: SparkFun Fork of Mike McCauley's RadioHead library (http://www.airspayce.com/mikem/arduino/RadioHead/)

Can you share details of the RF hardware, please? It's not clear to me if the library you posted will actually work with your hardware in the first place. All you gave is a picture and Google doesn't turn up a datasheet or information on the chipset. Please post a link to the datasheet, or lacking that, some good pictures of both sides of the transmitter and receiver modules.

No.

No.

The point is in order to transmit stuff you have to have a pin capable of being a serial output. As the Mega has only four of these you have made a fatal design error. Your best bet is to use one of these four pins and replace the intended use with another pin. Unless, of course these pins are using the serial UARTs.

You could try using software serial to give you an extra serial port, but these are not very reliable especially at high speed.

Not a real one, just a clone isn't it?

My device details..
Rf 433 mhz receiver will receive signal, and send to my esp8266 board and esp8266 will do some actions on getting input.
But here,
I want to use my Arduino mega 2560 pro to handle rf433 mhz transmitter. 2560 pro already connected with my Synth wia tx rx pins 0 and 1. Others pins with switches write in my post#1 . Please suggest if any possible....

If no ,,,
Can I connect HT 12e ic to transmitter to send input to my ESP 8266 board (connected with rf 433 mhz receiver) as below
(HT 12E + RF receiver) >>> ( RF receiver+ESP8266)

I'm not sure.

Radiohead handles regular ASK simple radio sets, and the OP is using a plain old 433 simple radio set.

So shouldn't that just work, and work on any i/o pins what might be left over?

a7

I can't see how it can, especially as it is being received as if it were a serial stream.

I have no idea what code you are looking at.

The pictured radio set is probably these simple dumb ASK modules:


They are suitable for RadioHead. The charter of RadioHead is radio-agnostic high level software; RadioHead's RH_ASK class is useful here.

RH_ASK inherits from the RHGenericDriver. The constructor allows setting the pins used.

RH_ASK (uint16_t speed=2000, uint8_t rxPin=11, uint8_t txPin=12, uint8_t pttPin=10, bool pttInverted=false)

This comment in the code seems clear enough:
/// Does not use the Arduino UART. Messages are sent with a training preamble,
/// message length and checksum. Messages are sent with 4-to-6 bit encoding
/// for good DC balance, and a CRC checksum for message integrity.

There is no need to use a serial capable pin, a UART or SoftwareSerial.

a7

Thank you, I will try

Yes sir,
here i am showing what i did.
I tried Library which is given in above post#6 by rsmls .

Here i tested my RF Transmitter & Reciever is working or not.
after installing Library, i edit "RF_ASK.h" file . changed Tx pin to A1.
then i upload following code into Arduino mega 2560 pro.

#include <RH_ASK.h>
#include <SPI.h> // Not actually used but needed to compile

RH_ASK driver;

void setup()
{
    Serial.begin(9600);    // Debugging only
    if (!driver.init())
         Serial.println("init failed");
}

void loop()
{
    const char *msg = "hello";
    driver.send((uint8_t *)msg, strlen(msg));
    driver.waitPacketSent();
    delay(200);
}

then i made circuit like it,


after it i saw , Transmitter is sending,, and Green led is blinking according to Transmission... it mean my Tx Rx module is working, and Arduino mega 2560 pro is also sending data to Transmitter.
but when i try following code For "Teensy LC Board" & " ESP8266 Board" to see Data.

#include <RH_ASK.h>
#include <SPI.h> // Not actualy used but needed to compile

RH_ASK driver;

void setup()
{
    Serial.begin(9600);  // Debugging only
    if (!driver.init())
         Serial.println("init failed");
}

void loop()
{
    uint8_t buf[RH_ASK_MAX_MESSAGE_LEN];
    uint8_t buflen = sizeof(buf);

    if (driver.recv(buf, &buflen)) // Non-blocking
    {
  int i;

  // Message with a good checksum received, dump it.
  driver.printBuffer("Got:", buf, buflen);
    }
}

I am getting Error from Teensy LC Board

Arduino: 1.8.13 (Windows 7), TD: 1.53, Board: "Teensy LC, Serial, 48 MHz, Smallest Code, US English"





















C:\Program Files\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files\Arduino\hardware -hardware C:\Users\acer\AppData\Local\Arduino15\packages -tools C:\Program Files\Arduino\tools-builder -tools C:\Program Files\Arduino\hardware\tools\avr -tools C:\Users\acer\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files\Arduino\libraries -libraries C:\Users\acer\Documents\Arduino\libraries -fqbn=teensy:avr:teensyLC:usb=serial,speed=48,opt=osstd,keys=en-us -ide-version=10813 -build-path C:\Users\acer\AppData\Local\Temp\arduino_build_754878 -warnings=none -build-cache C:\Users\acer\AppData\Local\Temp\arduino_cache_637036 -verbose C:\Users\acer\Documents\Arduino\RF_433_Mhz_Receiver\RF_433_Mhz_Receiver.ino

C:\Program Files\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files\Arduino\hardware -hardware C:\Users\acer\AppData\Local\Arduino15\packages -tools C:\Program Files\Arduino\tools-builder -tools C:\Program Files\Arduino\hardware\tools\avr -tools C:\Users\acer\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files\Arduino\libraries -libraries C:\Users\acer\Documents\Arduino\libraries -fqbn=teensy:avr:teensyLC:usb=serial,speed=48,opt=osstd,keys=en-us -ide-version=10813 -build-path C:\Users\acer\AppData\Local\Temp\arduino_build_754878 -warnings=none -build-cache C:\Users\acer\AppData\Local\Temp\arduino_cache_637036 -verbose C:\Users\acer\Documents\Arduino\RF_433_Mhz_Receiver\RF_433_Mhz_Receiver.ino

Using board 'teensyLC' from platform in folder: C:\Program Files\Arduino\hardware\teensy\avr

Using core 'teensy3' from platform in folder: C:\Program Files\Arduino\hardware\teensy\avr

Detecting libraries used...

"C:\\Program Files\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -fno-exceptions -fpermissive -felide-constructors -std=gnu++14 -Wno-error=narrowing -fno-rtti -mthumb -mcpu=cortex-m0plus -fsingle-precision-constant -D__MKL26Z64__ -DTEENSYDUINO=153 -DARDUINO=10813 -DARDUINO_TEENSYLC -DF_CPU=48000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\\Program Files\\Arduino\\hardware\\teensy\\avr\\cores\\teensy3" "C:\\Users\\acer\\AppData\\Local\\Temp\\arduino_build_754878\\sketch\\RF_433_Mhz_Receiver.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE

Alternatives for RH_ASK.h: [RadioHead SparkFun_RadioHead_Arduino_Library-master@1.4.2]

ResolveLibrary(RH_ASK.h)

  -> candidates: [RadioHead SparkFun_RadioHead_Arduino_Library-master@1.4.2]

"C:\\Program Files\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -fno-exceptions -fpermissive -felide-constructors -std=gnu++14 -Wno-error=narrowing -fno-rtti -mthumb -mcpu=cortex-m0plus -fsingle-precision-constant -D__MKL26Z64__ -DTEENSYDUINO=153 -DARDUINO=10813 -DARDUINO_TEENSYLC -DF_CPU=48000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\\Program Files\\Arduino\\hardware\\teensy\\avr\\cores\\teensy3" "-IC:\\Users\\acer\\Documents\\Arduino\\libraries\\SparkFun_RadioHead_Arduino_Library-master\\src" "C:\\Users\\acer\\AppData\\Local\\Temp\\arduino_build_754878\\sketch\\RF_433_Mhz_Receiver.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE

Alternatives for SPI.h: [SPI@1.0]

ResolveLibrary(SPI.h)

  -> candidates: [SPI@1.0]

"C:\\Program Files\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -fno-exceptions -fpermissive -felide-constructors -std=gnu++14 -Wno-error=narrowing -fno-rtti -mthumb -mcpu=cortex-m0plus -fsingle-precision-constant -D__MKL26Z64__ -DTEENSYDUINO=153 -DARDUINO=10813 -DARDUINO_TEENSYLC -DF_CPU=48000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\\Program Files\\Arduino\\hardware\\teensy\\avr\\cores\\teensy3" "-IC:\\Users\\acer\\Documents\\Arduino\\libraries\\SparkFun_RadioHead_Arduino_Library-master\\src" "-IC:\\Program Files\\Arduino\\hardware\\teensy\\avr\\libraries\\SPI" "C:\\Users\\acer\\AppData\\Local\\Temp\\arduino_build_754878\\sketch\\RF_433_Mhz_Receiver.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE

Alternatives for RHutil/atomic.h: []

ResolveLibrary(RHutil/atomic.h)In file included from C:\Users\acer\Documents\Arduino\libraries\SparkFun_RadioHead_Arduino_Library-master\src/RHGenericDriver.h:9:0,



  -> candidates: []

                 from C:\Users\acer\Documents\Arduino\libraries\SparkFun_RadioHead_Arduino_Library-master\src/RH_ASK.h:9,

                 from C:\Users\acer\Documents\Arduino\RF_433_Mhz_Receiver\RF_433_Mhz_Receiver.ino:1:

C:\Users\acer\Documents\Arduino\libraries\SparkFun_RadioHead_Arduino_Library-master\src/RadioHead.h:616:29: fatal error: RHutil/atomic.h: No such file or directory

compilation terminated.

Multiple libraries were found for "RH_ASK.h"

 Used: C:\Users\acer\Documents\Arduino\libraries\SparkFun_RadioHead_Arduino_Library-master

 Not used: C:\Program Files\Arduino\hardware\teensy\avr\libraries\RadioHead

Using library SparkFun_RadioHead_Arduino_Library-master at version 1.4.2 in folder: C:\Users\acer\Documents\Arduino\libraries\SparkFun_RadioHead_Arduino_Library-master 

Using library SPI at version 1.0 in folder: C:\Program Files\Arduino\hardware\teensy\avr\libraries\SPI 

Error compiling for board Teensy LC.


i am not at advance level about coding. please reply how to fix it.
Please also notice ,

Serial.println ();

function is not used in library's Receiver Example code. how to see recieved DATA in serial monitor.
i want set both board to Recieve Data from RF Module one by one . please check how it can be solve step by step.
thank you .......

You should not need to do that. The constructor allows picking the pins to use.

No, it means you made some lights blink. Yes, the library successfully started up, but it would do with nothing connected at all - it has no idea if you even have a TX moduke there, or if there is one whether it is functioning or not.

Consider leaving the real radio set off to the side and get both examples and your sketches to work using a wire between the two Arduino boards.

Note: if one of them is 5 volt logic and the other is 3.3 volt, you will need to do level translation, not just use a plain wire from the TX pin on one side to RX pin on the other.

Still better than using a radio set you aren't sure even works.

Have you tried to get the simple examples in the library to function? All the way to just using the default pins, worry about that constructor later.

a7

Thank you alto777,
If "RF_ASK.h" shouldn't be edit. How to set pin A1 for tx pin ??

Both board can't be connected before uploading sketch. Please tell, what is error?? How to fix it??

When error will be fix. How should be wiring sender_board to receiver_board.
As sender_board_tx to receiver_board_rx.
Is there need to connect gnd to gnd. 5v to 5v etc???
Thank you.

Have you tried getting examples you do not alter, not even the pins? Exact examples. Worry about the pin assignment later.

Do that, and post both sketches. Try it with a wire as described above, below and elsewhere on the internet. Try it with your radio set. Report the results.

When you use the radio set, separate the transmitter and receiver by two meters or more.

Use the full constructor. Here's what I see, check the documentation.

#include <RH_ASK.h>
RH_ASK driver(2000, 10, 12, 11);

Run two instances of the IDE, one for each Arduino board.


Wire a common ground. Wire TX on the transmitter to RX on the receiver. Do not connect the Vcc (5 volts and/or 3.3 volts) of the two boards to each other.

Note: if one of them is 5 volt logic and the other is 3.3 volt, you will need to do level translation, not just use a plain wire from the TX pin on one side to RX pin on the other.

HTH

a7

Thank you all of you seniors experts.
I did simple experiment of rh 12 yrs ago. ButToday I am very confused about it. I seemed, I should start New topic with simple experiment. So no need to reply this post. I will ask in new topic from beginning. Thank you....
Don't reply please...

Don't start a new thread, you'll just make ppl tell you all the same advices again.

a7

1 Like

Thank you again all of you.
I got solved my issue. I got a library from below link
RF communication
It has compatible to RF 433 mhz module with all Arduino board. Ability to change Rx pin Tx pin. with help of this , I can send data from A1 pin of Arduino mega 2560 pro to any pin of Teensy LC board. For details you can click on above link. Again thank you. Nice to talk you, :green_heart::green_heart::green_heart::green_heart:

Nice work.

VirtualWire is like one blade off the Swiss Army knife which is RadioHead.

VirtualWire works on a very low level, as does RH_ASK when used in RadioHead.

The advantage of RadioHead is its ability to use a wider range of radio moduke sets. If you are using ASK 433 modules, VirtualWire is a perfect choice.

Simple ASK is also not that hard to directly code, similar to software serial code, but you would learn quite a bit about how those modules must be used to get the best reception.

a7