I am creating an Air Quality Monitoring System. I am using Arduino Uno to control my relay, fan, and PM Sensor. The RAK3172 will be my LoRa module to connect it to TTN. My problem is that my Arduino and RAL3172 are not communicating. Can you help me with the code for this please? I am not familiar with RAK.
(1) As far as I know, the Arduino UNO has 5V signal level on its UARTS. The RAK3172 is a 3.3V device, so you need logic level shifters between the two.
(2) For communication using AT commands, you can have a look at the RUI3-Arduino-Library, which provides some Arduino code examples.
Thank you! And one more thing. I just noticed that if I change the baud rate of RAK3172, it does not save. so everytime I remove the device it goes back to the default. i think this is the reason why my Arduino uno and RAK3172 are not communicating. BTW, I am using 3.4.11 ver
I already updated the firmware to v4.2.1. the rak is able to join the TTN and I successfully changed the baud rate to 9600. however the arduino is still not communicating with the RAK. This is my sample code.
#include <SoftwareSerial.h>
// D11 = RX (Arduino reads from RAK TX)
// D10 = TX (Arduino writes to RAK RX)
SoftwareSerial rakSerial(11, 10);
void setup() {
Serial.begin(9600); // Serial Monitor
rakSerial.begin(9600); // Communication with RAK
delay(2000); // Give RAK time to power up
Serial.println(“Sending AT…”);
rakSerial.print(“AT\r\n”); // Send AT command with proper line endings
}
void loop() {
// Read replies from RAK
if (rakSerial.available()) {
char c = rakSerial.read();
Serial.write(c); // Show it in Serial Monitor
}
}
The Evaluation Board is using the USB port for AT command communication. The RX0/TX0 UART cannot be used for AT command communication.
For your application it would be better to use the RAK3272 Breakout Board. This has the UART2 on the pin headers to communicate with a host MCU like your Arduino UNO.
The RAK3172 can do all the stuff you want to do with a custom application written with ArduinoIDE.
We have the RUI3 API, which is a Arduino BSP and allows you to write custom firmware for the RAK3172. The RUI3 API includes the complete LoRa P2P and LoRaWAN communication functionality. RUI3 API includes as well the full AT command interface.
We have a lot of example code for sensors, relays and other actuators in our RUI3 Best Practices.
sensor modules for the sensor type you want to collect WisBlock Sensors
If you have all external components already, you can try to use the IO Module RAk13001. But keep in mind, the GPIO’s of the RAK3172 have a limited output current and are 3.3V level only. You cannot control a relay directly with them.
It depends.
If your relays can be controlled with 3.3V they could work.
I don’t know the PMS5003, what kind of sensor is it and what interface does it have?