Skip to content
/ tinyUPS Public

tinyUPS is the Control and Management Tool with SNMP Server for your UPS

License

Notifications You must be signed in to change notification settings

way5/tinyUPS

Repository files navigation

  |   _)              |  | _ \   __| 
   _|  |    \   |  |  |  | __/ \__ \ 
 \__| _| _| _| \_, | \__/ _|   ____/ 
               ___/                  

Dynamic JSON Badge    UI version   Static Badge

+ DESCRIPTION

tinyUPS is the way to extend functionality of an Uninterruptible Power Supply (UPS)/power inverters. It provides onboard SNMP server, temperature control and a Control Panel (CP), just like on an enterprise systems. The project is now on beta test stage, however it shows very stable results during months 24/7. If you'll decide to modify your own UPS it's at your own risk.

WARNING

The project requires an advanced skills in electronics. It's not a plug-n-play device. ;)

WARNING

Follow the standard precautions! Every UPS is a potentially dangerous device because it contains an electric parts under high voltage.

+ TABLE OF CONTENTS

+ TOOLKIT

  • PlatformIO
  • KiCAD

- CONTROLLER

tinyUPS is originally based on WEMOS S2 mini board. However very likely it would work on another ESP32 boards with minor changes in firmware. All the configuration you may need is in platformio.ini and the UPS driver header file. If the communication interface of a particular UPS is not SPI, you need to create a new UPS driver and to change the PCB as well.

Development

If you've created a new driver please share it by creating merge request or attaching it in discussions.

- PCB

The current PCB is designed for DIY via CAM method. If you want it printed profesionally, you may need to redesign the PCB. Since the most of the UPS controllers have 5V data bus, we need a level shifter to be able to communicate with them and a small step-down PSU for ESP32.

Bill of materials. Instead of the BSS138 mosfets could be used any compatible type, ex.: IRLML2502.

If you'll be using S2 mini board you need to desolder built-in LDO IC (ME6211C33) since power will be supplied directly to 3.3V pin. It's possible to keep the LDO but you will not be able to use serial port for firmware upload and debugging. See WEMOS S2 mini schematics.

The example driver is for a built in SPI LCD display, for a particular manufacturer and model. You'll probably have the very different device and may be even without any LCD display, so you'd need to figure out how to speak with the controller. This part is DIY. Feel free to call for help in Discussions.

- Web UI

tinyUPS has web UI based at tailwindcss/flowbite and webpack.

UI translations are available in ./web/lang directory. You're able to add a new one or remove existing if you wish by editing the header of common.js script. Variable i18nlang contains the list of available locales to be built-in, where element 0 of the array is also a fallback (used by default) locale. Remove unnecessary locales from i18nlang to save space on file system partition.

The package manager is yarn so if you're not familiar with it continue with the folowing to build the UI:

yarn build:prod

that's all you need to prepare the FS to upload. Use "Upload Filesystem Image" command from PlatformIO project tasks or:

platformio run --target uploadfs [--environment [your_env]]

+ BUILD

- CONFIGURATION

All the sigificant parameters for your setup are inside configrure.json file. If you're adding a new parameter you'd need to run Rebuild Intellisense Index in PlatformIO in order to have your parameter set and available.

PARAMETER DESCRIPTION
system_log_size Size of the system log file (in bytes)
snmp_log_size Size of the SNMP server log file (in bytes)
mtemp_log_size Size of the temperature management log (in bytes)
mdata_log_size Size of the log of monitored events (in bytes)
ups_rated_input_voltage Nominal input voltage value (V)
ups_rated_input_freq Nominal input frequency (Hz)
ups_rated_low_input_voltage_threshold Nominal low threshold of the input voltage (V)
ups_rated_high_input_voltage_threshold Nominal hight threshold for input voltage (V)
ups_rated_output_voltage Nominal output voltage (V)
ups_rated_output_freq Nominal output frequency (Hz)
battery_rated_charge_capacity_ah Nominal UPS battery capacity (Ah)
ups_rated_battery_amps_max Nominal UPS battery current (Amps)

- WiFi RECONNECTION STRATEGIES

If tinyUPS has lost connection with AP you may wish it to fallback to AP mode (tinyUPS.01.XXXX network name) or it may keep trying to reconnect till the source network is available. You can choose the desired behavior (see wifi_reconnect_method parameter) before to compile firmware.

METHOD_ID DESCRIPTION
1 If the configuration data is available, tinyUPS intents to connect to the specified AP. If the connection is not succeeded it starts AP. If connection is lost the device tryes to reconnect once (10 sec interval). If connection is not succeeded it starts AP and remains in this mode untill restart.
2 [D] If tinyUPS has lost connection with source network it tryes to reconnect once. If connection is not succeeded it starts AP and periodically scans WiFi networks. If the source network has been found, the device intents to reconnect. Till the connection is not succeeded it remains in AP mode.
3 Once the device has lost connection to AP it continuously tryes to reconnect to the source network. The WiFi mode remains STA.
4 Rely on built-in functionality of setAutoReconnect(). tinyUPS will remain in STA mode and be seeking for the source AP.

[D] - the default method

+ SETUP

When you first run tinyUPS, it boots up in AP mode. Look for tinyUPS.01.XXXX WiFi network. Default network password (config.apkey) could be changed in helpers.h. Once connected the configuration is available on 192.168.4.1.

tinyUPS setup page

When setup is completed tinyUPS restarts, expecting an automatically assigned IP.

You are able to restart the device or reset configuration data to defaults using Control Panel -> Service Menu:

tinyUPS service menu

and then continue with confirmation:

tinyUPS confirmation

+ CONTROL PANEL

The UI is pretty simple and displays most of the real-time parameters. There are multiple self explanatory graphical representations for the collected data.

tinyUPS dashboard charts

tinyUPS may be monitored remotely via JSON API, in practice it may be easily included in a local smart home network. To get access to API you need to add an API key (go to Configuration -> API):

API control panel

Now you're able to send a post request using similar url format:

http://tinyUPS_ip_address/command?key=154aae95aa657fc37e0fa7e712dd7856

+ DEVELOPMENT

- DRIVERS

There are the following functions that must be implemented by every UPS driver: upsDriverInit, upsDriverLoop, upsDriverDeinit. You may also wish to look at the driver for thermistor (currently this is 1k M52A), it may need some changes. Depends on which thermistor you'll be using.

- DEBUG

Serial monitor is used to perform the most of the tasks and to solve issues. Once you've connected use ? to request the commands list.

tinyUPS serial monitor

+ CHANGELOG

  • fw:1.3.0 / ui:1.2.0
    1. firmware and filesystem now upgradable Over the Air
    2. overal improvements on UI
    3. firmware stability improvements (memory leaks, code structure, etc)

+ PHOTOS

tinyUPS PCB thermistor PCB UPS LCD UPS exterior

+ CREDITS

About

tinyUPS is the Control and Management Tool with SNMP Server for your UPS

Resources

License

Stars

Watchers

Forks