renatogp / Playground4IoT

repository to store firmware, tutorial and libs for Playground4IoT development board

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Playground4IoT

"There are three states of being: Not knowing, action and completion" Cult of Done Manifesto, Bre Pettis

Welcome Playgrounder to our repository where you can find libraries, firmwares, Arduino Sketch, tutorials and more for Playground4IoT development board. Playground4IoT is a development board that make easy and fun to start playing, prototyping and deploying connected devices projects using AWS Services like AWS IoT Core and Amazon FreeRTOS with security for adults, deployment over-the-air and management of big fleets of devices in production.

This project was done by AWS Developer Relations Team but is open-source, don't hesitate to clone it, produce, have fun, make money, change the world or anything else you dream. Developer Relations Team exist to help you to make it happen, count on us.. ALWAYS!

Technical Resume

"Accept that everything is a draft. It helps to get it done." The Cult of Done Manifesto, Bre Pettis

This board is based on ESP32, a powerful SoC that can run in low-energy with solar panel and simple battery forever and you can program using Arduino IDE, libraries and frameworks or you can go deeper and programa with Amazon FreeRTOS for industry ready devices.

  • Based on ESP32 SoC (System-on-chip) with WIFI and Bluetooth
  • Accelerometer Sensor
  • Temperature, Humidity and Pressure sensor
  • Light sensor
  • Battery voltage sensor
  • Solar panel sensor
  • Groovy connectors
  • External Solar Panel Connector
  • External Battery Connector
  • Battery charger system (cable / solar panel)
  • And a lot of love!

Let's Play!

"People without dirty hands are wrong, doing something makes you right!" The Cult of Done Manifesto, Bre Pettis

To start playing with this device (or toy?!?) we have those main steps:

  1. Install Playground4IoT usb driver
  2. Install and setup Arduino IDE environment: install Arduino IDE itself and setup for E SP32 development
  3. Install Arduino libraries for the Playground4IoT sensors
  4. Create a thing to represent your board in AWS IoT Core
  5. Setup the wifi credential, root-ca, device certificate and private key inside the Arduino C code
  6. Upload the Arduino code to your board using an USB cable
  7. Open AWS IoT Core console and start playing with your board

Now let's go deep in each step!

1. Install Playground4IoT usb driver

Our board uses a chip called CH340 to communicate throught the USB-C port, this chip is actualy a Serial - USB converter so once you have the driver installed you will see the Playground4IoT as a Serial port (windows: COM1, COM7, COMx - linux /dev/acm0 /dev/usb0 - macs /dev/cu.wchusbserial).

Follow this nice sparkfun.com tutorial to install the driver: https://learn.sparkfun.com/tutorials/how-to-install-ch340-drivers/all

2. Arduino IDE

We have different ways to start programming our Playground4IoT that is based on ESP32 SoC and the simple way to do it is using Arduino IDE. It's a very popular IDE / tool for writing firmwares they call sketches using a simplified C sintax with many libraries to abstract all the hardware and C complex code.

To install Arduino IDE go to Arduino Web Site, download and install it, it's quite simlpe. Here is the link: https://www.arduino.cc/en/Main/Software

After installing the Arduino IDE we must add the ESP32 support.

  1. Open your Arduino IDE

  2. Go to File -> Preferences

tutorial image

  1. Enter https://dl.espressif.com/dl/package_esp32_index.json into the “Additional Board Manager URLs” field as shown in the figure below. Then, click the “OK” button:

tutorial image

  1. Open the Boards Manager. Go to Tools > Board > Boards Manager…

tutorial image

  1. Search for ESP32 and press install button for the “ESP32 by Espressif Systems“:

tutorial image

Now wait until it finish the downlaod and install

tutorial image

All done with ESP32 support for Arduino IDE:

tutorial image

  1. Choose the "ESP32 Dev Module" in boards manager:

tutorial image

  1. Now it's time to find your USB port, don't plug your board in your computer and check which ports you have on the Tools -> Port menu:

tutorial image

  1. Now plug your Playground4IoT and check this menu again, you should see something new like here that COM7 is the choosen port:

tutorial image

3. Install Arduino Libraries for our Sensors

The Playground for IoT uses some sensors that has specific C libraries to make it easy to use. All we need to do is copy the folders in /Playground4IoT/Arduino/Libraries to your $HOME/Documents/Arduino/Library.

tutorial image

4. AWS IoT Core Setup

  1. Now we need to setup the cloud side of the moon... We will create a thing to represent our Playground4IoT board and also the certificate and security keys. Open your AWS IoT Core Console and click Manage -> Things - Create:

tutorial image

  1. Let's choose "Create a single thing"

tutorial image

  1. Now give a name to your thing and click next

tutorial image

  1. Now choose "One-click certificate creation"

tutorial image

  1. You can finally download your thing's certificate and private key

tutorial image

  1. Click Activate to make your certicates valid

tutorial image

  1. Download ROOT Certifica Authoroty clicking in "A root CA for AWS IoT Download"

tutorial image

  1. You will be redirected to another page that you can choose some options:

tutorial image

  1. Now we need to take note of our AWS IoT Core endpoint to use in the next step. Open AWS IoT Core Console and click settings

tutorial image

5. Let's code!

  1. Clone Playground4IoT repo: git clone https://github.com/vsenger/Playground4IoT

  2. Open your Arduino IDE and make sure you selected the right USB port and ESP32 board!

  3. Open the Arduino Sketch with current the firmware located inside the folder you clone the github repo: Playground4IoT/arduino/Playground4IoTFirmware-V0/

tutorial image

tutorial image

  1. Setup your SSID and password: scroll down to the line around 60 and change:
  1. The host name to your AWS IoT Core Thing name
  2. SSID and passsword
  3. Optional: change the name of the topics we are going to use to communicate with our board

tutorial image

  1. Let's configure our credentials: click in secrets.h tab and then update:
  1. AWS IoT Core endpoint
  2. ROOT CA certificate: open the downloaded file and copy and paste the content
  3. Same things for Device Certificate and Private Key.

tutorial image

6. Upload and fingers crossed

Now click the Upload button and wait until it compile and upload to your board. Keep your eyes in the log message panel, it's "normal" to have warning messages :).

tutorial image

7. Let's Play!

Time to have fun! Open your AWS IoT Core Console and click Test

tutorial image

Type playground/sensors and click Subscribe

tutorial image

Type playground/sensors and click Subscribe

Now you should start seeing the json results!

tutorial image

8. Oppss, not working and now?

Chime Vini vsenger@ is now the first option but you can check the following:

  1. Is your USB port ok?
  2. Did you get any error message during the compile and upload process?
  3. Did you choose the right Arduino Board setting to ESP32 Dev?
  4. Can you open the Arduino Serial monitor?

9. More to come!

From here you can start changing the Arduino code to improve anything you want or do some local logic implementation reacting locally based on sensors data.

About

repository to store firmware, tutorial and libs for Playground4IoT development board

License:Apache License 2.0


Languages

Language:HTML 80.8%Language:C++ 9.0%Language:C 8.3%Language:JavaScript 0.9%Language:CSS 0.4%Language:Python 0.4%Language:Shell 0.1%Language:Makefile 0.1%Language:Objective-C 0.1%Language:Batchfile 0.0%