Thursday, October 24, 2013

Halloween Prank

https://github.com/jacobantoun/Halloween-Fun

Here's a little Halloween prank you can play on someone! What this is it's a little container of some sort and when a door opens, a spider will drop down and scare whoever walks through the door!

How it works is by using a Sonic distance sensor to detect when the door is opened, and when the door gets opened it uses a servo to slide open the lid to have the spider drop out!

So far I only have the prototype completed, using a toilet paper roll as the container and a cut up post card for the lid. It's really pretty easy and I can't wait to try it out on some unsuspecting people!

So what you need is:
Arduino
Servo
Sonic Sensor (I'm using the HC-SR04)
Hot glue gun or any type of glue
Wires
Container
Lid

I created a Fritzing image for the first time ever to show you how it's all connected.
The code for the project can be found on my github, along with all of my other projects I've made so far.

Now here's my prototype of this project! (I don't have a fake spider and I haven't mounted this anywhere fancy yet, except underneath my desk.)









Wednesday, October 23, 2013

How to use the Parallax QTI line sensor with Arduino

The code for the line sensors can be found at https://github.com/jacobantoun


I spent a lot of time reading up on line sensors and ended up having a lot of trouble finding code for 'line sensors'. I found out that sensors that I have are called QTI Sensors, which stands for Charge Transfer Infrared. I won't go into too much detail about that because I don't really understand what it all means. I got a lot of help using these line sensors from http://learn.parallax.com/KickStart/555-27401, which explains what the whole QTI thing is a lot better than what I probably could.

After reading more online I found out that you can read from these sensors in two different ways. analogRead or using an RCTime function that is duplicated from the Basic Stamp. It can be used to read the resistive sensors, line the QTI sensor. It reads the charge across the capacitor.

NOTICE: The wiring for these are a bit odd. It's not standard with it being Ground Power Signal (Black, Red, White) on the three wires. It's Ground Signal Power.


On github, I posted two files. One file using the sensor as an analog input, and another file using the RCTime function. I haven't noticed a huge difference in performance when comparing the two outputs, except the code for the analog input is shorter and I personally think it's a bit easier to understand.

But anyways, the parts needed for this are:
Arduino
BreadBoard
Wires
QTI Sensor/Line Sensor (Data Sheet for linesensorand this is the actual product)

If you go to my github you can download all the code you need to use these. Look under the QTISensor repository.
https://github.com/jacobantoun

Here's some pictures of just the wiring and whatever else.
 The 'face' of the line sensor

 the back of the line sensor

 How it's wired. The yellow wire is going to pin 5, and the purple wire is used as an LED indicator.


Sunday, October 20, 2013

How To Use The LM335Z Temperature Sensor With An Arduino

Parts needed:
LM335Z temperature sensor
1K ohm resistor (brown, black, red)
Breadboard
Some wire

I had a little trouble finding code for this temperature sensor online, but ended up getting enough pieces together to finally get it working.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//Sketch created by Jacob Antoun
//10/20/13
//
//Wiring Info:
//Nothing is connected on the collector
//Analog Pin 3 is connected to the Base
//1K ohm resistor is connected to the Base, after the AnalogPin
//Ground is connected to the Emitter
//

#define tempSensor A0 //Puts the LM355Z temperature sensor on anolog pin 0

const float miniVoltsToKelvin = 0.004882812 * 100; //found this online, I don't remember the source :(

void setup() {
  Serial.begin(9600); //initialize the serial monitor
}

void loop() {
  float kelvin;
  float fahr;
  kelvin = analogRead(tempSensor) * miniVoltsToKelvin; //converts the reading from the arduino into kelvin
  fahr = 1.8 * (kelvin - 273) + 32; //converts the kelvin to fahrenheit
  Serial.print(fahr); //prints to the serial monitor
  Serial.print(" degrees");
  Serial.println();
  delay(1000);
}

If you want a copy of the code, and to see other projects I'm working on, look at my GitHub.
https://github.com/jacobantoun/LM335Z

Below are just two images that show the wiring of the temp sensor


Just showing the wiring of it on a breadboard

Notice how nothing is connected to the collector, and look at the placement of the analog pin and resistor.