Go Down

Topic: Reading Voltage from my body? (Read 2499 times) previous topic - next topic


Apr 27, 2013, 05:34 am Last Edit: Apr 27, 2013, 06:43 am by wretrop Reason: 1
Hi all!

First off, I'm completely new to Arduino, electronics, and the forum so this might be a simple answer...

I'm trying to build a circuit with a tilt switch in it.  When the switch is closed, I want the arduino to recognize it and turn on an LED.

The circuit works, sort of.  For awhile the LED was flashing for no apparent reason with the tilt switch in the open position.  I disconnected the tilt switch section from the circuit completely and the LED would still flash.  I discovered that if *I* grabbed a wire connected to a ground pin the flashing would stop and the tilt switch would operate somewhat normally.  I say somewhat because it takes a few seconds for the arduino the recognize that the switch is open again when I tip it back.

EDIT:  Oh also, if I bring my hand closer to the LED while not touching a ground wire, the flashing intensifies.  If I move away from the LED, it calms down and stops.

What's going on?  Is the arduino so sensitive that it's reading voltage from my body?  I'm assuming that I'm doing something wrong here...

Set Up:
5V -> 3300? Pull up Resistor -> Tilt Switch -> Pin 12

Pin 4 -> 2200? Pull up Resistor -> Tiny lil green LED -> Ground

EDIT: Schematic Image Attached


#define led 4
int input = 12;
int count = 0;
int val = 0;

void setup () {

 pinMode(input, INPUT);


void loop() {

 val = digitalRead(input);

if (val == HIGH) {

 digitalWrite(led, HIGH);

else {
 digitalWrite(led, LOW);




Can you upload the schematic so that it would be much clear??`



Those aren't pull-ups, those are series resistors. That happens to be right for the LED (edit: although you might like to re-think the value), but you need to wire the switch something like this.

Johannesburg hams call me: ZS6JMB on Highveld rep 145.7875 (-600 & 88.5 tone)
Dr Perry Cox: "Help me to help you, help me to help you...."
Your answer may already be here: https://forum.arduino.cc/index.php?topic=384198.0


You need this in "setup()":

Code: [Select]

  pinMode(input, INPUT);
  digitalWrite(input, HIGH);

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)


This is a common issue reported here - input PINs float if not connected to some definite potential, which
is why pull-up or pull-down resistors (built-in or external) are required for interfacing to any mechanical
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


You are aware that you can do away without the Arduino ? There is no reason to have a microcontroller turn on an LED, the tilt switch can do that directly...

// Per.

Go Up