Internet of Things with Arduino and the CC3000

Similar documents
INA169 Breakout Board Hookup Guide

Programming 2 Servos. Learn to connect and write code to control two servos.

SPI, Talking to Chips, and Minimizing Noise

Milli Developer Kit Reference Application Published on Silver Spring Networks STAGE (

The wiring is relatively simple. You should put the module on one of the compatible Arduinos. The following are compatible:

An IoT Based Real-Time Environmental Monitoring System Using Arduino and Cloud Service

Free ebooks ==>

Arduino Home Automation Projects

Programming a Servo. Servo. Red Wire. Black Wire. White Wire

Internet of Things Student STEM Project Jackson High School. Lesson 2: Arduino and LED

nrf24l01+ Transceiver Hookup Guide

CPSC 226 Lab Four Spring 2018

ZX Distance and Gesture Sensor Hookup Guide

Prelab: Introduction and Greenhouse Construction

LESSONS Lesson 1. Microcontrollers and SBCs. The Big Idea: Lesson 1: Microcontrollers and SBCs. Background: What, precisely, is computer science?

Application Note AN 102: Arduino I2C Interface to K 30 Sensor

9DoF Sensor Stick Hookup Guide

Welcome to Arduino Day 2016

Arduino Lesson 1. Blink. Created by Simon Monk

You'll create a lamp that turns a light on and off when you touch a piece of conductive material

APDS-9960 RGB and Gesture Sensor Hookup Guide

EE-110 Introduction to Engineering & Laboratory Experience Saeid Rahimi, Ph.D. Labs Introduction to Arduino

EARTH PEOPLE TECHNOLOGY. EPT-200TMP-TS-U2 Temperature Sensor Docking Board User Manual

Arduino STEAM Academy Arduino STEM Academy Art without Engineering is dreaming. Engineering without Art is calculating. - Steven K.

Adafruit SGP30 TVOC/eCO2 Gas Sensor

ASCOM EF Lens Controller

For this exercise, you will need a partner, an Arduino kit (in the plastic tub), and a laptop with the Arduino programming environment.

AS726X NIR/VIS Spectral Sensor Hookup Guide

From Github Wiki. Release. Giovanni Blu Mitolo

A servo is an electric motor that takes in a pulse width modulated signal that controls direction and speed. A servo has three leads:

FABO ACADEMY X ELECTRONIC DESIGN

Web-Enabled Speaker and Equalizer Final Project Report December 9, 2016 E155 Josh Lam and Tommy Berrueta

Application Note. Communication between arduino and IMU Software capturing the data

Adafruit 16-Channel Servo Driver with Arduino

ROBOTICS & IOT. Workshop Module

ROBOTICS & IOT. Workshop Module

Adafruit Si4713 FM Radio Transmitter with RDS/RDBS Support

TWEAK THE ARDUINO LOGO

Internet of Things (Winter Training Program) 6 Weeks/45 Days

Coding with Arduino to operate the prosthetic arm

Internet of Things Student STEM Project Jackson High School. Lesson 3: Arduino Solar Tracker

Objectives: Learn what an Arduino is and what it can do Learn what an LED is and how to use it Be able to wire and program an LED to blink

instruments, however, is that they are large in size, heavy and quite expensive.

PSoC and Arduino Calculator

CONSTRUCTION GUIDE Robotic Arm. Robobox. Level II

Computational Crafting with Arduino. Christopher Michaud Marist School ECEP Programs, Georgia Tech

Experiment 1 Identification of Components and Breadboard Realization

Cloud Based LightSwitch Edgar Lopez Garcia Professor Kastner CSE 145 Spring 2016

CONSTRUCTION GUIDE IR Alarm. Robobox. Level I

e-paper ESP866 Driver Board USER MANUAL

DESCRIPTION DOCUMENT FOR WIFI / BT HEAVY DUTY RELAY BOARD HARDWARE REVISION 0.1

Arduino Setup & Flexing the ExBow

Lab 2: Blinkie Lab. Objectives. Materials. Theory

Teaching students science and engineering with high altitude balloons and ChipKits

Application Note AN 157: Arduino UART Interface to TelAire T6613 CO2 Sensor

Objective of the lesson

ENGN/PHYS 207 Fall 2018 Assignment #5 Final Report Due Date: 5pm Wed Oct 31, 2018

Montgomery Village Arduino Meetup Dec 10, 2016

Lab 5: Arduino Uno Microcontroller Innovation Fellows Program Bootcamp Prof. Steven S. Saliterman

Lesson 3: Arduino. Goals

Community College of Allegheny County Unit 4 Page #1. Timers and PWM Motor Control

Module: Arduino as Signal Generator

Total Hours Registration through Website or for further details please visit (Refer Upcoming Events Section)

settinga.html & setcookiesa.php

Adafruit 16-Channel Servo Driver with Arduino

1Getting Started SIK BINDER //3

Arduino Sensor Beginners Guide

Lecture 4: Basic Electronics. Lecture 4 Brief Introduction to Electronics and the Arduino

Smart RFDuino. Alexander Baldamus Dominik Schlütter Hinrikus Wolf. Sommersemester 2014

Two Hour Robot. Lets build a Robot.

Arduino Microcontroller Processing for Everyone!: Third Edition / Steven F. Barrett

Getting Started with the micro:bit

PLAN DE FORMACIÓN EN LENGUAS EXTRANJERAS IN-57 Technology for ESO: Contents and Strategies

Congratulations on your purchase of the SparkFun Arduino ProtoShield Kit!

Community College of Allegheny County Unit 7 Page #1. Analog to Digital

LED + Servo 2 devices, 1 Arduino

THE IMPORTANCE OF PLANNING AND DRAWING IN DESIGN

Light Emitting Diode IV Characterization

Arduino Workshop 01. AD32600 Physical Computing Prof. Fabian Winkler Fall 2014

Grove - Infrared Receiver

Lab 06: Ohm s Law and Servo Motor Control

Breadboard Arduino Compatible Assembly Guide

AN ARDUINO CONTROLLED CHAOTIC PENDULUM FOR A REMOTE PHYSICS LABORATORY

ISSN: [Singh* et al., 6(6): June, 2017] Impact Factor: 4.116

Adafruit 16-channel PWM/Servo Shield

DESCRIPTION DOCUMENT FOR WIFI SINGLE DIMMER ONE AMPERE BOARD HARDWARE REVISION 0.3

Adafruit 16-Channel Servo Driver with Arduino

Bluetooth Based IOT through Arduino

MASTER THESIS. TITLE: Arduino based acquisition system for control applications

Team Number ECE-10. Solar Power Forecasting Tool

J. La Favre Using Arduino with Raspberry Pi February 7, 2018

Adafruit 16-channel PWM/Servo Shield

IMU: Get started with Arduino and the MPU 6050 Sensor!

Rodni What will yours be?

smraza Getting Start Guide Contents Arduino IDE (Integrated Development Environment)... 1 Introduction... 1 Install the Arduino Software (IDE)...

Step 1: Getting to know your Rain Sensor: About This Instructable views. 115 favorites

Skill Level: Beginner

Practical Assignment 1: Arduino interface with Simulink

802.11g Wireless Sensor Network Modules

Photon Weather Shield Hookup Guide

Transcription:

Internet of Things with Arduino and the CC3000 WiFi chip In this guide, we are going to see how to connect a temperature & humidity sensor to an online platform for connected objects, Xively. The sensor will be connected to an Arduino Uno board, which will also communicate with the Adafruit CC3000 breakout boar Written By: Feitan 2017 www.botsbits.org Page 1 of 12

INTRODUCTION The CC3000 WiFi chip from Texas Instrument is a quite versatile chip that can be used to connect your projects to the web. However, connecting your Arduino project to a web server can be tricky: you need to know how to install & configure a web server, and know a bit about HTML & PHP. Luckily, there are other solutions to make things easier. TOOLS: Breadboard (1) Arduino IDE (1) CC3000 library (1) Make sure that the libraries are correctly placed in your /libraries folder inside your main Arduino folder DHT library (1) Make sure that the libraries are correctly placed in your /libraries folder inside your main Arduino folder PARTS: Arduino Uno R3 or Arduino Mega or Arduino Due (1) Adafruit CC3000 breakout board (1) DHT22 or DHT11 sensor (1) 10K Ohm resistor (1) 2017 www.botsbits.org Page 2 of 12

Step 1 Internet of Things with Arduino and the CC3000 WiFi chip The DHT sensor is quite easy to connect: just plug the pin number 1 to the Arduino s 5V, pin number 4 to GND, and pin number 2 to Arduino pin 7. Finally, put the 10K resistor between the sensor pins number 1 and 2. The hardware configuration of the CC3000 breakout board is relatively easy. Connect the IRQ pin of the CC3000 board to pin number 3 of the Arduino board, VBAT to pin 5, and CS to pin 10. Then, you need to connect the SPI pins of the board to the corresponding pins on the Arduino board: MOSI, MISO, and CLK go to pins 11,12, and 13, respectively. Finally, you have to take care of the power supply: Vin goes to the Arduino 5V, and GND to GND. 2017 www.botsbits.org Page 3 of 12

Step 2 The following picture summarizes the hardware connections. Step 3 Create your Xively account The first step is to create your Xively account, and to configure it for this project. It is all done via their graphical interface, so there is no need to code anything in this part. First, you need to create an account. Just click on Get started And then on Sign up here You can now enter your personal informations. 2017 www.botsbits.org Page 4 of 12

Step 4 Now that your account is created, you can create a device to track some data. First, click on Develop. And on Add Device It s now time to enter some information about the device 2017 www.botsbits.org Page 5 of 12

Step 5 Finally, you should arrive to this page corresponding to your device. What is important on this page is the Feed ID that identify your device, and the API key that identify your account. Please note these two values, you will need them later. Now, we need to create Channels to track some data. Click on Add Channel to create the first one. Now enter the details about this first channel for the Temperature. The name of the channels are important, we will use them in the Arduino sketch. You can now do the same for the Humidity channel. At the end, you will end up with this on your device page Your Xively account is now ready to receive some data coming from your Arduino board. Let s now focus on how to connect your Arduino board, the DHT 11 sensor, and the CC3000 chip. 2017 www.botsbits.org Page 6 of 12

Step 6 The Arduino sketch for this project consists in initializing the DHT 11 sensor & the CC3000 WiFi chip, and then in running a loop that measures the temperature & humidity, send data to the Xively server, and repeat itself every 10 seconds. You can find detailed information about how to connect the CC3000 chip to your WiFi network in other tutorials, like our WiFi weather station tutorial. In this article, I will focus on the parts that concerns Xively. It starts by defining your feedid and API key: #define WEBSITE "api.xively.com" #define API_key "yourapikey" #define feedid "yourfeedid" Then, at every iteration of the loop, we need to connect to the network, and measure the temperature: float h = dht.readhumidity(); 2017 www.botsbits.org Page 7 of 12

Step 7 float t = dht.readtemperature(); int temperature = (int) t; int humidity = (int) h; This is now the time to format the data for the Xively website. There are two things to do here: first, we need to format the data into a String variable that will contain the information in the JSON format. It might seem complicated, but the Xively website has many tutorials to format your data correctly. We also need to know the length (in number of characters) of the data so we can put it in the HTTP request. int length = 0;String data = ""; data = data + "\n" + " {\"version\":\"1.0.0\",\"datastreams\" : [ {\"id\" : \"Temperature\",\"current_value\" : \"" + String(temperature) + "\"}," 2017 www.botsbits.org Page 8 of 12

Step 8 + "{\"id\" : \"Humidity\",\"current_value\" : \"" + String(humidity) + "\"}]}"; length = data.length(); When the client is connected, we can send the request to the server. This is a typical HTTP PUT request, where we specify the feedid, the API key, and send the data at the end of the request. if (client.connected()) { Serial.println("Connected!"); client.println("put /v2/feeds/" + String(feedID) + ".json HTTP/1.0"); client.println("host: api.xively.com"); client.println("x-apikey: " + String(API_key)); 2017 www.botsbits.org Page 9 of 12

Step 9 client.println("content-length: " + String(length)); client.print("connection: close"); client.println(); client.print(data); client.println();} Because the temperature & humidity are slow-changing values, we can read these values & send them over to Xively every 10 seconds only. This is done by using a delay: delay(10000); Finally, the complete code can be found in the GitHub repository of this project. 2017 www.botsbits.org Page 10 of 12

Step 10 Using Xively Now that the Arduino sketch is completed, you can upload the sketch to your Arduino board, and test the project. Make sure that the page corresponding to your device on Xively is opened. You can now open your Serial Monitor and you should see the Arduino connecting to your network, preparing the request, and connecting to the Xively website. If everything goes well, you should see this response from the Xively server: HTTP/1.1 200 OK Date: Mon, 14 Oct 2013 17:44:20 GMT Content-Type: application/json; charset=utf-8 Content-Length: 0 Connection: close 2017 www.botsbits.org Page 11 of 12

Step 11 X-Request-Id: 55c792d07f4a679dfb8a1a09141264d 7c98eea1e Cache-Control: max-age=0 Vary: Accept-Encoding And finally, have a look on your Xively page in your browser. You should see that you successfully sent some information to the Xively server and the temperature & humidity should be displayed on this page After a few measurements, you should also have the graphs displayed on the device s page. Of course, you can use this tutorial to connect other sensors to Xively: motion sensors, contact switches, luminosity sensors, the possibilities are endless, so don t hesitate to experiment and share your results! This document was last generated on 2017-06-28 06:32:44 AM. 2017 www.botsbits.org Page 12 of 12