<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mitchell Starnes &#187; Arduino</title>
	<atom:link href="http://www.pdqweb.net/category/arduino/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pdqweb.net</link>
	<description>Web Technical Consultant</description>
	<lastBuildDate>Sat, 07 Jan 2012 00:56:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Arduino Motion Detector</title>
		<link>http://www.pdqweb.net/arduino-motion-detector/</link>
		<comments>http://www.pdqweb.net/arduino-motion-detector/#comments</comments>
		<pubDate>Sat, 07 Aug 2010 20:43:18 +0000</pubDate>
		<dc:creator>Mitch</dc:creator>
				<category><![CDATA[Arduino]]></category>

		<guid isPermaLink="false">http://www.pdqweb.net/?p=405</guid>
		<description><![CDATA[Parallax&#8217;s Passive Infrared Motion Sensor, #555-28027, is a small board you can easily add to your Arduino project. I put together a sketch using this device together with a 16&#215;2 LCD for the read out. The code is based on two other sketches I found; one for LCD and the other for processing the input [...]]]></description>
			<content:encoded><![CDATA[	<p><div id="attachment_409" class="wp-caption alignleft" style="width: 310px"><a href="http://www.pdqweb.net/wp-content/uploads/IMG00045-20100807-1544.jpg"><img class="size-medium wp-image-409 " title="Arduino Motion Detector" src="http://www.pdqweb.net/wp-content/uploads/IMG00045-20100807-1544-300x225.jpg" alt="Using Parallax Passive Infrared Motion Sensor #555-28027" width="300" height="225" /></a><p class="wp-caption-text">Arduino Motion Detector Using Parallax Passive Infrared Motion Sensor #555-28027</p></div></p>
	<p>Parallax&#8217;s Passive Infrared Motion Sensor, #555-28027, is a small board you can easily add to your Arduino project. I put together a sketch using this device together with a 16&#215;2 LCD for the read out. The code is based on two other sketches I found; one for LCD and the other for processing the input from the sensor.</p>
	<p>The circuit is powered by 3.3V on the Arduino.</p>
	<p>This code prints an alert along with the hours, minutes, and seconds since initialization on the LCD. It also prints out to the serial port/USB that you can read from your computer if you don&#8217;t have an LCD.</p>
	<p><span id="more-405"></span></p>
	<pre>#include
	
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
	
/////////////////////////////
//VARS
//the time we give the sensor to calibrate (10-60 secs according to the datasheet)
unsigned int calibrationTime = 30;
unsigned long current_millis_value = 0;
unsigned long previous_millis_value = calibrationTime * 1000;
unsigned long m = 0;
unsigned int seconds = 0;
unsigned int minutes = 0;
unsigned int hours = 0;
char msg[32];
	
//the time when the sensor outputs a low impulse
long unsigned int lowIn;         
	
//the amount of milliseconds the sensor has to be low
//before we assume all motion has stopped
long unsigned int pause = 5000;  
	
boolean lockLow = true;
boolean takeLowTime;  
	
int pirPin = 10;    //the digital pin connected to the PIR sensor's output
int ledPin = 13;
	
/////////////////////////////
//SETUP
void setup(){
  Serial.begin(9600);
  lcd.begin(16,2);
  pinMode(pirPin, INPUT);
  pinMode(ledPin, OUTPUT);
  digitalWrite(pirPin, LOW);
	
  //give the sensor some time to calibrate
  Serial.print(\"calibrating sensor \");
  lcd.print(\"calibrating sensor \");
  for(int i = calibrationTime; i &gt; 0; i--){
    lcd.clear();
    lcd.print(i);
    Serial.print(\".\");
    delay(1000);
  }
  Serial.println(\" done\");
  lcd.clear();
  lcd.print(\"Ready\");
  Serial.println(\"SENSOR ACTIVE\");
  delay(50);
}
	
void loop(){
	
  current_millis_value = millis();
  m += current_millis_value - previous_millis_value;
  seconds += m / 1000;
  m = m % 1000;
  minutes += seconds / 60;
  seconds = seconds % 60;
  hours += minutes / 60;
  minutes = minutes % 60;
  hours = hours % 24;
  previous_millis_value = current_millis_value;
	
  if(digitalRead(pirPin) == HIGH){
    digitalWrite(ledPin, HIGH);   //the led visualizes the sensors output pin state
    if(lockLow){
      //makes sure we wait for a transition to LOW before any further output is made:
      lockLow = false;
      Serial.println(\"---\");
      Serial.print(\"Motion detected at \");
      Serial.print(millis()/1000);
      Serial.println(\" sec\");
      lcd.clear();
      lcd.setCursor(0, 0);
      sprintf(msg,\"%d:%02d:%02d %s\", hours, minutes, seconds, \"Alert!\");
      //sprintf(msg,\"%s%d%s\", \"Alert at \", (millis() - pause)/1000, \" sec\");
      lcd.print(msg);
      delay(50);
    }
    takeLowTime = true;
  }
	
  if(digitalRead(pirPin) == LOW){
    digitalWrite(ledPin, LOW);  //the led visualizes the sensors output pin state
	
    if(takeLowTime){
      lowIn = millis();    //save the time of the transition from high to LOW
      takeLowTime = false;    //make sure this is only done at the start of a LOW phase
    }
    //if the sensor is low for more than the given pause,
    //we assume that no more motion is going to happen
    if(!lockLow &amp;&amp; millis() - lowIn &gt; pause){
      //makes sure this block of code is only executed again after
      //a new motion sequence has been detected
      lockLow = true;
      Serial.print(\"motion ended at \");   //output
      Serial.print((millis() - pause)/1000);
      Serial.println(\" sec\");
      lcd.clear();
      lcd.setCursor(0, 1);
      sprintf(msg,\"%2d:%02d:%02d %s\", hours, minutes, seconds, \"Reset\");
      //sprintf(msg,\"%s%d%s\", \"Reset at \", (millis() - pause)/1000, \" sec\");
      lcd.print(msg);
      delay(50);
    }
  }
}</pre>
	<p>To put the project together, I used the following components:</p>
	<ul>
	<li>Breadboard</li>
	<li>Parallax Passive Infrared Motion Sensor, #555-28027</li>
	<li>10K Pot</li>
	<li>NMTC-S16205DRGHS Gray Reflective Microtips LCD Character Display Module (16&#215;2)</li>
	<li>Arduino Duemilanove</li>
	</ul>
	<p>Connections:</p>
	<ol>
	<li>Arduino 3V to Breadboard +</li>
	<li>Arduino GND to Breadboard GND</li>
	<li>Parallax Motion Sensor + to Breadboard +</li>
	<li>Parallax Motion Sensor GND to Breadboard GND</li>
	<li>Parallax Motion Sensor Data to Arduino Pin 10</li>
	<li>10k Potentiometer legs to Breadboard GND and Breadboard +</li>
	<li>LCD Pin 1 to Breadboard GND</li>
	<li>LCD Pin 2 to Breadboard +</li>
	<li>LCD Pin 3 to 10k Pot Wiper (center)</li>
	<li>LCD Pin 4 to Arduino Pin 12</li>
	<li>LCD Pin 5 to Breadboard GND</li>
	<li>LCD Pin 6 to Arduino Pin 11</li>
	<li>LCD Pin 11 to Arduino Pin 5</li>
	<li>LCD Pin 12 to Arduino Pin 6</li>
	<li>LCD Pin 13 to Arduino Pin 7</li>
	<li>LCD Pin 14 to Arduino Pin 8</li>
	</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.pdqweb.net/arduino-motion-detector/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Arduino LCD Thermometer</title>
		<link>http://www.pdqweb.net/arduino-lcd-thermometer/</link>
		<comments>http://www.pdqweb.net/arduino-lcd-thermometer/#comments</comments>
		<pubDate>Sat, 07 Aug 2010 15:13:09 +0000</pubDate>
		<dc:creator>Mitch</dc:creator>
				<category><![CDATA[Arduino]]></category>

		<guid isPermaLink="false">http://www.pdqweb.net/?p=387</guid>
		<description><![CDATA[The Dallas DS1822+ is a tiny little IC in a typical transistor package that can be used for temperature readings. I put together a simple little sketch using this device together with a 16&#215;2 LCD for the read out. The code is based on two other sketches I found; one for LCD and the other [...]]]></description>
			<content:encoded><![CDATA[	<p><div id="attachment_413" class="wp-caption alignleft" style="width: 310px"><a href="http://www.pdqweb.net/wp-content/uploads/IMG00043-20100807-10092.jpg"><img class="size-medium wp-image-413" title="Arduino LCD Thermometer" src="http://www.pdqweb.net/wp-content/uploads/IMG00043-20100807-10092-300x225.jpg" alt="Arduino LCD Thermometer Using Dallas DS1822+" width="300" height="225" /></a><p class="wp-caption-text">Arduino LCD Thermometer Using Dallas DS1822+</p></div></p>
	<p>The Dallas DS1822+ is a tiny little IC in a typical transistor package that can be used for temperature readings. I put together a simple little sketch using this device together with a 16&#215;2 LCD for the read out. The code is based on two other sketches I found; one for LCD and the other for reading temperatures with the Dallas 1822+.</p>
	<p>It is powered by 5V via USB. I had to use both the 3V and 5V outputs of the Arduino to power the Dallas DS1822+ and the LCD simultaneously. The LCD wouldn&#8217;t work when I tried to power it on the same 5V as the IC. Does anyone know how to make them work together? This is one of my first Arduino projects and I&#8217;m just thinking the circuits I can combine is limited if they all need separate power supplies.</p>
	<p>This code prints the temperature only when it changes. It prints to the serial port that you can read from your computer if hooked up and it prints to the LCD.</p>
	<p><span id="more-387"></span></p>
	<pre>#include
	
#include
long temp_old = 0;
	
DallasTemperature tempSensor;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
	
void setup(void) {
  lcd.begin(16, 2);
  Serial.begin(9600);
  tempSensor.begin(10);
  Serial.println(\"LCD Thermometer by M. Starnes and the Arduino Community\");
}
	
void loop(void) {
  // Ask the library whether the device is valid
  switch(tempSensor.isValid())
  {
    case 1:
      Serial.println(\"Invalid CRC\");
      tempSensor.reset();
      return;
    case 2:
      Serial.println(\"Not a valid device\");
      tempSensor.reset();
      return;
  }
	
  long temp = DallasTemperature::toFahrenheit(tempSensor.getTemperature());
  // update only if the temperature has changed
  if( abs(long(temp)) != abs(long(temp_old)) ) {
    Serial.print(temp);
    Serial.print(\"F\");
    lcd.setCursor(0, 1);
    lcd.print(temp);
    lcd.print(\"F\");
    temp_old = temp;
    Serial.println();
  }
}</pre>
	<p>To put the project together, I used the following components:</p>
	<ul>
	<li>Breadboard</li>
	<li>Dallas DS1822+ IC Thermometer (board mount)</li>
	<li>4.7K resistor</li>
	<li>10K Pot</li>
	<li>NMTC-S16205DRGHS Gray Reflective Microtips LCD Character Display Module (16&#215;2)</li>
	<li>Arduino Duemilanove</li>
	</ul>
	<p>Connections:</p>
	<ol>
	<li>Arduino 3V to Breadboard +</li>
	<li>Arduino GND to Breadboard GND</li>
	<li>Arduino 5V to DS1822+ VDD</li>
	<li>DS1822+ to 4.7k resistor</li>
	<li>4.7k  Resistor to DS1822+ Data pin</li>
	<li>DS1822+ GND to Breadboard GND</li>
	<li>DS1882+ Data pin to Arduino Pin 10</li>
	<li>10k Potentiometer legs to Breadboard GND and Breadboard +</li>
	<li>LCD Pin 1 to Breadboard GND</li>
	<li>LCD Pin 2 to Breadboard +</li>
	<li>LCD Pin 3 to 10k Pot Wiper (center)</li>
	<li>LCD Pin 4 to Arduino Pin 12</li>
	<li>LCD Pin 5 to Breadboard GND</li>
	<li>LCD Pin 6 to Arduino Pin 11</li>
	<li>LCD Pin 11 to Arduino Pin 5</li>
	<li>LCD Pin 12 to Arduino Pin 6</li>
	<li>LCD Pin 13 to Arduino Pin 7</li>
	<li>LCD Pin 14 to Arduino Pin 8</li>
	</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.pdqweb.net/arduino-lcd-thermometer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

