Wiznet / WIZ550S2E

Serial to Ethernet Module based on W5500 & Cortex-M0
https://docs.wiznet.io/Product/S2E-Module/WIZ550S2E
11 stars 10 forks source link

How to use MQTT iO library for WIZ5500S2E ? #15

Closed anujmattoo closed 6 years ago

anujmattoo commented 6 years ago

I upgraded the WIZ5500S2E module to v1.1.2. It has an LPC1136E microcontroller. How to use MQTT library for it?

Ricky-Kwon commented 6 years ago

Dear anujmattoo,

For a simple mqtt example, see the link below. example 1 example 2

I don't know what you're going to do, but applying mqtt to wiz550s2e requires a lot of trouble.

I am trying to create a sensor-to-Ethernet (mqtt) based on wiz550s2e. That is a sensor gateway.

I will proceed that with an open project.

If you are interested please leave a comment.

anujmattoo commented 6 years ago

Please open this issue. As WIZ5500S2E has on board MCU, so development gets easy. The link you mentioned has MQTT implemented on STM32 MCU whereas WIZ550S2E has LPC11E36 MCU.

Ricky-Kwon commented 6 years ago

I added mqtt to wiz550s2e. To use mqtt, you need a v1.10 Configuration Tool .

  1. v1.2.0 binary update
  2. Factory Reset with old Configuration Tool
  3. And then Use v1.10 Configuration Tool

And the sensor to ethernet is still in my plan and will go on as an open project. I'll let you know when the project repository is created.

anujmattoo commented 6 years ago

That's Great! Which bin file to update WIZ550S2E.bin or WIZ550S2E_App.bin for using MQTT?

Ricky-Kwon commented 6 years ago

You should use a WIZ550S2E_App.bin file. WIZ550S2E.bin is all firmware.(app+boot)

Please upload the firmware using the v1.03 Configuration Tool.

The guide is here.

anujmattoo commented 6 years ago

Okay. I uploaded the firmware using Flash Magic software provided by NXP to flash LPC Controller. Is that right way to flash?

Ricky-Kwon commented 6 years ago

It is also possible.

In that case can use only just .hex file.

anujmattoo commented 6 years ago

@Ricky-Kwon I uploaded the latest firmware and after that factory reset using Configuration tool v1.03. I downloaded the configuration tool v1.10. I then searched the ethernet mac address on the network, it did find.

Here is the snapshot : inkedcapture_wiznet_li

I will now select the MQTT option in Working mode and will fill up MQTT details username, password and topic. My question is where is an option for filling up MQTT port number? Also after entering the details and setting it, how will I send data over MQTT? Are there any commands or format to be sent to com port in order to send data?

Ricky-Kwon commented 6 years ago

Share and use the remote port. That is, you can write the port of mqtt server on the remote port. The same is true of host ip.

Ricky-Kwon commented 6 years ago

If you do it correctly, it indicates that you are connected on the network status. After entering any data into the serial it is sent to the mqtt server. If you want to create a packet, use packing conditions.

anujmattoo commented 6 years ago

@Ricky-Kwon Understood. The MQTT Server IP provided by the broker is m12.cloudmqtt.com but the Host IP only accept the IP in digits and displays Host IP Input Error.

inkedcapture_wiznet_li

Ricky-Kwon commented 6 years ago

you can use a dns.

anujmattoo commented 6 years ago

Can you share some screenshot of the same. I selected use DNS and inputted m12.cloudmqtt.com in DNS Server IP, it displays error DNS server IP input error

inkedcapture_wiznet_li

Ricky-Kwon commented 6 years ago

Oh, check the DNS server addresses on your PC using the commands such as ipconfig. If you don't know, use Google DNS server, such as 8.8.8.8. m12.cloudmqtt.com must be written to a domain. I'll make a guided video later on and show it to you.

anujmattoo commented 6 years ago

@Ricky-Kwon I am still unable to connect to MQTT. Here is the setting for MQTT : inkedcapture_wiznet_li 2

Ricky-Kwon commented 6 years ago

The module should be Internet. Make sure that the Internet is compatible with the same IP bandwidth as your PC.

Please refer to the attached video(static).

WIZ550S2E with MQTT.zip

Ricky-Kwon commented 6 years ago

Please refer to the attached video(dhcp).

WIZ550S2E with MQTT(DHCP).zip

anujmattoo commented 6 years ago

@Ricky-Kwon Wooah! 😄 The MQTT is working over WIZ5500S2E. Can you implement AT commands to configure MQTT serially?

Ricky-Kwon commented 6 years ago

Of course. I am wondering what commands are convenient for the user.

Can you give us your opinion? For example...

Is it better to add MQTT to AT + NOPEN, AT + NSEND? Or would you make the command independently? For example, AT + MQTT ...

Anyway, it is under development.

anujmattoo commented 6 years ago

Why not keep commands already made for WizFi modules, this way it will universal for all the Wiznet family. Adding different commands for this specific module is not worth it. Comments?

  1. Setting topic every time when publishing data is a good option but it should be optional, not mandatory. Sending data without topic should be default option when someone has to send data to some other topic, a specific command should be there which will not replace the original topic.

  2. Subscribe to single topic only, should be done exactly what mentioned above.

I think adding commands specifically for MQTT is a good idea.

Commands such as [They already exist for WizFi modules] :-

http://wizwiki.net/wiki/doku.php?id=products:wizfi310:wizfi310pg:start#plugin_include__products__wizfi310__wizfi310pg__at_command_set-mqtt_commands

- AT+MQTTSET=<UserName>,<Password>,<ClientID>,<AliveTime>
- AT+MQTTSET=?
- AT+MQTTCON=<Con/Discon>,<BrokerIP>,<BrokerPort>,<SSL_Enable>
- AT+MQTTCON=?
- AT+MQTTPUB=<Topic>,<Length>
- AT+MQTTSUB=<Sub/Unsub>,<Topic>

After setting, all the parameters should be saved in flash/EEPROM and upon power up should retain and automatically connects to the saved configuration and topic and should work transparently as it's working now. For this, it's important to set the working mode to MQTT or change to UDP/TCP Server or client when MQTT not required.

What do you say about this?