Create the src/main.h
file based on src/main.h.example
with the relevant information for your project and save it.
#ifndef MAIN_H
// Wifi Details
const char *ssid = "YourWifiSSID";
const char *password = "YourWifiPassword";
const String thing_id = "YourThingID";
// AWS MQTT Details
char *aws_mqtt_server = "YourAWSThingID.iot.us-east-1.amazonaws.com";
char *aws_mqtt_client_id = "YourMQTTClientID";
char *aws_mqtt_thing_topic_pub = "Your/MQTT/Topic";
char *aws_mqtt_thing_topic_sub = "Your/MQTT/Topic";
#endif
You will also need to create the cert files based on the output from the CloudFormation deploy of the vending machine
openssl x509 -in certs/certificate.pem.crt -out data/cert.der -outform DER
openssl rsa -in certs/private.pem.key -out data/private.der -outform DER
openssl x509 -in certs/root-CA.pem -out data/ca.der -outform DER
Then upload the certificates using SPIFFS
pio run -t uploadfs
For more information on AWS IoT, check out the AWS IoT Setup guide
This project is build and run with PlatformIO. The library dependencies can be found in the platformio.ini
file. Below is the current configuration targetting the NodeMCU varient of the ESP8266 development board.
[env:nodemcuv2]
platform = espressif8266
board = nodemcuv2
framework = arduino
monitor_speed = 115200
lib_deps =
[email protected]
EspSoftwareSerial
[email protected]
[email protected]
[email protected]
Some examples using x.509 certificates and TLSv1.2 under Arduino IDE