Welcome to Gaia-Js!
Gaia-js is a NodeJs library for climate control in terrariums, aquariums, vivariums and grow rooms using a RaspberryPi
Getting Started
Installation
To start using GaiaJs you only need to install the main module:
npm install gaia-js
After install the core module you need to install the controllers module for add basic functionality:
npm install gaia-js-controllers
Examples
PID controller
The best way to control values like temperature or humidity is using a PID controller:
var Gaia = ;var PidController = PidController; // Create the new PID controllervar temperatureZone1 = name: 'Temperature_Zone1' input: temperature // The temperature input usually obtained from a sensor setPoint: 23 // The desired temperature kp: 500 // PID algorithm settings ki: 200 kd: 0 limits: // The output limits used for control the temperature outMin: 0 outMax: 255 ; // Set the controller callbacktemperatureZone1; // Add the controller to the GaiaJs coreGaia; // Start GaiaJsGaiastart;
The use of this controller is recommended whenever is possible to adjust the output level of the device used to control the desired values
You can change the PID direction in the constructor options or with the direction setter:
var temperatureZone1 = name: 'Temperature_Zone1' direction: PidControllerREVERSE ...; temperatureZone1;
Level controller
The use of this controller is recommended when the device used to control the desired values have only on/off states.
var Gaia = ;var LevelController = LevelController; // Create the new PID controllervar humidityZone1 = name: 'Humidity_Zone1' input: humidity // The humidity input usually obtained from a sensor setPoint: 80 // The desired humidity ; // Set the controller callbackhumidityZone1; // Add the controller to the GaiaJs coreGaia; // Start GaiaJsGaiastart;
Time interval controller
Use this controller to perform actions depending on a time interval, such as turning lights on and off
var Gaia = ;var TimeIntervalController = TimeIntervalController; // Create the new Time Interval controllervar mainLightsControl = name: 'Main_Lights_Control' intervals: start: '17:06' end: '17:07' start: '17:08' end: '17:09' ; // Set the controller tick callbackmainLightsControl; // Set the callback of the controller, this method is executed when the controller is startedmainLightsControl; // Add the controller to the GaiaJs coreGaia; // Start GaiaJsGaiastart;
People
Author Vicente Giner Tendero