Help Please - Unknown Error - Newbie

Hi, I am new to Arduino and have a problem that I am unsure how to fix.

I am building a fall detection circuit to detect a human falling. I have created the circuit as shown in the image attached and compiled the code attached. I am looking for the LED to come on (over port 11) when a fall occurs. However, when I run the code the LED appears always on and there is no change when a fall is simulated. Please can anyone help?

Arduino-based Fall Detector Code.txt (4.47 KB)

Have a read of the how to use the forum and post you code correctly . A brief explanation of how your project is supposed to work is helpful .

BTW - how will you test this and prove it works ?

katiejayne:
Hi, I am new to Arduino and have a problem that I am unsure how to fix.

I am building a fall detection circuit to detect a human falling. I have created the circuit as shown in the image attached and compiled the code attached. I am looking for the LED to come on (over port 11) when a fall occurs. However, when I run the code the LED appears always on and there is no change when a fall is simulated. Please can anyone help?

The way you have your LED wired an output of HIGH is on. You have initialized the output to HIGH and it remains HIGH until a fall is detected in which you set it to LOW for 20ms and then back ON. That is a very short amount of time.

 if (fall==true){ //in event of a fall detection
   Serial.println("FALL DETECTED");
   digitalWrite(11, LOW);
   delay(20);
   digitalWrite(11, HIGH);
   fall=false;
  // exit(1);
   }

You need to reverse your outputs and leave the LED on longer.

hammy:
Have a read of the how to use the forum and post you code correctly . A brief explanation of how your project is supposed to work is helpful .

BTW - how will you test this and prove it works ?

Thank you, I did read but didn’t realise how much explaining I should do.

Essentially the project is a human fall detection, it’s looking to measure a significant change in acceleration and direction that is then unchanged for a period of time. As if someone has fallen and can’t get up.

I will be testing by literally simulating a fall. I.e standing and falling onto a soft mat.

How is best to post the code? Embedded in the text?

ToddL1962:
The way you have your LED wired an output of HIGH is on. You have initialized the output to HIGH and it remains HIGH until a fall is detected in which you set it to LOW for 20ms and then back ON. That is a very short amount of time.

 if (fall==true){ //in event of a fall detection

Serial.println("FALL DETECTED");
  digitalWrite(11, LOW);
  delay(20);
  digitalWrite(11, HIGH);
  fall=false;
  // exit(1);
  }




You need to reverse your outputs and leave the LED on longer.

Thank you, works perfectly now! Thanks again simple mistakes

katiejayne:
How is best to post the code? Embedded in the text?

You were told what to do:

hammy:
Have a read of the how to use the forum and post you code correctly.

katiejayne:
.... I did read...

But the information did not make it to your brain?

Hi,
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".
OR
http://forum.arduino.cc/index.php/topic,148850.0.html.
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom... :slight_smile: