I would like to connect an RF Modem Module to my arduino. I will be hooking two of them up to communicate with each other. All i know is they talk via RX TX.
That RF module is 3.3V, and most Arduino boards are 5V.
You need to convert all signals between 3.3V and 5V or use a 3.3V Arduino board.
If RTS is pulled low, only RX and TX are used.
Which Arduino board do you have ? An Arduino Uno ? In that case, use the SoftwareSerial to create a software serial port.
connect both vcc to 3.3v, gnd to gnd both rts’s to gnd and the is my script:
/*
Software serial multple serial test
Receives from the hardware serial, sends to software serial.
Receives from software serial, sends to hardware serial.
The circuit:
* RX is digital pin 10 (connect to TX of other device)
* TX is digital pin 11 (connect to RX of other device)
Note:
Not all pins on the Mega and Mega 2560 support change interrupts,
so only the following can be used for RX:
10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69
Not all pins on the Leonardo support change interrupts,
so only the following can be used for RX:
8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).
created back in the mists of time
modified 25 May 2012
by Tom Igoe
based on Mikal Hart's example
This example code is in the public domain.
*/
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
SoftwareSerial mySerialb(12, 13); // RX, TX
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
Serial.println("Goodnight moon!");
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
mySerialb.begin(9600);
}
void loop() // run over and over
{
int a = random(0,1000);
mySerial.write(a);
Serial.print("rnd:");
Serial.print(a);
Serial.print("rcvd:");
Serial.println(mySerialb.read());
delay(100);
}
the output from the second one is always so i assume it isnt working correctly
The pins of the Arduino Uno are 0V or 5V, and I’m not sure if the RF module has 5V tolerant inputs.
According to the document of the RF module, any pin can have 5.8V or Vcc + 3.6V. So perhaps the pins are 5V tolerant.
I think it should be connected like this (I assume you have this already):
Arduino 3.3V to RF module Vcc
Arduino Pin 10 RX to the RF module TX pin.
Arduino Pin 11 TX to the RF module RX pin.
Arduino GND to RF module GND.
RF module RTS to GND.
A serial read() is only valid when there is something available().
Perhaps a sketch to type the command in the serial monitor. So you can type +++ to enter the configuration mode. I did not test the sketch below, but try to talk to the RF module.
// Not tested
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
SoftwareSerial mySerialb(12, 13); // RX, TX
void setup()
{
Serial.begin(9600);
Serial.println("Started");
Serial.println("Set the serial monitor for Carriage Return only");
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
mySerialb.begin(9600);
}
void loop() // run over and over
{
if( Serial.available() > 0)
{
byte dataPC = Serial.read();
mySerial.write (dataPC);
}
if( mySerial.available() > 0)
{
byte dataRF = mySerial.read();
Serial.write (dataRF);
}
}