3826 views|4 replies

5304

Posts

454

Resources
The OP
 

Controlled by "Playpad" + Siri + shortcut commands + XCC3200 (MQTT) [Copy link]

 

Some time ago, a "shortcut command" was added to the mobile phone system update. I also saw others using shortcut commands to control the ESP8266 output. This is indeed more suitable for us electronics enthusiasts who like to tinker!

Others only demonstrated the effect in the Douyin video, but he did not introduce in detail how to achieve it. Without a master to guide you, you can only watch and figure it out on Baidu!

Later, I gradually learned that their work was: using "shortcuts" in the mobile phone, adding "web pages" to send a "push" to the device connected to the MQTT server, and the device receives and parses it and outputs it. I also learned and figured it out!

Implementation in three steps

1. Mobile shortcut settings

1 "Get URL content": http:api.hecoluds.com/cmds?device_id=xxxxxxxxxx

2 "Method": POST

3 Header: "api-key", "xxxxxxxxxxxxxxxx" information APIKey on the MQTT server

4 Request body JSON: The content here is the information received by XCC3200 for judging output, such as "switch ,1" turns on the green light. "switch ,0" turns off the green light.


2. MQTT Settings

I directly refer to the MQTT settings on ONENET!

In particular, some parameters need to be saved

Server Addr 183.230.40.39
Port 6002

ProductID
DeviceID
AuthInfo

APIKey needs ONENET tool to calculate

3 | XCC3200 Configuration

Import the MQTT Client project in TI's CC3200 SDK into CCS, and then modify some basic parameters in main.c

Modify several aspects of main.c

MQTT server address and port

#define SERVER_ADDRESS "mqtt.heclouds.com"//mqtt.eclipse.org api
#define SERVER_IP_ADDRESS "183.230.40.39"//192.168.178.67
#define PORT_NUMBER 6002//1883

There is also some information about the XCC3200 design device

/* connection configuration */
connect_config usr_connect_config[]

{

Basic parameter modification settings

}

There is also the setting of XCC3200 connecting to the wireless network

common.h file

#define SSID_NAME " *********** " /* AP SSID */
#define SECURITY_TYPE SL_SEC_TYPE_WPA_WPA2/* Security type (OPEN or WEP or WPA*/
#define SECURITY_KEY "******** ****** " /* Password of the secured AP */

Finally, the data received in static void
Mqtt_Recv(void *app_hndl, const char *topstr, long top_len, const void *payload,
long pay_len, bool dup,unsigned char qos, bool retain) is judged and output.

//Control output
if(output_str[11]=='5')//{"switch":"1"} Here is the "shortcut command" request body JSON branch
{
GPIO_IF_LedOn(MCU_RED_LED_GPIO);
}
else if(output_str[11]=='4')//{"switch":"1"}
{
GPIO_IF_LedOff(MCU_RED_LED_GPIO);
}


This content is originally created by EEWORLD forum user Lan Yuye . If you want to reprint or use it for commercial purposes, you must obtain the author's consent and indicate the source

Latest reply

Can the shortcut command send a string to a LAN IP address? For example: send COM1 to 192.168.1.100. If so, can you guide me on the implementation process? Thank you!   Details Published on 2021-8-8 16:36
 
 

5304

Posts

454

Resources
2
 
This post was last edited by Lan Yuye on 2020-2-28 08:07

Video demonstration effect


 
 
 

295

Posts

1

Resources
3
 

I just want to say this is pretty cool.

Personal signature

我的小站 我的博客

 
 
 

1w

Posts

204

Resources
4
 

This is very interesting ~ great ~ haha, I think there will definitely be people who will follow the author to tinker with this.

Add and join groups EEWorld service account EEWorld subscription account Automotive development circle
Personal signature

玩板看这里:

https://bbs.eeworld.com.cn/elecplay.html

EEWorld测评频道众多好板等你来玩,还可以来频道许愿树许愿说说你想要玩的板子,我们都在努力为大家实现!

 
 
 

1

Posts

0

Resources
5
 

Can the shortcut command send a string to a LAN IP address? For example: send COM1 to 192.168.1.100. If so, can you guide me on the implementation process? Thank you!

 
 
 

Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list