# Inspired by Wildebus



## alwaysared (May 12, 2020)

After posting on here about the Victron Colour Controller Wildebus said it was possible to use a Raspberry Pi with two VE Direct to USB cables (for my BMV712 and M100/30 MPPT controller) and a MK3 VE Direct USB cable for my 12/3000/120-16 inverter/charger so this inspired me to try it out. So I purchased a Raspberry Pi 3 Model B+, a case and a 16gb Sandisk Micro SD card from Amazon for £44.18. I then followed a link on here to our sister site motorhomebuilder.com which in turn had a link and a picture explaining how to make your own VE Direct cables, so I bought a couple of USB to UART cables which cost me £6.99 and a pack of five four pin JST leads for £2.49, unfortunately for me they had different colour cables to the ones in the picture but I found out which pins were which on the MPPT and BMV. I followed the picture but it didn't work then I realised that the picture had a fundamental flaw! It shows the TxD on the USB going to the TxD on the JST plug and RxD on the USB going to the RxD on the JST, but it's obvious that this is the wrong way round! The RxD on the USB goes to the TxD on the JST and the TxD on the USB goes to the RxD on the JST, once I had switched them round it work okay and I already had the cable for my inverter/charger. So everything works as expected, I will probably keep looking on ebay for a Venus GX but until then the Pi is doing a decent job and the total cost was less than £60.00 which includes a 12v to 5v 3a step down to power the Pi. So a big thank you to Wildebus for the inspiration
Screenshot (fridge was on 240v to put some load on the inverter):




Next up is build a NAS for my music,movies and files  

Regards,
Del


----------



## Minisorella (May 12, 2020)

Del, you lost me at VE Direct but I'm well impressed anyway


----------



## st3v3 (May 12, 2020)

Looking good!



alwaysared said:


> I then followed a link on here to our sister site motorhomebuilder.com which in turn had a link and a picture explaining how to make your own VE Direct cables,



Bollox, I wish I had known about that before I bought them lol.

You should add to the other thread about this pinout being wrong.


----------



## wildebus (May 12, 2020)

alwaysared said:


> After posting on here about the Victron Colour Controller Wildebus said it was possible to use a Raspberry Pi with two VE Direct to USB cables (for my BMV712 and M100/30 MPPT controller) and a MK3 VE Direct USB cable for my 12/3000/120-16 inverter/charger so this inspired me to try it out. So I purchased a Raspberry Pi 3 Model B+, a case and a 16gb Sandisk Micro SD card from Amazon for £44.18. I then followed a link on here to our sister site motorhomebuilder.com which in turn had a link and a picture explaining how to make your own VE Direct cables, so I bought a couple of USB to UART cables which cost me £6.99 and a pack of five four pin JST leads for £2.49, unfortunately for me they had different colour cables to the ones in the picture but I found out which pins were which on the MPPT and BMV. I followed the picture but it didn't work then I realised that the picture had a fundamental flaw! It shows the TxD on the USB going to the TxD on the JST plug and RxD on the USB going to the RxD on the JST, but it's obvious that this is the wrong way round! The RxD on the USB goes to the TxD on the JST and the TxD on the USB goes to the RxD on the JST, once I had switched them round it work okay and I already had the cable for my inverter/charger. So everything works as expected, I will probably keep looking on ebay for a Venus GX but until then the Pi is doing a decent job and the total cost was less than £60.00 which includes a 12v to 5v 3a step down to power the Pi. So a big thank you to Wildebus for the inspiration
> Screenshot (fridge was on 240v to put some load on the inverter):
> View attachment 81514
> Next up is build a NAS for my music,movies and files
> ...


glad to been of help   and nice job with the DIY Cables!  I have never got round to trying to make my own, but YOUR success has now INSPIRED ME to give it a go


----------



## Fisherman (May 12, 2020)

alwaysared said:


> After posting on here about the Victron Colour Controller Wildebus said it was possible to use a Raspberry Pi with two VE Direct to USB cables (for my BMV712 and M100/30 MPPT controller) and a MK3 VE Direct USB cable for my 12/3000/120-16 inverter/charger so this inspired me to try it out. So I purchased a Raspberry Pi 3 Model B+, a case and a 16gb Sandisk Micro SD card from Amazon for £44.18. I then followed a link on here to our sister site motorhomebuilder.com which in turn had a link and a picture explaining how to make your own VE Direct cables, so I bought a couple of USB to UART cables which cost me £6.99 and a pack of five four pin JST leads for £2.49, unfortunately for me they had different colour cables to the ones in the picture but I found out which pins were which on the MPPT and BMV. I followed the picture but it didn't work then I realised that the picture had a fundamental flaw! It shows the TxD on the USB going to the TxD on the JST plug and RxD on the USB going to the RxD on the JST, but it's obvious that this is the wrong way round! The RxD on the USB goes to the TxD on the JST and the TxD on the USB goes to the RxD on the JST, once I had switched them round it work okay and I already had the cable for my inverter/charger. So everything works as expected, I will probably keep looking on ebay for a Venus GX but until then the Pi is doing a decent job and the total cost was less than £60.00 which includes a 12v to 5v 3a step down to power the Pi. So a big thank you to Wildebus for the inspiration
> Screenshot (fridge was on 240v to put some load on the inverter):
> View attachment 81514
> Next up is build a NAS for my music,movies and files
> ...



I have not got a clue what you are talking about, but it sounds like you know what wildebus is talking about, and that impresses the S—t out of me. Well done, sounds like you had lots of fun.


----------



## alwaysared (May 12, 2020)

wildebus said:


> glad to been of help  and nice job with the DIY Cables! I have never got round to trying to make my own, but YOUR success has now INSPIRED ME to give it a go



This is the picture I got off the internet for the MPPT Pin Outs, it's obviously the same for all of the Victron stuff using a VE Direct to USB cable.





The USB is as follows:

Red: +5V
Green: Tx
White : Rx
Black: GND
But you probably already know these.

Regards,
Del


----------



## alwaysared (May 12, 2020)

st3v3 said:


> You should add to the other thread about this pinout being wrong.



Good idea, I've just done that, the connections on the picture are actually correct, the guy has just wrote the JST ones the wrong way round  which of course wouldn't matter if you're lucky enough to get a JST plug with the same colours as his one 

Regards,
Del


----------



## QFour (May 12, 2020)

Surprising what you can get these little boards to do. I have an Audrino Uno connected to the fans that try and keep the fridge cool. It also has a temp sensor input. Checks the temp and switches fans on to half speed. It then waits 5 minutes and checks again. Stops the fan keep switching on and off. Above 40 degrees the fans run at full power. Three fans certainly get the temp down and half speed means you can hardly hear them.


----------



## alwaysared (May 12, 2020)

QFour said:


> Surprising what you can get these little boards to do. I have an Audrino Uno connected to the fans that try and keep the fridge cool. It also has a temp sensor input. Checks the temp and switches fans on to half speed. It then waits 5 minutes and checks again. Stops the fan keep switching on and off. Above 40 degrees the fans run at full power. Three fans certainly get the temp down and half speed means you can hardly hear them.



Care to share your set up details?

Regards,
Del


----------



## wildebus (May 12, 2020)

alwaysared said:


> This is the picture I got off the internet for the MPPT Pin Outs, it's obviously the same for all of the Victron stuff using a VE Direct to USB cable.
> 
> View attachment 81515
> 
> ...


I will be looking at this in more detail but I will throw in one comment now, based not on direct experience  (as not made the cables so far) but what I have read... there is something about the voltage that you need to be wary of?  USB is +5V and the VE.Direct is +3.3V? so you don't carry on the power line from end to end.
I'll see if I can find out what it is but something you may need to watch?


----------



## izwozral (May 12, 2020)

Minisorella said:


> Del, you lost me at VE Direct but I'm well impressed anyway



I was lost at Raspberry Pi, all I could think of was custard.

There some right clever peeps on here.


----------



## Minisorella (May 12, 2020)

Mmmmmm now I'm hungry...


----------



## alwaysared (May 12, 2020)

wildebus said:


> I will be looking at this in more detail but I will throw in one comment now, based not on direct experience  (as not made the cables so far) but what I have read... there is something about the voltage that you need to be wary of?  USB is +5V and the VE.Direct is +3.3V? so you don't carry on the power line from end to end.
> I'll see if I can find out what it is but something you may need to watch?



Sorry I should've pointed out that you don't connect the 5v + wire, this is also shown on the picture from motorhomebuilder.com.





Regards,
Del


----------



## st3v3 (May 12, 2020)

Hmm. I wonder what voltage the RX/TX lines get up to?


----------



## Asterix (May 12, 2020)

I finally understand....what a parallel universe is.


----------



## Fisherman (May 12, 2020)

Asterix said:


> I finally understand....what a parallel universe is.



That’s a doddle in comparison to post 1


----------



## RAW (May 13, 2020)

alwaysared said:


> I bought a couple of USB to UART cables which cost me £6.99 and a pack of five four pin JST leads for £2.49, unfortunately for me they had different colour cables to the ones in the picture but I found out which pins were which on the MPPT and BMV. I followed the picture but it didn't work then I realised that the picture had a fundamental flaw! It shows the TxD on the USB going to the TxD on the JST plug and RxD on the USB going to the RxD on the JST, but it's obvious that this is the wrong way round! The RxD on the USB goes to the TxD on the JST and the TxD on the USB goes to the RxD on the JST, once I had switched them round it work okay and I already had the cable for my inverter/charger. So everything works as expected, I will probably keep looking on ebay for a Venus GX but until then the Pi is doing a decent job and the total cost was less than £60.00 which includes a 12v to 5v 3a step down to power the Pi. So a big thank you to Wildebus for the inspiration


I did all this myself and never got my MPPT 100/30 and Raspberry Pi 3 to link up with the homemade cable scenario. Pretty sure I tried all the pin-out options at the time and concluded it was likely down to whatever extra components Victron use in their own USB cables



So just to confirm you have this working on a raspberry pi (if so which one?) using a homemade cable UART to USB connected to an MPPT controller OR connected to a BMV ? TBH I never tried it on the BMV I have  so hoemmade USB to UART may work with the BMV's but not the MPPT controllers ? Thanks @alwaysared , would also be interested in your arduino set-up if you have details of that anywhere.


----------



## Fisherman (May 13, 2020)

Victron Energy ASS030530010 Vedirect to USB Interface Cable for sale online | eBay
					

Find many great new & used options and get the best deals for Victron Energy ASS030530010 Vedirect to USB Interface Cable at the best online prices at eBay! Free delivery for many products!



					www.ebay.co.uk


----------



## RAW (May 13, 2020)

Cheaper at http://onboardenergydirect.co.uk/shop/ with the Motorhome discount code as found on
https://motorhomer.com/discounts/
If you want to buy new @Fisherman


----------



## wildebus (May 13, 2020)

RAW said:


> I did all this myself and never got my MPPT 100/30 and Raspberry Pi 3 to link up with the homemade cable scenario. Pretty sure I tried all the pin-out options at the time and concluded it was likely down to whatever extra components Victron use in their own USB cables
> View attachment 81547
> So just to confirm you have this working on a raspberry pi (if so which one?) using a homemade cable UART to USB connected to an MPPT controller OR connected to a BMV ? TBH I never tried it on the BMV I have  so hoemmade USB to UART may work with the BMV's but not the MPPT controllers ? Thanks @alwaysared , would also be interested in your arduino set-up if you have details of that anywhere.


He has the Pi Model B+ (is in the post  ).  That is the model I have favoured as it always seems to work 
He also has his home-made cables working on both BMV and MPPT, which is encouraging.  

I am curious about what is contained in that lump on the Victron cable as well. But it could be as simple as an encapsulated choke? Putting a meter end to end might reveal more?


----------



## Fisherman (May 13, 2020)

RAW said:


> Cheaper at http://onboardenergydirect.co.uk/shop/ with the Motorhome discount code as found on
> https://motorhomer.com/discounts/
> If you want to buy new @Fisherman



RAW, I don't even know what its for, its all gobbledygook to me, just trying to be helpful.


----------



## RAW (May 13, 2020)

Personally think all this is better off on the MHB site TBH and all resources can be in one place
Not sure if Phil @Geeky Philip could find a way to sort that out ?


----------



## wildebus (May 13, 2020)

I've just done a little search on Amazon for a USB Cable and I noticed quite a few were labelled with wording like "USB to TTL 3.3V" for example.  I wonder if within the USB plug there is some kind of componentry that is more suitable to using with a mismatched voltage requirement? When I tried briefly in the past to make up my own cable, I just used a standard lead I had lying around - a USB-A (The plug that goes into a computer or charger) to USB-micro (phone end) data lead, which has just end to end straight wires, and chopped the end off.  Might need "something" else besides?


----------



## st3v3 (May 13, 2020)

I'll go with it being the 3.3v isolation


----------



## alwaysared (May 13, 2020)

RAW said:


> I did all this myself and never got my MPPT 100/30 and Raspberry Pi 3 to link up with the homemade cable scenario. Pretty sure I tried all the pin-out options at the time and concluded it was likely down to whatever extra components Victron use in their own USB cables
> View attachment 81547
> So just to confirm you have this working on a raspberry pi (if so which one?) using a homemade cable UART to USB connected to an MPPT controller OR connected to a BMV ? TBH I never tried it on the BMV I have  so hoemmade USB to UART may work with the BMV's but not the MPPT controllers ? Thanks @alwaysared , would also be interested in your arduino set-up if you have details of that anywhere.


The answer is yes to everything, I've used a Raspberry Pi 3 Model B+ with a Sandisk Ultra 16Gb micro SD and the cables are homemade, it wasn't about cost (although I made two for less than a tenner) it was more to prove they can work and that the Pi is usable and so far they have and it is   

Regards,
Del


----------



## alwaysared (May 13, 2020)

wildebus said:


> I just used a standard lead I had lying around - a USB-A (The plug that goes into a computer or charger) to USB-micro (phone end) data lead, which has just end to end straight wires, and chopped the end off.  Might need "something" else besides?



The cables need to be "USB to UART" which converts the USB to a Comm port because the MPPT and BMV712 are a serial connection _*not* _USB.

Regards,
Del


----------



## SquirrellCook (May 13, 2020)

If you wanted the TTL level 5 volts to 3.3 volts couldn't you just divide the voltage with a couple of resistors?


----------



## SquirrellCook (May 13, 2020)

Electrickery involved.









						USB to UART circuit
					

Now a days computers are uses USB ports to interface external peripherals. If we wish to connect a microcontroller with computer or laptop means, we need to convert UART signal…




					www.theorycircuit.com


----------



## alwaysared (May 13, 2020)

SquirrellCook said:


> If you wanted the TTL level 5 volts to 3.3 volts couldn't you just divide the voltage with a couple of resistors?


There's not much use in worrying about the voltages, it's not needed or connected  

Regards,
Del


----------



## st3v3 (May 13, 2020)

alwaysared said:


> There's not much use in worrying about the voltages, it's not needed or connected
> 
> Regards,
> Del



What about the voltages on the RX/TX signal lines?


----------



## campervanannie (May 13, 2020)

Minisorella said:


> Del, you lost me at VE Direct but I'm well impressed anyway


I can beat that as soon as he mentioned raspberries I went to the fridge


----------



## alwaysared (May 13, 2020)

st3v3 said:


> What about the voltages on the RX/TX signal lines?



I would assume they are standard serial port connections, which are usually between 0v and 3.3v (but can be 5v) when transmitting/receiving but I believe that the device transmitting data ie. the Victron MPPT will decide on the voltage not the device receiving data ie the Pi. All I know is that they work   
I think the confusion is that the USB to UART and standard USB cables have a 5v wire (red) but this is not needed for a serial port and is usually used to power or charge USB devices when needed I've used USB to UART cables for programming security alarms and telephone systems which all need a serial connection and non of them have ever needed the 5v from the USB to UART cable to be connected. if you plug one into a Windows PC or laptop it shows up as a Comm port.
If using homemade leads is a worry then just buy the Victron ones, they're hardly going to break the bank and it's still costs less than a Colour GX Controller 

Regards,
Del


----------



## wildebus (May 13, 2020)

Something that might be worth knowing if you haven't tried already ... You can use the connections via a standard USB Hub if you need more connections than the 4 the Pi has  (this is also useful if you use the genuine Victron Dongles as those block adjacent USB ports on the RPi, so without a Hub, you are limited to 2 Victron Dongles only).
Also, distance does not seem to be a factor ... the VE.Direct cables come in upto 20 metre lengths, and you can certainly use a USB extension lead if you need to extend (I used a Logitech USB Mouse extension to connect the BMV at the front of the van to the RPi at the rear until I changed from an RPi to a Venus GX).


----------



## SquirrellCook (May 13, 2020)

The only down side of this is that I've just seen on the news that there has been a flock of motorhomes on the road heading to shops.  It seems they are running out of pastry and raspberries!


----------



## alwaysared (May 13, 2020)

wildebus said:


> Something that might be worth knowing if you haven't tried already ... You can use the connections via a standard USB Hub if you need more connections than the 4 the Pi has  (this is also useful if you use the genuine Victron Dongles as those block adjacent USB ports on the RPi, so without a Hub, you are limited to 2 Victron Dongles only).
> Also, distance does not seem to be a factor ... the VE.Direct cables come in upto 20 metre lengths, and you can certainly use a USB extension lead if you need to extend (I used a Logitech USB Mouse extension to connect the BMV at the front of the van to the RPi at the rear until I changed from an RPi to a Venus GX).


Yes I had to use a couple of extension leads, they do need to be good quality ones though, one from Poundland didn't work but a Ugreen one was fine  
Maximum Serial Cable Length I have some USB over Cat5 adapters, I wonder if these would increase the length if needed? 

Kind regards,
Del


----------



## st3v3 (May 13, 2020)

While we are on the subject of Victron cables, I needed to extend the Pi to MPPT cable. Cut and soldered in a bit of cat5 cable, works fine


----------



## st3v3 (May 13, 2020)

I'm just hoping for someone to write the code in to the Pi so that you can hook temperature sensors up to it and have it graphed in VRM...


----------



## alwaysared (May 13, 2020)

st3v3 said:


> I'm just hoping for someone to write the code in to the Pi so that you can hook temperature sensors up to it and have it graphed in VRM...



Yes that would be nice  

Regards,
Del


----------



## wildebus (May 13, 2020)

st3v3 said:


> I'm just hoping for someone to write the code in to the Pi so that you can hook temperature sensors up to it and have it graphed in VRM...


I cannot deny ... this is one of the reasons I decided to change to a Venus GX ...




And you can set an alarm if a temp goes above or below a chosen temp (so warning you if say the room temp dropped to a level you could have water freezing for example)


----------



## Okta (May 13, 2020)

I have to say I am impressed by this discussion and the various skills of others. I do not have such skills but I do like to be able to monitor things remotely. I have a Victron BMV 700 battery monitor with a bluetooth dongle which allows me to monitor it when I am near by. Does anyone know of a method that an electronics numpty could use to monitor this device remotely using the mobile phone network? Obviously this would be more expensive than the clever diy solutions but during this lockdown I have realised being able to keep an eye on what my toys are doing would be useful.
Any ideas?


----------



## mistericeman (May 13, 2020)

Okta said:


> I have to say I am impressed by this discussion and the various skills of others. I do not have such skills but I do like to be able to monitor things remotely. I have a Victron BMV 700 battery monitor with a bluetooth dongle which allows me to monitor it when I am near by. Does anyone know of a method that an electronics numpty could use to monitor this device remotely using the mobile phone network? Obviously this would be more expensive than the clever diy solutions but during this lockdown I have realised being able to keep an eye on what my toys are doing would be useful.
> Any ideas?



Exactly what I wanted to do.... 

I went with a raspberry pi 4 and with some pointers/help from Wildebus/Ian h 
I managed to have my smartshunt talk to the pi via a £20 usb/victron lead (pi pretends to be the victron venus) 
And pi connect to my teltonika router in the van (or when parked outside connect to the home WiFi.... 

So I can check from anywhere what the charging on the van is doing.... 
I can even view it on the smart TV if I want. 

I suspect that someone could/would provide you with a raspberry pi pre loaded running victron for a reasonable cost compared to the genuine victron unit.... 
IF you didn't want to splash out on the cost of the genuine victron thing


----------



## wildebus (May 13, 2020)

Okta said:


> I have to say I am impressed by this discussion and the various skills of others. I do not have such skills but I do like to be able to monitor things remotely. I have a Victron BMV 700 battery monitor with a bluetooth dongle which allows me to monitor it when I am near by. Does anyone know of a method that an electronics numpty could use to monitor this device remotely using the mobile phone network? Obviously this would be more expensive than the clever diy solutions but during this lockdown I have realised being able to keep an eye on what my toys are doing would be useful.
> Any ideas?


Say you got a lead like Del has made ... £10.  You could get a Raspberry Pi for say £50 (give or take including 12V-5V power adapter to feed it).  That is actually all you need apart from the mobile phone connection.
I use Sky Mobile for phones.  With that, I add another basic SIM with minimal data for £5/month.  put in a old mobile and have the Raspberry Pi talk to that to send data. If I need more data, I can just add some from the 'piggy bank' but the Victron setup uses very little data anyway.
The Victron VRM for remote monitoring and management is free to use.

So actually, the kind of setup that Del posted here would suit you, is not that tricky to setup once you start to look at it and is pretty cost effective.


----------



## wildebus (May 13, 2020)

mistericeman said:


> .....
> So I can check from anywhere what the charging on the van is doing....
> *I can even view it on the smart TV if I want.*
> 
> ...


One thing that annoys me and I have not managed to find a workround for is that the Victron stuff - either the Remote Console or the VRM Webpage weirdly - will not display correctly on an Amazon Firestick  (my 'Smart TV' solution).  Quite frustrating


----------



## mistericeman (May 13, 2020)

wildebus said:


> One thing that annoys me and I have not managed to find a workround for is that the Victron stuff - either the Remote Console or the VRM Webpage weirdly - will not display correctly on an Amazon Firestick  (my 'Smart TV' solution).  Quite frustrating



Buy yourself a 65" smart TV like I did ..... 

Even the data on your graphs is clearly visible ;-)


----------



## Wully (May 13, 2020)

Wished I could join in but I’m at the hammer end of the building trade,


----------



## wildebus (May 14, 2020)

mistericeman said:


> Buy yourself a 65" smart TV like I did .....
> 
> Even the data on your graphs is clearly visible ;-)



Taking a lead from Wullys post, all that is needed is a finely tuned screen ....


----------



## wildebus (May 14, 2020)

As mentioned, after seeing Dels success on his home-made cables, I decided to have a go, but this time buying a proper donor USB Cable...

Success!




Only got an MPPT 100/20 connected to the Pi and no panel, but the unit is recognised 
The voltage info also comes from the MPPT, so we are reading data.  But is it sending anything to the MPPT?

With the VRM setup, you can check and remotely update the firmware on VE.Direct devices like the MPPT Controllers.  So checked the firmware version ...



Hit the "Update Device" button ...




and after a couple of minutes ...




So it looks like the home-made cables will read and send data between the Pi and the Devices as needed.

Nice one, alwaysared


----------



## Polar Bear (May 14, 2020)

I like pie.
On the brighter side. If anyone wants them I have some caravan gas lights going in the skip unless someone puts their name on them before I next go?


----------



## QFour (May 14, 2020)

@alwaysared 

*Fridge Fans*

If uses a Arduino Uno, Dallas Temp Sensor, Liquid Crystal Display, Relay Board, Three Fans and a Switch with 4 positions

Code is simple enough and nice thing about Arduino is the bits and pieces are not expensive. Arduino software is free and works on IMac, Linux and Windows. Ideal if you want something to have a play with. The four position switch is to switch it off, Automatic, Fans Minimum, Fans Maximum. I always like to have a backup plan just in case something packs up I can switch the fans on manually. Winter project 3 years ago.

This is the code I have running at the moment.

#include <DallasTemperature.h>
#include <OneWire.h>
#include <Wire.h>
#include <LiquidCrystal_PCF8574.h>

// Define Relay Ports and I/O ports for relays
#define relay1 6
#define relay2 7
#define BUS 2

OneWire oneWire(BUS);
DallasTemperature sensors(&oneWire);
LiquidCrystal_PCF8574 lcd(0x3F);  // set the LCD address to 0x3F for a 16 chars and 2 line display


// Define Variables
int show;
int i,v;
int probe;

void setup() // Start setup for UNO Board
{
  sensors.begin();
  Wire.begin();
  Wire.beginTransmission(0x3F);

  i = 20; // Set any temp to start

// Initalize the lcd

  lcd.begin(16, 2);
  lcd.home(); lcd.clear();
  lcd.print("FRIDGE TEMP");
  displayTemp(i);

// Setup the relay pins for driving relays and switch fans off

  pinMode(relay1,OUTPUT);
  digitalWrite(relay1,HIGH);
  pinMode(relay2,OUTPUT);
  digitalWrite(relay2,HIGH);
//  fanState(3);  // Used to update display

} // end setup()

void loop() // Start of Main Program
{

// Display flashs so we only change the display when we have to

    v = checkSensor(); // get the Temp

    if ( v != i ) // if v and i are different then the temp has changed
    {

// Ok v is different to i so set i for next time we check;     
      i = v;
      displayTemp(i);

// Work out what the temp is and act accordingly
      if ( i < 25 ) { fanState(3); }
      if (( i > 24 ) && ( i < 30 )) { fanState(1); }
      if ( i > 29 ) { fanState(2); }     

    } // end if statement temp different

delay ( 5000 ); // not necessary to check every couple of seconds    

} // End void loop()


int checkSensor()
{
   sensors.requestTemperatures(); // Ask nicely for temperature
   delay(50);
   return sensors.getTempCByIndex(0); // Return with temp

} //end checkSensor

int displayTemp(int i) // Sets up and displays temp
{
      lcd.setCursor(12,0);
      lcd.print("   ");
      lcd.setCursor(12,0);
      lcd.print(i);
      lcd.write(223); // Degree Symbol
      lcd.print("C");
} //end displayTemp

int fanState(int i) // Display and Set FAN State 1 - 3
{
      lcd.setCursor(0,1);
      lcd.print("                ");
      lcd.setCursor(0,1);

      switch (i) {
         case 1:
            lcd.print("FANS MINIMUM");
            digitalWrite(relay1,LOW);
            digitalWrite(relay2,HIGH);
            break;
         case 2:
            lcd.print("FANS MAXIMUM");
            digitalWrite(relay1,HIGH);
            digitalWrite(relay2,LOW);
            break;
         case 3:
            lcd.print("FANS OFF");
            digitalWrite(relay1,HIGH);
            digitalWrite(relay2,HIGH);
            break;
         break;
      }

} //end fanState


----------



## SquirrellCook (May 14, 2020)

Simple code he says.    Mmmmm


----------



## SquirrellCook (May 14, 2020)

For fridge cooling fans I use a mains relay triggered by the ptc   It does mess up the fridge cycling a little.  I like the Arduino method but would like less complicated.


----------



## QFour (May 14, 2020)

It's not complicated. The display tells you the temp behind the fridge at the top and f the fans are on full / half / Off

@SquirrellCook  Arduino is as complicated as you want to make it. They make a Auduino Nano costs less than a £5 on ebay. You then need a Dallas Temp sensor £3 and a relay board. Then just hack the display bit out of the code as below .. Two relays as one supplies 6v to fans and the other one supplies 12v. There are other ways of doing it by switching a single transistor on and off but requires more code. This code just switches pins 6 and 7 on and off. I used 3 x 12v fans as they move far more air even at half speed.

@alwaysared

#include <DallasTemperature.h>
#include <OneWire.h>
#include <Wire.h>

// Define Relay Ports and I/O ports for relays
#define relay1 6
#define relay2 7
#define BUS 2

OneWire oneWire(BUS);
DallasTemperature sensors(&oneWire);

// Define Variables
int show;
int i,v;
int probe;

void setup() // Start setup for UNO Board
{
sensors.begin();
Wire.begin();
Wire.beginTransmission(0x3F);

i = 20; // Set any temp to start

// Setup the relay pins for driving relays and switch fans off

pinMode(relay1,OUTPUT);
digitalWrite(relay1,HIGH);
pinMode(relay2,OUTPUT);

} // end setup()

void loop() // Start of Main Program
{

v = checkSensor(); // get the Temp

if ( v != i ) // if v and i are different then the temp has changed
{

// Ok v is different to i so set i for next time we check;
i = v;

// Work out what the temp is and act accordingly change these depending on what you want fans to do

if ( i < 25 ) { fanState(3); }
if (( i > 24 ) && ( i < 30 )) { fanState(1); }
if ( i > 29 ) { fanState(2); }

} // end if statement temp different

delay ( 5000 ); // not necessary to check every couple of seconds

} // End void loop()


int checkSensor()
{
sensors.requestTemperatures(); // Ask nicely for temperature
delay(50);
return sensors.getTempCByIndex(0); // Return with temp

} //end checkSensor

int fanState(int i) // Set FAN State 1 - 3
{

switch (i) {
case 1:
digitalWrite(relay1,LOW);
digitalWrite(relay2,HIGH);
break;
case 2:
digitalWrite(relay1,HIGH);
digitalWrite(relay2,LOW);
break;
case 3:
digitalWrite(relay1,HIGH);
digitalWrite(relay2,HIGH);
break;
break;
}

} //end fanState


----------



## SquirrellCook (May 15, 2020)

I'll try to look into this soon to broaden my knowledge.  I bought a load of pi stuff a couple of years ago and have hardly touched it   There is always some other project calling you, or yet worse having to work!

One down side of using an external temperature sensor it that when it's hot inside the camper the fan comes on without the fridge.  Hence my system being electrically switched.  What I'd like to do is sense when one of the compressor motor wires is loaded.


----------



## wildebus (May 15, 2020)

SquirrellCook said:


> I'll try to look into this soon to broaden my knowledge.  I bought a load of pi stuff a couple of years ago and have hardly touched it   There is always some other project calling you, or yet worse having to work!
> 
> One down side of using an external temperature sensor it that when it's hot inside the camper the fan comes on without the fridge.  Hence my system being electrically switched.  What I'd like to do is sense when one of the compressor motor wires is loaded.


If you were to do that, the fan would only work when the compressor was running though?  Would you not want the fan to run at high temps to help reduce the duty cycle of the compressor? 
I guess you could put an inline switch onto the power to the fan as an override if you were not actually using the fridge and the fan was coming on and so not required?


----------



## SquirrellCook (May 15, 2020)

wildebus said:


> If you were to do that, the fan would only work when the compressor was running though?


Yes Dave this what I'm doing.  When the PTC goes into motor run mode I use this wire to operate a relay that switches two 12 volt fans over the cooling element.  The down side is that the resistance in the relay coil winding messes with the PTC, so it's duty cycle changes.  So when the compressor is running, so are the fans.  What I'd like to do is run the fans via current sensing and better still have a delay to remove residual heat from the cooling element.
I'm tempted to try one of these as a switch.








						0.2A~30A Adjustable AC Sensing Switch Current Sensing Switch (Normally Open) New  | eBay
					

Find many great new & used options and get the best deals for 0.2A~30A Adjustable AC Sensing Switch Current Sensing Switch (Normally Open) New at the best online prices at eBay! Free delivery for many products.



					www.ebay.co.uk


----------



## wildebus (May 15, 2020)

yup, a hall effect sensor controlled device should work like that.  But is it an advantage to have the fan only running when the compressor is running though? that is what I am wondering 
I've not checked how much power my external fridge fan uses when it is running, but when it is running due to a high temp, typically that also means it is very bright sunny day to produce the heat, which also means the solar will be working nicely  (so the power to the fan is a very small amount of the improved harvesting?)


----------



## Deleted member 64209 (May 15, 2020)

Minisorella said:


> Del, you lost me at VE Direct but I'm well impressed anyway


Quite, I have either pressed the wrong button and have landed in 'Quantum Electronics Advanced Higher Diploma Course For the Under 12's.com' or whilst asleep someone performed a full evacuation frontal labotomy on me....   now dazed, confused but fortunately warm and comfortable and in moments I'd have forgotten and it just won't matter..... ahhhhhh


----------



## SquirrellCook (May 15, 2020)

wildebus said:


> I've not checked how much power my external fridge fan uses when it is running, but when it is running due to a high temp, typically that also means it is very bright sunny day to produce the heat, which also means the solar will be working nicely (so the power to the fan is a very small amount of the improved harvesting?)


I can see your point, I just remember a horrible night in Italy when we couldn't open the windows due to mosquitos.  No fly screened fans in those days.  It was so hot in side the fridge fans would have been on all night.  In the end we slept on the wet room floor.  This also sold me on the domestic fridge idea as being good.  Many people could not keep their fridges cold.


----------



## QFour (May 15, 2020)

Correct me if I am wrong but does the compressor fridge have an AC motor. I would assume in a MH it would be 12vdc from the battery.


----------



## SquirrellCook (May 15, 2020)

QFour said:


> Correct me if I am wrong but does the compressor fridge have an AC motor. I would assume in a MH it would be 12vdc from the battery.


You are correct about a domestic fridge, though they do make 12/24 DC ones.  Watch out though, I've seen Motorhome ones with an inverter built into them.  I think a purpose made compressor is better, though I haven't tried one.


----------



## QFour (May 15, 2020)

SquirrellCook said:


> Yes Dave this what I'm doing.  When the PTC goes into motor run mode I use this wire to operate a relay that switches two 12 volt fans over the cooling element.  The down side is that the resistance in the relay coil winding messes with the PTC, so it's duty cycle changes.  So when the compressor is running, so are the fans.  What I'd like to do is run the fans via current sensing and better still have a delay to remove residual heat from the cooling element.
> I'm tempted to try one of these as a switch.
> 
> 
> ...



Being thick here what is a PTC ?


----------



## wildebus (May 15, 2020)

wildebus said:


> yup, a hall effect sensor controlled device should work like that.  But is it an advantage to have the fan only running when the compressor is running though? that is what I am wondering
> I've not checked how much power my external fridge fan uses when it is running, but when it is running due to a high temp, typically that also means it is very bright sunny day to produce the heat, which also means the solar will be working nicely  (so the power to the fan is a very small amount of the improved harvesting?)


I wonder if a 12V digital timer would work well maybe? so as soon as the fan kicks on, it will run for the time the temp is above the selected "fan on" temp OR the duration of the timer, whichever is the shorter, then set to not be allowed to come on again for say 60 minutes?

I have this kind of setup for my 2kW water heater so when that comes on, it will cycle on for a few minutes then off for some time to avoid a long single hit on the battery. 
I use this timer and am pretty pleased with it  -
https://amzn.to/2TasXLY


----------



## st3v3 (May 15, 2020)

wildebus said:


> I wonder if a 12V digital timer would work well maybe? so as soon as the fan kicks on, it will run for the time the temp is above the selected "fan on" temp OR the duration of the timer, whichever is the shorter, then set to not be allowed to come on again for say 60 minutes?




Are you talking with the Arduino setup? Timing can be done in the software surely?


----------



## wildebus (May 15, 2020)

st3v3 said:


> Are you talking with the Arduino setup? Timing can be done in the software surely?


nah, talking about standardalone hardware.


----------



## SquirrellCook (May 15, 2020)

QFour said:


> Being thick here what is a PTC ?


Hope this helps.



			http://www.vishay.com/docs/23086/ptc305c.pdf


----------



## wildebus (May 15, 2020)

wildebus said:


> As mentioned, after seeing Dels success on his home-made cables, I decided to have a go, but this time buying a proper donor USB Cable...
> 
> ......
> So it looks like the home-made cables will read and send data between the Pi and the Devices as needed.
> ...


The USB-UART cables I got came as a two-pack, so I decided to use the second cable a little differently 

Fitted a JST 2.0 pitch connection  (the type fitted to the Victron Devices) to a PCB  (slightly tricky as the typical PCB has a wider pitch).
Also fitted a 3-connector screwdown block to the PCB and a 3-pin connector, all wired in parallel



So I connected a Flying Lead with the JST female connector to the green screwdown block;  the 4 pin JST male connector is ready to accept a standard Victron VE.Direct-VE.Direct cable  (saves having to adapt an existing cable if changing from a Venus/CC GX to a Pi), and the 3 pin connector accepts the plugs pre-fitted on the USB Cable.


----------



## xsilvergs (May 15, 2020)

I have a BMV-712 and a MPPT 100/30 connected to a RPi. I have dropped the Victron portal in favour of my own data logging as I can then use products from different manufacturers.
There is also AC in measurement for current and voltage from which consumed kVA can be calculated. From this I intend to run a 3 way fridge from an inverter when the sun shines, saving LPG.
Leisure Battery temperature is another variable that can be logged.

More to come hopefully from B2B and battery maintainers.


----------



## QFour (May 15, 2020)

st3v3 said:


> Are you talking with the Arduino setup? Timing can be done in the software surely?



The circuit for the fridge motor is AC so you could use an Arduino as a voltmeter for AC and work out if the motor is on or off. Easy enough to try with an ordinary meter first to see if it upsets anything and work out where the voltage can be measured. It's a reasonably simple circuit with a few resistors and a diode. Arduino Volt Meter  You don't need the display part of it just the small circuit. Nice little project for the summer while you have nothing to do.


----------



## st3v3 (May 15, 2020)

Hang a relay off of the motor feed and switch an input maybe?


----------



## QFour (May 20, 2020)

SquirrellCook said:


> If you wanted the TTL level 5 volts to 3.3 volts couldn't you just divide the voltage with a couple of resistors?



Sorry it will not work. Use a DC to DC converter which gives you the power output you need. That is all that is in the 12v to USB sockets. It cannot be done with resistors unless you know the resistance of the circuit you want to connect.


----------



## wildebus (Jun 1, 2020)

alwaysared said:


> After posting on here about the Victron Colour Controller Wildebus said it was possible to use a Raspberry Pi with two VE Direct to USB cables (for my BMV712 and M100/30 MPPT controller) and a MK3 VE Direct USB cable for my 12/3000/120-16 inverter/charger so this inspired me to try it out. So I purchased a Raspberry Pi 3 Model B+, a case and a 16gb Sandisk Micro SD card from Amazon for £44.18. I then followed a link on here to our sister site motorhomebuilder.com which in turn had a link and a picture explaining how to make your own VE Direct cables, so I bought a couple of USB to UART cables which cost me £6.99 and a pack of five four pin JST leads for £2.49, unfortunately for me they had different colour cables to the ones in the picture but I found out which pins were which on the MPPT and BMV. I followed the picture but it didn't work then I realised that the picture had a fundamental flaw! It shows the TxD on the USB going to the TxD on the JST plug and RxD on the USB going to the RxD on the JST, but it's obvious that this is the wrong way round! The RxD on the USB goes to the TxD on the JST and the TxD on the USB goes to the RxD on the JST, once I had switched them round it work okay and I already had the cable for my inverter/charger. So everything works as expected,.......
> 
> Del


Quick question ...
Have the cables been reliable for you?  any device disconnections?

Asking as I setup my test rig yesterday, comprising:

Raspberry Pi
BMV-712
MPPT 100/20
2 x 100W Panel
75Ah "Leisure" Battery
34Ah "Starter Battery"
Mains Charger as an "Alternator" on Starter Battery
B2B between Starter and Leisure Batteries
The BMV and MPPT are connected to the Pi with the DIY cables.  The BMV has been seen all the time, but the MPPT disappears at random and for hours - but at the time it is not seen by the Pi, it IS still active and working, so I am wondering if there is a cable problem?  not tried swapping the two USB-VE.Direct cables over yet, but thought just ask if you've seen disappearing products on yours?

Currently, Solar went AWOL 32 minutes ago ...


----------



## xsilvergs (Jun 1, 2020)

My Pi 3 B+ runs with a BMV and MPPT, I use the Victron VE.Direct cables and it has worked for 18 months without dropping.

Strangely I have the attached sat on the table but I can't remember what I tried or what success I had.

Linux can give a USB devices a different address each time it starts up if more than one device is connected. I.e. the BMV may be /dev/ttyUSB0 today it may be /dev/ttyUSB1 tomorrow. A Pi running the Venus OS does not suffer this in my experience. .
My own code looks for the product id BMV or MPPT from the data sent by the Victron bits.


----------



## wildebus (Jun 1, 2020)

It was really about the DIY Cables and if there is something about _those _cables which could maybe cause an problem, rather then using the Raspberry per se.   The Pi hadn't restarted at the time the device disappeared  (otherwise all device data would have gone at the same time) and if a new ID popped up, then in the Victron VRM, there would be an extra device listed in the devices.  So Pi running and Device running - so have to suspect the cable in-between.
Makes me wonder if the dongle lump on the Victron VE.Direct - USB cable has maybe some kind of noise suppression?


As an aside, I found the Pi running Victron OS can actually be quite annoying on device ID changing at random in some circumstances. When I had the Multiplus connected to the Pi 18 months ago I used to get random reassignments of ID on that device  (but not on the VE.Direct devices).  IIRC, got 4 different IDs for the same Multiplus in a couple of hours one time.  The same Multiplus on the Venus GX has only had one ID ever.

Want to run the standard Venus OS on the setup for a week or so to make sure everything is working correctly before I introduce a change of OS.


----------



## alwaysared (Jun 1, 2020)

wildebus said:


> Quick question ...
> Have the cables been reliable for you?  any device disconnections?
> 
> Asking as I setup my test rig yesterday, comprising:
> ...


I had the same problem with the MPPT dropping the first couple of days, the BMV and Multiplus never dropped out though. I swapped the home made cables over with the each other, still the same. I was using a USB extension cable so I swapped that still the same. This went on for the first three days, my son then suggested plugging it into a different USB port on th Pi and low and behold it's hasn't dropped out since! Don't ask me why but it could be something to do with way Linux addresses them I suppose.
The Victron VE cables are only really doing the same thing, converting USB to serial and the way that's done is with a UART adapter and like everything in life I'm sure there are good and bad ones. I've been happy with my setup, well at least since day four 

Regards,
Del


----------



## wildebus (Jun 1, 2020)

alwaysared said:


> I had the same problem with the MPPT dropping the first couple of days, the BMV and Multiplus never dropped out though. I swapped the home made cables over with the each other, still the same. I was using a USB extension cable so I swapped that still the same. This went on for the first three days, my son then suggested plugging it into a different USB port on th Pi and low and behold it's hasn't dropped out since! Don't ask me why but it could be something to do with way Linux addresses them I suppose.
> The Victron VE cables are only really doing the same thing, converting USB to serial and the way that's done is with a UART adapter and like everything in life I'm sure there are good and bad ones. I've been happy with my setup, well at least since day four
> 
> Regards,
> Del


Interesting.  This afternoon I tried swapping the cables and I also have used different USB sockets (must admit, I just plugged them in willy-nilly in that respect so not been tracking that aspect but I do know it is a different pattern of USB used).
Just looked and now I see the BMV has been off-line for 2 hours but the MPPT is still there, so I think maybe I do have a dodgy cable?  I'll buy another pair to adapt I think as not expensive and handy to have.


----------



## wildebus (Jun 3, 2020)

Changed ports couple of days ago and both back again.  Just had a look and the BMV went off-line just before midnight last night.

So different tactic this time .... Plugged DIY USB Cables into a little 4-port USB Hub and plugged _that _into the Pi.  So both now using same physical USB Port on the Pi.  Will see what happens this time  (I have used this same actual Raspberry Pi for many many months in my van before I installed a Venus GX and was always reliable (except for Device ID swapping on MP) and also use a USB Hub as well before (due to physical size of Victron Dongles) so should be fine.
I am running the lastest Venus OS though - maybe something in that is a bit buggy for the Pi?
I do have a genuine Victron VE.Direct-USB Dongle somewhere so might try and find that as well?


----------



## xsilvergs (Jun 3, 2020)

When using the Victron USB / VE.Direct leads each lead will have the same ID made up of a pair of hexadecimal numbers, like 04f2:0112 , first part is Vendor ID then Device ID. I guess that won't help the Pi identify which device is connected. Try lsusb -v in terminal.

If I remember correctly the leads have different serial numbers. Sorry I can't check this at the moment.

Hence in my code I looked for the Product ID, like MPPT or BMV.

Am I right in thinking the original Venus for Pi was ported by a South African guy, perhaps he has an answer.


----------



## wildebus (Jun 3, 2020)

Interesting.  But if you are using DIY leads with no intelligence in them, just wires, every lead is the same, no?

Since using a hub, both devices are being read.  (to early to be sure, but some more cables arrived today to modify anyway so will make another pair up  )


----------



## xsilvergs (Jun 4, 2020)

wildebus said:


> Interesting.  But if you are using DIY leads with no intelligence in them, just wires, every lead is the same, no?
> 
> Since using a hub, both devices are being read.  (to early to be sure, but some more cables arrived today to modify anyway so will make another pair up  )



I guess a lead that has no ID is no better than the Victron leads which have the same ID.


----------



## wildebus (Jun 5, 2020)

Been 48 hours now since I connected the devices via a cheap little hub and no disconnections 
I don't know but I am suspecting when the Victron OS goes and samples each device for data some kind of polling happens linked to the USB port IDs.  I am thinking there is a little bug in the OS when used with the Pi?


----------



## wildebus (Jun 8, 2020)

Doing a different test with my new battery which means the connections are different, but still getting dropouts ....
The BMV  is connected with a DIY Cable to the unpowered hub, and then that hub is now connected to a genuine Victron Venus GX USB port.  Been like this since noon today and had two disconnects already.
Rebooting the Venus GX got it recognised again  (rebooting the Pi had the same result as well)
So this maybe eliminates the Pi as a causal effect?
What I have added into the mix however is a 5 Metre long USB Extension lead to let me plug in the BMV, and I am dubious about a USB Cable that long TBH?

I really am thinking whatever is in the dongle in the Victron Lead is there for a reason!  going to try to find a shorter USB Lead to use instead.  I have previously used a Logitech Mouse dongle extension when I used the Pi on a live system (but with the Victron VE.Direct-USB Lead) and they are around 1.5 or 2M long, which would be plenty for me.  Might also see if I can find the genuine Dongle VE.D-USB lead as well to use with the long extension.


----------



## st3v3 (Jun 8, 2020)

I've never got on well with long USB cables unless they are active, powered types.


----------



## wildebus (Jun 8, 2020)

st3v3 said:


> I've never got on well with long USB cables unless they are active, powered types.


5 Metres seems very long to me.  I decided to get a lead that long as Victron do make a VE.Direct lead 10 Metres long so I thought maybe ..... 
The USB hub I was using is unpowered, but it has lights on, so it is powered  by the port itself (which actually makes it worse probably!).

Just went to the kit and found I could get away with using one of the original DIY cables I made which will reach the Venus GX without an extension or Hub.  Lets see what happens ...
(I think right now if I were installing a Pi setup for someone, I'd buy the genuine cables just to avoid the doubt, but the DIY jobbies are great for testing)


----------



## alwaysared (Jun 8, 2020)

Shame your still having trouble, mine is still going strong with no dropouts since day 3. What amp PSU are you using for the Pi? Have you thought of powering the hub?

Regards,
Del


----------



## xsilvergs (Jun 8, 2020)

From the www: Pi 3 the power LED is slightly more intelligent. it is connected to the 5V and will flash if the voltage drops below 4.63V

I use 3 of these:

https://www.ebay.co.uk/itm/12V-To-5...e=STRK:MEBIDX:IT&_trksid=p2057872.m2749.l2649

in our MH now. I've tried a few motorhome/caravan CBE C-Line USB sockets but they struggle to charge unless the 12V battery is on charge.


----------



## wildebus (Jun 8, 2020)

alwaysared said:


> Shame your still having trouble, mine is still going strong with no dropouts since day 3. What amp PSU are you using for the Pi? Have you thought of powering the hub?
> 
> Regards,
> Del


This is using the Victron GX now when I had the long lead.
With the Pi I using either the Official Raspberry Pi Mains Lead or a 3A/5V 12V  converter  (the typical USB Socket in a van won't provide enough current I have found).
This Pi worked fine for many many months (probably over a year) running 24/7 without a break.


----------



## Nabsim (Jun 9, 2020)

I was hoping to turn into a semi Luddite when I retired but can feel the pull of extra monitoring. Being lazy does help me resist for now though


----------



## wildebus (Jun 9, 2020)

Nabsim said:


> I was hoping to turn into a semi Luddite when I retired but can feel the pull of extra monitoring. Being lazy does help me resist for now though


you know you want to .....






How is simple .....

Look into my eyes.  not around the eyes, into the eyes .....


----------



## Nabsim (Jun 9, 2020)

You know, I downloaded a couple of new languages just before I retired, was interested in the Apple one they are pushing with kids and another I can’t remember. This retirement is a bugger though, no time for anything lol


----------



## wildebus (Jun 18, 2020)

Back to topic - mostly ... I am really not having luck with the DIY cables on the Pi     Devices randomly disappearing with no rhyme or reason.  Tried different DIY Cables and still getting random AWOLs.  Tried with and without a USB Hub and I made the cables deliberately short to suit the setup.
If I do a reboot via the Remote Console I will get the devices back  (sometimes takes two reboots to get both back) so the physical connections are ok and seems to be purely some kind of logical/software issue?
I am going to try adding a ferrite choke to the cable to see if that makes a difference but if that doesn't sort it, at a loss to know what to try next?  I think the genuine item will be required   (at least they are not that bad a price!)

And I can't find the one that I _do _have already (I think!) annoyingly.


----------



## xsilvergs (Jun 18, 2020)

wildebus said:


> Back to topic - mostly ... I am really not having luck with the DIY cables on the Pi     Devices randomly disappearing with no rhyme or reason.  Tried different DIY Cables and still getting random AWOLs.  Tried with and without a USB Hub and I made the cables deliberately short to suit the setup.
> If I do a reboot via the Remote Console I will get the devices back  (sometimes takes two reboots to get both back) so the physical connections are ok and seems to be purely some kind of logical/software issue?
> I am going to try adding a ferrite choke to the cable to see if that makes a difference but if that doesn't sort it, at a loss to know what to try next?  I think the genuine item will be required   (at least they are not that bad a price!)
> 
> And I can't find the one that I _do _have already (I think!) annoyingly.



The Victron leads are galvanically isolated (if I remember correctly), I used an opto isolator in my DIY lead. Does the Victron VE.Direct signal have a 5 volt level or is it less?

I can't check my MPPT outputs as it's at the back of a packed cupboard.


----------



## wildebus (Jun 18, 2020)

xsilvergs said:


> The Victron leads are galvanically isolated (if I remember correctly), I used an opto isolator in my DIY lead. Does the Victron VE.Direct signal have a 5 volt level or is it less?
> 
> I can't check my MPPT outputs as it's at the back of a packed cupboard.


Interesting.  There should be no need for isolation but might be a factor? I have a 4-way opto-isolator kicking around (I use one on my Venus GX to change the digital signals from 12V to 3.3V on the Heater Fuel Pump).  That should work with 2 USB cables then (2 pairs of Rx & Tx)?  But I think it will be the wrong voltage, thinking about it (12V & 3.3V)

The VE.Direct connections are 3.3V.  USB will be 5V so need a 3.3V + 5V isolator if using one of those?  definately simpler to buy the Victron  Cable!


----------



## xsilvergs (Jun 18, 2020)

wildebus said:


> Interesting.  There should be no need for isolation but might be a factor? I have a 4-way opto-isolator kicking around (I use one on my Venus GX to change the digital signals from 12V to 3.3V on the Heater Fuel Pump).  That should work with 2 USB cables then (2 pairs of Rx & Tx)?  But I think it will be the wrong voltage, thinking about it (12V & 3.3V)
> 
> The VE.Direct connections are 3.3V.  USB will be 5V so need a 3.3V + 5V isolator if using one of those?  definately simpler to buy the Victron  Cable!



I bought 2 Victron cables, it made a neat and reliable lead. The only slight difficulty was the lead length between the dongle part  and the male USB that plugs into the Pi is quite short so ended up with a couple of right angled USB extension leads too.


----------



## wildebus (Jun 19, 2020)

Added a pair of Ferrite chokes to each cable  (one towards each end).  Didn't make any difference to what I can see (solar controller AWOL for a hour as I type this).
Shame, but giving up with using DIY cables I think


----------



## st3v3 (Jun 20, 2020)

wildebus said:


> Added a pair of Ferrite chokes to each cable  (one towards each end).  Didn't make any difference to what I can see (solar controller AWOL for a hour as I type this).
> Shame, but giving up with using DIY cables I think



I think this is all about the signal level at 3.3V


----------



## xsilvergs (Jun 20, 2020)

These are cheap and work









						2x IIC I2C Bi-Directional Logic Level Shifter Converter Module 5V to 3.3V  | eBay
					

Find many great new & used options and get the best deals for 2x IIC I2C Bi-Directional Logic Level Shifter Converter Module 5V to 3.3V at the best online prices at eBay! Free delivery for many products.



					www.ebay.co.uk
				




But life is so much simpler with the Victron lead.


----------



## alwaysared (Jun 20, 2020)

wildebus said:


> Added a pair of Ferrite chokes to each cable  (one towards each end).  Didn't make any difference to what I can see (solar controller AWOL for a hour as I type this).
> Shame, but giving up with using DIY cables I think


That's a shame, are you using a VenusGX? If so maybe it looks for a signal from the USB lead to identify it has being a real Victron one, a bit like Dell laptops will tell you if you've plugged a non genuine battery or PSU in? Mine are still going strong even after replacing the 100/30 with a 100/50 MPPT controller.







If you think about it the MPPT etc are using a serial type connector and all you are doing is converting it to USB, this is a common thing and you can buy USB to serial converters but they usually go to a 9 pin serial connector. The voltage can't be the problem as 3.3v is the common voltage for data over a serial connection and the Victron will decide the voltage it uses when sending data to the Pi which in turn is clever enough to send it back at the same voltage. If you really wanted to you could eliminate the USB by connecting directly to the onboard serial pins in the Pi but of course you can only connect one device and we want to connect more devices. Like I said in an earlier post I've made these for programming security alarms and telephone systems who are both notorious for ripping you off, one phone system programming lead is nearly £200.00 and I was using my homemade one years and my son is still using it now  

Regards,
Del


----------



## wildebus (Jun 20, 2020)

Cheers 
It is a RPi that I am having the problem with. But the very same Pi was fine for a year with Victron leads.
It usually sees the missing one after a reboot but will often assign a new device ID (this I understand is a general 'feature' of the Victron OS though. I thought originally it was some thing to do with a lead ID when I first setup the Pi with the real leads a few years ago and plugged the BMV and the MPPT into the two leads without taking note of which was which but I don't believe that is the case in fact.
I wonder if anyone has taken apart a Victron lead to see what is in the dongle.
I am considering getting a Beaglebone rather than a RPi anyway and having a little go with that (as that is the core of the Venus hardware).


----------



## SquirrellCook (Jun 20, 2020)

wildebus said:


> I am considering getting a Beaglebone rather than a RPi anyway and having a little go with that (as that is the core of the Venus hardware).


So what are saying, Victron kit is unsuitable for vegans?


----------



## wildebus (Jul 6, 2020)

I have left my battery box (with battery, BMV, MPPT and Pi in it) alone since the 20th June...
Since then I have had Zero dropouts from the BMV communications to the Pi, but the MPPT comms are unreliable.  The longest that has talked to the Pi is 9 hours without going AWOL.  doing a Reset of the Pi via Remote Console once or twice will allow the MPPT to be seen again, but it will go away again a bit later

So one good, one bad.
Need to decide what to try next ....
Is it the cable? (swap VE.Direct plugs over - same device fails = cable)
Is it the Pi USB Ports? (swap USB plus over - same device fails = USB)
Could it actually be a fault with the MPPT if either of above happens?  Or is the MPPT comms just more 'sensitive'?

Think I will move the two USBs over to the other unused USBs and see what happens ...


----------



## xsilvergs (Jul 6, 2020)

wildebus said:


> I have left my battery box (with battery, BMV, MPPT and Pi in it) alone since the 20th June...
> Since then I have had Zero dropouts from the BMV communications to the Pi, but the MPPT comms are unreliable.  The longest that has talked to the Pi is 9 hours without going AWOL.  doing a Reset of the Pi via Remote Console once or twice will allow the MPPT to be seen again, but it will go away again a bit later
> 
> So one good, one bad.
> ...



How about using an Arduino to read the data from the MPPT. The Arduino should read the 3.x Volt Victron data as it's over 2.5 volts. Using SoftSerial to connect to the Victron. Then Serial.Print to the normal serial out which you can view in Serial Monitor. Add "time" to each write and then look to see when it drops.


----------



## wildebus (Jul 6, 2020)

xsilvergs said:


> How about using an Arduino to read the data from the MPPT. The Arduino should read the 3.x Volt Victron data as it's over 2.5 volts. Using SoftSerial to connect to the Victron. Then Serial.Print to the normal serial out which you can view in Serial Monitor. Add "time" to each write and then look to see when it drops.


Before I try a different OS or the like, I want to make sure I have reliable comms so I'm not ending up chasing my tail trying to troubleshoot multiple possibilities for an issue.
I can see the times the connection was lost by the sudden lost data in VRM, but there is no pattern or apparent logic to the occurances.
The top is BMV - data all the time from 20 June.  The bottom is the MPPT - no lines means no comms.  Only returns when I reboot.





Happens at any time  (for example, just looked as typing this and it lost comms 13 minutes ago and will not be back until I remote reboot the Pi)


----------



## xsilvergs (Jul 6, 2020)

wildebus said:


> Before I try a different OS or the like, I want to make sure I have reliable comms so I'm not ending up chasing my tail trying to troubleshoot multiple possibilities for an issue.
> I can see the times the connection was lost by the sudden lost data in VRM, but there is no pattern or apparent logic to the occurances. Happens at any time  (for example, just looked as typing this and it lose comms 13 minutes ago and will not be back until I remote reboot the Pi)



My thought for using the Arduino was that you could see if the MPPT stopped sending data or if it never saw a drop the problem must be with the Pi.

As Victron spit data every second the Arduino could run a timer and if no data is received after 1.5 seconds it records it.


----------



## wildebus (Jul 6, 2020)

xsilvergs said:


> My thought for using the Arduino was that you could see if the MPPT stopped sending data or if it never saw a drop the problem must be with the Pi.
> 
> As Victron spit data every second the Arduino could run a timer and if no data is received after 1.5 seconds it records it.


that is a good point - is it the reciever or the transmitter at fault?

What I could do is put the 100/20 MPPT onto my regular system (Venus GX rather than Pi) and see how that goes (but was getting drops on the first set of cables I made).
we'll get there!


----------



## alwaysared (Jul 7, 2020)

Instead of rebooting the Pi why don't you just unplug the USB lead and plug it back in? This is what I did for the first couple of days when I was having the same issue. Like I said once I switched the MPPT lead to a different USB port it's not lost the connection even after changing the 100/30 for the 100/50.  Have you tried a genuine Victron lead? That would eliminate your homemade one. Looking on the internet indicates that a lot of people are using the Pi and Victron's own forums also show this is the case. It doesn't however indicate whether they are using homemade leads or the Victron ones.
What version of Venus OS are you running?

Regards,
Del


----------



## wildebus (Jul 7, 2020)

Look how often it disconnects. It is a lot easier to click a button then go outside to the workshop, open up the box unplug and plug in lead and come back each time.
Apart from which, the hands-off I think is a better test as it doesn't rely on fixing possible bad connections. It points to s/w I think (with Venus OS or MPPT)

Yesterday moved BOTH leads to different USB  ports.  BMV is still perfect. MPPT is still dropping.
Next step will be to swap VE.Direct plugs and see what happens.


----------



## alwaysared (Jul 7, 2020)

wildebus said:


> Look how often it disconnects. It is a lot easier to click a button then go outside to the workshop, open up the box unplug and plug in lead and come back each time.
> Apart from which, the hands-off I think is a better test as it doesn't rely on fixing possible bad connections. It points to s/w I think (with Venus OS or MPPT)
> 
> Yesterday moved BOTH leads to different USB  ports.  BMV is still perfect. MPPT is still dropping.
> Next step will be to swap VE.Direct plugs and see what happens.


I see your point, it's just that it was easy for me as I'm in the van fulltime. I was thinking that rebooting maybe giving the ports a different address whereas unplugging would still use the same address  So are you still using homemade leads?

Regards,
Del


----------



## wildebus (Jul 7, 2020)

Good point about the port addresses maybe changing on reboots.
I have noticed - and am surprised - that the device ID does not change when the MPPT is found again after a reboot.
Still DIY leads. will shortly swap over the leads to the different devices. I think that could be a telling change....


----------



## wildebus (Jul 7, 2020)

Swapped the VE.Direct plugs over.....
The Device IDs also swapped over (I didn't reboot the Pi during this process, just moved the leads). 

I guess that is due to the USB Ports each seeing now seeing a different device and allocating it a 'new' ID.


----------



## xsilvergs (Jul 7, 2020)

wildebus said:


> that is a good point - is it the reciever or the transmitter at fault?
> 
> What I could do is put the 100/20 MPPT onto my regular system (Venus GX rather than Pi) and see how that goes (but was getting drops on the first set of cables I made).
> we'll get there!



I thought I posted this but obviously not and I can't multi task.

If you're intending running your own code on the Pi you the Arduino idea works the output could be level shifted back down to 3v3 and use a gpio pin


----------



## xsilvergs (Jul 7, 2020)

Re port numbering in Linux. To my knowledge when Linux boots it number the USB devices connected starting from 0 (zero), which device it starts numbering first is random, this has caused me issues in the past.


----------



## alwaysared (Jul 7, 2020)

wildebus said:


> Swapped the VE.Direct plugs over.....
> The Device IDs also swapped over (I didn't reboot the Pi during this process, just moved the leads).
> 
> I guess that is due to the USB Ports each seeing now seeing a different device and allocating it a 'new' ID.


When I unplugged the USB leads and plugged them back in (without a reboot) the VRM showed two MPPTs in the Device list, one it hadn't seen for ages and one it had seen 3 minutes ago, so I just deleted the one it hadn't seen for ages so I guess something changed when I did it? Or else I wouldn't have seen two MPPTs in the VRM  

Regards,
Del


----------



## wildebus (Jul 7, 2020)

This is what I currently have ....




I have decided to not delete the old IDs so I can keep a track better.

So 8 hours ago was when I switched the VE.Direct plugs over.  Since then the MPPT has stayed connected but the BMV has lost connection twice - so by a process of elimination, it looks like I have a bad cable there


----------



## alwaysared (Jul 7, 2020)

wildebus said:


> This is what I currently have ....
> 
> View attachment 84123
> I have decided to not delete the old IDs so I can keep a track better.
> ...


Are you using USB extension leads? If so maybe swap them over and see if they are okay first?

Regards,
Del


----------



## wildebus (Jul 7, 2020)

nope.  just a pair of modifed USB leads with the VE.Direct style connectors (JST 2.0) soldered on, so made as short as feasible.
I have 4 altogether so will swap the suspect one out in a couple of days (just going to monitor for a while first to check the same pattern happens)


----------



## wildebus (Jul 8, 2020)

A few more outages on the BMV, so got to be the cable.
Removed the cable few minutes ago and fitted one of the first ones I made.  Will see how it goes!


----------



## wildebus (Jul 13, 2020)

wildebus said:


> A few more outages on the BMV, so got to be the cable.
> Removed the cable few minutes ago and fitted one of the first ones I made.  Will see how it goes!


So I fitted another cable to the BMV and that has been good.  But the MPPT  - which has been working great is now disappearing randomly despite not being touched.  
The cost of the proper cables are not that much so I am throwing in the towel on these DIY cables as it is just not worth the time and hassle.  We don't know what is in that lump on the end of the genuine Victron cables but there will be something there and whatever it is looks like it is important for reliable operation.

For messing around, use DIY cables, but for an installation that you want to rely on it communicating, I think the pukka cable has to be the way to go.


----------



## alwaysared (Jul 13, 2020)

wildebus said:


> So I fitted another cable to the BMV and that has been good.  But the MPPT  - which has been working great is now disappearing randomly despite not being touched.
> The cost of the proper cables are not that much so I am throwing in the towel on these DIY cables as it is just not worth the time and hassle.  We don't know what is in that lump on the end of the genuine Victron cables but there will be something there and whatever it is looks like it is important for reliable operation.
> 
> For messing around, use DIY cables, but for an installation that you want to rely on it communicating, I think the pukka cable has to be the way to go.


I'll buy the Victron ones if and when my DIY  ones pack in. I didn't make them to save money, I made them just to see if I could. Shame you've had so much trouble 

Regards,
Del
Note added:
I've just checked and mine have been working without anything dropping out since I upgraded the MPPT controller on June 19th


----------



## wildebus (Jul 13, 2020)

alwaysared said:


> I'll buy the Victron ones if and when my DIY  ones pack in. I didn't make them to save money, I made them just to see if I could. Shame you've had so much trouble
> 
> Regards,
> Del
> ...


It is good yours is working and I am pleased I saw the post and tried it   Just a shame it didn't work out as good in my case 
Maybe I should post you mine to see if they work properly on your system?  I think there is something borderline somewhere in the whole configuration.  I could use one on my regular setup instead of a VE.Direct cable to see I guess?


----------



## SquirrellCook (Jul 13, 2020)

What you don’t want is to buy new cables and still have the same problems.


----------



## alwaysared (Jul 13, 2020)

wildebus said:


> It is good yours is working and I am pleased I saw the post and tried it  Just a shame it didn't work out as good in my case
> Maybe I should post you mine to see if they work properly on your system?  I think there is something borderline somewhere in the whole configuration.  I could use one on my regular setup instead of a VE.Direct cable to see I guess?



Why don't you use one of your VE Direct cables on this setup and see if they drop out again?
That would eliminate the Pi set up.

Regards.
Del


----------



## wildebus (Jul 13, 2020)

alwaysared said:


> Why don't you use one of your VE Direct cables on this setup and see if they drop out again?
> That would eliminate the Pi set up.
> 
> Regards.
> Del


because the Pi doesn't have any VE.Direct ports?   (my 'proper' setup is using a Venus GX  )

I did run the Pi as a live setup for over a year and it was reliable (using OEM cables)


----------



## alwaysared (Jul 14, 2020)

wildebus said:


> because the Pi doesn't have any VE.Direct ports?   (my 'proper' setup is using a Venus GX  )
> 
> I did run the Pi as a live setup for over a year and it was reliable (using OEM cables)



Sorry, I thought you were referring to Victron's VE.Direct to USB cables.

Regards,
Del


----------



## wildebus (Jul 14, 2020)

SquirrellCook said:


> What you don’t want is to buy new cables and still have the same problems.


Indeed.  What I would need to do is use it on the Venus GX to confirm it is good if suspected still an overall issue.


----------



## xsilvergs (Jul 22, 2020)

This lead and description may give a clue to the type of lead required for communication:









						USB to TTL Serial Cable
					

This is a USB to TTL Serial Cable which allows for a simple way to connect TTL interface devices to USB. The I/O pins of this cable are c...




					www.littlebird.com.au
				




I found the link after stumbling on this:





__





						Caravaners Forum - Since 2000 - Information
					





					www.caravanersforum.com
				




I'm looking into control, which is limited, of the Phoenix inverter from the RPi, having to get my phone out to switch between ECO and ON is a faff. The inverter doesn't have Bluetooth built in, I bought the Victron dongle but it's expensive!


----------



## wildebus (Jul 22, 2020)

xsilvergs said:


> This lead and description may give a clue to the type of lead required for communication:
> 
> 
> 
> ...


Don't forget the new Feature added to Victron Connect which lets you connect to the VE.Direct devices via the Venus unit (including the Raspeberry Pi) through VRM.
And this is available via any platform Victron Connect works on, including a Windows PC - https://motorhomebuilder.com/threads/new-victron-feature.66980/#post-874039


----------



## wildebus (Jul 22, 2020)

xsilvergs said:


> .....I found the link after stumbling on this:
> 
> 
> 
> ...


blimey, that's getting complicated!


----------

