- read up to 16 push buttons
- blink up to 16 LEDs (push button LEDs)
- up to 16 outputs
- connect to ethernet (DHCP)
- connect to MQTT server
- send mqtt message on output state change or state query
- subscribe to mqtt and output changes
- output state can be 0 = off, 1 = on, >1 = seconds till stop
Uses FreeRTOS port for Arduino.
- Arduino MEGA 2560 board with W5100 ethernet shield
- Arduino AVR Boards version 1.8.6
- FreeRTOS version 11.0.1
- when connecing to MQTT server, send mqtt message
house/:id/start
with payload1
(online)
- can be set/toggled by mqtt message on
house/:id/light/:output
with payload0
,1
or number of seconds to keep output on - can be set/toggled by button press (actions)
- on change, send mqtt message
house/:id/light/state/:output
with payload0
,1
or number of seconds to keep output on
- short press (default action is toggle output for light X)
- medium press - 1.5 seconds (default action is toggle blink mode for button LED)
- long press - 6 seconds (default action is mqtt publish button number)
Can be set by sending mqtt message house/:id/set
with payload
asXYZ
- set action short for button X (0-F), action Y (0-5), param Z (0-F)amXYZ
- set action medium for button X, action Y, param ZalXYZ
- set action long for button X, action Y, param Z
eg: as01F
- set action short for button 0 to toggle output 15 (will set output 16)
0
: no action1
: toggle output for light X2
: toggle blink mode for button LED3
: mqtt publish1
on button number topic:house/:id/button/:button
4
: mqtt publish2
on button number topic5
: mqtt publish3
on button number topic
house/:id/light/:output
with payload0
or1
: set output on or off. If:output
is0
, turn off all outputs. If payload is a number > 1, set output on for that many seconds.house/:id
send status for all outputs that are onhouse/:id/reset
reset the devicehouse/:id/set
update setting, when payload0
- reset settings to default?X
- send current settings via mqtthouse/:id/settings
, X can be i = id, h = hostname, a[sml] = actions, b = blink modesiX
- set id toX
eg:i1
hHOSTNAME
- set hostname toHOSTNAME
eg:hArdu
asXYZ
- set action short for button X (0-F), action Y (0-5), param Z (0-F)amXYZ
- set action medium for button X, action Y, param ZalXYZ
- set action long for button X, action Y, param ZbX
, X=0..4 - set blink mode
-
multiplexed with button LED:
- LED+ = 5V
- LED- = pin
- ButtonNO1 = pin
- ButtonNO2 = GND
-
Arduino PINS: 22 - 29, 37 - 30
- Arduino PINS: A8 - A15, 42 - 49
#undef portUSE_WDTO
#undef configTICK_RATE_HZ
#undef portTICK_PERIOD_MS
#define portTICK_PERIOD_MS 15
#define configTICK_RATE_HZ ( (TickType_t) ( 1000 / portTICK_PERIOD_MS ) )
#define portSCHEDULER_ISR TIMER3_COMPA_vect
extern void prvSetupTimerInterrupt( void );