Make your low cost fan smarter, control it from anyway!
Project has been done in Amiqual4Home Equipex Creativity Lab - https://amiqual4home.inria.fr/
-
Spark Core with latest firmware updates :
sudo particle flash --usb cc3000 sudo particle flash --usb deep_update_2014_06
-
3 relays
-
A fan
- MQTT broker - (do not use mosquitto 1.4.3 - hirotakaster/MQTT#13 )
- For this model, there are four buttons for three speed and one stop. They are connected to the input pullup sparkcore in D0, D1 , D2 associated to 3 relays to control motor speed.
Commands can be sent either using MQTT protocol or using Particle API
- CMD_NAME =
- POWEROFF
- SPEED1
- SPEED2
- SPEED3
Command line syntax :
curl https://api.spark.io/v1/devices/'SPARK_CORE_ID'/fanAPI -d access_token='YOUR_TOKEN' -d "params=CMD_NAME"
e.g. :
curl https://api.spark.io/v1/devices/'SPARK_CORE_ID'/fanAPI -d access_token='YOUR_TOKEN' -d "params=SPEED2"
- a valid MQTT broker must be defined in Photon code mqttserver variable
In this topic, payload containing command name must be sent,
e.g :
mosquitto_pub -h BROKER_IP -t fan/fanCmds -m CMD_NAME
To enable cloud connection
mosquitto_pub -h BROKER_IP -t fan/particleCloud -m ENABLE
To disable cloud connection
mosquitto_pub -h BROKER_IP -t fan/particleCloud -m DISABLE
-
To get status :
curl https://api.spark.io/v1/devices/'SPARK_CORE_ID'/state\?access_token\='YOUR_TOKEN'
- state = 0 : OFF
- state = 1 : SPEED1
- state = 2 : SPEED2
- state = 3 : SPEED3