question

eathan-northwood avatar image
eathan-northwood asked

How do I use the VE.Direct pins with a raspberry pi(running pi os) and read the data using python?

i was wondering if it is possible to read data from the VE.Direct pins with my raspberry pi pins, and python. I want to use raspberry pi OS, and not the Victron OS. is this possible?

VE.Direct Bluetooth Smart Donglepython
1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

kevgermany avatar image kevgermany ♦♦ commented ·
@eathan northwood

Moved to modifications space.

0 Likes 0 ·
1 Answer
von-baron avatar image
von-baron answered ·

Simple answer is yes, this is not uncommon.

But, care needs to be taken around any common mode voltages that differ between your VE.Direct device and the RPi.

What you should do, is to place an isolator in between the two, so that there can not be any voltage differences, say between the zero volt lines.

As I understand it, most if not all VE.Direct ports do not have any or very much in the way of protection before the CPU.

So, now it depends if you are thinking of using serial over USB or plain async TTL between the two ?

There can be issues with USB, in that if at any time a serial connection becomes broken, say some data corruption, then generally, a serial over USB connection will remain disconnected. You don't get this with async TTL.

With USB, make sure you have the correct USB interface voltage on the TTL side. Often they provide a jumper for selecting 3.3V or 5.0V.

I have on a plane somewhere from Italy a nice little board that has 4 isolated TTL ports into a single USB port on its way. It even can come with the same JST connectors used for VE.Direct.

This allows you to then use a single USB port to then communicate with up to 4 async TTL devices, and in my case these will be SmartShunt, MPPT controller and RS 48| 6000 inverter. The 4th port will go to my own design BMS.

Like you, I do not use VenusOS and also do use RPi, but use Python to create a full SCADA application which does the lot. It's a lot of fun, so go for it :)

1674256095607.jpeg


1674256095607.jpeg (243.0 KiB)
4 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

eathan-northwood avatar image eathan-northwood commented ·
Thanks that board should be very useful. Would I be able to connect the VE.Direct straight up to my gpio pins? If I can how would I read the async ttl data, and read imput voltage?
0 Likes 0 ·
von-baron avatar image von-baron eathan-northwood commented ·

Well, firstly, you meed to know the TTL voltage of your Victron device, you did not mention what it was. Some are 3.3V and most are 5V and I understand all new devices will be 5V. Your RPi will be 3.3V, so the answer is no, if your Victron device is 5V.

Regarding gpio pin, you would need to assign an available async port. You would not use plain gpio, you need to use the on chip uart to do the decode and encode of serial async data. I guess there will be one available on the RPi pin header, but as I mentioned, I don't use these boards, I don't trust or rely on them. I prefer industrial spec'd boards, my system is too important to risk it. In my opinion, the RPi is a learning device, not open source and not that cheap either.

Maybe look for a RPi hat that gives you a nice buffered async port.

Or use the board liek I mentioned above.

You can try a simple USB to TTL converter board, I think these days you can almost buy them from your corner fish and chip store :)

Using an async port, and using Python, you simply connect to the communications port and capture the data and then with it as you please.

Install a little communications program to get you going first, such as tio it is very useful and once connected to the victron device the data will be displayed. From this you will learn the format of the data, simple text data.

Then in Python you can build your program to decode and do what ever with the data, such as store to a file or db and to watch for maximum and minimum data. The possibilities are plenty.

Check in the Victron site for technical data on the VE.Direct protocol, It is best that you search for it and look at other documents as well and read and learn rather.

Important things are to not assume anything in electronics as mentioned above with voltages, make certain. Also, learning a little of electronics in a project like this is worthwhile if you do not already know a lot.

Also, learn about GNU/Linux, in particular Debian, which is the basis of what is running on your RPi I am sure. Learn the command line in GNU/Linux, it is quite amazing what you can do and fast too.


0 Likes 0 ·
Michelle Konzack avatar image Michelle Konzack commented ·
I am interested in this board.

Please can you brovide more Infos?

Especially where you have bought it?

Thankyou


0 Likes 0 ·
von-baron avatar image von-baron Michelle Konzack commented ·

Hi Michelle, sure, it is from Duppa in Italy,

The Link is this: Isolated 4 port USB to TTL UART FTDI

Mine should arrive here in the next week I guess.

My brother in law bought one for his GX to connect various VE.Direct devices after having some issues with using non isolated connections before. Now he is very happy and it all works for him.

Since I will use it on my own system, Olimex Micro running Armbian GNU/Linux and software that I write in Python, it will work equally as well I expect. I do have dedicated TTL ports available on the Olimex which I could use, but I decided to keep those ports free for other serial connections such as RS-485 to things like a weather station and other future projects to connect back into my control system.

Hope it can work for you too :)

0 Likes 0 ·

Related Resources

Additional resources still need to be added for this topic