MQTT with ESP8266 ESP-01 WiFi module

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
jessylin
Level 2
Level 2
10 sign-ins 5 replies posted 5 sign-ins

Is it posible to conect ESP8266 ESP-01 WiFi module and psoc6 CY8CKIT 062S2 43012 by use MQTT ?

Dose it have example code ? I have tried the example code of MQTT client by use Modustool box but it didn’t work .

i am not sure if ESP8266 ESP-01 WiFi module can receive the date from Psoc .

Thanks!

 

 

0 Likes
1 Solution
Phanindra_I
Moderator
Moderator
Moderator
250 sign-ins 10 likes given 25 likes received

Hi,

"Interface is not up/NULL" msg is seen when one of the whd_init(), cybsp_wifi_bus_init(), whd_wifi_on() fail which are called as part of wcm_init(). Most probably sdio bus init might be failing which could happen due to sdio interface hardware issue or for some other reason.

To pin point which API among the three that are listed above is failing, the CE could be run in debugger mode with breakpoints placed at each of those APIs called inside the cybsp_wifi_init_primary_extended() in the cybsp_wifi.c file. If cybsp_wifi_bus_init() is failing, you can run the CE on another CY8CKIT 062S2 43012 board and see if it runs. If that is the case then it could be the board hardware issue.

Thanks 

View solution in original post

0 Likes
10 Replies
Phanindra_I
Moderator
Moderator
Moderator
250 sign-ins 10 likes given 25 likes received

Hi,

You can connect both devices using MQTT. In MQTT,  clients have to be connected to MQTT broker which pushes the information to the client according to the subscribed topics. The client on ESP8266 ESP-01 WiFi module must subscribe to same topic that psoc6 board is publishing to receive data. The example code works if parameters mentioned in README are properly set.

Thanks, 

Phanindra

jessylin_0-1647494861977.png

The ''MQTT_USERNAME"and"MQTT_PASSWORD"  maens that my AWS acount if i use AWS IoT as MQTT  broker?

thanks

Jessy

 

0 Likes
Phanindra_I
Moderator
Moderator
Moderator
250 sign-ins 10 likes given 25 likes received

''MQTT_USERNAME" and "MQTT_PASSWORD" are not AWS account credentials. They are for client authentication and not necessary to set if you are using AWS IOT broker.

AWS MQTT broker uses client certificate and client private key that you get after creating a new thing in AWS for client authentication.

Thanks,

Phanindra

0 Likes

If I can’t find MQTT USERNAME and PASSWORD how can I use the example code? I have already checked the broker address is correct. 
Thank

Jessy. 

0 Likes
Phanindra_I
Moderator
Moderator
Moderator
250 sign-ins 10 likes given 25 likes received

MQTT USERNAME and PASSWORD are for client authentication and authorization, if required by the MQTT broker. AWS requires secure connection, so It uses certificates, keys for the authentication instead of username, password. You can use example code without setting USERNAME, PASSWORD in case of AWS broker.

Make sure to convert the certificates and keys from PEM format to C string format using HTML utility in README before updating the macros in mqtt_client_config.h file.

Thanks, 

Phanindra

 

0 Likes

i have download the certificates and keys but i still don't know how to change PEM form to C string after i read the README.

jessylin_0-1647620053491.png

 

Thanks,

Jessy 

0 Likes
Phanindra_I
Moderator
Moderator
Moderator
250 sign-ins 10 likes given 25 likes received

In the README, at the bottom of the "AWS IoT MQTT" sub section, you can find a link for HTML utility present in the GitHub repository. I have pasted that link below for your reference.

(https://github.com/Infineon/amazon-freertos/blob/master/tools/certificate_configuration/PEMfileToCSt...)

First, you need to clone that repository to your pc and then you can open "PEMfileToCString.html"  file, upload the certificates, keys and paste the converted ones in their respective macros of "mqtt_client_config.h" file.

Thanks,

Phanindra

0 Likes
lock attach
Attachments are accessible only for community members.

jessylin_0-1647692438964.png

i paste the key and upload certificates,but now have different error.

whats wrong? i can't find the error at 182 line   

0 Likes
Phanindra_I
Moderator
Moderator
Moderator
250 sign-ins 10 likes given 25 likes received

Hi,

"Interface is not up/NULL" msg is seen when one of the whd_init(), cybsp_wifi_bus_init(), whd_wifi_on() fail which are called as part of wcm_init(). Most probably sdio bus init might be failing which could happen due to sdio interface hardware issue or for some other reason.

To pin point which API among the three that are listed above is failing, the CE could be run in debugger mode with breakpoints placed at each of those APIs called inside the cybsp_wifi_init_primary_extended() in the cybsp_wifi.c file. If cybsp_wifi_bus_init() is failing, you can run the CE on another CY8CKIT 062S2 43012 board and see if it runs. If that is the case then it could be the board hardware issue.

Thanks 

0 Likes
Panometric
Level 5
Level 5
100 sign-ins 100 replies posted 10 solutions authored

Seems you did not actually need a broker for ESP8266 but if you do, here is one. https://github.com/martin-ger/uMQTTBroker  In my experience AWS is harder to use because you can't just have username password connections, you need the signed certificates.  By running your own broker you will not have that problem. 

0 Likes