Skip to content

Commit

Permalink
Voltronic Power SCC-MPPT Blueprint (#299)
Browse files Browse the repository at this point in the history
adding initial version of Voltronic Power SCC MPPT Charge Controller Blueprint
  • Loading branch information
nkrasko authored Feb 27, 2024
1 parent 4b197e6 commit c968e4f
Show file tree
Hide file tree
Showing 12 changed files with 686 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .marketplace/devices/devices.yml
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,16 @@
- blueprint: solar_charge_controllers/srne_ml-2440
verification_level: verified

- id: voltronic-power--scc-mppt
display_name: Voltronic Power SCC MPPT
description: MPPT Solar Charge Controller
icon: enapter-inverter-solar
vendor: voltronic
category: solar_charge_controllers
blueprint_options:
- blueprint: solar_charge_controllers/voltronic_scc_mppt
verification_level: ready_for_testing

- id: mpp-solar
display_name: MPP Solar Inverter
description: MPP Solar Inverters.
Expand Down
Binary file added .marketplace/vendors/icons/voltronic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions .marketplace/vendors/vendors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -232,3 +232,8 @@
display_name: Aquara
icon_url: https://raw.githubusercontent.com/Enapter/marketplace/main/.marketplace/vendors/icons/aqara.png
website: https://www.aqara.com/

- id: voltronic
display_name: Voltronic Power
icon_url: https://raw.githubusercontent.com/Enapter/marketplace/main/.marketplace/vendors/icons/voltronic.png
website: https://www.voltronicpower.com
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions solar_charge_controllers/voltronic_scc_mppt/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Voltronic Power SCC-MPPT Charge Controller

This [Enapter Device Blueprint](https://go.enapter.com/marketplace-readme) integrates **Voltronic Power SCC-MPPT Charge Controller**. The Blueprint supports protocol over [RS-232 communication interface](https://go.enapter.com/developers-enapter-rs232).

This Blueprint supports visualization of the following metrics in Enapter Cloud and Mobile App:

- PV Input Voltage
- Battery Voltage
- Charging Current
- Charging Current 1
- Charging Current 2
- Charging Power
- Warnings and Errors

For detailed connection and operation instructions check [Voltronic Power Website](https://voltronicpower.com/en-US/Product/Detail/SCC-MPPT) site.

## Connect to Enapter

- Sign up to the Enapter Cloud using the [Web](https://cloud.enapter.com/) or mobile app ([iOS](https://apps.apple.com/app/id1388329910), [Android](https://play.google.com/store/apps/details?id=com.enapter&hl=en)).
- Use the [Enapter ENP-RS232](https://go.enapter.com/handbook-enp-rs232) or [Enapter ENP-KIT-232-485-CAN](https://go.enapter.com/enp-kit-232-485-can) communication module for physical connection.
- [Add communication module to your site](https://go.enapter.com/handbook-mobile-app) using the mobile app.
- [Upload](https://go.enapter.com/developers-upload-blueprint) this blueprint to the communication module.

## Physical Connection

For physical RS-232 connection with the inverter you will need:

- RS-232 communication module:
- _Either_ Enapter [**ENP-RS232** communication module](https://handbook.enapter.com/modules/ENP-RS232/ENP-RS232.html),
- _Or_ [**ENP-KIT-232-485-CAN** module](https://developers.enapter.com/docs/tutorial/ucm-kit/enp-kit-232-485-can) (check out UCM Kit [introduction](https://developers.enapter.com/docs/tutorial/ucm-kit/introduction) and simple [JLPCB ordering guide](https://developers.enapter.com/docs/tutorial/ucm-kit/ordering)) + ESP-32 development board.
- Communication cable with RJ45 connector on one side and plain wires on another side. You can use _RJ45 breakout connector_ to assemble such cable.

### ENP-RS232 Connection Diagram

<p align="left"><img height="auto" width="800" src=".assets/wiring-scheme-enp.png"></p>

### ENP-KIT-232-485-CAN Connection Diagram

<p align="left"><img height="auto" width="800" src=".assets/wiring-scheme-kit.png"></p>

## Troubleshooting

This is initial version of the Blueprint. In case you find out any issues, please contact us in [Discord](https://go.enapter.com/discord).

## References

- [Voltronic Power Website](https://voltronicpower.com/en-US/Product/Detail/SCC-MPPT)
132 changes: 132 additions & 0 deletions solar_charge_controllers/voltronic_scc_mppt/manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
blueprint_spec: device/1.0

display_name: Voltronic SCC-MPPT Charge Controller
description: MPPT Solar Charge Controller from Voltronic.
icon: enapter-solar-inverter
vendor: voltronic
license: MIT
author: enapter
support:
url: https://go.enapter.com/enapter-blueprint-support
email: support@enapter.com

communication_module:
product: ENP-RS232
lua:
dir: src
amalg_mode: nodebug

properties:
serial_num:
display_name: Serial Number
type: string
fw_ver:
display_name: Firmware version
type: string
protocol_ver:
display_name: Protocol version
type: string

telemetry:
status:
display_name: Status
type: string
enum:
- Error
- Charging
- Not Charging
pv_input_voltage:
display_name: PV Input Voltage
type: float
unit: watt
battery_voltage:
display_name: Battery Voltage
type: float
unit: watt
charging_current:
display_name: Charging Current
type: float
unit: watt
charging_current_1:
display_name: Charging Current 1
type: float
unit: watt
charging_current_2:
display_name: Charging Current 2
type: float
unit: watt
charging_power:
display_name: Charging Power
type: integer
unit: watt

alerts:
no_data:
severity: error
display_name: No data from device
description: >
Can not get data from device, please check connection between Enapter
communication module and the inverter.
over_charge_current:
severity: error
display_name: Over charge current
description: Over charge current
over_temperature:
severity: error
display_name: Over temperature
description: Over temperature
battery_voltage_under:
severity: error
display_name: Battery voltage under
description: Battery voltage under
battery_voltage_high:
severity: error
display_name: Battery voltage high
description: Battery voltage high
pv_high_loss:
severity: error
display_name: PV high loss
description: PV high loss
battery_temperature_too_low:
severity: error
display_name: Battery temperature too low
description: Battery temperature too low
battery_temperature_too_high:
severity: error
display_name: Battery temperature too high
description: Battery temperature too high
pv_low_loss:
severity: warning
display_name: PV low loss
description: PV low loss
pv_high_derating:
severity: warning
display_name: PV high derating
description: PV high derating
temperature_high_derating:
severity: warning
display_name: Temperature high derating
description: Temperature high derating
battery_temperature_low_alarm:
severity: warning
display_name: Battery temperature low alarm
description: Battery temperature low alarm
battery_low_warning:
severity: warning
display_name: Battery low warning
description: Battery low warning

.cloud:
category: renewable_energy_sources
mobile_main_chart: charging_power
mobile_telemetry:
- pv_input_voltage
- battery_voltage
- charging_power
mobile_charts:
- pv_input_voltage
- battery_voltage
- charging_power
- charging_current
- charging_current_1
- charging_current_2
76 changes: 76 additions & 0 deletions solar_charge_controllers/voltronic_scc_mppt/src/commands.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
-- In order to reduce telemetry size some metrics are commented out.
-- If needed uncomment them and add to manifest.yml.

local commands = {
device_protocol = {
command = 'QPI',
},
serial_number = {
command = 'QID',
},
firmware_version = {
command = 'QVFW',
},
device_rating_info = {
command = 'QPIRI',
data = {
max_output_power = 1,
nominal_battery_voltage = 2,
nominal_charging_current = 3,
absorption_voltage_per_unit = 4,
float_voltage_per_unit = 5,
battery_type = 6,
remote_battery_voltage_detect = 7,
battery_temperature_compensation = 8,
remote_temperature_detect = 9,
battery_rated_voltage_set = 10,
the_piece_of_battery_in_serial = 11,
battery_low_warning_voltage = 12,
battery_low_shutdown_detect = 13,
},
},
general_parameters = {
command = 'QPIGS',
data = {
pv_input_voltage = 1,
battery_voltage = 2,
charging_current = 3,
charging_current_1 = 4,
charging_current_2 = 5,
charging_power = 6,
-- unit_temperature = 7,
-- remote_battery_voltage = 8,
-- remote_battery_temperature = 9,
-- reserved = 10,
status = 11,
},
},
device_warning_status = {
command = 'QPIWS',
general = {
over_charge_current = 1,
over_temperature = 2,
battery_voltage_under = 3,
battery_voltage_high = 4,
pv_high_loss = 5,
battery_temperature_too_low = 6,
battery_temperature_too_high = 7,
-- reserved = 8,
-- reserved = 9,
-- reserved = 13,
-- reserved = 14,
-- reserved = 15,
-- reserved = 16,
-- reserved = 17,
-- reserved = 18,
-- reserved = 19,
pv_low_loss = 20,
pv_high_derating = 21,
temperature_high_derating = 22,
battery_temperature_low_alarm = 23,
battery_low_warning = 30,
},
},
}

return commands
76 changes: 76 additions & 0 deletions solar_charge_controllers/voltronic_scc_mppt/src/main.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
local voltronic = require('voltronic')
local parser = require('parser')

function main()
local err = rs232.init(voltronic.baudrate, voltronic.data_bits, voltronic.parity, voltronic.stop_bits)
if err ~= 0 then
enapter.log('RS232 init failed: ' .. rs232.err_to_str(err), 'error')
enapter.send_telemetry({ status = 'Error', alerts = { 'init_error' } })
return
end

scheduler.add(30000, send_properties)
scheduler.add(1000, send_telemetry)
end

function send_properties()
local properties = {}
local result
local data

result, data = parser:get_protocol_version()
if result then
properties['serial_num'] = data
end

result, data = parser:get_serial_number()
if result then
properties['protocol_ver'] = data
end

result, data = parser:get_firmware_version()
if result then
properties['fw_ver'] = data
end

enapter.send_properties(properties)
end

function send_telemetry()
local telemetry = {}
local alerts = {}

local data, err = parser:get_device_general_status_params()
if data then
merge_tables(telemetry, data)
else
enapter.log('Failed to get general status params: ' .. err, 'error')
end

local data = parser:get_device_alerts()
if data then
alerts = data
end

if telemetry['status'] then
if string.sub(telemetry['status'], 2, 2) == '1' then
telemetry['status'] = 'Charging'
else
telemetry['status'] = 'Not Charging'
end
else
telemetry['status'] = 'Error'
end

telemetry['alerts'] = alerts
enapter.send_telemetry(telemetry)
collectgarbage()
end

function merge_tables(t1, t2)
for key, value in pairs(t2) do
t1[key] = value
end
end

main()
23 changes: 23 additions & 0 deletions solar_charge_controllers/voltronic_scc_mppt/src/moving_average.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
local MA = {}
MA.period = 10
MA.table = {}

function MA:add_to_table(voltage)
if #MA.table == MA.period then
table.remove(MA.table, 1)
end
MA.table[#MA.table + 1] = voltage
end

function MA:get_value()
local function sum(a, ...)
if a then
return a + sum(...)
else
return 0
end
end
return sum(table.unpack(MA.table)) / #MA.table
end

return MA
Loading

0 comments on commit c968e4f

Please sign in to comment.