Diannamertz (talk | contribs) mNo edit summary |
Diannamertz (talk | contribs) mNo edit summary |
||
Line 21: | Line 21: | ||
Short range (3 - 40 cm) infrared sensor fixed to container lid, container with flour, Arduino, computer, mobile device<br><br><br> | Short range (3 - 40 cm) infrared sensor fixed to container lid, container with flour, Arduino, computer, mobile device<br><br><br> | ||
http://indepth.imorrison.webfactional.com/web/presentation/thumbs/Picture_0_thumb.jpg<br> | http://indepth.imorrison.webfactional.com/web/presentation/thumbs/Picture_0_thumb.jpg<br> | ||
Short-range (3 - 40 cm) Infrared | Short-range (3 - 40 cm) Infrared Sensor and Arduino<br><br><br> | ||
http://indepth.imorrison.webfactional.com/web/presentation/thumbs/Picture_2_thumb.jpg<br> | http://indepth.imorrison.webfactional.com/web/presentation/thumbs/Picture_2_thumb.jpg<br> | ||
Shot of Arduino and Processing running with on-screen visualizer<br><br><br><br> | Shot of Arduino and Processing running with on-screen visualizer<br><br><br><br> | ||
http://indepth.imorrison.webfactional.com/web/presentation/thumbs/Picture_3_thumb.jpg<br> | http://indepth.imorrison.webfactional.com/web/presentation/thumbs/Picture_3_thumb.jpg<br> | ||
Shot of Arduino and Processing stopped and .tsv file opened to display the data produced<br><br><br> | Shot of Arduino and Processing stopped and .tsv file opened to display the data produced<br><br><br> | ||
http://indepth.imorrison.webfactional.com/web/presentation/thumbs/Picture_4_thumb.jpg | http://indepth.imorrison.webfactional.com/web/presentation/thumbs/Picture_4_thumb.jpg | ||
http://indepth.imorrison.webfactional.com/web/presentation/thumbs/Picture_5_thumb.jpg | http://indepth.imorrison.webfactional.com/web/presentation/thumbs/Picture_5_thumb.jpg | ||
Line 39: | Line 37: | ||
<videoflash type=vimeo>36023409</videoflash><br> | <videoflash type=vimeo>36023409</videoflash><br> | ||
On-screen visualization of the infrared sensor monitoring the level of the container contents.<br> | On-screen visualization of the infrared sensor monitoring the level of the container contents.<br> | ||
<videoflash type=vimeo> | <videoflash type=vimeo>36032905</videoflash><br> | ||
Demo of the mobile app prototype. | Demo of the mobile app prototype. | ||
Revision as of 18:40, 1 February 2012
In-Depth: Smart Containers
Concept
Question: Is there enough flour and sugar at home to make a cake for your friend's birthday tomorrow? Or do you need to stop at the store on your way home?
Solution: Smart containers for your pantry — this way all you need to do is check your mobile device and you can see exactly how much flour and sugar you have at home. No need for unnecessary purchases or stops on the way home.
Prototype
Equipment
- Arduino
- Sharp GP2D120XJ00F Analog Infrared Distance Sensor 4-30cm
- Container
- Computer
- Mobile Device
Gallery
Short range (3 - 40 cm) infrared sensor fixed to container lid, container with flour, Arduino, computer, mobile device
Short-range (3 - 40 cm) Infrared Sensor and Arduino
Shot of Arduino and Processing running with on-screen visualizer
Shot of Arduino and Processing stopped and .tsv file opened to display the data produced
In-Depth mobile device screen shots (vertical)
In-Depth mobile device content levels visualizer (horizontal)
Videos
<videoflash type=vimeo>36023409</videoflash>
On-screen visualization of the infrared sensor monitoring the level of the container contents.
<videoflash type=vimeo>36032905</videoflash>
Demo of the mobile app prototype.
Web
In-Depth: Smart Containers web site -- optimized for mobile device
Code
Arduino
int sensePin = 1; // infrared sensor to analog pin
int value; // value coming from the sensor
void setup() {
Serial.begin(9600); // start the serial port
}
void loop() {
int value = analogRead(sensePin); // current value of the sensor
byte scaledVal = map(value, 0, 600, 0, 255); // rescale to send as one byte
Serial.write(scaledVal); //print the distance
delay(100); // arbitrary wait time
}
Processing
Serial myPort; // variable for the serial
import processing.serial.*; // reads information coming in through the server via Arduino
int incomingVal; // incoming number value
int r; // example
int b; // example
int q; // example
int o; // example
void setup(){
size(255,255); // visualization window size
myPort = new Serial(this,"/dev/tty.usbmodem411",9600); // my Arduino port
}
void draw(){
background(0); // background black for visualization
while(myPort.available() > 0){
incomingVal = myPort.read(); // while new data coming in from Arduino, store in variable
}
float reVal =map(incomingVal, 51, 255, 0, 255); // rescale the incoming value to the depth of the container
fill(reVal); // fill the visualization with the rescaled incoming value
rect(0,height - reVal,width,height); // draws rectangle of the incoming value
println("Flour:" +(reVal)+ " Sugar:" + r+ " Oats:" + b+ " Pasta:" + q+ " Millet" + o ); // incoming value to be seen in console
PrintWriter output = createWriter("data/data.tsv"); // send info to external file
output.println("Flour:" +(reVal)+ " Sugar:" + r+ " Oats:" + b+ " Pasta:" + q+ " Millet:" + o ); // directs which information to be written to new file
output.flush(); // write the info
}
PHP
(Gets the data from an automatically uploaded file from desktop)
<?php
$file_handle = fopen("data.tsv", "r");
while (!feof($file_handle)) {
$line = fgets($file_handle);
echo $line;
}
fclose($file_handle);
?>
Final Product Design
(Forthcoming)
References
The Internet of Things Infographic
Reference for Sharp GP2D120XJ00F Analog Distance Sensor 4-30cm
Arduino – Using a Sharp IR Sensor for Distance Calculation
Frederic Gmeiner's Potentiometer Code
The Right Way to Read Files with PHP
Sencha Touch Charts
iPhone 4 PSD template