All Projects → jandrassy → Regulator

jandrassy / Regulator

Licence: AGPL-3.0 license
DIY Arduino consumption regulator build to use excess solar power for auxiliary 'summer' heating. The solar power data are retrieved over SunSpec Modbus TCP. IoT monitoring with Blynk and local Web server.

Programming Languages

C++
36643 projects - #6 most used programming language
javascript
184084 projects - #8 most used programming language
java
68154 projects - #9 most used programming language
c
50402 projects - #5 most used programming language
HTML
75241 projects
CSS
56736 projects

Projects that are alternatives of or similar to Regulator

solaredge modbus
SolarEdge Modbus data collection library
Stars: ✭ 49 (+53.13%)
Mutual labels:  modbus-tcp, sunspec
POST-Arduino-Data-Wireless
A simple way to send data from an Arduino and save it to a database (MySQL) over WiFi.
Stars: ✭ 43 (+34.38%)
Mutual labels:  arduino-sketch
khttpd
An experimental HTTP server implemented as Linux kernel module
Stars: ✭ 41 (+28.13%)
Mutual labels:  web-server
arduino-modbus-rtu-tcp-gateway
Arduino-based Modbus RTU to Modbus TCP/UDP gateway with web interface. Allows you to connect Modbus RTU slaves (such as sensors, energy meters, HVAC devices) to Modbus TCP/UDP masters (such as home automation systems). You can adjust settings through web interface.
Stars: ✭ 56 (+75%)
Mutual labels:  modbus-tcp
arduino-primo-tutorials
Here some tutorials to explain and show how to make use of the new features of the Arduino Primo and Arduino Primo Core, such as Wifi, BLE, NFC, InfraRed and various sensors. Hope you can find this helpful to create amazing stuff, save the planet or make a cool project to look smart at the dinning table with your uncles.
Stars: ✭ 12 (-62.5%)
Mutual labels:  arduino-sketch
go-modbus
modbus write in pure go, support rtu,ascii,tcp master library,also support tcp slave.(WIP new implement<old: https://github.com/thinkgos/gomodbus >)
Stars: ✭ 124 (+287.5%)
Mutual labels:  modbus-tcp
huawei solar
Home Assistant integration for Huawei Solar inverters via Modbus
Stars: ✭ 126 (+293.75%)
Mutual labels:  modbus-tcp
good-arduino-code
Frontend for goodarduinocode.com - A curated collection of Arduino coding examples
Stars: ✭ 22 (-31.25%)
Mutual labels:  arduino-sketch
Modbus-TCP
Modbus TCP client library to interact with Modbus servers such as PLCs.
Stars: ✭ 43 (+34.38%)
Mutual labels:  modbus-tcp
go-baseapp
A lightweight starting point for Go web servers
Stars: ✭ 61 (+90.63%)
Mutual labels:  web-server
stirfry
StirFry is a self contained and lightweight web framework for nodejs
Stars: ✭ 24 (-25%)
Mutual labels:  web-server
ModbusMechanic
Cross platform GUI MODBUS TCP/RTU simulator & gateway. Interprets data types including ascii float and int.
Stars: ✭ 63 (+96.88%)
Mutual labels:  modbus-tcp
diecast
A standalone web server and template framework.
Stars: ✭ 13 (-59.37%)
Mutual labels:  web-server
satori
An HTTP server library in C++
Stars: ✭ 14 (-56.25%)
Mutual labels:  web-server
azure-iothub-pubsub-esp8266
Using Arduino PubSub library with Azure IoT Hub on an ESP8266
Stars: ✭ 17 (-46.87%)
Mutual labels:  arduino-sketch
mbmd
ModBus Measurement Daemon - simple reading of data from ModBus meters and grid inverters
Stars: ✭ 140 (+337.5%)
Mutual labels:  sunspec
BadUSB
Personal implementation of the BadUSB exploit with an Atmel 8-bit AVR ATTiny85 acting as a HID keyboard
Stars: ✭ 63 (+96.88%)
Mutual labels:  arduino-sketch
ESPShaker
ESP8266 interactive serial command processor via Arduino core.
Stars: ✭ 24 (-25%)
Mutual labels:  arduino-sketch
Prack
Simple and Scalable Web Server 🚀
Stars: ✭ 14 (-56.25%)
Mutual labels:  web-server
muse-as-service
REST API for sentence tokenization and embedding using Multilingual Universal Sentence Encoder.
Stars: ✭ 45 (+40.63%)
Mutual labels:  web-server

Regulator

DIY Arduino consumption regulator build to use surplus solar power for auxiliary 'summer' heating. The solar power data are retrieved over SunSpec Modbus TCP. IoT monitoring with Blynk.

Intro

I have in the basement a small wellness room with a hot tub. The room has a floor heating and in the Winter there is pleasantly warm. But in Summer the floor was uncomfortable cold. After I bought a Fronius Symo Hybrid PV system in 2016, I discovered that I could use the surplus solar power in Summer to heat with a small 2kW electric heater the water of the floor heating of that room.

For the PWM regulation of "PWM to 'phase cutting' adapter box" I discovered Arduino. I am a professional software developer so the programming is the easy and fun part. And building the box was fun too. And it is still work in progress with improvements, additional functions and control. In Jun 2019 I replaced the PWM-to-phase-cutting module with Triac Dimmer module with the Triac directly controlled by the Arduino.

To regulate the water heater using surplus solar power Fronius has Ohmpilot, but it can't do the additional control which my regulator does, like commanding valves or turning off some other deferrable consumption.

I don't think someone could take this project and use it without changes, but the concept and many parts of the project can help to build a similar system. The source code is modular with multiple ino files. They are all like add-ons to the main Regulator.ino which handles only the core parts of the system. Most of the additional ino files can be simply removed, because they are special for my system or add only additional optional control and/or monitoring. I decided to go the multiple ino code separation way with almost no encapsulation of partial functionality. I could encapsulate functionality into classes with declarations in h files, but it would be only more work for me and harder to understand and reuse for a hobby coder.

Pictures

Heating

Regulator box

AC schematics

Regulator box versions with Kemo modules

Hardware

Electronics

  • Arduino with some shield or module for networking and optional SD card reader for static web files and csv logging
  • Seeed Grove Base Shield - the Grove connectors ensure firm connection of wires with simple assemble and disassemble and the shield supplies 5 V VCC for the Grove modules.
  • Robotdyn AC Light Dimmer Module - Triac and zero crossing detector for direct AC phase cutting. I use additional heat sink, because for 2 kW the dimmer overheated. For 1.5 kW or less it should be good.
  • Grove 30 A Relay module for Triac bypass at full power
  • ACS712 20 A current sensor module
  • Grove SSR V2 2 pcs for circulation pump and valves
  • Grove Dry-Reed Relay is for Balboa hot tub heating suspend activation
  • Grove Passive Buzzer - buzzer module for strong melody beeps
  • Grove LED Bar - 10 LEDs with individual dimming requiring only any two digital pins
  • 5 mm status LED with resistor as simple alternative to LED Bar
  • Button - plain momentary push-button to be used with internal pin pull-up (do not use the Grove button module, it has a pull-down and when you disconnected it, the pin floats.
  • Grove Wrapper - to fasten the Grove modules to a DIN rail mount (the Grove 30 A relays don't fit into Grove wrappers)

Removed components

MCU options

  • any classic AVR Arduino in Uno or Mega format with some shield or module for networking
  • Arduino Zero or M0 in Uno format with some shield or module for networking and with SD card to save events (no EEPROM)
  • Arduino MKR board on Arduino MKR Connector Carrier (Grove compatible) with on-board WiFi, ETH Shield or other networking module
  • Nano 33 IoT with Nano Grove shield

Heating system

  • TEZA2000 heating - this small electric heating is a local 'invention'
  • circulation pump - set at 40 W
  • Servo valves Lufberg ZV-2 - simple and cheap, it disconnects AC on end-stop

Sketch

Copy the folder Regulatorfrom this GitHub repository into your sketch folder of Arduino IDE and the TriacLib folder goes into your libraries folder.

System

  • Regulator.ino - core: global variables, setup() and loop() handling network, heating relays, main states
  • Events.ino - data saved to EEPROM or SD for monitoring
  • Modbus.ino - reads the PV SunSpec data and time
  • Watchdog.ino - watchdog handling

Heating

  • PowerPilot.ino - heater regulation with AC phase cutting to exactly consume the excess solar electricity calculated from SunSpec data.
  • ManualRun.ino - unregulated timed heating, activated with a button or from a remote monitoring
  • ElSens.ino - functions around the electricity sensor: checking expected consumption of the pump and heating and detecting disconnection by the heater's thermostat
  • ValvesBack.ino - handles turning valves back to the main heating system, if EMS-ESP reports that the main heating is active
  • ExtHeater.h - external/extension heater for additional consumption of surplus power
  • TriacLib.h - AC dimmer module control

Front panel

  • Beeper.ino - Handles the speaker using tone() function. In loop handles the alarm sound if the system is in alarm state.
  • Button.ino - handles push and long push ('manual run') of the physical button on the front panel
  • LedBar.ino - handles visualization on the front panel LED Bar: blink, alarm, power level, count-down etc.
  • StatusLed.ino - shows state with plain LED as simple alternative to LED Bar

Monitoring

  • Telnet.ino - logging csv lines to telnet client and reading command characters sent from telnet client
  • CsvLog.ino - logging heating regulation to csv files on SD card or SPIFFS
  • Stats.ino - count and store power consumption statistics
  • WebServer.ino - JSON data for the web pages with optional serving of static web page files and csv files from SD card or SPIFFS
  • Blynk.ino - control from everywhere with Blynk Android application. more...

Symo Hybrid Battery

  • BattSett.ino - SunSpec Modbus storage control
  • SusCalib.ino - at 9 am sends 'calibration disable' for 3 hours

Special

  • ConsumptionMeter.ino - take data from secondary Fronius Smart Meter measuring this heater's consumption. Value is only logged to csv for evaluation (charts in Calc). It is an alternative to WemoInsight.ino.
  • WemoInsight.ino - functions to access Belkin WiFi switch. Can be used as an alternative to ConsumptionMeter.ino or for control of external heater.
  • Balboa.ino - defers hot tub heating if overall household consumption exceeds PV inverter's limit

Web interface

The data subfolder contains static web pages of the regulator. The static web pages use data in json format requested from the WebServer implemented in WebServer.ino.

With Uno WiFi I had the static pages served by the esp8266 WebServer of WiFi Link firmware in the esp8266 on-board of the Uno WiFi. I added them to the SPIFFS data folder of WiFi Link firmware.

WebServer.ino can serve the pages from SD card or SPIFFS.

These static web pages can be started from a folder on a computer to show the data from Regulator. Only set the IP address of Arduino in script.js.

Comments

The complete project doesn't fit into the Uno flash memory. To run it, comment out less important functions in setup and loop and the builder leaves the code out.

Project log

2017/4 First board used in this project was Uno WiFi.

2018/5 Next board was Wemos D1 R2 esp8266.

2018/8 I wanted Ethernet and 32 bit MCU. I moved to Crowduino MO -SD with Ethernet Shield

2019/5 secondary Fronius Smart Meter measures the heater for Fronius Solarweb

2019/6 I replaced the Kemo modules with the AC 'dimmer' module

2019/9 AVR ATmega1284p board and Ethernet Shield with W5500 (Seeed version with low profile RJ-45 connector)

2019/10 Grove Electricity Sensor CT replaced with ACS712 and Grove I2C ADC removed

2020/05 I bought Blynk points and updated the Blynk dashboard and I added charts

2020/10 I removed the temperature sensor which measured the main heating temperature for 'valves back' function. The temperature is now retrieved over network from the EMS-ESP Arduino, which adds IoT monitoring to my Buderus boiler.

2020/10 I removed code for esp8266 and nRF51 and code for power control over PWM with Kemo modules

2020/-- GitHub user stealth-ultd built his version of Regulator.

2021/02 I added extra relay for circ. pump to solve EMI from the pump motor at main relay switching

2021/03 ExtHeater.ino for more surplus consumption

2022/04 Removed separate circulation pump relay. It didn't solve EMI, which caused resets. 'Main' relay now controls only pump and valves so Triac module's ZC detector can detect zero crossing to time switching of the 'main' relay. The 2A Grove SSR module can now be the 'main' relay. EMI is solved.

Buy Me A Coffee

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].