Posts Tagged Home
My Arduino & XBee Parts
Posted by Will Eatherton in Uncategorized on May 24th, 2009
My equipment bought 1st half of May 2009 :
From nkcelectronics :
Name Code Qty Each Options
—————————————————————
Arduino Duemilanove ARD-0020 1 29.45
XBee Explorer USB XBE-0002 1 19.95
Character LCD Module 20×4 LCD-0016 1 15.99 Blue
Wall Adapter Power Supply PRO-0011 1 5.95 - 9VDC 650mA
Solderless Breadboard PRO-0003 1 9.99
Jumper Wire Kit
From Sparkfun :
Status Product Qty Total
————————————————————————————————————-
Item in Box COM-00528 Super Bright LED - Red - 10,000mcd 2 $1.90
Item in Box COM-00530 Super Bright LED - Yellow - 10,000mcd 2 $1.90
Item in Box COM-08285 Super Bright LED - Green - 10,000mcd 2 $1.90
Item in Box PRT-00112 Basic Breadboard 1 $11.95
Item in Box DEV-09063 Arduino XBee Shield Empty 1 $24.95
Item in Box WRL-08691 XBee 2mW Series 2.5 Chip Antenna 2 $51.90
Item in Box COM-00097 Mini Push Button Switch 4 $1.40
Item in Box SEN-08630 PIR Motion Sensor 1 $9.95
To Buy
MOSFET like the IRF520 (NEED TO GET THIS FROM RADIO SHACK !!)
Light sensor
0.1” male headers
any general resistor/capactior packs ? what about online ?
My Arduino Experiments
Posted by Will Eatherton in Uncategorized on May 24th, 2009
1) Did Blinking LED Experiment from ARduino Book, last weekend : May17th 2009
Below are notes from the book on Arduino :
——————————————————————

#define LED 13 // LED connected to
// digital pin 13
void setup()
{
pinMode(LED, OUTPUT); // sets the digital
// pin as output
}
void loop()
{
digitalWrite(LED, HIGH); // turns the LED on
delay(1000); // waits for a second
digitalWrite(LED, LOW); // turns the LED off
delay(1000); // waits for a second
}
——————————————————————
* With kids we changed the delay and watched the blinking go very fast (as we go into 10 miliseconds still blinked even though eye can’t see more then like 30 Hz right ?
2) Next experiment using say PIR sensor instead of light sensor
See : PIR Motion Sensor Research
Using PIR from sparkfun : SEN-08630
Experiments run on May 24th,2009
I tried to use instructions from : http://itp.nyu.edu/physcomp/sensors/Reports/PIRMotionSensor


minor modifications for newer Arudino board and changed my setup slightly.
// example for the PIR motion sensor SE-10
int timer = 500;
int alarmPin = 1;
int alarmValue = 1;
int ledPin = 13;
void setup () {
Serial.begin (9600);
pinMode(ledPin, OUTPUT);
pinMode(alarmPin, INPUT);
delay (2000); // it takes the sensor 2 seconds to scan the area around it before it can detect infrared presence.
}
void loop ()
{
alarmValue = analogRead(alarmPin);
if (alarmValue < 100)
{
blinky(); // blinks when the motion has been detected, just for confirmation.
}
delay(timer);
Serial.println (alarmValue);
delay (10);
}
void blinky() {
for(int i=0; i<3; i++) {
digitalWrite(13,HIGH);
delay(200);
digitalWrite(13,LOW);
delay(200);
}
}
Was not happy with results !! Though it was cool to see sensor data coming out of the Arduino into the ‘Serial Monitor’ screen of the Arduino IDE for the first time
Example data results when not moving

* When I waved my hands no real change (300’s)
* When I put my hand onto the PIR senseor it goes up to ~1000, then will drop to <20, and then will call the blinky function
* I think that I need 12V rail is my guess based on comment in forum that with 12V more sensistive
— don’t have any easy/great ways to get 12V DC onto my breadboard
– searching web pages
* woudl it help to remove plastic casing ?
There is some code on web to do calibration for a parallax sensor, given how little my readins vary unless I touch the sensor seems like it would not be useful.
– http://www.arduino.cc/playground/Code/PIRsense
– there is note in forums for this code that with parallalx it takes minute for sensor to calibrate, and any movement will disrupt, I will try to be calm first
* At this point I took pictures of the setup, and plan to put it aside
– now I realize good photos of electronics setups that will be useful to me later is not easy (using a simple canon point and shoot), why does everything have to be hard !!
* Scouring internet for all references to this PIR device, finally found one that sounds similar to my issue
– http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1236875530
– “But I can’t get any output from it. If I plug it in analog port I get a constant output from 300 to 500 but it doesn’t change with motion.”
** Ok so I did visual inspection of my wiring on the breadboard and found mistake ! I did not have the Brown (ground) wire of the PIR sensor connected to the ground on the BB (which is connected to ground on the Ardunino)
– boy it has been a while since I have done debugging like this, very sad, somehow in my head when I wired up I though (easy) and I visualized 2 wires in adjacent rows of BB were connected (which they are not)
* now when I turn on the program the readings bounce from 20-60 regardless of what I am doing and the blinking from the software (for trigger) is continous !!
– so I flipped the issue onto it’s head
* ok visually debugging again
– no issues
* one theory now is I somehow burnt out the PIR sensor ?
* am getting out DMM to look at if voltages are correct
* Hmm when I check voltage there is 200mV on BB rails, ok time to start at square one
- coming out of Ardunino power rails seeing 5V - check
–
* BTW I need me some alligator clips
– very sorry I threw away electronics box sometime in past 15 years since college, had some cool stuff
* Ok at this point I am giving up on PIR (maybe burn out ?)

3) Next try turning the little toy motor I have
Ok based on below
From Arduino Book :
——————————————————————
Each one of the pins on an Arduino board can be used to power devices that use up to 20
milliamps: this is a very small amount of current, just enough to drive an LED. If you try
to drive something like a motor, the pin will immediately stop working, and could
potentially burn out the whole processor. To drive bigger loads like motors or incandescent
lamps, we need to use an external component that can switch such things on and off and
that is driven by an Arduino pin. One such device is called a MOSFET transistor—ignore
the funny name—it’s an electronic switch that can be driven by applying a voltage to one
of its three pins, each of which is called a gate. It is something like the light switch that we
use at home, where the action of a finger turning the light on and off is replaced by a pin
on the Arduino board sending voltage to the gate of the MOSFET.
In Figure 5-7, you can see how you would use a MOSFET like the IRF520 (NEED TO GET THIS FROM RADIO SHACK !!) to turn on and
off a small motor attached to a fan. You will also notice that the motor takes its power
supply from the 9 V connector on the Arduino board. This is another benefit of the
MOSFET: it allows us to drive devices whose power supply differs from the one used by
Arduino. As the MOSFET is connected to pin 9, we can also use analogWrite() to control
the speed of the motor through PWM.
——————————————————————
Ok used DC motor from toy, 10k resistor and BB from circuit above
Program (trying to keep it simple) was :
int value = 0; // variable to keep the actual value
int ledpin = 9; // light connected to digital pin 9
void setup()
{
// nothing for setup
}
void loop()
{
analogWrite(ledpin, 1023);
}
Trying to use DMM not working out well
– overall I need better way to debug BB (alligator clips e.g.)

5) Try out xbee simple
What to try ? toggling of led from laptop ? See how far away you can move ?
6) try out xbee + LCD + Arduino
Missing parts ?
(2) 1N4004 diodes
40-pin Male Header to expose LCD pins
![]()
http://rapplogic.blogspot.com/2009/05/arduino-xbee-portal.html