Lecture 7 Datalogger Programming Using Arduino – Part 2

Slides:



Advertisements
Similar presentations
ARDUINO FRAMEWORK.
Advertisements

Arduino Real Time Data Download Arduino Mega2560: Download.
How to use Arduino By: Andrew Hoffmaster.
Khaled A. Al-Utaibi  Digital Vs Analog Signals  Converting an Analog Signal to a Digital One  Reading Analog Sensors with the.
Intel Galileo Gen 2 & Grove Seeed Starter Kit Gen 1
Copyright 2014 Kenneth M. Chipps Ph.D. Network Management Using Sensors to Monitor Network Equipment Rooms Last Update
Introduction to Cameras Jim Rasche Samba Danfa Jaya Joseph 1.
Khaled A. Al-Utaibi  What is Arduino?  Arduino Boards  Arduino Shields  Arduino Uno Hardware.
Embedded Programming and Robotics Lesson 2 C Programming Refresher C Programming1.
Vex 1.0 © 2005 Carnegie Mellon Robotics Academy Inc. Touch Sensor This lesson will explain how to hook a standard micro switch into the Vex system to function.
Colorado Space Grant Consortium Gateway To Space ASEN 1400 / ASTR 2500 Class #12 Gateway To Space ASEN 1400 / ASTR 2500 Class #12 T-58.
1 of 20 Core Arduino Workshop Chris Koehler and Brian Sanders Colorado Space Grant Consortium.
Programming the Geiger Counter Board 1. Arduino Files Go to and download the latest Arduino.
1 - Remove LED from 13 and GND - Bring out your breadboard from HW#4 Arduino Overview:
AAPT workshop W03 July 26, 2014 Saint Cloud State University, MN, USA
Electronic instrumentation Digitization of Analog Signal in TD
Pulse-Width Modulation: Simulating variable DC output
1 of 20 How to use the Compass A. Compass. 2 Compass: - Provides heading relative to Magnetic North, not true North HMC5883L V input - I2C (not.
Partners: Zayira Vasquez Frantz St Valliere Lucy Lin.
Arduino Programming. THE ARDUINO IS A MICROCONTROLLER – A LOW COST, LOW PERFORMANCE COMPUTER.
Prototyping with Microcontrollers and Sensors. Overview Objective Background Information Problem Statement Materials Procedure Assignment Closing.
Using a SparkFun™ serial LCD with an Arduino
Having fun with code, using Arduino in a middle school CS classroom
Arduino - Introduction
Embedded Systems Intro to the Arduino
Getting Started: Building & Programming
Arduino Uno – controlling LED strips
By Rick Darby Sponsors: Geekspace Gwinnett The WorkSpot
simple example program to control a DC-Motor
Breadboards and LED’s with Arduino
Prototyping with Microcontrollers and Sensors
Dr. Kyung Eun Park Summer 2017
Val Manes Department of Math & Computer Science
DHT 11 Sensor Connect the sensor with Arduino board like picture below. Download DHT11 Sensor library from
Microcontroller basics
Manual for Arduino Kit v1.0
Microcontroller basics
An Arduino Workshop A Microcontroller.
Haiwell PLC Modules Introduce
Welcome to Arduino A Microcontroller.
Lecture 8 Database Implementation
Arduino Part 1 Topics: Microcontrollers Programming Basics
Arduino - Introduction
DHT11 Temperature and Humidity Measurement
Datalogger Programming Using Arduino – Part 2
Creative Innovation Series
Arduino and Design of Embedded Applications
Arduino and Grove LET’S START.
Introduction to Arduinos
Roller Coaster Design Project
ARDUINO     What is an Arduino? Features 14 Digital I/O pins 6 Analogue inputs 6 PWM pins USB serial 16MHz Clock speed 32KB Flash memory 2KB SRAM.
What is an Arduino ? Open Source electronic prototyping platform based on flexible easy to use hardware and software.
Internet-of-Things (IoT)
Neurochip3.
Training Module Introduction to the TB9100/P25 CG/P25 TAG Customer Service Software (CSS) Describes Release 3.95 for Trunked TB9100 and P25 TAG Release.
Programming 2: The Arduino IDE & First Sketches
Stata Basic Course Lab 2.
CTY SAR FCPS Shawn Lupoli, Elliot Tan
Aeroponic Engineering and Vertical Farming
Arduino Leonardo Setup
Introduction to Arduino
Downloading Arduino FOR MAC.
Arduino and Grove LET’S START.
Introduction to Arduinos
Introduction to arduino
Introduction to Arduino IDE and Software
Instructor Resources.
Interrupts.
Pulse-Width Modulation: Simulating variable DC output
CTY SAR FCPS Alexander Velikanov
Presentation transcript:

Lecture 7 Datalogger Programming Using Arduino – Part 2 Jeffery S. Horsburgh Hydroinformatics Fall 2016 This work was funded by National Science Foundation Grants EPS 1135482 and EPS 1208732

Objectives Learn basic data collection concepts for hydrologic data Examine more closely observation dimensionality, including the scale triplet of support, spacing, and extent Learn the basic datalogger program structure for logging data

How do we turn an Arduino into a datalogger? Some things we have to figure out: Debugging Timing Interfacing with sensors and making measurements Recording data to a file

Let’s Add a Sensor AM2302 (wired version of the DHT22) Measures temperature and relative humidity Accuracy Temperature: +- 0.5 Deg. C Relative Humidity: +- 2% RH For $15 it’s an OK sensor Unfortunately, it’s SLOW – can only get new measurements every 2 seconds https://cdn-shop.adafruit.com/datasheets/Digital+humidity+and+temperature+sensor+AM2302.pdf

Wiring Red  +5V Black  Ground Yellow  Digital Pin 2

Environmental Sensors Purpose is to detect events or changes in the environment and provide a corresponding output – usually electrical or optical Signal is interpreted by or transmitted to a datalogger Analog A continuous voltage output proportional to the value of the observed variable Datalogger must interpret the result Digital Sensor does all signal processing Reports a result encoded as a digital signal to the datalogger

Communications The AM2302 is a digital sensor 1 wire digital bus Complicated – and requires precise timing

Arduino Libraries Arduino code functions written by others with functionality that you may want to reuse The AM2302/DHT22 sensor has a library that we can use: https://github.com/adafruit/DHT-sensor- library Useful functions: readHumidity() readTemperature() convertCtoF() convertFtoC() computeHeatIndex()

Arduino Library Download and Install Use the Arduino IDE Library Manager Details: https://www.arduino.cc/en/Guide/Libraries Click on the “Sketch” menu then “Include Library  Manage Libraries”

Arduino Library Manager 2. Select the Library and Click “Install” 1. Search for ”DHT”

Testing the Sensor – “Measurement_Example” Sketch Red  +5V Black  Ground Yellow  Digital Pin 2

How do we turn it into a datalogger? Some things we have to figure out: Debugging Timing Interfacing with sensors and making measurements Recording data to a file

Recording Data to a File The Arduino UNO has no data recording capability You can output to a serial monitor and capture that as a file Requires your computer to be deployed with the Arduino and sensor (not ideal) The answer – add a MicroSD Card Breakout board! MicroSD Card provides GB of storage for files Supports extended deployments

SD Card Library for Arduino Already installed by default Enables reading and writing contents of an SD or MicroSD card Examples of use: https://learn.adafruit.com/adafruit-micro-sd- breakout-board-card-tutorial/library

Some Notes on the MicroSD Cards They are strictly 3.3 volt devices! SD cards are raw storage, but can be formatted with a file system The SD cards in your kit should work with Arduino, Windows, and Mac (but some devices require a specific file system) Don’t format unless you use the “official” formatter from: https://www.sdcard.org/downloads/formatter_3/ FAT32 is a good option for the file system

Micro SD Breakout Wiring Breakout CS --> Arduino Digital Port 10 Breakout DI --> Arduino Digital Port 11 Breakout DO --> Arduino Digital Port 12 Breakout CLK --> Arduino Digital Port 13 Breakout GND --> Arduino GND Breakout 5V --> Arduino 5V

Testing the SD Card – “SD_CardInfo” Sketch Wire up the SD Card breakout Open the “SD_CardInfo” sketch in the IDE Load it onto the Arduino Open your serial monitor Should give you some diagnostic information about your SD Card Useful for testing SD cards

What should our output data file look like? A descriptive header Column headings Comma separated values (CSV)

Create a file and write some data “SD_Write_Example” Sketch Pseudo Code In the setup() function: Open a serial port Initialize the SD card Open a file Write a couple of header lines Close the file In the loop() function Open the file Create a string with random values to write as a line to the file Print the string to the file Delay for 2 seconds

How do we turn it into a datalogger? Some things we have to figure out: Debugging Timing Interfacing with sensors and making measurements Recording data to a file You’ve got all the pieces you need now

It will look something like this…

Summary Interfacing Arduino (and other dataloggers) with sensors may be analog or digital Arduino libraries can be imported into sketches to extent functionality (e.g., for working with sensors) Arduinos can write to external SD storage SD cards provide a ton of space for files Relatively simple library provides functions for creating files, reading files, writing to files You should think carefully about the format of your file in planning for data collection (header, column headings, data structure, etc.)