Go Down

Topic: [SOLVED]Lightning detection arduino UNO (Read 1 time) previous topic - next topic


May 03, 2012, 04:32 pm Last Edit: May 03, 2012, 06:51 pm by Kaihos Reason: 1
Hello guys!!

I'm new here but the arduino programming and the c++ generic coding is familiar for me.

I have a problem here on this code

#define pLed 2  //here is attached a resistor and a led on series
#define ceFul A0  //here comes in a signal from an whip antenna
void setup()
 pinMode(ceFul, INPUT); //you know what this is .........
 pinMode(pLed, OUTPUT);
 digitalWrite(pLed, LOW);

void loop()
 if(analogRead(ceFul)==HIGH) //if the signal is HIGH it should
     delay(10);                //light up the led for 10 ms
It's fine and correct, but the led is lighting like the blink sketch in basics - and the fun part is that it lights up randomly  :smiley-eek-blue:

Please, Help me !!!


Well, it happens that the analogic pin when used with other voltage generators, it makes a lot of high impedence signals, wich i detected later. So i changed few things :
1) the if instruction uses a int variable and not the direct input signal;
2) used a logic pin and not more analogic, after some trials works well;
3) Tried and tried and now it works.
Anyway, you can always give me a hand constructing a real antenna filter and signal receiver from the 590 kHz frequency. Sorry for bad english and, have a nice day!!


May 03, 2012, 06:21 pm Last Edit: May 03, 2012, 06:26 pm by Krodal Reason: 1
A led that is on for 10ms is almost not visible.
You could use a delay of 200ms for both delays.

Or just follow the input:
Code: [Select]

void loop()
  int i;
  i = analogRead(ceFul);
  if (i == HIGH)
     digitalWrite(pLed, HIGH);
     digitalWrite(pLed, LOW);

This code tries to detect a small pulse, that will keep the led on for 500 ms.
If the input is LOW most of the time, there is no delay in the loop, so the input is checked with a high frequency.


but the led is lighting like the blink sketch in basics

That is because the input is floating:-

To detect lighting you need a very large coil, and some protection on the analogue input, like catcher diodes:-


I assumed that there was a protected input circuit.
But a resistor in series with the input can be 10k for the Arduino.


Sorry but i solved my problems by myself  8)

Goodbyeeeeeeeeeee!! :smiley-mr-green:


Sorry but i solved my problems by myself  smiley-cool


Sorry not good enough. You asked for help, you got some, and now you have an obligation to post the solution to help others searching the threads in future.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131