This is a proyect that I followed from the video video from Shilleh.
This is my video with my raspberry Pi PICO 2 W using the AWS IoT Core services.
To be able to make a connection between the Raspberry Pi and AWS we have to create some policies that will allow the communication. in the Policies option, go to the bottom of the page until Policy Document and create four new Statement.
- First statement: Allow iot:Connect for all resources (*)
- Second statement: Allow iot:Publish for all resources (*)
- Third statement: Allow iot:Receive for all resources (*)
- Fourth statement: Allow iot:Subscribe for all resources (*)
This is not recommended for general use, but for this small project, it will be allowed.
A thing resource is a digital representation of a physical device or logical entity in AWS IoT/
- Number of Things to Create: Select "Create a single thing" (first option).
- Create a Name: Use a meaningful name, usually "picow", then click Next.
- Device Certificate: Choose "Auto-generate a new certificate" (first option).
- Policy Selection: Select the policy you created earlier, then click "Create thing".
Important Step: After clicking the "Create thing" button, a window will pop up on your screen displaying different certificates. You must download all of them to proceed with the configuration of your Raspberry Pi Pico W
Add the certificate files to your Raspberry Pi.
-
Create a file named simple.py inside a directory called "lib". Paste the code from the repository into this file or copy the file directly. Save the file.
-
In the main directory, create or copy a new file named main.py, this file will establish the connection.
-
Inside main.py, update the following:
- Add your Wi-Fi name and password to enable the internet connection.
- Specify the required file names inside the quotation marks "".
Once you add all the necessary information, run the code and go to the management console in your AWS account. This is what you will see on the screen if everything is okay
Click on the MQTT test client, select Publish to a topic, and fill in the required information. For example, the topic name should be "LED", and the message payload should be "toggle", because we use those names in the main code to trigger a response from AWS IoT to the Raspberry Pi.
Now, click the Publish button, and you're done!
This is what you expect to see now. => video.
Thanks 👍