How to use RX TX ??
Moderators: lily.li, violet, seth.welday
How to use RX TX ??
Hi,
I have a WIO GPS board, and would like to use RX TX for a RDM6300 RFID scanner
when I use the RDM6300 with a standard arduino it works just fine... I can declare Digital pins as RX TX and it works
like this for eg:
#include <SoftwareSerial.h>
#include "RDM6300.h"
SoftwareSerial rdm_serial(10, 11);
RDM6300<SoftwareSerial> rdm(&rdm_serial);
int led_pin = 13;
void setup()
{
pinMode(led_pin, OUTPUT);
digitalWrite(led_pin, LOW);
Serial.begin(115200);
Serial.println("SETUP");
blink(5);
}
void loop()
{
static const unsigned long long my_id = 0x0000ABCDEF;
static unsigned long long last_id = 0;
last_id = rdm.read();
Serial.print("RFID: 0x");
rdm.print_int64(last_id);
Serial.println();
}
Can I do the same with the WIO ? I tried the SerialUSB.begin iso serial.begin but no luck.
I tried using the UART port but no success on tx rx, no data received ?
of course I activated the #define GrovePowerPin 12
what can I do ?
thanks for your support
jean-Louis
I have a WIO GPS board, and would like to use RX TX for a RDM6300 RFID scanner
when I use the RDM6300 with a standard arduino it works just fine... I can declare Digital pins as RX TX and it works
like this for eg:
#include <SoftwareSerial.h>
#include "RDM6300.h"
SoftwareSerial rdm_serial(10, 11);
RDM6300<SoftwareSerial> rdm(&rdm_serial);
int led_pin = 13;
void setup()
{
pinMode(led_pin, OUTPUT);
digitalWrite(led_pin, LOW);
Serial.begin(115200);
Serial.println("SETUP");
blink(5);
}
void loop()
{
static const unsigned long long my_id = 0x0000ABCDEF;
static unsigned long long last_id = 0;
last_id = rdm.read();
Serial.print("RFID: 0x");
rdm.print_int64(last_id);
Serial.println();
}
Can I do the same with the WIO ? I tried the SerialUSB.begin iso serial.begin but no luck.
I tried using the UART port but no success on tx rx, no data received ?
of course I activated the #define GrovePowerPin 12
what can I do ?
thanks for your support
jean-Louis
Re: How to use RX TX ??
Hi jean-Louis
We tested the UART and softwareSerial and both of them work well.
The following code shows how to use Grove UART port:
#define GrovePowerPin 12
void setup() {
pinMode(GrovePowerPin, OUTPUT);
digitalWrite(GrovePowerPin, HIGH); //power Grove
//SerialUSB.begin(115200);
SerialDBG.begin(115200); //set Grove UART baud rate 115200
}
void loop() {
//SerialUSB.println("Grove UART is sending message");
SerialDBG.println("This is Grove UART");
delay(1000);
}
D2, D4, A0, A2 also can be used for SoftwareSerial port.
#define GrovePowerPin 12
#include <SoftwareSerial.h>
SoftwareSerial ser_serial(A0,A1);
void setup() {
pinMode(GrovePowerPin, OUTPUT);
digitalWrite(GrovePowerPin, HIGH); //power Grove
ser_serial.begin(9600); /t Grove UART baud rate 115200
}
void loop() {
ser_serial.println("This is Grove UART");
delay(1000);
}
Seeed techsupport team
Bill
We tested the UART and softwareSerial and both of them work well.
The following code shows how to use Grove UART port:
#define GrovePowerPin 12
void setup() {
pinMode(GrovePowerPin, OUTPUT);
digitalWrite(GrovePowerPin, HIGH); //power Grove
//SerialUSB.begin(115200);
SerialDBG.begin(115200); //set Grove UART baud rate 115200
}
void loop() {
//SerialUSB.println("Grove UART is sending message");
SerialDBG.println("This is Grove UART");
delay(1000);
}
D2, D4, A0, A2 also can be used for SoftwareSerial port.
#define GrovePowerPin 12
#include <SoftwareSerial.h>
SoftwareSerial ser_serial(A0,A1);
void setup() {
pinMode(GrovePowerPin, OUTPUT);
digitalWrite(GrovePowerPin, HIGH); //power Grove
ser_serial.begin(9600); /t Grove UART baud rate 115200
}
void loop() {
ser_serial.println("This is Grove UART");
delay(1000);
}
Seeed techsupport team
Bill
Re: How to use RX TX ??
I must do something wrong ...
on arduino leonardo this works with my rfid reader (RDM6300)
#include <SoftwareSerial.h>
SoftwareSerial RFID(2, 3); // RX and TX
int i;
void setup()
{
RFID.begin(9600); // start serial to RFID reader
Serial.begin(9600); // start serial to PC
}
void loop()
{
if (RFID.available() > 0)
{
i = RFID.read();
Serial.print(i, DEC);
Serial.print(" ");
}
}
now if I use it with WIO on digital ping 4,5, following your example I do :
#define GrovePowerPin 12
#include <SoftwareSerial.h>
SoftwareSerial ser_serial(4,5); // RX and TX
int i;
void setup()
{
pinMode(GrovePowerPin, OUTPUT);
digitalWrite(GrovePowerPin, HIGH); //power Grove
ser_serial.begin(9600); // start serial to RFID reader
//SerialUSB.begin(9600); // start serial to PC
}
void loop()
{
if (ser_serial.available() > 0)
{
i = ser_serial.read();
ser_serial.print(i, DEC);
}
}
but nothing received, what do I miss ?!
thanks,
on arduino leonardo this works with my rfid reader (RDM6300)
#include <SoftwareSerial.h>
SoftwareSerial RFID(2, 3); // RX and TX
int i;
void setup()
{
RFID.begin(9600); // start serial to RFID reader
Serial.begin(9600); // start serial to PC
}
void loop()
{
if (RFID.available() > 0)
{
i = RFID.read();
Serial.print(i, DEC);
Serial.print(" ");
}
}
now if I use it with WIO on digital ping 4,5, following your example I do :
#define GrovePowerPin 12
#include <SoftwareSerial.h>
SoftwareSerial ser_serial(4,5); // RX and TX
int i;
void setup()
{
pinMode(GrovePowerPin, OUTPUT);
digitalWrite(GrovePowerPin, HIGH); //power Grove
ser_serial.begin(9600); // start serial to RFID reader
//SerialUSB.begin(9600); // start serial to PC
}
void loop()
{
if (ser_serial.available() > 0)
{
i = ser_serial.read();
ser_serial.print(i, DEC);
}
}
but nothing received, what do I miss ?!
thanks,
-
- Staff
- Posts: 200
- Joined: Tue Apr 17, 2018 11:03 am
Re: How to use RX TX ??
Hi, if you use the software serial port to communicate with the sensor., you have to use the SerialDBG hardware serial port to print the message to PC terminal. thanks.
Seeed techsupport team
Bill
Seeed techsupport team
Bill
Re: How to use RX TX ??
Hi,
despite all your support and advices, I can't get it working, it might be the board or me ,but there is something wrong.
I'm stuck, could show me a code that would work with a device like this one ?
http://wiki.seeedstudio.com/Grove-125KHz_RFID_Reader/
thanks,
despite all your support and advices, I can't get it working, it might be the board or me ,but there is something wrong.
I'm stuck, could show me a code that would work with a device like this one ?
http://wiki.seeedstudio.com/Grove-125KHz_RFID_Reader/
thanks,
Re: How to use RX TX ??
Hi, I do not have a tag, so i can't test it. please test it and let us know if the issue is solved. thanks.
#define GrovePowerPin 12
#include <SoftwareSerial.h>
SoftwareSerial SoftSerial(A0,A1);
unsigned char buffer[64]; // buffer array for data receive over serial port
int count = 0; // counter for buffer array
void setup()
{
pinMode(GrovePowerPin, OUTPUT);
digitalWrite(GrovePowerPin, HIGH); //power Grove
SoftSerial.begin(9600); // Grove UART baud rate 9600
SerialDBG.begin(9600); // the Serial port of Arduino baud rate.
}
void loop()
{
// if date is coming from software serial port ==> data is coming from SoftSerial shield
if (SoftSerial.available())
{
while(SoftSerial.available()) // reading data into char array
{
buffer[count++] = SoftSerial.read(); // writing data into array
if(count == 64)break;
}
SerialDBG.write(buffer, count); // if no data transmission ends, write buffer to hardware serial port
clearBufferArray(); // call clearBufferArray function to clear the stored data from the array
count = 0; // set counter of while loop to zero
}
if (SerialDBG.available()) // if data is available on hardware serial port ==> data is coming from PC or notebook
SoftSerial.write(SerialDBG.read()); // write it to the SoftSerial shield
}
void clearBufferArray() // function to clear buffer array
{
// clear all index of array with command NULL
for (int i=0; i<count; i++)
{
buffer=NULL;
}
}
best rgds
Bill
#define GrovePowerPin 12
#include <SoftwareSerial.h>
SoftwareSerial SoftSerial(A0,A1);
unsigned char buffer[64]; // buffer array for data receive over serial port
int count = 0; // counter for buffer array
void setup()
{
pinMode(GrovePowerPin, OUTPUT);
digitalWrite(GrovePowerPin, HIGH); //power Grove
SoftSerial.begin(9600); // Grove UART baud rate 9600
SerialDBG.begin(9600); // the Serial port of Arduino baud rate.
}
void loop()
{
// if date is coming from software serial port ==> data is coming from SoftSerial shield
if (SoftSerial.available())
{
while(SoftSerial.available()) // reading data into char array
{
buffer[count++] = SoftSerial.read(); // writing data into array
if(count == 64)break;
}
SerialDBG.write(buffer, count); // if no data transmission ends, write buffer to hardware serial port
clearBufferArray(); // call clearBufferArray function to clear the stored data from the array
count = 0; // set counter of while loop to zero
}
if (SerialDBG.available()) // if data is available on hardware serial port ==> data is coming from PC or notebook
SoftSerial.write(SerialDBG.read()); // write it to the SoftSerial shield
}
void clearBufferArray() // function to clear buffer array
{
// clear all index of array with command NULL
for (int i=0; i<count; i++)
{
buffer=NULL;
}
}
best rgds
Bill
Re: How to use RX TX ??
I connected the device like this
https://www.dropbox.com/s/2fv91i8quut1t ... 2.JPG?dl=0
code uploaded successfully
https://www.dropbox.com/s/ruwuc0zcvbu4f ... l.png?dl=0
unfortunately nothing move
jean-louis
https://www.dropbox.com/s/2fv91i8quut1t ... 2.JPG?dl=0
code uploaded successfully
https://www.dropbox.com/s/ruwuc0zcvbu4f ... l.png?dl=0
unfortunately nothing move

jean-louis
Re: How to use RX TX ??
Hi jean-Louis
1. I see the white wire is removed from the Grove interface. We do need it for the software serial.
2. for the tag, do you use the correct tag?
thanks
Bill
1. I see the white wire is removed from the Grove interface. We do need it for the software serial.
2. for the tag, do you use the correct tag?
thanks
Bill
-
- Pre-kindergarten
- Posts: 3
- Joined: Mon Aug 13, 2018 6:09 pm
Re: How to use RX TX ??
Can you tell me how this should be connected on an arduino mega?
Ground and VCC I understand, but to what pin should the Grove RX (white cable) and Grove TX (yellow cable go to on the arduino mega?
Re: How to use RX TX ??
HI,
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, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).
For more info about the software serial, please refer to https://www.arduino.cc/en/Reference/SoftwareSerial thanks.
Bill
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, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).
For more info about the software serial, please refer to https://www.arduino.cc/en/Reference/SoftwareSerial thanks.
Bill