CN107864085A - Use the method and device of wechat control stepper motor - Google Patents
Use the method and device of wechat control stepper motor Download PDFInfo
- Publication number
- CN107864085A CN107864085A CN201610847132.7A CN201610847132A CN107864085A CN 107864085 A CN107864085 A CN 107864085A CN 201610847132 A CN201610847132 A CN 201610847132A CN 107864085 A CN107864085 A CN 107864085A
- Authority
- CN
- China
- Prior art keywords
- cloud server
- stepper motor
- cpu
- server platform
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L51/00—User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
- H04L51/04—Real-time or near real-time messaging, e.g. instant messaging [IM]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/02—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
- H04L67/025—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP] for remote control or remote monitoring of applications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/12—Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Health & Medical Sciences (AREA)
- Computing Systems (AREA)
- General Health & Medical Sciences (AREA)
- Medical Informatics (AREA)
- Telephonic Communication Services (AREA)
- Control Of Stepping Motors (AREA)
Abstract
The invention discloses a kind of method and device that stepper motor is controlled using wechat, method includes:User logs in the wechat of mobile terminal, is sent in wechat and meets the operational order of Transmission Control Protocol form to wechat server;Wechat server is by internet by http protocol forwards operational order to Cloud Server platform;Cloud Server platform sends socket director datas bag to hardware terminal by 3G network, 4G networks, WIFI or Ethernet;CPU is provided with hardware terminal;After CPU receives socket director data bags, GPIO level pulse control signals are resolved to, and corresponding actions are carried out using GPIO level pulse control signals Driving Stepping Motor;Each stepper motor matches a platform account number cipher and bound as control key, platform account with WeChat accounts.The present invention is easy to operate simply, can really realize borderless and unlimited distance remote control.
Description
Technical field
The present invention relates to Motor Control Field, more particularly to a kind of method and device that stepper motor is controlled using wechat.
Background technology
Traditional remote-control motor technology is substantially using radio high frequency connection, bluetooth connection, ultrasonic wave connection or red
Outer connected mode.Or these modes need to use the hardware of pairing, or needing to be attached pairing, come for domestic consumer
Say it is cumbersome, sometimes even need professional knowledge to match;Limited remote control distance can not be more importantly broken through, is not
The remote control whenever and wherever possible of real meaning.Its is troublesome in poeration, and remote control distance is limited, it is impossible to really realizes borderless, unlimited distance
Remote control.
The content of the invention
The technical problem to be solved in the present invention is, for the drawbacks described above of prior art, there is provided a kind of easy to operate letter
The method and device that stepper motor is controlled using wechat that is single, can really realizing borderless and unlimited distance remote control.
The technical solution adopted for the present invention to solve the technical problems is:Construct and a kind of control stepper motor using wechat
Method, comprise the following steps:
A) user logs in the wechat of mobile terminal, is sent in wechat and meets the operational order of Transmission Control Protocol form to wechat
Server;
B) wechat server by internet as described in http protocol forwards operational order to Cloud Server platform;
C) Cloud Server platform sends socket director data bags by 3G network, 4G networks, WIFI or Ethernet
To hardware terminal;CPU is provided with the hardware terminal;The data format of the socket director datas bag includes instruction, parameter
Length and parameter;
D after) CPU receives the socket director datas bag, GPIO level pulse control signals are resolved to, and
The stepper motor is driven to carry out corresponding actions using GPIO level pulses control signal;Each stepper motor matches one
Platform account number cipher is bound as control key, platform account with WeChat accounts.
In the method for the present invention that stepper motor is controlled using wechat, SIM cores are additionally provided with the hardware terminal
Piece, the mobile terminal are smart mobile phone, the step C) further comprise:
C1) CPU controls the SIM chip to be connected to cell phone network after starting, and is connected to by Transmission Control Protocol described
Cloud Server platform;
C2) after the connection upper Cloud Server platform, the CPU enters working cycles, and waits the socket to refer to
Make packet.
In the method for the present invention that stepper motor is controlled using wechat, the step D) further comprise:
D1) after the CPU receives the socket director datas bag, it is parsed to obtain action command;
D2) by controlling GPIO level, course changing control instruction and step-by-step impulse is sent to the stepper motor, drives institute
State stepper motor action.
In the method for the present invention that stepper motor is controlled using wechat, followed when the CPU enters normal work
After ring, breathing bag program periodically is sent to the Cloud Server platform, and notify hardware described in the Cloud Server platform
Terminal is movable;After detecting that network connection disconnects, the CPU reenters TCP connection state, reconnects to described
Cloud Server platform.
In the method for the present invention that stepper motor is controlled using wechat, when the CPU determines to be connected to the cloud
After server platform, the CPU starts a timer, often triggers timer to interrupt by a default cycle time, institute
State CPU be clocked into device interrupt after, by AT instruct to the Cloud Server platform send a socket for including timestamp
Packet, inform the Cloud Server platform last time and the time of Cloud Server platform communication.
The invention further relates to a kind of device for realizing the above-mentioned method that stepper motor is controlled using wechat, including:
Log in transmitting element:For making user log in the wechat of mobile terminal, sent in wechat and meet Transmission Control Protocol form
Operational order to wechat server;
Operational order retransmission unit:For making the wechat server be operated by internet as described in http protocol forwards
Instruct Cloud Server platform;
Director data bag transmitting element:For making the Cloud Server platform pass through 3G network, 4G networks, WIFI or ether
Net sends socket director datas bag to hardware terminal;CPU is provided with the hardware terminal;The socket director datas bag
Data format includes instruction, parameter length and parameter;
Parse driver element:After the CPU is received the socket director datas bag, GPIO electricity is resolved to
Flat pulse control signal, and drive the stepper motor to carry out corresponding actions using GPIO level pulses control signal;Each institute
State stepper motor and match a platform account number cipher as control key, platform account and WeChat accounts binding.
In the device of the present invention for realizing the above-mentioned method that stepper motor is controlled using wechat, the hardware terminal
In be additionally provided with SIM chip, the mobile terminal is smart mobile phone, and the director data bag transmitting element further comprises:
Control link block:For making the CPU control the SIM chip to be connected to cell phone network after starting, and pass through
Transmission Control Protocol is connected to the Cloud Server platform;
Connection waits module:For after the connection upper Cloud Server platform, the CPU to enter working cycles, and waits
Treat the socket director datas bag.
In the device of the present invention for realizing the above-mentioned method that stepper motor is controlled using wechat, the parsing driving
Unit further comprises:
Command analysis module:For after the CPU receives the socket director datas bag, being parsed to obtain to it
Action command;
Send drive module:For the level by controlling GPIO, to the stepper motor send course changing control instruction and
Step-by-step impulse, the stepper motor is driven to act.
In the device of the present invention for realizing the above-mentioned method that stepper motor is controlled using wechat, when the CPU enters
After entering normal working cycles, breathing bag program periodically is sent to the Cloud Server platform, and notify the cloud service
Hardware terminal described in device platform is movable;After detecting that network connection disconnects, the CPU reenters TCP connection state,
Reconnect to the Cloud Server platform.
In the device of the present invention for realizing the above-mentioned method that stepper motor is controlled using wechat, when the CPU is true
Surely after being connected to the Cloud Server platform, the CPU starts a timer, often triggers by a default cycle time
Timer interrupt, the CPU be clocked into device interrupt after, by AT instruct to the Cloud Server platform send one comprising when
Between the socket packets that stab, inform time of the Cloud Server platform last time and Cloud Server platform communication.
Implement the method and device that stepper motor is controlled using wechat of the present invention, have the advantages that:Due to
Family is sent in wechat meets the operational order of Transmission Control Protocol form to wechat server, wechat server by internet by
Operational order described in http protocol forwards to Cloud Server platform, Cloud Server platform by 3G network, 4G networks, WIFI or with
Too net sends socket director datas bag to hardware terminal, after CPU receives socket director data bags, is resolved to GPIO electricity
Flat pulse control signal, and corresponding actions are carried out using GPIO level pulse control signals Driving Stepping Motor, wechat user is general
And amount is huge, is controlled using wechat, its is easy to operate simple, can really borderless, unlimited distance remote control;So its is easy to operate
Simply, borderless and unlimited distance remote control can really be realized.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing
There is the required accompanying drawing used in technology description to be briefly described, it should be apparent that, drawings in the following description are only this
Some embodiments of invention, for those of ordinary skill in the art, without having to pay creative labor, may be used also
To obtain other accompanying drawings according to these accompanying drawings.
Fig. 1 is flow chart of the present invention using method in method and device one embodiment of wechat control stepper motor;
Fig. 2 is that Cloud Server platform sends socket by 3G network, 4G networks, WIFI or Ethernet in the embodiment
Particular flow sheet of the director data bag to hardware terminal;
After Fig. 3 receives socket director data bags for CPU in the embodiment, the control of GPIO level pulses is resolved to
Signal, and use the particular flow sheet of GPIO level pulse control signals Driving Stepping Motor progress corresponding actions;
Fig. 4 is the structural representation of device in the embodiment.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete
Site preparation describes, it is clear that described embodiment is only part of the embodiment of the present invention, rather than whole embodiments.It is based on
Embodiment in the present invention, those of ordinary skill in the art are obtained every other under the premise of creative work is not made
Embodiment, belong to the scope of protection of the invention.
In the present invention using in the method and device embodiment of wechat control stepper motor, it uses wechat control stepping electricity
The flow chart of the method for machine is as shown in Figure 1.In Fig. 1, this controls the method for stepper motor to comprise the following steps using wechat:
Step S01 user logs in the wechat of mobile terminal, sent in wechat meet the operational order of Transmission Control Protocol form to
Wechat server:In this step, user logs in the wechat of mobile terminal, and the operation for meeting Transmission Control Protocol form is sent in wechat
Instruct wechat server.The mobile terminal can be smart mobile phone, with the popularization of smart mobile phone, wechat software therein
User has reached more than 700,000,000, therefore, controls stepper motor action to turn into the selection for being very easy to receive, operation using wechat
Also it is more convenient, and modern communications technology and resources advantage have been played completely, really realize that borderless, unlimited distance is distant
Control.
Step S02 wechat servers are by internet by http protocol forwards operational order to Cloud Server platform:This step
In rapid, wechat server is by internet, by http protocol forwards operational order to Cloud Server platform.The Cloud Server platform
It is developer's Cloud Server platform, its title can be defined arbitrarily, such as:Its title can open up Cloud Server platform.
Step S03 Cloud Server platforms send socket director data bags by 3G network, 4G networks, WIFI or Ethernet
To hardware terminal:In this step, in this step, Cloud Server platform is sent by 3G network, 4G networks, WIFI or Ethernet
Socket director datas bag is to hardware terminal.CPU is provided with the hardware terminal, the data format of socket director data bags includes
Instruction, parameter length and parameter, such as:The data format of the socket director data bags is [instruction] [length of the first parameter]
[the first parameter] ... [length of N parameters] [N parameters].
After step S04CPU receives socket director data bags, GPIO level pulse control signals are resolved to, and make
Corresponding actions are carried out with GPIO level pulse control signal Driving Stepping Motors:In this step, CPU receives socket director datas
Bao Hou, GPIO level pulse control signals are resolved to, and use the GPIO level pulse control signal Driving Stepping Motors
Carry out corresponding actions.It is noted that in the present embodiment, each stepper motor matches a platform account number cipher as control
Key, platform account (can open up cloud service platform account with regard to the platform account) are bound with WeChat accounts.
In the present embodiment, stepper motor is selected to be because stepper motor is distinguished relative to other the maximum of control purposes motor
It is that stepper motor can receive digital control electric impulse signal and change into corresponding angular displacement or straight-line displacement, its
Body is exactly an executive component for completing digital simulation conversion.And can open ring position control, input one pulse signal must
To a defined positional increment, such so-called incremental counter control system compared with traditional DC control system, its into
This obvious reduction, must hardly carry out system call interception.The angular displacement of stepper motor and the pulse number inputted are strictly directly proportional,
And in time with impulsive synchronization.As long as the thus phase sequence of the quantity of control pulse, frequency and machine winding, you can obtain institute
Corner, speed and the direction needed.
The present invention's controls the method for stepper motor to be controlled using wechat using wechat, and its is easy to operate simple, can be really
Borderless, unlimited distance remote control;So its it is easy to operate it is simple, can really realize borderless and unlimited distance remote control.
The present invention sends operation information by Transmission Control Protocol by modern communications technology, connects corresponding wechat server, then lead to
Http protocol explanation and forwarding information are crossed, then passes through 3G/4G/WIFI/ Ethernets and sends socket director datas bag to hardware
Terminal, received finally by the CPU of hardware terminal and be construed to GPIO level pulse control signals after socket director data bags and arrive
Stepper motor, carry out Driving Stepping Motor action.Particularly as be by wechat program (can also be have identical function APP or
Person webpage) control stepper motor to act.Because the user group of wechat is huge, without need instruct user use, it is relatively conventional
Remote control thereof, it is to be convenient to use mode the most, temporary transient no other application scene can be than having more users using wechat.
Addition breathes bag program and keeps hardware corresponding at any time in a control program, is easy and effective and cost-effective keep in communication
Ingenious mode.Accurately driven using wechat control stepper motor;Breathing bag program can keep stepper motor to be swift in response.
In the present embodiment, SIM chip is additionally provided with above-mentioned hardware terminal, SIM chip is connected with CPU.For the present embodiment
For, above-mentioned steps S03 can also be refined further, and the flow chart after it is refined is as shown in Figure 2.In Fig. 2, above-mentioned steps S03 enters
One step includes:
Control SIM chip is connected to cell phone network after step S31CPU starts, and is connected to Cloud Server by Transmission Control Protocol
Platform:In this step, CPU controls SIM chip to be connected to cell phone network first after starting, and is then connected to cloud by Transmission Control Protocol
Server platform.
For step S31 after connection upper Cloud Server platform, CPU enters working cycles, and waits socket director data bags:
In this step, after connection upper Cloud Server platform, CPU enters working cycles, and constantly waits network instruction, that is, waits
Socket director data bags.
For the present embodiment, above-mentioned steps S04 can also be refined further, and the flow chart after it is refined is as shown in Figure 3.
In Fig. 3, above-mentioned steps S04 further comprises:
Step S41 is parsed to obtain action command after CPU receives socket director data bags to it:In this step,
After CPU receives socket director data bags, (or analysis) is parsed to the socket director data bags, action is obtained and refers to
Order.
Step S42 sends course changing control instruction and step-by-step impulse, driving step by controlling GPIO level, to stepper motor
Stepper motor acts:In this step, the level of the GPIO by controlling hardware terminal, to stepper motor send course changing control instruction and
Step-by-step impulse, Driving Stepping Motor action.
In the method for the wechat control stepper motor of the present invention, after CPU enters normal working cycles, periodically
Breathing bag program is sent to Cloud Server platform, ensures that network connection does not turn off, and notify Cloud Server platform hardware terminal just
In activity;And after detecting that network connection disconnects, CPU reenters TCP connection state, reconnects to Cloud Server and puts down
Platform, ensure that operation duration is stable.
In the method for the wechat control stepper motor of the present invention, after CPU determines to be connected to Cloud Server platform, CPU
Start a timer, often trigger timer to interrupt by a default cycle time, after CPU is clocked into device interruption, lead to
Cross AT instruct to Cloud Server platform send a socket packet for including timestamp, inform Cloud Server platform last
The secondary time with Cloud Server platform communication.This is the principle of breathing bag program., can be with by increasing the control of breathing bag program
Ensure response speed, guarantee to receive and send messages at any time, stepper motor accurately acts in time.The wechat control stepping of the present invention
The method of motor operates simple, borderless limitation, can give full play to modern communication science and technology advantage.
In the present embodiment, the wechat of mobile terminal can be write using C++ (.Net), and wechat uses mobile phone version more than 6.0
Version, have invoked the background function interface of wechat, and the server operation page is operationally connected to by wechat, main to provide user behaviour
Make interface, information reception transmission and information feedback function, while user data preservation is provided.Server can use C#
Language is write, and the main data message for being responsible for parsing wechat server and Cloud Server platform and receiving and sending simultaneously carries out corresponding position
Reason, Cloud Server platform can use Ali's Cloud Server, 4 core CPU, 8G internal memories, 5Mbps fixed-bandwidths, operating system use
ASP/.NET running environment (windows2008 64 | IIS7.0) V1.2.
In the present embodiment, Cloud Server platform constantly gathers the activity time of each hardware terminal, judges hardware terminal
Whether normal operation, when sending out existing hardware connection and disconnecting, user stepping electricity actively can be notified by the wechat of mobile terminal
Machine work is abnormal.
The present embodiment further relates to a kind of device for realizing the above-mentioned method that stepper motor is controlled using wechat, its structural representation
Figure is as shown in Figure 4.In Fig. 4, the device includes logging in transmitting element 1, operational order retransmission unit 2, director data bag transmission list
Member 3 and parsing driver element 4;Wherein, the wechat that transmitting element 1 is used to make user log in mobile terminal is logged in, is sent out in wechat
Send and meet the operational order of Transmission Control Protocol form to wechat server;Operational order retransmission unit 2 is used to pass through wechat server
Internet is by http protocol forwards operational order to Cloud Server platform;Director data bag transmitting element 3 is used to make Cloud Server
Platform sends socket director datas bag to hardware terminal by 3G network, 4G networks, WIFI or Ethernet;Set in hardware terminal
There is CPU;The form of socket director data bags includes instruction, parameter length and parameter;Parsing driver element 4 is used to receive CPU
To after socket director data bags, GPIO level pulse control signals are resolved to, and use GPIO level pulses control letter
Number Driving Stepping Motor carries out corresponding actions;Each stepper motor matches a platform account number cipher as control key, platform
Account is bound with WeChat accounts.
The device of the present invention is easy to operate simple, can really borderless, unlimited distance remote control;So its easy to operate letter
List, it can really realize borderless and unlimited distance remote control.
In the present embodiment, SIM chip is additionally provided with hardware terminal, mobile terminal can be smart mobile phone, director data bag
Transmitting element 3 further comprises controlling link block 31 and connection to wait module 32;Wherein, link block 31 is controlled to be used to make
Control SIM chip is connected to cell phone network after CPU starts, and is connected to Cloud Server platform by Transmission Control Protocol;Connection waits mould
Block 32 is used for after connection upper Cloud Server platform, and CPU enters working cycles, and waits socket director data bags.
In the present embodiment, parsing driver element 4 further comprises command analysis module 41 and sends drive module 42;Its
In, command analysis module 41 is used for after CPU receives socket director data bags, and it is parsed to obtain action command;Hair
Send drive module 42 to be used for the level by controlling GPIO, course changing control instruction and step-by-step impulse, driving are sent to stepper motor
Stepper motor acts.
In the apparatus of the present, after CPU enters normal working cycles, periodically sent to Cloud Server platform
Bag program is breathed, ensures that network connection does not turn off, and notify that Cloud Server platform hardware terminal is movable;And work as and detect net
After network connection disconnects, CPU reenters TCP connection state, reconnects to Cloud Server platform, ensures that operation duration is stable.
In the apparatus of the present, after CPU determines to be connected to Cloud Server platform, CPU starts a timer, often passes through
Spending a default cycle time triggers timer to interrupt, and after CPU is clocked into device interruption, is instructed to Cloud Server and put down by AT
Platform sends a socket packet for including timestamp, informs that Cloud Server platform last time communicates with Cloud Server platform
Time.This is the principle of breathing bag program.By the control for increasing breathing bag program, it is ensured that response speed, guarantee
Enough to receive and send messages at any time, stepper motor accurately acts in time.The method operation of the wechat control stepper motor of the present invention is simple,
Borderless limitation, modern communication science and technology advantage can be given full play to.
In the present embodiment, the control program instruction mode set for implementing function course is as follows:Instruction type:user-
Log in instruction, alive- survivals instruction, event- event commands and debug- test instructions.Stepper motor and Cloud Server platform
Communication is carried out by socket, TCP connections are actively initiated from stepper motor to Cloud Server platform, are connected to [domain name:Port].
<1>After the completion of TCP connections, login authentication packet should be sent immediately:
<user>Stepping motor system is numbered</user>
<pwd>Login password</pwd>
For safety verification, the system coding of each stepper motor is different, should can be in the LAN of stepping motor system
Main frame (software end for initiating TCP connections) configuration;Login failure, Cloud Server platform return to 0, successfully return to 1 (unsigned
Int types);After software logins successfully, it should be always maintained at connecting, Auto-reconnect after broken string.
<2>After stepping motor system logs in, (tentative 30 seconds) " survival " packet regularly should be sent to Cloud Server platform.
Prevent TCP time-out is automatic from disconnecting, and notify Cloud Server platform normal operation.
<alive></alive>
This format string (utf-8 codings) can be directly transmitted, Cloud Server platform returns to 1 (unsigned int
Type), no return represents that malunion is normal.
<3>Up protocol format illustrates (being sent to remote server from stepping motor system):
<event>Event</event>
<id>User's stepper motor encodes</id>
<time>Time To Event</time>
<free>The current effective time for allowing operation</free>
Up agreement uses utf-8 coded strings;Event is divided into two kinds, is respectively:(expression needs stepper motor into
Rotate), leave (expression warming-up exercise), out (represent tenth skill);Id segment tables show that user numbers (user's stepper motor
Coding), free sections are standby, and time segment tables show time (yyyy-MM-dd hh:Mm forms).When stepping motor system is to cloud service
After device platform sends up event, the descending reply of wait Cloud Server platform (see<4>), no reply is regarded as time-out.
<4>Descending protocol format description (replys stepping motor system) from Cloud Server platform:[usigned int];Cloud
Server platform returns to 1 byte, 32 signless integers.
Corresponding into events, Cloud Server platform return to [1], and expression has received, without returned specification time-out;It is corresponding
Leave events, Cloud Server platform return to [real-time effective time the number of minutes], can repeatedly inquired about;Corresponding out events, cloud service
Device platform returns to [1], and expression has received.
<5>Debug test instructions:Test instruction is used for development phase test and used (in the use of software test client),
Formal system should not include the program using test instruction.Run and successfully return to 1, otherwise return to 0.
On set can waiting operation time command,<debug>freeTime</debug>;<id>User numbers</id
>;<value>Effective time the number of minutes of test</value>.Example:(person's of being set using YOU696 warming-up exercise times are 180 points
In clock):<debug>freeTime</debug>;<id>YOU696</id>;<value>180</value>.
For into events, when user prepares operation, into events notice should be sent to Cloud Server platform, and send use
Family numbering, time started and effective actuation time etc..Then Cloud Server platform is waited to return to [0] (32 signless integers),
Time-out is then regarded as without returning.Example:Upstream data:<event>into</event>;<id>Y88888</id>;<time>2016-
01-16 19:00</time>;<free>85</free>;Cloud Server platform returns:[1].
For leave events, when user prepares operation stepper motor action, leave things should be sent to Cloud Server platform
Part notifies, and sends Customs Assigned Number, time started and effective actuation time etc..And wait Cloud Server platform to return and [prepare dynamic
Make the effective time the number of minutes waited] (32 signless integers).Example:Upstream data:<event>leave</event>;<id>
Y88888</id>;<time>2016-01-16 21:00</time>;<free>85</free>.Cloud Server platform returns:
[120], 120 be the number of minutes that can prepare effective actuation time, and on-fixed 120.
On the number of minutes for the effective time that can be waited with warming-up exercise, when the numeral expression of return can be with warming-up exercise
Effective the number of minutes, it is that is, 2 hours in 120 minutes as returned to 120 expressions action effective time.If the actual act time is less than
Equal to this time, then stepper motor action.Otherwise the time of setting should be subtracted with the actual act time, is come as time-out time
Judge whether to continue corresponding actions.Such as time-out is regarded as without return.Such as:Time started is 19:00, the end time 21:00, cloud
Server platform return can using actuation time the number of minutes as 120 (minutes), then the actual act time equal to the set action time it
Interior, then stepper motor acts.
For out events, notified after release.Example:Upstream data:<event>out</event>;<id>
Y88888</id>;<time>2016-01-16 21:00</time>;<free>85</free>.Cloud Server platform returns:
[1], such as it is regarded as time-out without return.
In a word, the present invention is to control stepper motor by handset Wechat, is led to than traditional radio communication mode, bluetooth
News mode and ultrasonic communication mode are much more convenient to control, because the user of wechat has reached 700,000,000, and using very
It is convenient quick.In addition, by internet communication, the control of national boundaries and distance is surmounted, infinite indeed distance controlling can be reached;
Transmitted by mobile Internet, given full play to the potentiality of modern communications technology.Breathing bag is devised in communication process simultaneously
Program, ensure hardware can respond at any time, effectively avoid occurring postponing when being absorbed in net dormancy state and being waken up once again or
Unpredictable mistake.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all essences in the present invention
God any modification, equivalent substitution and improvements made etc., should be included in the scope of the protection with principle.
Claims (10)
- A kind of 1. method that stepper motor is controlled using wechat, it is characterised in that comprise the following steps:A) user logs in the wechat of mobile terminal, is sent in wechat and meets the operational order of Transmission Control Protocol form to wechat service Device;B) wechat server by internet as described in http protocol forwards operational order to Cloud Server platform;C) Cloud Server platform sends socket director datas bag to firmly by 3G network, 4G networks, WIFI or Ethernet Part terminal;CPU is provided with the hardware terminal;The data format of the socket director datas bag includes instruction, parameter length And parameter;D after) CPU receives the socket director datas bag, GPIO level pulse control signals are resolved to, and use GPIO level pulses control signal drives the stepper motor to carry out corresponding actions;Each stepper motor matches a platform Account number cipher is bound as control key, platform account with WeChat accounts.
- 2. the method according to claim 1 that stepper motor is controlled using wechat, it is characterised in that in the hardware terminal It is additionally provided with SIM chip, the mobile terminal is smart mobile phone, the step C) further comprise:C1) CPU controls the SIM chip to be connected to cell phone network after starting, and is connected to the cloud by Transmission Control Protocol and takes Business device platform;C2) after the connection upper Cloud Server platform, the CPU enters working cycles, and waits the socket instructions number According to bag.
- 3. the method according to claim 2 that stepper motor is controlled using wechat, it is characterised in that the step D) enter one Step includes:D1) after the CPU receives the socket director datas bag, it is parsed to obtain action command;D2) by controlling GPIO level, course changing control instruction and step-by-step impulse is sent to the stepper motor, drives the step Stepper motor acts.
- 4. the method that stepper motor is controlled using wechat according to claims 1 to 3 any one, it is characterised in that when After the CPU enters normal working cycles, breathing bag program periodically is sent to the Cloud Server platform, and notify institute It is movable to state hardware terminal described in Cloud Server platform;After detecting that network connection disconnects, the CPU reenters TCP Connection status, reconnect to the Cloud Server platform.
- 5. the method that stepper motor is controlled using wechat according to claims 1 to 3 any one, it is characterised in that when The CPU determines after being connected to the Cloud Server platform that the CPU starts a timer, often by a default week Time phase triggers timer to interrupt, and after the CPU is clocked into device interruption, is instructed to the Cloud Server platform and sent by AT One socket packet for including timestamp, inform that the Cloud Server platform last time is led to the Cloud Server platform The time of news.
- A kind of 6. device for realizing the method as claimed in claim 1 using wechat control stepper motor, it is characterised in that bag Include:Log in transmitting element:For making user log in the wechat of mobile terminal, the behaviour for meeting Transmission Control Protocol form is sent in wechat Make instruction and arrive wechat server;Operational order retransmission unit:For make the wechat server by internet the operational order as described in http protocol forwards To Cloud Server platform;Director data bag transmitting element:For making the Cloud Server platform be sent out by 3G network, 4G networks, WIFI or Ethernet Socket director datas bag is sent to hardware terminal;CPU is provided with the hardware terminal;The data of the socket director datas bag Form includes instruction, parameter length and parameter;Parse driver element:After the CPU is received the socket director datas bag, GPIO level arteries and veins is resolved to Control signal is rushed, and drives the stepper motor to carry out corresponding actions using GPIO level pulses control signal;Each step Stepper motor matches a platform account number cipher and bound as control key, platform account with WeChat accounts.
- 7. realization according to claim 6 controls the dress of the method for stepper motor using wechat as claimed in claim 1 Put, it is characterised in that be additionally provided with SIM chip in the hardware terminal, the mobile terminal is smart mobile phone, the director data Bag transmitting element further comprises:Control link block:For making the CPU control the SIM chip to be connected to cell phone network after starting, and assisted by TCP View is connected to the Cloud Server platform;Connection waits module:For after the connection upper Cloud Server platform, the CPU to enter working cycles, and waits institute State socket director data bags.
- 8. realization according to claim 7 controls the dress of the method for stepper motor using wechat as claimed in claim 1 Put, it is characterised in that the parsing driver element further comprises:Command analysis module:For after the CPU receives the socket director datas bag, being parsed and being acted to it Instruction;Send drive module:For the level by controlling GPIO, course changing control instruction and stepping are sent to the stepper motor Pulse, the stepper motor is driven to act.
- 9. the realization according to claim 6 to 8 any one is as claimed in claim 1 using wechat control stepper motor Method device, it is characterised in that after the CPU enters normal working cycles, periodically to the Cloud Server Platform sends breathing bag program, and notifies that hardware terminal described in the Cloud Server platform is movable;When detect network connect After connecing disconnection, the CPU reenters TCP connection state, reconnects to the Cloud Server platform.
- 10. the realization according to claim 6 to 8 any one is as claimed in claim 1 using wechat control stepping electricity The device of the method for machine, it is characterised in that after the CPU determines to be connected to the Cloud Server platform, the CPU starts one Individual timer, often trigger timer to interrupt by a default cycle time, after the CPU is clocked into device interruption, pass through AT is instructed to the Cloud Server platform and is sent a socket packet for including timestamp, informs the Cloud Server platform Last time and the time of Cloud Server platform communication.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610847132.7A CN107864085B (en) | 2016-09-22 | 2016-09-22 | Method and apparatus for controlling stepping motor using WeChat |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610847132.7A CN107864085B (en) | 2016-09-22 | 2016-09-22 | Method and apparatus for controlling stepping motor using WeChat |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107864085A true CN107864085A (en) | 2018-03-30 |
CN107864085B CN107864085B (en) | 2020-07-24 |
Family
ID=61698997
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610847132.7A Active CN107864085B (en) | 2016-09-22 | 2016-09-22 | Method and apparatus for controlling stepping motor using WeChat |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107864085B (en) |
Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102546242A (en) * | 2011-12-23 | 2012-07-04 | 广东步步高电子工业有限公司 | Cloud server based data backup and system recovery method and system utilizing same |
US20140325601A1 (en) * | 2013-04-27 | 2014-10-30 | Xiao Sun | Managing private information in instant messaging |
CN105120007A (en) * | 2015-09-14 | 2015-12-02 | 劳海鹏 | Method and system for remotely setting and invalidating temporary password of intelligent lock |
US20160021050A1 (en) * | 2014-07-19 | 2016-01-21 | Jianhua Zhou | Event message system |
CN105354450A (en) * | 2015-10-26 | 2016-02-24 | 青岛海尔智能家电科技有限公司 | Method and apparatus for authorizing WeChat to control intelligent devices |
CN105427020A (en) * | 2015-10-30 | 2016-03-23 | 长沙奥科电子科技有限公司 | Vehicle scheduling system and vehicle scheduling method based on WeChat |
CN105516352A (en) * | 2016-01-11 | 2016-04-20 | 山西黑龙科技有限公司 | Intelligent lock monitoring system based on WeChat public platform and monitoring method of intelligent lock monitoring system |
CN105553836A (en) * | 2016-02-02 | 2016-05-04 | 四川长虹电器股份有限公司 | Household appliance control method and system based on Wechat |
CN205375161U (en) * | 2015-12-17 | 2016-07-06 | 无锡职业技术学院 | PCB cutting machine based on little letter control |
CN205490667U (en) * | 2016-01-11 | 2016-08-17 | 山西黑龙科技有限公司 | Intelligence lock monitored control system , intelligent gateway and intelligence lock based on believe public platform a little |
-
2016
- 2016-09-22 CN CN201610847132.7A patent/CN107864085B/en active Active
Patent Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102546242A (en) * | 2011-12-23 | 2012-07-04 | 广东步步高电子工业有限公司 | Cloud server based data backup and system recovery method and system utilizing same |
US20140325601A1 (en) * | 2013-04-27 | 2014-10-30 | Xiao Sun | Managing private information in instant messaging |
US20160021050A1 (en) * | 2014-07-19 | 2016-01-21 | Jianhua Zhou | Event message system |
CN105120007A (en) * | 2015-09-14 | 2015-12-02 | 劳海鹏 | Method and system for remotely setting and invalidating temporary password of intelligent lock |
CN105354450A (en) * | 2015-10-26 | 2016-02-24 | 青岛海尔智能家电科技有限公司 | Method and apparatus for authorizing WeChat to control intelligent devices |
CN105427020A (en) * | 2015-10-30 | 2016-03-23 | 长沙奥科电子科技有限公司 | Vehicle scheduling system and vehicle scheduling method based on WeChat |
CN205375161U (en) * | 2015-12-17 | 2016-07-06 | 无锡职业技术学院 | PCB cutting machine based on little letter control |
CN105516352A (en) * | 2016-01-11 | 2016-04-20 | 山西黑龙科技有限公司 | Intelligent lock monitoring system based on WeChat public platform and monitoring method of intelligent lock monitoring system |
CN205490667U (en) * | 2016-01-11 | 2016-08-17 | 山西黑龙科技有限公司 | Intelligence lock monitored control system , intelligent gateway and intelligence lock based on believe public platform a little |
CN105553836A (en) * | 2016-02-02 | 2016-05-04 | 四川长虹电器股份有限公司 | Household appliance control method and system based on Wechat |
Also Published As
Publication number | Publication date |
---|---|
CN107864085B (en) | 2020-07-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR101902159B1 (en) | How SmartWatch and WiChat Platform talk, devices and smart watch | |
CN102546619B (en) | Modbus protocol conversion system based on 3G (The 3rd Generation Telecommunication) Internet access | |
CN102006616B (en) | Test system and test method | |
CN105516262B (en) | Application program remote control method and system | |
CN107148031A (en) | A kind of method of testing of WiFi module software systems, apparatus and system | |
US9244754B2 (en) | Error code conversion method and system, PPPoE server and mobile terminal | |
CN107426233A (en) | Data communication system, method, Web server and monitoring system based on B/S frameworks | |
CN108632798A (en) | A kind of quick binding method of Internet of Things household appliance, system and relevant apparatus | |
CN102255898A (en) | Method for ensuring stability of large data stream by tcp (Transmission Control Protocol)/udp (User Datagram Protocol) double-mode communication | |
CN103457985A (en) | Method and system of dual-channel communication | |
CN109639703A (en) | A kind of radio station remote control method and system based on B/S framework | |
CN103841587B (en) | A kind of implementation method, the apparatus and system of Internet of Things Convergence gateway | |
CN103516766B (en) | Method and system of communication between client-side and application server | |
CN106888431A (en) | The method and system of good friend are added on a kind of intelligent watch | |
CN102291692B (en) | A kind of method of mobile terminal and Dynamic Selection communication network thereof | |
EP3972197A1 (en) | Method and apparatus for customer premise equipment configuration management | |
CN208158631U (en) | A kind of Modbus protocol data transparent transmission device based on WiFi and TCP | |
CN107864085A (en) | Use the method and device of wechat control stepper motor | |
CN102932564B (en) | Communication proxy device fused with VoIP/IM (Voice over Internet Protocol)/(Instant Messenger) and mobile communication technology and use method thereof | |
CN101997858B (en) | Method and device for consumer premises equipment wide area network management protocol (CWMP) conversation interaction | |
CN103987017B (en) | A kind of method and system for being used to set up service access in a wlan | |
CN105306305B (en) | A kind of mobile wireless network traffic data collection method and device | |
CN113810473A (en) | Thing networking wiFi passes module thoroughly | |
CN107483299A (en) | Internet of things access method and device | |
Cisco | Configuring Asynchronous Connections |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |