Hey, so I'm having some trouble with the APC220 module. I'm trying to get it to send the data that the arduino nano gets from a BMP280, and MQ135 and other sensors to a receiver thats connected to my pc. I'm using a software called CoolTerm to print the dat. The software connects to the module but it recieves no data, any ideas ? Do i need to make a loop that sends the data back to the receiver ?
These modules have a TTL UART interface. How did you connect that to the PC?
If you still have problems, provide a complete wiring diagram and complete code that shows the problem.
If no data is received, how do you know that?
So you know the serial baud rate setting of the APC220 modules?
Here is a sketch that you can use to see the settings of the modules and change as necessary.
/*
1
apc220.println("WR 433900 3 9 3 0");
To configure the APC220 you need to set the SET pin HIGH and then pull it down (set it to LOW).
This will put the module in configuration mode. Once it is in configuration mode you can write
the configuration to it as displayed in the above example.
The format is
WR Frequency RFDataRate OutputPower UART-Rate Series check
Possible values for all these settings:
Frequency: Unit is KHz,for example 434MHz is 434000
RF Data Rate: 1,2,3 and 4 refer to 2400,4800,9600,19200bps
Output Power: 0 to 9, 9 means 13dBm(20mW)
UART Rate: 0,1,2,3,4,5 and 6 refers to 1200,2400,4800,9600,19200,38400,57600bps
Series Checkout: Series checkout:0 means no check,1 means even parity,2 means odd parity.
*/
#include <SoftwareSerial.h>
/*
1 SET connected to Arduino pin 13
2 AUX not connected
3 TXD connected to pin 4
4 RXD connected to pin 7
5 EN not connected
6 VCC connected to 5V
7 GND connected to ground
*/
const int pinRX = 4;
const int pinTX = 7;
const int pinSET = 13;
SoftwareSerial apc220(pinRX, pinTX); // Crt softserial port and bind tx / rx to appropriate PINS
void setupSoftAPC(void)
{
pinMode(pinSET, HIGH);
apc220.begin(9600);
}
void setSettings(void)
{
digitalWrite(pinSET, LOW); // pulling SET to low will put apc220 in config mode
delay(10); // stabilize please
// apc220.println("WR 433900 3 9 3 0");
apc220.println("WR 433900 3 9 3 0"); // change ss baud rate
delay(10);
while (apc220.available())
{
Serial.write(apc220.read());
}
digitalWrite(pinSET, HIGH); // put apc220 back in operation
delay(200);
}
void getSettings(void)
{
digitalWrite(pinSET, LOW); // pulling SET to low will put apc220 in config mode
delay(10); // stabilize please
apc220.println("RD"); // ask for data
delay(10);
Serial.println("reading ");
while (apc220.available())
{
Serial.write(apc220.read());
}
digitalWrite(pinSET, HIGH); // put apc220 back in operation
delay(200);
}
void setup()
{
Serial.begin(9600);
setupSoftAPC();
setSettings();
getSettings();
}
void loop()
{
static unsigned long radioTimer = 0;
unsigned long radioInterval = 5000;
if (millis() - radioTimer >= radioInterval)
{
radioTimer = millis();
apc220.println("Hello World!");
}
if (apc220.available())
{
Serial.println(char(apc220.read()));
}
}
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.