A Simple Sensor Server Using Cy8ckit-062-wifi-bt
About the project
A CY8CKIT-062-WiFi-BT ModusToolbox project, using BME280 sensor module.
Project info
Difficulty: Moderate
Platforms: Cypress
Estimated time: 1 week
License: GNU General Public License, version 3 or later (GPL3+)
Items used in this project
Hardware components
Software apps and online services
Story
Preface
Although submitting to “The Great PSoC 6 Design Challenge”,
this project is not a great project.
But I hope that this can give some hints for newcomers of
PSoC 6 and/or ModusToolbox.
This program uses a BME280 sensor module as data source via I2C interface
and display Temperature, Humidity, Pressure in a Web Browser.
A onboard LED can be toggled by using the “Toggle LED” button,
and the status of the LED will be also reflected with color Red/Black.
Since this project is using Wi-Fi connection, the sensor and LED can be accessed
from a PC or an iPhone. (I have not tried with an Android but hopefully it will also work)
To build the project,
(1) Create a new project from ModusToolbox Template Application AnyCloud_HTTPS_Server
(2) Replace the following files
main.c
secure_http_server.h
secure_http_server.c
generate_ssl_certs.sh
(3) Add the following files to the project
html.h
i2c_utils.h
i2c_utils.c
bme280.h
bme280.c
(4) Modify secure_http_server.h for
WIFI_SSID
WIFI_PASSSED
(5) Generate certifications (cygwin)
Run generate_ssl_certs.sh
(6) compile ssl2c.c (cygwin)
$ cc ssl2c.c -o ssl2c
(7) Convert certifications into C strings filse (cygwin)
$ ssl2c s3.local.crt local_crt.h
$ ssl2c s3.local.key local_key.h
$ ssl2c rootCA.crt rootCA_crt.h
(8) Copy and paste the contents of local_crt.h in the secure_keys.h keySERVER_CERTIFICATE_PEM definition
(9) Copy and paste the contents of local_key.h in the secure_keys.h keySERVER_PRIVATE_KEY_PEM definition
(10) Copy and paste the contents of rootCA_crt in the secure_keys.h keyCLIENT_ROOTCA_PEM definition
(11) compile html2c.c (cygwin)
$ cc html2c.c -o html2c
(12) Convert test.html to test_html.h
$ html2c test.html test_html.h
(13) Copy and paste the contents of test_html.h in the html.h HTTPS_STARTUP_WEBPAGE definition
(14) Build and Run the project.
Leave your feedback...