Skip to content

Variables and Commands

Tim O'Brien edited this page Apr 6, 2021 · 1 revision
Home 1:Parts 2:Hardware 3:Software 4:Data 5:Wiring About

The controller has a bunch of commands and preferences you can set. Here's some detail on what each does:

Preferences

WiFi & Database settings

  • wifiap - what wifi name to connect to
  • wifipass - what password to use
  • mqttServ - what MQTT server IP/address to connect to (supports setting the :port)
  • mqttUser - username for MQTT
  • mqttPass - password for MQTT
  • mqttFeed - feed prefix for MQTT

Hardware setup

  • inPin - which GPIO pin to measure solar voltage from (after a voltage divider!) Make sure it's ADC1! (pins with ADC0 through 7 in this diagram)
  • psu - which type power supply unit to use. Set "DROK" or "DPS" (does support fancier syntax for custom setups, ask Tim in the discord)
  • vadjust - use this to fine tune the involt measurement (like if you used a different voltage divider)
  • currentcap - cap your maximum current output to your batteries. For example if you've got batteries that are only safe up to 4.5A you could set it to 4.5 and it would never increase above it
  • lvProtect - triggers a GPIO pin low or high if your battery gets too low. Set to PIN[i]:LOW-THRESHOLD:RECOVERY-THRESHOLD (ex: 22i:36.0:37.0 is pin 22, inverted, low cutoff of 36.0, recovery 37.0)

Tuning

  • pgain - Proportional Gain: changes how a change in solar panel voltage affects the output current to the batteries. Use this to tune to get better solar following performance
  • ramplimit - limits how fast the output changes to the current are allowed to happen
  • offthreshold - can ignore. Is auto-set and in-development

Update rates

  • pubperiod - change the time (in ms) between database publishes (only publishes changed values depending on the periods below..)
  • printperiod - change the time (in ms) between printing system state to the serial port
  • adjustperiod - change the time (in ms) between adjustments to the PSU. Adjustments will already happen faster if collapse is imminent
  • measperiod - change the time (in ms) between input voltage measurement. Much faster.
  • autosweep - change the time (in seconds) between sweeps (see sweep action)

Power things (not just actions but definitely not prefs)

  • outputEN - enable power output. must be set to on to enable output, anything else to disable. Empty value returns current state
  • outvolt - set output voltage limit on the PSU. Empty value returns current state
  • outcurr - set output current limit on the PSU. Empty value returns current state
  • outpower - just returns the measured output power
  • currFilt - returns filtered output power
  • state - allows you to override the current state variable or just get it
  • involt - reads the current input panel voltage
  • wh - reads the current Wh stored since last reset. May be set as well. On bootup it restores from mqtt
  • collapses - returns the number of collapses in the last 5 minutes
  • setpoint - The usually auto calculated goal setpoint for the input solar voltage to reach.

Actions

  • sweep - trigger a sweep process to calculate the setpoint
  • connect - connects the wifi and mqtt database if not already done
  • disconnect - disconnects mqtt and wifi
  • restart - reboots the ESP32 microcontroller
  • clear - clears all prefs
  • debug - enables debug output. set debug=off to disable
  • version - returns the firmware version
  • update - run an OTA update from an HTTP link
  • uptime - returns the time since last boot