Connecting npk sensor to arduino pro mini

Hello!

How do I connect my npk sensor to arduino pro mini using this converter module?

is there a ttl to rs485 module, like MAX485, with a working voltage of 3.3V?

the board of post 1 looks like RS485 3V3 board with Auto Transmit/Receive Switching Control
it has the advantage you don't have to change over from receive to transmit when transmitting - it is automatic

works OK on a Arduino Pro Mini 3V3 8MHz (pin 8 and 9) communicating with a USB-RS485 dongle on a PC using the following code which uses the AltSoftSerial library

// Arduino pro mini AltSoftSerial test using pin 8 Rx and 9 Tx
// note Serial baudrate is 57600 (115200 give problems)

// works with RS485 board with Auto Transmit/Receive Switching Control 
// e.g. https://quartzcomponents.com/products/rs485-ttl-module-with-protection-auto-transmit-receive-switching

#include <AltSoftSerial.h>

// pro mini RX pin 8
// pro mini TX pin 9

AltSoftSerial simSerial;

void setup() {
  Serial.begin(57600);    // on pro mini 115200 gives problems ???
  Serial.println("AltSoftSerial test pro mini pin 8 Rx and 9 Tx");
  simSerial.begin(9600);
}

void loop() {
  if (Serial.available()) {
    char command = Serial.read();
    //Serial.println(command);
    simSerial.print(command);
  }
  while (simSerial.available()) {
    char reponse = simSerial.read();
    Serial.print(reponse);
  }
}

pro mini serial output

AltSoftSerial test pro mini pin 8 Rx and 9 Tx
hello from PC 
pc test 1234567890

PC terminal emulator output

hello from Pro Mini

pro mini test 2 1234567890
1 Like

so i could use this module to interface my npk sensor with pro mini?

My two cents.
I have had problems with the modules that have autodetect.
Worked with some devices not others, had problems at higher bitrates. seemed more prone to noise issues

try it - I would suggest you get a USB-RS485 dongle to carry out some initial tests to check it works then connect your npk sensor

comments by @jim-p are interesting - never tried this particular module with anything complex such as Modbus
when transmitting data from remote sensors using RS485 always ended up building custom PCB with microcontroller and sensor pus RS485 interface and implementing own protocol

Why do you need 3.3V?
Are you using the 3.3V 8MHz pro mini?

yes

Do you know if your NPK sensor will work with RS485 at 3.3V?
If not, then it will be best to use a 5V module with voltage translators.
Also use a module that has enable pins for the Driver and Receiver.

is it okay to connect the 5v module to arduino pro mini?

You can connect DI, DE, and RE directly to the pro mini.
You need to connect RO through a voltage divider as shown below
However the baud rate should not be more than 9600.
image

1 Like

Have you tried the RS485 module of post 1? any results?
it is worth getting a USB-RS485 dongle for a PC - it can be useful for monitoring the RS485 data flows and performing simple tests such as that in post 3

1 Like

i haven’t tried it yet im still waiting for the module to arrive. btw, is this the usb rs485 dongle for pc?

looks like it - when plugged in it should create a COM port which displays the RS485 data using a terminal emulator (I use TeraTerm but there many more)

1 Like

hi! i already have the RS485 3V3 board. i'm having difficulties with connecting it, could you please help me :frowning:

both the vcc pins on my pro mini is already occupied since i connected it with the sx1276 lora chip and i also power it up using arduino uno (connected to a battery) for wireless comm.

for a start I would test the RS485 module with the pro mini without anything else connected to it
e.g. using program of 3 connect
pro mini VCC to RS485 VCC 3.3V
pro mini GND to RS485 GND
pro mini pin D8 to RS484 RXD
pro mini pin D9 to RS485 TXD

connect RS485 A/B to USB/RS485 A/B

plug the USB-RS485 module into a PC creates a COM port
connect a terminal emulator to the COM port
information entered on the pro mini keyboard should appear on the terminal emulator etc etc

photo

once you know the TTL-RS485 module works you can start connecting and testing the rest of the system

be careful what you attempt to power from the pro mini VCC
it only has a small regulator and you may overload it

could you post a complete schematic of the system circuit in particular show how you power it

here:

it is difficult to follow your wiring from the photo
can you post a hand drawn schematic?

do you have a USB-RS485 dongle to plug into your PC?
if so did you test the UNO and RS485-TTL module connected to the USB-RS485 dongle?
did it work OK?

this is the connection between pro mini and the sx1276:


in case of the arduino uno and pro mini, the 3.3V of arduino is connected to the other vcc terminal of pro mini.
i also haven't connected the npk sensor to the pro mini yet.

as for the USB-RS485 dongle i think i wont have enough time testing it since i havent bought it yet :((

looks OK - I assume it is working
next using separate programs

  1. test the npk sensor with a pro mini
  2. test the RS485 module with a pro mini

if they work OK start implementing a complete program