Easy Peasy Temperature Monitor

by dsberman in Circuits > Arduino

15 Views, 0 Favorites, 0 Comments

Easy Peasy Temperature Monitor

20180123_160112_bfjD7e1xAU.jpg

Get temperature data on your serial monitor with minimal effort setup using the XinaBox xChips.

Things Used in This Project

Hardware components

Software apps and online services

Story

About this project

I built this project using XinaBox xChips and Arduino IDE. It is a 5 min project, that allows you to read temperature data received from the xSW01 on the serial monitor.

Introduction

My objective was simple - find the simplest way to receive temperature data. I chose to use the xChips because they are user friendly. They also eliminate the need for soldering and serious circuit design. Using Arduino IDE I could simply program the xChips to show me the temperature data on the serial monitor.

Downloading the Libraries

  • Go to Github.xinabox
  • Download xCore ZIP
  • Install it into Arduino IDE by going to "Sketch", "Include Library", then "Add .ZIP Library". As seen below.

Figure 1: Installing xCore library

  • Download xSW01 ZIP
  • Add the library the same way as you did for the xCore.

Programming

  • Connect the IP01 and CC01 using an xBUS Connector. Make sure the xChips' names are orientated correctly.

Figure 2: Connected IP01 and CC01

  • Insert into an available USB port.
  • Download or copy and paste the code from the "CODE" heading into your Arduino IDE. Alternatively you could create your own code using the relevant principles to achieve the same objective.
  • To ensure there are no errors compile the code.
  • After successful compilation(no errors found) you may upload the code to your xChips. Ensure the switches are facing "A" and "DCE" respectively before uploading.

Final Assembly

  • Once the upload is successful, remove the IP01 from the USB port. Attach the SW01 with another xBUS Connector to the CC01.

Figure 3: Connected IP01, CC01 and SW01.

  • Insert the board back into the same USB port.
  • Open the serial monitor in the top, right-hand corner of the screen. It should look like the image below after a few moments.

Figure 4: Serial Monitor displaying temperature data

  • You can now view the temperature data on the serial monitor

Code

Temperature Serial print Arduino
Code for showing temperature data received from the XChip SW01 in the serial monitor of Arduino IDE.

#include <xCore.h><xcore.h>
#include <xSW01.h><br><br></xcore.h>// Create a variable for the storage of data received from SW01
  float Celsius_Temp;
  float Farenheit_Temp;


const int DELAY_TIME = 1000;

xSW01 SW01;

void setup() {
  // Start the Serial Monitor
  Serial.begin(115200);

  // START I2C COMMUNICATION
  Wire.begin();

  // Start the SW01
  SW01.begin();

  //Intialising variables
  Celsius_Temp = Farenheit_Temp = 0;

  Serial.println("     Temperature Project        ");
  Serial.println("================================");

  //Delay for sensor to normalise
  delay(3000);
}

void loop() {

  // Read and calculate data from SW01 sensor
  SW01.poll();

  // Request the temperature measurement from SW01 and store in
  // the temperature variable
  Celsius_Temp = SW01.getTempC(); // Temperature in Celcuis
   Farenheit_Temp = SW01.getTempF(); // Temperature in Farenheit

  // Show data over the Serial Monitor
  Serial.print("Celsius_Temp: ");
  Serial.print(Celsius_Temp);
  Serial.println(" C");
  Serial.print("Farenheit_Temp: ");
  Serial.print(Farenheit_Temp);
  Serial.println(" F");

  // Small delay between sensor reads
  delay(DELAY_TIME);
}