Skip to content

Single interface for read from sensors and update devices state

License

Notifications You must be signed in to change notification settings

el-fuego/Arduino-devices

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Arduino-devices

Single interface for reading from sensors and updating devices state

  • You need to control weather at your home?
  • Or, maybe, watering at your greenhouse, basing on time?
  • Or turn on lights, basing on moving sensor?

=== This project will provide an easy solution for you! ===

Devices

Switch by level

Turn on when higher

Will put HIGH level to specified pin, if provided value > than demanded

TurnOnWhenHigher airConditioner(AIR_CONDITIONER_PIN, DEMANDED_TEMPERATURE, currentTemperature);

full usage example

Turn on when lower

Will put HIGH level to specified pin, if provided value < than demanded

TurnOnWhenLower heater(HEATER_PIN, DEMANDED_TEMPERATURE, currentTemperature);

full usage example

Advantage usage

/*
 Use minDifference as 4th argument, when you need to turn ON|OFF your few devices 
 for maintaining some parameter in specific range
 In this case, your devices will be turned OFF, if value is close to demanded
*/
TurnOnWhenHigher airConditioner(AIR_CONDITIONER_PIN, demandedTemperature, currentTemperature, TEMPERATURE_RANGE / 2);
TurnOnWhenLower heater(HEATER_PIN, demandedTemperature, currentTemperature, TEMPERATURE_RANGE / 2);

full usage example

Switch by time

Schedule interval switch

Will put HIGH level to specified pin, for specified time every interval time.
Work in pair with clock sensor

ScheduleIntervalSwitch waterPump(WATER_PUMP_PIN, wateringInterval, clock);

full usage example

Time interval switch

Will put HIGH level to specified pin, for specified time every interval time.
Work in pair with clock sensor

ClockTimeIntervalSwitch lamp(LAMP_PIN, lighteningInterval, clock);

full usage example

Analog devices

Intensity control

Will put 0-100% voltage to specified pin
Can be used as light dimmer, fan speed control...

IntensityControl fanSpeedController(FAN_PIN, speedPercentage);

Most of fans will start work from different voltage point (60%, for example), so you need to find it by measurement or testing speedPercentage value and specify this start value in percentage as 3rd parameter

IntensityControl fanSpeedController(FAN_PIN, speedPercentage, FAN_START_PERCENTAGE);

full usage example

Advanced usage

/*
 If you are using inverted relay input (LOW pin value for enabling), 
 you can invert device output before initialization 
 Also, this works with analog output devices
*/
void setup() {
  myDevice.makeOutputInverted(); # heater, conditioner, fan.. 
}

/*
 In any time, you can check current status of your device
 Use this option to indicate working process at the screen
*/
myDevice.isEnabled; # bool

Sensors

Clocks

DS3231 Sensor

Most used RTC clock, connected to I2C

DS3231_Sensor clock;

TODO: full usage example. For a now, see: "Switch by time" section

Joysticks

AnalogJoystick

AnalogJoystick jiystick(PIN_X, PIN_Y);

TODO: full usage example.

Temperature and humidity

DHT11 Sensor

Cheap digital humidity and temperature, used single data-pin

DHT11_Sensor temperatureAndHumiditySensor(TEMPERATURE_SENSOR_PIN)

TODO: full usage example. For a now, see: "Switch by level" section

Advanced usage

/*
 In any time, you can check current status of your sensor
 Use this option to indicate working process at the screen
*/
mySensor.hasError; # bool