Go Down

Topic: programming mercury tilt switch (Read 3292 times) previous topic - next topic

liabilityquek

Hi guys, i have just purchase a mecury tilt switch from company ASSEMTECH, can anyone teach me how to program the tilt switch to the arduino board? Should i use digital or analog input? Please help.

AWOL

Digital input, and don't forget to debounce.
(and don't break it open!)
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

cr0sh

Quote
(and don't break it open!)


I'm not sure which I find more amazing: The fact that these switches are still being manufactured "brand new", or that you can get them in Europe!

I was almost convinced the only way to get mercury tilt switches anymore was surplus; I thought the technology had been pretty much phased out due to the environmental concerns of mercury.

As AWOL noted, definitely don't break it! Not that standard mercury metal is extremely toxic; it needs to be either inhaled as a vapor, or be of one of the organic mercury compounds for quick absorption. Still, you don't want it just laying around in the open if you can avoid it, because it will evaporate over time with temperature changes.

It used to be (long ago) the standard way to clean up a mercury spill was to vacuum it up, then close up the bag tight and throw it away, but that obviously won't do today (in fact, I think it can be highly illegal in some areas).

According to the EPA:

http://www.epa.gov/hg/spills/

...for even small spills you're basically hosed. More or less, I would imagine, if this happens to you and you follow such guidelines (or equivalent ones for your country), you're likely to get a large bill later after the cleanup...

:o
I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

retrolefty

Well as a young kid in the 50s I recall us playing with mercury sometimes. We would roll it around in our hands, and it was cool to coat copper pennies with it and turn the pennies silver. No cautions back then and I'm sure it's a health hazard to some degree. But I wonder if the hazards and risks aren't overstated at times. I recall the radon scare a while back, a natural occuring release from soil. Of well different times I guess.

Lefty

Coding Badly


My father worked as a college chemistry professor for about 25 years.  He frequently worked with nasty dangerous chemicals during that time.

While I attended High School, I would often do lab work for him.  One afternoon I was cleaning pipettes for him.  This consisted of sucking a brownish liquid as far into the pipette as I could, setting the pipette aside for about 20 minutes, and then pouring the liquid back into the container.  While waiting, I asked my father what the brown liquid was.  He stated, "chromic acid."  I then asked what would happen if I accidently got some in my mouth while sucking it into the pipette.  He calmly stated, "I probably couldn't get you to the hospital fast enough to save your life.  Don't get any in your mouth."

Years later I was in the lab when my father accidently dropped and broke an old mercury thermometer.  He first ordered my out of the lab.  He then, meticulously found and collected every last drop of mercury.  Later, I asked him why we was so concerned.  He replied, "Any mercury I didn't get picked up will evaporate.  We'll breath it into our bodies where it gets trapped and causes problems for the rest of our lives."

For what it's worth, I played with liquid mercury when I was young.  After those two events, it will never happen again.

liabilityquek

Hi guys, do I have to use the import.processing.serial library since the input is digital? And one more thing, how do I install the processing library into the Arduino IDE? I went to research on link like Arduino playground but still no avail, please help.

PaulS

Quote
Hi guys, do I have to use the import.processing.serial library since the input is digital?

The Processing.serial library is used in Processing, not Arduino.

Quote
And one more thing, how do I install the processing library into the Arduino IDE?

You don't. Processing is a separate application.

cr0sh

Quote
Well as a young kid in the 50s I recall us playing with mercury sometimes. We would roll it around in our hands, and it was cool to coat copper pennies with it and turn the pennies silver. No cautions back then and I'm sure it's a health hazard to some degree.


The biggest risk from metallic mercury (liquid) is the evaporation of it into gas, and the inhaling of that. Still, caution should always be used when around it, of course.

Quote
But I wonder if the hazards and risks aren't overstated at times.


Personally, I think they are. That doesn't mean you shouldn't try to clean up a spill if one happens, nor does it mean you shouldn't be cautious when handling it or a component containing it. But I do think that given all the things that are hazardous to us in our environment, mercury exposure is pretty far down the list. I am sure that our constant exposure to vehicular exhaust, and a host of other environmental contaminants should be of a much greater concern.

Quote
I recall the radon scare a while back, a natural occuring release from soil. Of well different times I guess.


We live in a toxic environment; yes, it was different times, but we shouldn't freak out over tiny things today. None of us leaves the room alive, anyhow...

;)

Quote
While I attended High School, I would often do lab work for him.  One afternoon I was cleaning pipettes for him.  This consisted of sucking a brownish liquid as far into the pipette as I could, setting the pipette aside for about 20 minutes, and then pouring the liquid back into the container.  While waiting, I asked my father what the brown liquid was.  He stated, "chromic acid."  I then asked what would happen if I accidently got some in my mouth while sucking it into the pipette.  He calmly stated, "I probably couldn't get you to the hospital fast enough to save your life.  Don't get any in your mouth."


Do you still speak to dad? Did he tell you to take caution with the cleaning of the pipettes before you started? Was he trying to kill you?

http://en.wikipedia.org/wiki/Chromic_acid
http://www.inchem.org/documents/icsc/icsc/eics1194.htm
http://www.cdc.gov/niosh/npg/npgd0138.html

Seriously - this stuff sounds waaaaaay nastier than mercury (though not quite as bad as hydrofluoric acid!); I'm not even sure you should have had your mouth anywhere near the pipette, to be honest (not too mention - just what was the pipettes used for to need such a thorough cleaning?)...

Quote
Years later I was in the lab when my father accidently dropped and broke an old mercury thermometer.  He first ordered my out of the lab.  He then, meticulously found and collected every last drop of mercury.  Later, I asked him why we was so concerned.  He replied, "Any mercury I didn't get picked up will evaporate.  We'll breath it into our bodies where it gets trapped and causes problems for the rest of our lives."


Seems like your dad had some mixed up priorities: "Sure son, clean those pipettes by sucking up chromic acid into them with your mouth, but if a mercury thermometer breaks - OMGWTFBBQ!!!"...

:P
I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

liabilityquek

PaulS, if I were to write up a program on mecury tilt switches with a digital input, do i use prcocessing or arduino library?

PaulS

The Arduino is programmed using the Arduino iDE.

liabilityquek

PaulS, I would like to the arduino IDE to communicate with Processing, because from what i know, Processing library does have animations to show how the tilt switch is moving.  I want to write a program something similar to this link here :http://webzone.k3.mah.se/projects/arduino-workshop/projects/arduino_meets_processing/instructions/tilt.html.

I got this program from the Arduino Playground; the program is like this:
import processing.serial.*;
import cc.arduino.*;

Arduino arduino;
int ledPin = 13;

void setup()
{
 //println(Arduino.list());
 arduino = new Arduino(this, Arduino.list()[0], 57600);
 arduino.pinMode(ledPin, Arduino.OUTPUT);
}

void draw()
{
 arduino.digitalWrite(ledPin, Arduino.HIGH);
 delay(1000);
 arduino.digitalWrite(ledPin, Arduino.LOW);
 delay(1000);
}

After compiling it, it shows a blank box and a message like this

"Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version   = RXTX-2.1-7"

May I know what does this message and the box represents?

PaulS

Processing shows output generated by the print() and println() commands in the console window. Your program doesn't have any of these statements, so you see only the few lines of output that show that the application is starting.

The other window is where the draw() stuff occurs. You aren't drawing anything, so you get a black box.

You are not reading anything from the mercury switch, either.

liabilityquek

How do I make both Processing PDE interact with the Arduino IDE? I have read up people saying that we need to change the baud rate and the serial port and the Firmdata. Desperately in need of help!

AWOL

The IDE don't interact - they are Development Environments.
Programs on the Arduino and Processing interact.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

WizenedEE

#14
Jan 09, 2011, 09:41 am Last Edit: Jan 09, 2011, 10:01 am by WizenedEE Reason: 1
From what I know about mercury tilt switches, it's impossible to tell the exact tilt - all you know is whether the mercury bead is touching the two leads.

To wire it, attach one side to gnd and the other side to a pin (say pin 8) (also attach an LED to pin 9)

To program it, you need to use the internal pull-up resistor. This makes it so that the pin doesn't get left "floating" when it's not connected, ie make random values. To use it, you'd have a code like this:
Code: [Select]

int tiltPin = 8;
int LEDpin = 9;

void setup() {
 pinMode(tiltPin, INPUT);
 pinMode(LEDpin, OUTPUT);

 digitalWrite(tiltPin, HIGH); //sets internal pull up resistor
}

void loop() {
 digitalWrite(LEDpin, digitalRead(tiltPin)); //turns on LED when the tilt sensor is tilted
}


If you want to have a draw command or something to determine the exact tiltage, you'd need a more advanced tilt sensor - probably a gyroscope or an accelerometer.

Go Up