Closed Rey1635 closed 1 year ago
Hi, sorry about not thinking about that, I'll make a schematic / code for a single arduino and charge controller. Will you have access to an esp8266? I'm thinking i can get it to work with just one esp8266. That way you don't have to deal with the RF24 stuff.
Thank you very much for your response.. I do have an esp8266. I'll just wait for your update. God Bless You always.
You are also going to need a MAX3232 breakout board since the voltage level the charge controller uses to talk over rs232 isn't compatible with the Arduino and needs to be converted.
I found this on amazon and it should work.
I'm not sure where you are from but try searching for "MAX3232 breakout" and see if you can find something simmilar to that, feel free to send links to the ones you find and I can try to tell you if they will work.
If you can only find ones which look like this that's ok, you'll need to find a way to connect to the DB9 connector using something like this.
Also the charge controller uses a RJ12 (6P6C) jack for the modbus connector so you are going to need a cable like this which you will need to splice in half and strip the wires. This may look like a phone cable or Ethernet cable, but it isn't, it has 6 contacts.
I managed to get a ESP8266 to talk to the charge controller, will upload code, schematic and pictures shortly.
I do have one of this and I already have a RJ12 (6P6C). Thank you very much
Nice, that should work!
I uploaded some examples and much more detailed instructions, have a look at them here.
Also this particular example is the one you are interested in, just make sure you replace the MAX3232_RX
and MAX3232_TX
values to whatever pins you are using. (Most of that file is spent writing the data to the serial monitor so it isn't as scary as it looks at first.)
Let me know if you run into any problems :)
Thank you very much. I'm so excited to start my project. May God Bless You always.
I tried to the upload code on my esp8266 but there is an error ("'class Modbus' has no member named 'start'") on master.start(); I've already installed the modbus-esp8266 library.
I'm not using that modbus library, I used https://github.com/smarmengol/Modbus-Master-Slave-for-Arduino There are instructions in that repoitory for how to install it, I don't think it is in the Arduino IDE.
thanks for the link of the library.. error has been solved.
Sad to say no luck for me.. I have already tried with arduino.
Maybe I should purchase a different type of MAX3232 breakout board.
How do you have it wired up? You may have RX and TX backwards on either the arduino side or the charge controller side. Please send a picture of the wiring you are using.
Here is how I wired up.
On the arduino side the you have the VCC and GND reversed. Also I'm not sure what roles you have assigned to D2 and D3. For getting it started for the first time, can you stick to D1 and D2 since those are the only pins I tested. Your RX and TX lines seem correct though.
I'm pretty sure D3 cannot be used for software serial according to some stuff I found online. Just use D1 and D2 for now since I know those work.
Thank you very much.
btw, can I apply this on arduino uno? What pins should I use? Thank you
Were you able to get it to work?
I have Arduino nano wiring examples here.
So, if you follow those examples use:
#define MAX3232_RX 2
#define MAX3232_TX 3
still no luck. I will just purchase other type of MAX3232 breakout.
Darn.
Here is the one I use by the way: https://www.digikey.com/en/products/detail/mikroelektronika/MIKROE-602/4495610
Also which charge controller are you using?
I'm using SRNE ML2420
Yeah that should work, appears to be nearly identical to the ML2440 which is one of the ones I use and the manual says it supports modbus and the bluetooth module which means we should be able to talk to it since the bluetooth module is pretty much doing the same thing.
If you do get one of the ones with the DB9 connector (like the one I used) make sure you get a DB9 breakout adapter like this.
ok. thanks for the suggestion, I'll do get that one.
I know I maybe a little late on saying this. But to the serial board, I just found a USB cable for it. It is USB-A to RS232 Serial 6P6C on Amazon. I use a Raspberry PI for mine so USB works for me, and my work for others.
https://www.amazon.com/dp/B07JGRJR4V?psc=1&ref=ppx_yo2ov_dt_b_product_details
Good day, I would like to ask if my connections are correct. and I changed the arduino code with this..
Thank you very much
Your connections are correct, but for the code you need to have a D in front of the number, so use D1 and D2.
The colour of the wires you chose going from the 6P6C jack to the DB9 connector in your diagram aren't the actual colours right? 1 should be white, 2 should be black and 3 should be red. Maybe just compare your connector with mine to make sure our connectors are the same:
Here's mine..
changed the code
but there is an error: 'D1' was not declared in this scope
Interesting, seems like some ESP8266 do not support the D labels. Lets just use the pin numbers directly.
#define MAX3232_RX 5 // RX pin. If following my ESP8266 instructions use D1.
#define MAX3232_TX 4 // TX pin. If following my ESP8266 instructions use D2.
Here is your diagram with the colors from your cable.
Still no luck even with new arduino nano... I followed your given pictures..
How are you going from the RJ12/6P6C cable to the DB9 connector?
I know that when building mine I had some trouble making good contact at first. Could you check with a multimeter to see if you are getting continuity on those three lines by putting one end on the RJ12 contact and the other on the corresponding solder connection of the DB9 connector on the underside of the MAX3232 connector board?
Also I know sometimes I've had to reboot some of my charge controllers after they stop reporting data, but it's quite rare. Try disconnecting one cable from both the battery and the solar panels and leaving it for like 10 seconds then plugging it back in.
Also check all your other connections to see if they are loose or have intermittent contact. In my experience DuPont connectors are loose alot so investigate those especially.
Also do you have a link to the exact MAX3232 board you bought, I'm curious if the pinout might be different for some reason.
I use this one https://www.amazon.com/Anmbest-Solderless-Terminal-Connector-Breakout/dp/B07S7M24C3 and here is my MAX3232 board https://www.elecrow.com/rs232-to-ttl-converter-module-max3232-p-762.html..
The MAX3232 board has the same pinout as mine and the breakout should eliminate contact issues.
For the ground (Green on RJ12) are you using the GND terminal block on the breakout connector? If so can you switch to using pin 5 instead? It looks like some of these breakouts don't actually connect that terminal to pin 5.
Also just to clarify BLUE->3, YELLOW->2, GREEN->5
I'm using pin 5 as ground on breakout connector. also blue to pin 3, yellow to pin 2 and green to 5. I will try reboot my charge controller
Error when trying to communicate with the charge controller. Here is my connections
RJ12 CONNECTIONS RJ12 pin 1 to db9 pin 3 RJ12 pin 2 to db9 pin 2 RJ12 pin 3 to db9 pin 5
Your connections look good. Let's try changing the ESP8266 pins, maybe those pins are reserved on your variant?
Move your Blue one (D1) over to D5 and Purple one (D2) over to D6 and then change the code to
#define MAX3232_RX 14
#define MAX3232_TX 12
As a sanity check I just went and did a fresh clone of the repo, changed only those two lines and using this configuration I was able to get data from my ML2440. So I'm not really sure what's going on here. My money is on the MAX3232 not working correctly since the capacitors on that thing look way smaller than the ones on mine.
Thank you.. I will replace my MAX3232 module
Hold on! I think I thought your connector was upside down, can you send another picture of your RJ12 jack?
One with the full connector please so I can see the wire colors through the clear plastic and see which way the wire exits the connector.
Like this:
Yeah it's the way I thought it was, darn. I'm going to try the wiring diagram the renogy guides use where RX and TX are flipped relative to what I'm doing.
That didn't work, even if I flipped the ones on the ESP8266 side. Seems like the way I have it is the only way it works. I wonder if the renogy ones use a different pinout.
I will try this
Good luck, I'm really sorry this is giving you so much trouble.
Thats always part of learning.
As a newbie, I would like to ask how to use only 1 arduino to read the battery voltage and the charging state status of the SRNE? How will I connect it to arduino? Thank you very much for your help.