This project can use voice command to:
- Turn on/off one, a range or all of LED strip
- Change color of one, a range or all of LED strip
- Change effect (blink, changing color or normal) of one, a range or all of LED strip
This project is an expansion of the project: https://www.hackster.io/phpoc_man/amazon-echo-control-diy-iot-devices-with-phpoc-037b11
Every step is almost the same, there are only some difference on interaction model configuration and source code.
You can do step by step on that link. I only show the differences in this article.
Step 2: Creating and configuring Alexa Skill (on Alexa Service)In “Interaction Model”:
Intent Schema
{
"intents": [
{
"slots": [
{
"name": "ColorState",
"type": "COLOR_STATE"
},
{
"name": "LedState",
"type": "LED_STATE"
},
{
"name": "FromLed",
"type": "LED_ID"
},
{
"name": "ToLed",
"type": "LED_ID"
},
{
"name": "Effect",
"type": "EFFECT_STATE"
}
],
"intent": "LedStrip"
}
]
}
Custom Slot Types- COLOR_STATE
red
green
blue
cyan
yellow
magenta
white
- LED_STATE
on
off
- LED_ID
one
two
three
four
five
six
seven
eight
night
ten
eleven
twelve
thirteen
fourteen
all
- EFFECT_STATE
normal
blink
color
Sample UtterancesLedStrip {FromLed} {ColorState}
LedStrip {FromLed} to {ToLed} {ColorState}
LedStrip number {FromLed} {ColorState}
LedStrip number {FromLed} to number {ToLed} {ColorState}
LedStrip led number {FromLed} {ColorState}
LedStrip led number {FromLed} to number {ToLed} {ColorState}
LedStrip led number {FromLed} to led number {ToLed} {ColorState}
LedStrip change color to {ColorState}
LedStrip change number {FromLed} to {ColorState}
LedStrip change number {FromLed} to number {ToLed} to {ColorState}
LedStrip change led number {FromLed} to {ColorState}
LedStrip change led number {FromLed} to number {ToLed} to {ColorState}
LedStrip change led number {FromLed} to led number {ToLed} to {ColorState}
LedStrip change led from number {FromLed} to number {ToLed} to {ColorState}
LedStrip {FromLed} {LedState}
LedStrip {LedState} {FromLed}
LedStrip {FromLed} to {ToLed} {LedState}
LedStrip turn {LedState} {FromLed}
LedStrip turn {LedState} number {FromLed}
LedStrip turn {LedState} led number {FromLed}
LedStrip turn {FromLed} {LedState}
LedStrip turn led number {FromLed} {LedState}
LedStrip turn {LedState} number {FromLed} to number {ToLed}
LedStrip turn {LedState} led number {FromLed} to number {ToLed}
LedStrip turn {LedState} led from number {FromLed} to number {ToLed}
LedStrip turn number {FromLed} to number {ToLed} {LedState}
LedStrip turn led number {FromLed} to number {ToLed} {LedState}
LedStrip turn led from number {FromLed} to number {ToLed} {LedState}
LedStrip {Effect}
LedStrip {FromLed} {Effect}
LedStrip {Effect} {FromLed}
LedStrip {Effect} number {FromLed}
LedStrip {Effect} led number {FromLed}
LedStrip {Effect} {FromLed} to {ToLed}
LedStrip {Effect} number {FromLed} to {ToLed}
LedStrip {Effect} number {FromLed} to number {ToLed}
LedStrip {Effect} led number {FromLed} to {ToLed}
LedStrip {Effect} led number {FromLed} to number {ToLed}
LedStrip number {FromLed} {Effect}
LedStrip {FromLed} to {ToLed} {Effect}
LedStrip number {FromLed} to {ToLed} {Effect}
LedStrip number {FromLed} to number {ToLed} {Effect}
LedStrip led number {FromLed} {Effect}
LedStrip led number {FromLed} to {ToLed} {Effect}
LedStrip led number {FromLed} to number {ToLed} {Effect}
LedStrip effect {Effect}
LedStrip effect {FromLed} {Effect}
LedStrip effect {Effect} {FromLed}
LedStrip effect {Effect} number {FromLed}
LedStrip effect {Effect} led number {FromLed}
LedStrip effect {Effect} {FromLed} to {ToLed}
LedStrip effect {Effect} number {FromLed} to {ToLed}
LedStrip effect {Effect} number {FromLed} to number {ToLed}
LedStrip effect {Effect} led number {FromLed} to {ToLed}
LedStrip effect {Effect} led number {FromLed} to number {ToLed}
Step 3: Writing source code to handle data from Alexa Skill (on AWS Lambda)- see index.js in code section
This code will handle "intent" from Alexa Skill and extract the necessary data, format it in json format and publish on a MQTT topic.
Step 5: Writing source code on PHPoC to handle commands and control the devices.- see task0.php in the code section
This code subscribe a MQTT topic and handle MQTT message which contains LED state, effect and LED numbers.
HardwareRGB LED strip required 12V power source. Therefore, we need to use relay to control the LED.
Each strip need 3 relays to control three colors lines. I use 14 strips, so I need 42 relays. Each PHPoC 4-Port Relay Expansion Board has 4 relays.
In order to simplify the wiring and source code, I use 14 Expansion Boards. Each board connect to one LED strip.
Comments