You need one that is the sonic equivalent of getting dragged out of bed and thrown into a cold pond of water. RTC.If you’re a heavy sleeper, you can’t just use any alarm clock. RTC.setAlarm(ALM1_MATCH_HOURS, 33, 18, 0) set your wake-up time here example: Set alarm1 every day at 18:33 or: seconds (but enter 00, is ignored), minutes then hours, daydate for ALM2 first seconds, then minutes, hours, daydate matches seconds AND minutes when _MINUTES is used. if every minute is needed change MINUTES to SECONDS (only for ALM1) RTC.setAlarm(ALM2_MATCH_MINUTES, 0, 10, 0, 0) //where "xx" is minutes RTC.setAlarm(ALM1_MATCH_SECONDS, 30, 00, 0, 0) //set your wake-up time here: if for example Sunday then: dowSunday if a date then date of the month example: Set alarm1 every day at 18:33: 00 seconds, 33 minutes, 18 hours, 0 = every day It must be connected to arduino D2 pin for wake-up The output of the DS3231 INT pin is connected to this pin Set SQW pin to OFF (in my case it was set by default to 1Hz) RTC.adjust(DateTime(_DATE_, _TIME_)) //set RTC date and time to COMPILE time, see instructions above then comment following line and immediately upload again uncomment following line when compiling and uploading, A convenient constructor for using "the compiler's time": Initialize communication with the clock switch-on the on-board led for 1 second for indicating that the sketch is ok and running Set pin D2 as INPUT for accepting the interrupt signal from DS3231 Void wakeUp() // here the interrupt is handled after wakeup Int dut圜ycleStatus = 8 // Input Capture Pin Int sendDut圜ycle // contains integer value of float cycleValue Int temperaturePin = A0 // analog input for LM35 temperature sensorįloat pwmPeriod, pwmWidth, pwmFrequency, pwmDutyDisplay Ĭonst byte x = 10 // loop value: loop amount = x, number of dutycycle measurements in 1 run Int wakeStatus = 9 //use D10 to drive 5V power to sensor module and HC-12 with MOSFET, 1=wake Int ledPin = 13 //use arduino on-board led for indicating sleep or wakeup status Int wakePin = 2 //use interrupt 0 (pin 2) and run function wakeUp when pin 2 gets LOW NOTE: pin D8 is used for reading incoming square wave for duty cycle measurement RTC_DS3231 RTC //we are using the DS3231 RTC MOSFET drain to dutycycle sensor board groundĮxternal supply ground to controller ground NEW: since, use with ESP8266_irrigation_controller_v1 (copied from ESP8266_RX_HC12_hardware-Serial_Thingspeak_v1)ĭ9 to MOSFET powerdrive gate on dutycycle sensor Use with ESP8266_RX_HC12_hardware-Serial_Thingspeak_v1 (experimental, to be tested 03/2018: tested and = ok) Use with Arduino_serial_Arduino_RX_HC12_burst_test_hardwareSerial_v4 V12: added second alarm ALM2, added 5th value: analog battery value V11: send 4 values: duty cycle %, temperature, minute, hour and sensor identification (A, B. V10: code without thingspeak, no ethernet module, and cleaned up send 3 integers: humidity %, minute, hour and sensor identification (A, B. serialPrint only what needs to be transmitted prepare values for transmission: int sendDut圜ycle, time and date V9: modified for transmission over HC12 via hardware serial v8: includes ethernet shield and upload to Thingspeak connect DS3231 pin INT/SQW to D2 on Arduino (INT0, PCINT18, PD2) corrected the library for use with Atmega168P I would like to change this to once every 10 minutes (or just several times an hour for that matter): how is that best accomplished in this program? /* However, this instruction in general manages to wake up only once a minute, once an hour. A well running routine wakes up an Arduino Uno from deep sleep using RTC.alarmInterrupt instruction, once a minute, at second 30.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |