I have built one of these before but thought I'd revisit the project.
I have based this on the excellent Blynk project:
https://github.com/tekk/Tracer-RS485-Modbus-Blynk-V2
First I built a breadboard prototype powered by a Lithium 12v battery and a probably broken 100W solar panel connected to an Epever LS2024B charge connector.
There are 4 wires from the RJ45 plug 0v (brown), +7.5v (orange), A (blue) and B (green).
The first two go to the 5v-9v to 5v converter. The output of which +5v and GND go to Vin and GND of the NodeMCU.
The last two A and B go to the A and B inputs of the RS485 converter. The GND and VCC of this converter come from the GND and +5v of the NodeMCU. That leaves the 4 pins DI, DE, RE and RO of this device. The DI (data in) pin is wired to RX of NodeMCU (brown wire) and the RO (data out) is wired to the TX pin of the NodeMCU (red wire) while the two enable pins DE and RE and wired together and connected to D2 of the NodeMCU (orange wire).
This worked OK once I'd updated the sketch to use the latest Blynk API.
But is was mains powered rather than using the 7.5v provided by the LS2024B. So I sent off for some 5-9v to 5v adaptors and prepared to box up the project.
After checking this produced 5v from the RS45 cables 7,5v I plugged the USB-A connector into the uUSB connector of the NodeMCU and ensured Blynk was happy! :)
So next was to move from a breadboard to a box.
I have also used a 4 pin connector. Looking from inside the box:
https://ie.farnell.com/binder/99-0609-00-04/plug-free-4way/dp/1122398
https://ie.farnell.com/binder/99-0612-00-04/socket-panel-4way/dp/1122416
1O O4 1- blue 3- green
2O O3 2 - orange 4 - brown
I think wiring up this fella was the trickiest part of the project (Did it twice as I forgot a securing sleeve the first time!)
A pity I cannot use Wowki for NodeMCU. But it is ESP2866 rather than ESP32 based.
https://docs.wokwi.com/getting-started/supported-hardware
So I will try fritzing. Great software well worth 8 euro.
Here's a circuit diagram:
And here's the wiring layout for the components in the box.
I recommend Fritzing. Cannot code simulate Modbus comms but great for drawing :)
Well did some temporary wiring to check out the new circuit and it worked well, after swapping A and B wires. So now to solder these wires and box it up ready for field trials :)
Testing the LS2024B (without PV panel) on a 12v LiFEPO4 battery :) (Guess I should check my Blynk readings against Renogy DC Home app - though there will be a voltage drop form the battery)
A bit of a nest of wires but feel better trying this before committing to solder wires that will fit tightly into the project box.
Blynk app is happy reporting battery voltage.
At first, unit came online but present no battery voltage as no Modbus comms because I got A and B the wrong way round!
Next to solder these wires and fit the boards in a box to field test with a PV panel as well as a battery attached and also to check if Blynk provides an API so I can MQTT the data transmitted.
So boxed up boards and deployed with probably broken 100W PV panel in the shed.
So that concludes this stage of the project. Next I'll see if I can access this Blynk data via an API and add it to MQTT and a database for graphing :)
I'll also github the modified Arduino code.
No comments:
Post a Comment