EXO 3s sonde
-
Hello ,
I am working with EXO 3s sonde and I need to program it on qtcreator, but there is no SDK for communicating with an EXO sonde.In order to connect the sonde to any third party device you would have to use either the SDI-12 or RS232 interfaces which will give you ways to get data from the instrument.
Data output over RS232 would show as strings of comma separated values.
When data comes back using SDI-12 the string will always start with the SDI-12 address that the sonde is set to followed by the data. The values are separated by either a + or – depending on if the values is positive or negative.
My question please : Has anyone worked with EXO 3s sonde on Qt creator and been able to recover the different data and parameters.
Best regards
-
Hi,
I haven't worked with that particular device but since it can use RS232, you can use the QSerialPort class to communicate with it.
Note that Qt Creator is just an IDE. It knows nothing about such devices, that is for your application to implement.
-
Hi,
I haven't worked with that particular device but since it can use RS232, you can use the QSerialPort class to communicate with it.
Note that Qt Creator is just an IDE. It knows nothing about such devices, that is for your application to implement.
@SGaist
Thank you for your reply, i wrote this code but it dosen't work, can you help me please :#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QSerialPort>
#include <QSerialPortInfo>
#include <string>
#include <QDebug>
#include <QMessageBox>MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
sonde = new QSerialPort(this);
serialBuffer = "";
parsed_data = "";
sonde_value = 0.0;
bool sonde_is_available = false;
QString sonde_uno_port_name;
//
// For each available serial port
foreach(const QSerialPortInfo &serialPortInfo, QSerialPortInfo::availablePorts()){
// check if the serialport has both a product identifier and a vendor identifier
if(serialPortInfo.hasProductIdentifier() && serialPortInfo.hasVendorIdentifier()){
// check if the product ID and the vendor ID match those of the sonde
if((serialPortInfo.productIdentifier() == sonde_uno_product_id)
&& (serialPortInfo.vendorIdentifier() == sonde_uno_vendor_id)){
sonde_is_available = true;
sonde_uno_port_name = serialPortInfo.portName();
}
}
}
if(sonde_is_available){
qDebug() << "Found the sonde port...\n";
sonde->setPortName(sonde_uno_port_name);
sonde->open(QSerialPort::ReadOnly);
sonde->setBaudRate(QSerialPort::Baud9600);
sonde->setDataBits(QSerialPort::Data8);
sonde->setFlowControl(QSerialPort::NoFlowControl);
sonde->setParity(QSerialPort::NoParity);
sonde->setStopBits(QSerialPort::OneStop);
QObject::connect(sonde, SIGNAL(readyRead()), this, SLOT(readSerial()));
}else{
qDebug() << "Couldn't find the correct port for the sonde.\n";
QMessageBox::information(this, "Serial Port Error", "Couldn't open serial port to sonde.");
}
}MainWindow::~MainWindow()
{
if(sonde->isOpen()){
sonde->close(); // Close the serial port if it's open.
}
delete ui;
}
void MainWindow::readSerial()
{QStringList buffer_split = serialBuffer.split(","); // split the serialBuffer string, parsing with ',' as the separator serialBuffer = ""; qDebug() << buffer_split << "\n"; parsed_data = buffer_split[1]; sonde_value = parsed_data.toDouble(); qDebug() << sonde_value << "\n"; }
.h :
QSerialPort *sonde;
static const quint16 sonde_uno_vendor_id = 1027;
static const quint16 sonde_uno_product_id = 24577;
QByteArray serialData;
QString serialBuffer;
QString parsed_data;
double sonde_value;Result :Found the sonde port...
But there is no data -
You might have to set the connection parameters (baudrate, parity, etc.) before you open the port. Check the return value of the
open()
call to see if it succeeded. Like @SGaist, I'm not familiar with this device either, do you have to send a request to it to get data back? Should you be opening it ReadWrite mode instead of ReadOnly? Are you able to communicate with it with another terminal application? -
@SGaist
Thank you for your reply, i wrote this code but it dosen't work, can you help me please :#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QSerialPort>
#include <QSerialPortInfo>
#include <string>
#include <QDebug>
#include <QMessageBox>MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
sonde = new QSerialPort(this);
serialBuffer = "";
parsed_data = "";
sonde_value = 0.0;
bool sonde_is_available = false;
QString sonde_uno_port_name;
//
// For each available serial port
foreach(const QSerialPortInfo &serialPortInfo, QSerialPortInfo::availablePorts()){
// check if the serialport has both a product identifier and a vendor identifier
if(serialPortInfo.hasProductIdentifier() && serialPortInfo.hasVendorIdentifier()){
// check if the product ID and the vendor ID match those of the sonde
if((serialPortInfo.productIdentifier() == sonde_uno_product_id)
&& (serialPortInfo.vendorIdentifier() == sonde_uno_vendor_id)){
sonde_is_available = true;
sonde_uno_port_name = serialPortInfo.portName();
}
}
}
if(sonde_is_available){
qDebug() << "Found the sonde port...\n";
sonde->setPortName(sonde_uno_port_name);
sonde->open(QSerialPort::ReadOnly);
sonde->setBaudRate(QSerialPort::Baud9600);
sonde->setDataBits(QSerialPort::Data8);
sonde->setFlowControl(QSerialPort::NoFlowControl);
sonde->setParity(QSerialPort::NoParity);
sonde->setStopBits(QSerialPort::OneStop);
QObject::connect(sonde, SIGNAL(readyRead()), this, SLOT(readSerial()));
}else{
qDebug() << "Couldn't find the correct port for the sonde.\n";
QMessageBox::information(this, "Serial Port Error", "Couldn't open serial port to sonde.");
}
}MainWindow::~MainWindow()
{
if(sonde->isOpen()){
sonde->close(); // Close the serial port if it's open.
}
delete ui;
}
void MainWindow::readSerial()
{QStringList buffer_split = serialBuffer.split(","); // split the serialBuffer string, parsing with ',' as the separator serialBuffer = ""; qDebug() << buffer_split << "\n"; parsed_data = buffer_split[1]; sonde_value = parsed_data.toDouble(); qDebug() << sonde_value << "\n"; }
.h :
QSerialPort *sonde;
static const quint16 sonde_uno_vendor_id = 1027;
static const quint16 sonde_uno_product_id = 24577;
QByteArray serialData;
QString serialBuffer;
QString parsed_data;
double sonde_value;Result :Found the sonde port...
But there is no data@micheal15 said in EXO 3s sonde:
it dosen't work
For the future: please take minute to specify what exactly does not work...
-
@micheal15 said in EXO 3s sonde:
it dosen't work
For the future: please take minute to specify what exactly does not work...
-
@micheal15 So, start to debug your app.
Doessonde->open(QSerialPort::ReadOnly);
succeed? Please add error handling to your app and please use code tags - your code is hard to read.