Skip to content

MarkBeresford/ESP8266-Fan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Arduino Fan/MQTT message broker

Fun small project for making a fan spin using a local MQTT message broker mosquitto.

Set Up

  • Mosquitto installed using brew
  • Source fan.sh script
  • Create a secrets.h file in the same directory as the fan.ino script with the following format:
#define SECRET_SSID "<WIFI SSID>"
#define SECRET_PASSWORD "<WIFI password>"
#define SECRET_MQTT_BROKER "<IP address of network>"
#define SECRET_MQTT_PORT <MQTT port>

Start fan topic

Run MQTT_START

Sub to fan topic

Run MQTT_SUB fan/topic

Pub to fan topic

Run MQTT_SUB fan/topic <message>

Accepted pub messages

Message Outcome Outcome
0 $\leq$ x $\leq$ 255 Sets fan duty cycle to x MQTT_SUB fan/topic 100
ON set duty cycle to 100 MQTT_SUB fan/topic ON
OFF set duty cycle to 0 MQTT_SUB fan/topic OFF
FLIP reverse rotation of fan, keeps same duty cycle MQTT_SUB fan/topic FLIP

Note: The accepted messages must either be between 0 and 255 or match ON, OFF, or FLIP exactly (case sensitive).

Components used

Resources used

About

Fun project for making fan spin

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published