MQTT (formerly MQ Telemetry Transport) is a publish-subscribe based "light weight" messaging protocol for use on top of the TCP/IP protocol. It is designed for connections with remote locations where a "small code footprint" is required or the network bandwidth is limited. The publish-subscribe messaging pattern requires a message broker. Thebroker is responsible for distributing messages to interested clients based on the topic of a message. Andy Stanford-Clark and Arlen Nipper of Cirrus Link Solutions authored the first version of the protocol in 1999.
My goal with this app is to implement a control for low power motor (40Watt) to travez of a microcontroller CC3200 SimpleLink of the family Texas Instruments.
Simply send commands like "motor_on" to start the engine and "motor_off" to turn it off, making it as simple as possible for anyone familiar with the electronics.
CC3200 MQtt Control Motor
Description (Texas Instruments):
The SimpleLink Wi-Fi CC3200 LaunchPad (with QFN-packaged device) is an evaluation development platform for the CC3200 wireless microcontroller (MCU), the industry’s first single-chip programmable MCU with built-in Wi-Fi connectivity. The board features on-board emulation using FTDI and includes sensors for a full out-of-the-box experience. This board can be directly connected to a PC for use with development tools such as CCS and IAR.
This LaunchPad has driver support and a software development kit (SDK) with 40+ applications for Wi-Fi protocols, internet applications, and MCU peripheral examples.
- CC3200 Wi-Fi wireless microcontroller (MCU) in QFN package
- Industry’s first devices to be Wi-Fi CERTIFIED at the chip level by the Wi-Fi Alliance
- USB interface to PC for CCS/IAR using FTDI USB drivers
- Flash update over the USB using SimpleLink Programmer
- 2 20-pin connectors enables compatibility with BoosterPacks with added functions (BoosterPack headers)
- Standalone development platform featuring sensors, LEDs and push-buttons
- Power from USB for the LaunchPad as well as external BoosterPack
- Operates from 2 AA alkaline batteries
- On-board antenna and U.FL connector selectable using a capacitor re-work
- Supports 4 wire JTAG and 2 Wire SWD
- GNU Debugger (GDB) support over Open On chip debugger (OpenOCD)
In this application, a graphical LCD screen is used, in which data such as name Network to the CC3200 Simple Link will connect, in my case is "casa1" is displayed once the platform has an answer modem that receives an address IP that is displayed on the LCD.
-The power circuit as the name implies working on power, holding large current.
-An observation of this circuit is that energy is neither created nor destroyed so the question is not where the energy goes into the load, once made the cut.
-The answer is simple there is an element within this network that absorbs all that energy is not delivered and 2.2K resistor R4; This excess current is consumed.
-So this overheats, the application circuit resistances are 1 / 2w, but to see this little detail by a resistance R4 1W replaced.
To load control AC, I'm using a MOC3021, which allows me to control the flow of current to the motor, turning on a pin for programming the internal Led MOC is active and leaves circular AC on the other side, allowing the engine it lights; in the same way to switch off the control pin current is limited and the engine stops.
|Schematic circuit solid state relay
- General description
Triac on a plastic envelope, intended for use in applications requiring high capacity and bidirectional transient voltage blocking performance and high thermal cycling. Typical applications include motor control voltages domestic and industrial lighting, heating and static switching.
|State repetitive peak voltages
|RMS current on the state
|Non-repetitive peak current on the status
The secret of programming:
Quite simply, the CC3200 to receive messages from this server PAHO internally generates an interrupt in the program, leendo the data buffer and storing it in a string.
The string is compared to the "strcmp" command, which already pre configured strings to be compared as "motor_on" and "motor_off" these handed me a value that then by a set of conditional "if", it switches to a the task to be performed.
@Jan Cumps Works:
Source Code Program (Energia.nu)