sensors and journalism seminar, university of british columbia - day 1
TRANSCRIPT
![Page 1: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/1.jpg)
sensors & journalism
two-day seminar for University of BCmasters of journalism students
Day 1: Feb 27, 2015by Fergus Pitt - @fergle
![Page 2: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/2.jpg)
me, you, & our two days…
(there’s a prize for the first person to see the glengarry glen ross reference...)
![Page 3: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/3.jpg)
why sense?
![Page 4: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/4.jpg)
why sense?
precise & comparable
vs
anecdotal & impressionistic
![Page 5: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/5.jpg)
why sense?
robot reporting:
remain in place…
dirty, denied, dangerous…
detect what humans can’t*
![Page 6: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/6.jpg)
why sense?
data in journalism
technical skills in newsrooms*
*mind the gap!
![Page 7: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/7.jpg)
why sense?
sensors everywhere
technology boom
electronics ecosystem
![Page 8: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/8.jpg)
why not?
complicated
expensive
not journalists’ core competencies
![Page 9: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/9.jpg)
characteristics(a language)
…of your whole process
![Page 10: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/10.jpg)
characteristics
precision,accuracy,resolution,maturity,range,linearity,distance,
directness,sensitivity,insensitivity to interference,autonomy,ownership…
![Page 11: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/11.jpg)
sensing typology
mobile,wearable,diy communal,expert,in-place,custom journalist,hybrid…
*thanks Lily Bui. @dangerbui
![Page 12: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/12.jpg)
forms of journalisminvestigative,accountability,illustrative,explanatory,participatory,profile,trend,breaking news,
*neither complete or mutually exclusive
![Page 13: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/13.jpg)
Case: USA Today
What were they trying to prove?What types of stories were these?What was their sensing process?How did they check their conclusions?What could sensors do that other reporting couldn’t?What were they comparing their data to?
Use our language from previous session.
![Page 14: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/14.jpg)
Case: Public Lab
What were they trying to prove?What types of stories were these?What was their sensing process?How did they check their conclusions?What could sensors do that other reporting couldn’t?What were they comparing their data to?
Use our language from previous session.
![Page 15: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/15.jpg)
Sensor Prototyping
![Page 16: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/16.jpg)
Sensor Prototyping
temperature & humidity
audio level
![Page 17: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/17.jpg)
Sensor Prototyping
background on Arduino
![Page 18: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/18.jpg)
Sensor Prototyping
![Page 19: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/19.jpg)
Sensor Prototyping
this is not…soldering, raspberry pi, factory PCB, calibrated
all of which are awesome directions
for future study
![Page 20: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/20.jpg)
Electronics 100.5
power,ground,signal.
(do go and learn more…)
![Page 21: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/21.jpg)
your parts
Arduino uno & solder-less breadboardhumidity & tempmicrophone3 x power wire (red)3 x ground wires (black)2 x output wires (some other color)1 x resistor usb cable (old skool: usb1)
a bunch of other components for y’all to play with later
![Page 22: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/22.jpg)
![Page 23: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/23.jpg)
![Page 24: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/24.jpg)
![Page 25: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/25.jpg)
basic arduino structure
1) initialize program2) setup the process3) loop the process
(can also build functions)
http://bit.ly/UBCMote
![Page 26: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/26.jpg)
arduino code#include "DHT.h" //import the library#define DHTPIN 2 // what pin we've connected the sensor data output to: Number "2" in the digital side.#define DHTTYPE DHT11 // DHT 11. If you have the wrong sensor defined, you'll see crazy big reading.DHT dht(DHTPIN, DHTTYPE);
a bunch of other components for y’all to play with later
![Page 27: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/27.jpg)
arduino code: initno need to type the grey or blue stuff.
#include "DHT.h" //import the library#define DHTPIN 2 // what pin we've connected the sensor data output to: Number "2" in the digital side.#define DHTTYPE DHT11 // DHT 11. If you have the wrong sensor defined, you'll see crazy big reading.DHT dht(DHTPIN, DHTTYPE);
const int sampleWindow = 50; // Sample window width in mS (50 mS = 20Hz)unsigned int sample; //we're making a *positive* number variable
a bunch of other components for y’all to play with later
12
3
4567
8
![Page 28: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/28.jpg)
arduino code: setupyou don’t need to type the grey stuff.
void setup() {// this is the startup sequence for the arduino code. Serial.begin(9600); //open data connection at 9600bds
// Serial.println("DHT testing"); //uncomment this on if we wanted to give a "hello world".dht.begin(); // calls a library function for the temp/humidity
} //Don’t forget the curly brace to close the setup!!
a bunch of other components for y’all to play with later
9
10111213
14
1617181920
![Page 29: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/29.jpg)
arduino code: loop
void loop() { //this is where we’re going to put our code
} // don’t forget this curly brace!!
a bunch of other components for y’all to play with later
21
22
![Page 30: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/30.jpg)
arduino code: loop
void loop() {//The loop we opened earlierunsigned long startMillis=millis();//define the start of the sample windowunsigned int peakToPeak =0;// a container for the level between peaksunsigned int signalMax = 0; //this is because an unsigned int will go up
to 0 then roll over unsigned int signalMin = 1024;
} // don’t forget this curly brace. We’ll have to keep moving it down
sound level sketch by adafruit.
2122
23
24
25262728
![Page 31: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/31.jpg)
arduino code: loopfurther down…
while(millis()-startMillis<sampleWindow){sample=analogRead(0);if(sample<1024){ // LOOK AT THIS, We're making decisions about
getting rid of some data, based on an expectation of what the sensor "should" produce
if(sample>signalMax){signalMax=sample; //save just the max level
}else if (sample<signalMin){signalMin=sample; //save just the minimum level
}}
}
} // still inside that curly brace, you’ve already typed
282930
3132333435
363738394041
sound level sketch by adafruit.
![Page 32: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/32.jpg)
arduino code: loopfurther down still…
peakToPeak=signalMax-signalMin; // max - min = peak-peak amplitudefloat current = (peakToPeak * 3.3) / 10.24; // convert to volts (And
multiply by ten to display more precision)// Serial.print("Noise level:"); //comment these out so we can get a csvSerial.print(current);Serial.print(",");// Serial.print("\n"); //Take these out so we can get a csvdelay(1000); // wait for a second (1000 milliseconds)} // still inside that curly brace, you’ve already typed
40
41
42
434445
4647
sound level sketch by adafruit.
![Page 33: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/33.jpg)
arduino codesave, compile and upload
save your file: “UBCMoteV1.ino”connect your to the arduino via usb
tools>board>arduino unotools>serial>****usb.modem*** or similar.
sketch>verify/compile: OK?file>upload: ta-da!!! (right?)
![Page 34: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/34.jpg)
arduino code
ok then… let’s debug.
![Page 35: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/35.jpg)
arduino codelet’s add in the temp and humidity.
![Page 36: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/36.jpg)
![Page 37: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/37.jpg)
arduino code: loopfurther down and still inside that brace }we’ll leave the delay() with the brace
float h = dht.readHumidity(); //call a function from the DHT sensor library, assign the output to a variable "h" (which is a float: a number with the decimal point anywhere it needs to be.)float t = dht.readTemperature(); // same idea as above, just calling a
different function.// float f = dht.readTemperature(true); // call the temp function, but pass
an "argument" which says give me the number in fahrenheit (because America)
delay(1000); // wait for a second (1000 milliseconds)} // our old friend, the last curly brace.
47
48
49
5051
sound level sketch by adafruit.
![Page 38: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/38.jpg)
arduino code: loopfurther down and still inside that brace }
// Check if any reads failed (by checking for NaN: Not a number) and exit early (to try again).if (isnan(h) || isnan(t)) {Serial.println("Failed to read from DHT sensor!,.,"); //Tell us something
went wrongreturn;
}
delay(1000);} // “ABC”: Always Be Closing …(with the last curly
brace).
50
5152
5354555657
sound level sketch by adafruit.
![Page 39: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/39.jpg)
arduino code: loopfurther down and still inside that brace }
Serial.print(h);Serial.print(",");Serial.print(t);Serial.print("\n");// Temp and humidity looped code ends.
delay(1000); //hold it for a second (1000 miliseconds)} // the end.
575859606162636465
sound level sketch by adafruit.
![Page 40: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/40.jpg)
add in Processing
for logging
![Page 41: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/41.jpg)
Sensor Prototyping
![Page 42: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/42.jpg)
add in Processing
download .pde file from github:
http://bit.ly/UBCCapture
(Might need to edit the 15th line. The [2].)
![Page 43: Sensors and Journalism Seminar, University of British Columbia - Day 1](https://reader034.vdocuments.mx/reader034/viewer/2022042701/55aba9c81a28ab4f5e8b45f8/html5/thumbnails/43.jpg)
More maker resources
http://stackexchange.com/ http://postscapes.com/internet-of-things-hardware https://www.adafruit.com/ https://www.sparkfun.com/ http://www.makerlabs.com/ http://arduino.stackexchange.com/