IoT project demonstrating Moduino X1 running Mongoose OS that publishes a MQTT message to AWS IoT when the Mode button is pressed over a GSM connection.
Ensure you have:
- Moduino X1
- mos
- esptool
- AWS CLI installed and configured
- Relevant USB to Serial driver installed
- APN settings for your carrier which can be commonly found on the t'internet
- Ensure directory that contains mos.exe is added to your PATH system variable
- Chocolatey is installed
- GNU Make is installed
In mos.yml
:
- Replace your-carrier-apn with your carrier's APN
- Replace your-carrier-username with your carrier's username
- Replace your-carrier-password with your carrier's password
Build project by using either command:
mos build --platform esp32 --clean
or
make
To flash Moduino X1:
- Power down Moduino
- Connect BOOT pin to GND
- Power up Moduino
- Run command:
Mac/Linux Users
make flash
Windows Users
Navigate to build
directory and extract fw.zip
into extract
directory within build
. Then run command
$ make wipe
$ make flash_device_win
- When terminal outputs message below power down and power up moduino
Connecting...
- Disconnect BOOT pin from GND and cycle power to moduino
To display logs from Moduino, run command
make console
Ensure you the device has connected to the GSM network and has internet connection. Run command to provision moduino on AWS IoT
mos aws-iot-setup
provision to specific region
mos aws-iot-setup --aws-region <desired region>
Note
: mos tool does not support multiple aws profiles so ensure the AWS account you want to provision it on is your default profile.
If this is successful moduino will show up in AWS Console under AWS IoT -> Manage -> Things. Alternatively you can AWS CLI to list your provisioned device:
aws iot list-things
Find your Moduino's device ID and copy it
mos config-get device.id
In AWS Console (ensure you're in the region that the moduino was provisioned to) go to AWS IoT -> Test.
Subscribe to topic <copied device ID>/button_pressed
leaving other options to default settings.
Press the Mode button on the Moduino X1 and message should pop up on the AWS MQTT client
{
"modeBtn": "Button pressed"
}
The following message should also appear in the device console logs
Published: yes topic: <your device ID>/button_pressed message: {\"modeBtn\":\"Button pressed\"}