Software apps and online services

Story

Out of the box, the AVR-IoT WG and PIC-IoT WG development boards already enable you to view temperature and light data from the cloud. Plug a MikroElektronika Weather Click into the MikroBUS socket to easily complete your weather sensor with humidity and pressure sensing.

By the end of the tutorial, you will have a complete cloud-connected weather sensor and you will be able to view temperature, light, humidity, and pressure data from the Microchip Sandbox within the Google Cloud Platform IoT Core.

The sendToCloud() function is invoked automatically every pre-defined interval period (typically 1 second).

The light sensor measurement is performed during the sendToCloud() function through calling SENSORS_getLightValue() in the sensor_handling.c file. The temperature, humidity, and pressure measurements are called from their respective functions in the weather.c file. Note that there is also an embedded temperature sensor on the AVR-IoT WG board.

Then, the sprintf() function is called to create a JSON formatted string (json), which is used to display the data in the cloud sandbox. The JSON formatted string is modified in this code snippet to accommodate the humidity and pressure readings.

Compile Code

We recommend that you modify the compiler settings to optimize efficiency. For this tutorial, we used the AVR 8-bit Toolchain 3.6.2.

To modify compiler settings, click on the gear icon in the dashboard (bottom left corner):

Click on the Gear Icon in the Dashboard to Modify Compiler Settings

Select the AVR compiler, navigate to avr-gcc, and select the Optimization menu

Select s as the optimization level

Uncheck "Pack Structure members together"

Select OK and navigate back to the IDE

Select S as the Optimization Level

Click on the Hammer and Brush Icon to Clean and Build your code

Clean and Build

Program the device by clicking on the green arrow Make and Program Device icon

Make and Program Device

View Weather Data from the Cloud

If you have not already, follow the Quick Start Guide to configure a Wi-Fi connection.

On your PC, navigate to the Curiosity Drive, and click on the CLICK-ME.HTM file to view your unique URL.

Until you migrate to a private google cloud account, this URL will always link to your device, so be sure to write it down so that you can access your weather data from anywhere.

perfect weather for a picnic in my cubicle!

That's it! We plugged a LiPo battery into the connector on the AVR-IoT board so we can take our weather sensor anywhere with a Wi-Fi connection.

1 / 2 • Desert flora do not require too much monitoring

Comment below to ask questions, give feedback on this tutorial, and share screenshots of the weather in your area!

Troubleshooting

If you are having trouble connecting to Wi-Fi:

Make sure you are using a 2.4GHz connection.

While the WINC1500 Wi-Fi Network Controller can support enterprise level security (what you'll usually see at your office or university), this is not part of the demo. I usually configure a hot spot on my phone.

We've had the most seamless experience using a Wi-Fi SSID that has no special characters. For example, we use "MCHP.IOT" instead of "MCHP's IOT"