Newbie here.
I have purchased the Wisblock starter kit RAK19007+rak4630 Arduino and I want to use the TX1 and RX1 to connect my energy meter device that transmit data thru TTL.
I am able to read the data from the energy device using ESP 32/8266 nodemcu as the pin no is straight forward where to put the RX and TX.
My question is, is the RX1 and TX1 from RAK19007 under J10 headers available to use? if yes, what would be the PIN no definition in arduino?
Here is the sample code which I am using in exp32/8266
#include <PZEM004Tv30.h>
#include <SoftwareSerial.h>
int counter =0;
/* Use software serial for the PZEM
* Pin 11 Rx (Connects to the Tx pin on the PZEM)
* Pin 12 Tx (Connects to the Rx pin on the PZEM)
*/
#if !defined(PZEM_RX_PIN) && !defined(PZEM_TX_PIN)
#define PZEM_RX_PIN D11
#define PZEM_TX_PIN D12
#endif
SoftwareSerial pzemSWSerial(PZEM_RX_PIN, PZEM_TX_PIN);
PZEM004Tv30 pzem;
void setup() {
Serial.begin(115200);
pzem = PZEM004Tv30(pzemSWSerial);
}
void loop() {
Serial.print("Custom Address:");
Serial.println(pzem.readAddress(), HEX);
// Read the data from the sensor
float voltage = pzem.voltage();
float current = pzem.current();
float power = pzem.power();
float energy = pzem.energy();
float frequency = pzem.frequency();
float pf = pzem.pf();
// Check if the data is valid
if(isnan(voltage)){
Serial.println("Error reading voltage");
} else if (isnan(cur rent)) {
Serial.println("Error reading current");
} else if (isnan(power)) {
Serial.println("Error reading power");
} else if (isnan(energy)) {
Serial.println("Error reading energy");
} else if (isnan(frequency)) {
Serial.println("Error reading frequency");
} else if (isnan(pf)) {
Serial.println("Error reading power factor");
} else {
// Print the values to the Serial console
Serial.print("Voltage: "); Serial.print(voltage); Serial.println("V");
Serial.print("Current: "); Serial.print(current); Serial.println("A");
Serial.print("Power: "); Serial.print(power); Serial.println("W");
Serial.print("Energy: "); Serial.print(energy,3); Serial.println("kWh");
Serial.print("Frequency: "); Serial.print(frequency, 1); Serial.println("Hz");
Serial.print("PF: "); Serial.println(pf);
}
Serial.println();
delay(1000);
}