• EUR€
  • £GBP
  • $USD
TUTORIALS ArduinoGravity

Arduino/Genuino 101 Starter Kit Tutorial - Lesson 13: Weather Station

DFRobot Jun 29 2017 388

This is the 13th tutorial for the Arduino/Genuino 101 Starter Kit.

After we know how to setup the Bluetooth connection, it’s the time for us to make use of it. In this chapter, we will build 101 to be a wireless weather station that we can view the temperature through Bluetooth.


Connect the LM35 Temperature Sensor to analog pin 0 on the I/O expansion shield. Insert the USB BLE-link into PC’s USB port.



  #include "BLESerial.h"  void setup() {    pinMode(13, OUTPUT);    Serial.begin(115200);    // initialize serial communication    BLESerial.setName("Bluno101");    BLESerial.begin();    //Serial.println("Bluetooth device active, waiting for connections...");    while(!BLESerial); }  void loop() {    while (BLESerial.operator bool())    {      digitalWrite(13, HIGH);      uint16_t val;      double dat;      val=analogRead(0);//Connect LM35 on Analog 0      dat = (double) val / 3.26;      BLESerial.print("Tep:"); //Display the temperature on Serial monitor      BLESerial.print(dat);      BLESerial.println("C");      delay(500);    }    digitalWrite(13, LOW);  }


Setup connection

In Arduino IDE, Select the board type (Arduino/Genuino 101) and COM port(COM7 in our case) for 101 and upload the code. When complete, approach 101 to the USB dongle and wait till both Bluetooth indicator lights up (exactly what we did in last chapter). Once connected, switch COM port (COM9 in our case) to the USB dongle and open the serial monitor, the humidity and temperature data will be displayed inside.

Read temperature from serial monitor


Code Analysis

In this code, we have left the Bluetooth initialization part unchanged, and added some code for temperature monitoring, which sets 101 sending all the data to the USB dongle via Bluetooth. Below are the functions that we use to print values and strings on the USB dongle’s serial monitor.

BLESerial.print(): prints out a variable or string. BLE

Serial.println():prints out a variable or string, then starts a new line.


Related category: arduino kits