|
Post by retrodaredevil on Jul 18, 2019 21:02:17 GMT
Please read the next few posts to fully understand the RJ12 port. I was successful in creating a DIY cable. Just read the next few posts.
Title was originally "Using an RJ11 cable to connect to a Raspberry Pi 2 GPIO"
Yesterday I received a Renogy Rover PG 40A charge controller and I was given the task of collecting data from it using a Raspberry Pi.
I was pretty angry, but not discouraged, to find that it didn't come with the RS232 to USB cable that was promised. So, I found an RJ11 cable with the 4 center wires/pins and soldered some connectors to it. The connections I made were solid and I tested they worked. I then tried to follow www.rototron.info/raspberry-pi-solar-serial-rest-api-tutorial/ that tutorial. Even though it was an RJ45 cable, I just ignored the first two and last two pins and treated it like a RJ11 cable since it was just 3 pins in the middle that were being used.
Once I did that it was too late. I measured the voltage on what I had actually connected and I realized I had sent 15V through the pi's GPIO. That part was pretty much my fault. I should have looked for a more up to date guide on how to connect it to a raspberry pi.
Is that correct? Can someone tell me the pins from left to right if I were looking at the controller mounted on a wall? Am I able to use an RJ11 (4 pins) instead of an RJ12 (6 pins) to get data, or do I need the two extra pins on the end?
Also, if there's a cable on amazon that someone has tested and uses that acts just like the cable that was SUPPOSED to come with the charge controller, I'd really appreciate a link.
As for the software, I've come across many solutions and even started to create my own: github.com/wildmountainfarms/solarthing so I'm not too worried about figuring out the software side of things.
|
|
|
Post by retrodaredevil on Jul 25, 2019 16:28:16 GMT
Update: I was able to get a RJ12 cable and came to the conclusion that I needed the 2 extra pins on the end. The pin out is something like "TX/RX/GND/GND/+/+". If you're using this for future reference, make sure to test it with a multimeter because it could be flipped.
When I measure the voltage from TX to Ground, it's 5.66 Volts. TX to RX is the same thing. I'm pretty sure that this means the serial communication uses a 5 volt "logic level". Because of that, I think that was the reason that I was unsuccessful in getting communication through my Raspberry Pi to work. The pi uses a 3.3V logic level so I think I would need a converter of some sort.
Right now I've ordered a USB to serial cable that hopefully supports the 5V logic level.
If anyone has any suggestions or experience with communication without the USB to RS232 cable, I'd really appreciate any tips or suggestions before the USB adapter arrives. Also if there are any modbus/renogy quirks I should be aware of that would also be helpful. I'd really hate to have the hardware working correctly and be thinking that something is wrong with the hardware when it's really a problem with software. I have to connect the Rover RX to the adapter TX and vice versa, correct?
|
|
|
Post by retrodaredevil on Jul 26, 2019 3:48:11 GMT
Second update: I did some research on Raspberry Pi and Arduino communication with the RS232 serial protocol. This page helped me understand it more: raspberrypi.tomasgreno.cz/uart-to-rs-232.htmlThat page basically says that without some sort of conversion, you cannot hook it up directly to your pi. So I bought: www.amazon.com/dp/B074Z55GPN/ref=cm_sw_r_wa_apa_i_RrFoDbWQ8NTV3 and www.amazon.com/dp/B00425S1H8/ref=cm_sw_r_wa_apa_i_KsFoDbMJNT050 . I will post an update in the next couple of days. I do not recommend getting an RJ12 to USB cable because I'm pretty sure that the pin out on the RJ12 cable is proprietary. I wish Renogy would stop pushing people towards their Bluetooth module and bring back the cable, but that's just me. I got an email back from someone at Renogy today and it was confirmed that the RS232 to USB cable was discontinued. I just hope they end up updating their manual and Amazon listing so no one else gets confused like I did.
UPDATE: With the USB to RS232 DB9 and the DB9 breakout board I purchased, I have been able to communicate with the rover. I hooked TX to RX and RX to TX and GND to GND. If anyone has any questions on how I did this I'd be happy to answer.
|
|
|
Post by williamwinters on Jul 30, 2019 23:10:41 GMT
I'm currently trying to do something similar, so this is great information.
I'm hoping to communicate with my renogy wanderer this weekend. It is part of a remote LTE connected project. I want to be able to track my solar power and battery data and report it along with all the other data that the station is collecting.
I have the Renogy modbus document. I ordered the same USB to RS232 and DB9 breakout board from amazon. I have a few raspberry pi boards lying around.
You are not talking to the void. I'm out here listening and you've provided a big head start. Thanks!
EDIT:
If you could show the pinout of your RJ12 cable to the DB9 breakout, that would be great. You've already done the work, I don't want to mess up such a simple step.
|
|
|
Post by retrodaredevil on Jul 31, 2019 20:24:10 GMT
Using the breakout, you will be using pins 2, 3, and 5. Pin 2 is the TX, Pin 3 is the RX and pin 5 is the ground. So for the RJ12 cable, I can give you a general idea, but I seriously recommend a multimeter just to make sure you don't connect either 15V pins instead of the data pins. Like I said above, the pin out is TX, RX, GND, GND, +, +. You still may want to make sure that's not flipped. If you use a multimeter, you can pretty easily figure out each pin out. TX to RX or GND will give you around 5.66V. RX to GND will be a very low non-zero value if I remember correctly. So you can always be sure that the 2 middle pins are both ground, but make sure to check the outside ones. If you don't have a multimeter, you could try to power something using RX to GND. If you get a lot power there, then you must have it flipped because RX to GND cannot power anything because there's so little power there. So you will be connecting pin 2 (TX) on the breakout to RX on the RJ12 cable, pin 3 (RX) on the breakout to TX on the RJ12 cable and pin 5 on the breakout to ground. Here's a few images: imgur.com/a/N3UCdWfAs you can see, I was able to get a nice box that even had a nice little breakout for the RJ12 cable as well, I don't know how hard those are to find since I found one at a store with many recycled things. Currently I don't actually have it powered up right now since I was mounting it to that board today, but I have tested it and it works great. If you're using Java, this might be useful: github.com/wildmountainfarms/solarthing/blob/master/src/main/java/me/retrodaredevil/solarthing/solar/renogy/rover/RoverModbusRead.java and github.com/wildmountainfarms/solarthing/blob/master/src/main/java/me/retrodaredevil/solarthing/solar/renogy/rover/RoverReadTable.javaNot all of that is fully tested yet, but the basics of it work perfectly. For whatever reason in my program it takes around 4 seconds to get all of the data. Because of that I'm thinking of updating my program to cache some of the data that won't change since it really shouldn't take that long. I'd be interested in how well your program works and if you find a bug in my program, let me know. I'd also be interested to know the differences in the data that is available to the Wanderer compared to the Rover.
|
|
|
Post by williamwinters on Aug 4, 2019 19:15:13 GMT
Awesome. Thanks. This is very appreciated. I’ll update when I have made some progress. Here is the install site. imgur.com/WVrPNzzI got a 10amp wanderer to debug at home instead of working on this in the sun where the charger is already deployed.
|
|
|
Post by playersz28 on Aug 12, 2019 11:13:30 GMT
I've had a Pi running and charting my Rover for almost a year now. I use the RJ-USB cable that came with the Rover.
|
|
|
Post by retrodaredevil on Aug 13, 2019 1:51:32 GMT
I've had a Pi running and charting my Rover for almost a year now. I use the RJ-USB cable that came with the Rover. You're pretty lucky you got a cable with that Rover. The newer ones on Amazon don't come with that cable anymore :/
I've been collecting data continuously for a week and a half now. It seems to be working great. Now I just have to use my program to set a few of the voltage settings. It's not actually hooked up to any solar panels yet, so most of the data is just zeros. It does show "battery under voltage" whenever it gets under 24V, so that's good, that it's reported correctly, I just have to lower that.
|
|
|
Post by playersz28 on Aug 14, 2019 12:42:17 GMT
I've had a Pi running and charting my Rover for almost a year now. I use the RJ-USB cable that came with the Rover. You're pretty lucky you got a Rover with that cable. The newer ones on Amazon don't come with that cable anymore :/
I've been collecting data continuously for a week and a half now. It seems to be working great. Now I just have to use my program to set a few of the voltage settings. It's not actually hooked up to any solar panels yet, so most of the data is just zeros. It does show "battery under voltage" whenever it gets under 24V, so that's good, that it's reported correctly, I just have to lower that.
Pretty sure I was also running an RS232-USB adapter I hacked up when I needed to run from the trailer in my yard into my office. I'll have to look for it to check.
|
|
|
Post by RayDas on Aug 14, 2019 21:17:07 GMT
Very interesting. I am using the 'Solar Station Monitor' program, provided by Renogy. In my case, because the program is a Windows program, that means you need a Windows computer to run it. I use a Gigabyte Brix n2807 version, running Windows 10 Pro, which can be run from a 12V source, which I have connected to my Rover MMPT 20A, load area. Yes, this uses quite a bit of juice when you do a start up, so I was thinking of using a Raspberry Pi.
Since I am not a Java tinkerer, I would like to use Python instead. Any suggestions as to some problems that would come up using Python?
Looking at a .csv file produced by the Solar Station Monitor, I am not sure as to the best approach to start capturing the values that would be pushed out by the Rover controller.
|
|
|
Post by retrodaredevil on Aug 15, 2019 2:37:59 GMT
So if you'd like to use python, it looks like there's a library made for this: github.com/corbinbs/solarshed . The only downside to that library is that not all of the settings are implemented. However, now that I look at it, the methods that aren't implemented in that library are completely useless, to me at least. If you look at the Modbus document, almost everything after the battery type is useless. (I haven't found a use for the unimplemented data anyway) There wouldn't be any problems that come up using Python at all. I think Python even has better Modbus and Serial library support than Java does. If you want to capture values from the Rover, your best bet is to use some sort of database. For my program, I am using CouchDB. If you ever plan to have CouchDB open to the public, don't use it. Securing it is a nightmare. I think I'm going to eventually look into MongoDB. TDLR: If you want to store data from the Rover, use a no-sql database that is document based. One that uses JSON to communicate the information is nice too. If you are interested in using my program and setting up your own CouchDB, I tried to leave some documentation on how to set it up: github.com/wildmountainfarms/solarthing/blob/master/couchdb.md and github.com/wildmountainfarms/solarthing/blob/master/solar/README.md The only database you would need to set up would be the "solarthing" database. The second link is the set up for running the program.
|
|
raydas
Solar Devotee
Posts: 166
|
Post by raydas on Aug 15, 2019 13:00:34 GMT
The reason I am more interested I python is because I have become somewhat familiar with SQLite DB. In fact I have a functional SQLite DB that is collecting data.
Below is a couple of lines from the 'Solar Station Monitor' .csv file:
In your experience, is the Rover pushing out the data fields, continuously, as seen in the .csv file or do you have to submit special commands to get the data?
Since my setup is more of an experiment to gather data and then try to do an analysis of the equipment, it seems like most of the data in the .csv file could be used, for my purposes anyway.
In the vicinity, close by, I have a Dell box setup that is running an xubuntu GUI server. So, maybe, have a Raspberry Pi connected to the Rover, that captures the Rover data and then submits it to the SQLite, and some form of data captured gets pushed to the Dell server for whatever?
|
|
|
Post by retrodaredevil on Aug 15, 2019 13:20:39 GMT
So the Rover doesn't "push" out data. Any data you want, you have to request. That's what Modbus is for. Basically Modbus is a protocol where you can request and set data. Both the solarshed library and my library are a pretty good example of how to get that data.
How you want to format that data to put into a database is up to you. Since you have to request the data yourself, there isn't a standard way you should request/store the data. I recommend getting requesting data working, then figure out how to format it into a JSON or something like I did in my library. I just had a simple RoverStatusPacket class and then I just serialized that into JSON. You can do the same thing in Python.
|
|
|
Post by playersz28 on Aug 15, 2019 15:37:44 GMT
My monitor app is based off of EPsolarserver code and runs on a Pi installed in my RV. I also have an ESP8266 reading a shunt via INA219. Still using the ESP because the INA lib is Python and I haven't got around to converting it to C++. I also log RV location by picking up the NEMA data from an old phone.
|
|
raydas
Solar Devotee
Posts: 166
|
Post by raydas on Aug 15, 2019 17:12:29 GMT
I started a quick experiment, I downloaded Tera Term to my Windows 10 computer. In the TT setup it showed that COM3 9600BAUD was connected, which is the connection to the Rover via RS232/USB cable. Now the only problem is the missing command set that allows you to talk to the Rover.
Will Renogy be releasing the command set for communication with the Rover, or is there a download, of the command set, available somewhere. Not sure how many people are using the RS232/USB cable, but it seems that this device is no longer supported by Renogy, maybe a public release of the command set is in order.
While thinking about that, maybe a public release of the command set for the BT module is in order also. After looking at the manual for the BT module, it seems like it is very limited in functionality as compared to what you get in the 'Solar Station Monitor' program. Just my 2 cents.
|
|