Page 1 of 1

[PB 5.73 x64] with RS485 arduino interface question ...

Posted: Mon Jul 22, 2024 10:29 am
by marc_256
Hello all,


After a dip in my life, I needed and started a side project ...
Before I had have a fixed electricity price contract.
I received my new variable electricity contract and bill, #$%^@&*!, so I decided to install a DIY SOLAR installation.

And yes, I wanted to avoid programming, but I didn't succeed.

As there are a lot of different parts (hardware), I created a virtual control panel (see below) on my computer to control all these parts.
From Solar panels, accu's, chargers, converters, shunts, ...
I use a 10 inch (1920x1200 px) touch panel with a small SBC win10/x64 for visualization of the data.

So, all the parts have there own communication protocol,
the solution is to use +-10 local arduino modules/converters and one main controller to create a RS485 network to the main panel.
The signal converters are serial to RS485 modules.

I want to create my own communication protocol as PROFIBUS is to complicated for my application.
I like to send AC/DC - Volt/Frequency/Current/Temperatures of panels, accu's, chargers data ...


Is there someone here who builded some installation/protocol in use with WIN 10 / PB 5.73 x64 ?


Thanks,
Marc


PS: I have a very small webhosting volume, so the image can stay only for a few days, thanks.



Image

Re: [PB 5.73 x64] with RS485 arduino interface question ...

Posted: Tue Jul 23, 2024 9:16 am
by TassyJim
Hi,
I am working on something similar but much less ambitious.
My solar is a professional installation but because of the layout of my house wiring, the supplied monitoring is not very useful.
My power supplier provides hourly monitoring but not in real time so not much use either.

Currently I run the monitor program on an old XP laptop. I can work on the PB program on the main PC and FTP the exe over to the XP machine. Once it is working as well as I can get it, I will probably swap the XP laptop for a RPi to save a bit of power.
For a display, I create graphs using JavaScript and chart.js That saves me a lot of work and allows me to view the data on any device.

I have 5 remote modules using various micros similar to Arduino.
The links are over TCPIP and most of the data acquisition modules are hanging off RPi computers.

For a protocol, I treat all modules as slaves and they only transmit when requested.
The master sends $NNCMDXX where $ is the start of transmission, NN is the module ID number and CMD is the command. this is followed by a simple checksum, XX.
An end of line character is optional and the DA modules will complete the reception with a timeout.
The modules reply with an comma separated line of data in ASCII text. Plain text is preferred over HEX numbers because it can be easily read when debugging.

My feeling is a simple checksum is sufficient for a small networks with short cable runs. That also makes it easy for the DA modules to use.

Jim

Re: [PB 5.73 x64] with RS485 arduino interface question ...

Posted: Wed Jul 24, 2024 1:34 am
by marc_256
Hi Jim,

Thanks for your reaction,

With the RS485 I have only one communication channel (half-duplex),
so send and receive data on one channel.
For that I need a master and slave structure.

Software:
I need an Address/Data structure to send commands and wait for answer with data.
But every part in the chain have its own data structure/length.
So, I need to write a protocol for each part on the RS485 chain.
You are right, I think to use data in ASCII text also, very simple to debug my program...


Hardware:
I use an LattePanda Delta2, there is an Arduino (Leonardo) interface on the PCB.
So, this is easy-er to integrate the TTL serial to RS485 converter on the master side.


Thanks,
Marc