Pages: [1]   Go Down
Author Topic: 315MHz Receiver - Interference from LED?  (Read 889 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi everyone,

I've got a simple setup for testing and have run into a bit of a problem. I have an Uno and a 315 MHz reciever where I'm simply reading the input in from A5 and printing it to the serial. Results are as expected. However, I wanted to add a visual indicator in the form of an LED to blink every time a value greater than zero is received. So I added the following code:

Code:
int ledPin = 12;
unsigned long timerA;
boolean ledOn = false;

void setup() {
    Serial.begin(9600);
    pinMode(ledPin,OUTPUT);
}

void loop() {
    int sensorValue = analogRead(A5);
    Serial.println(sensorValue);
   
    if (sensorValue > 0 && !ledOn) {
      timerA = millis();
      digitalWrite(ledPin,HIGH);
      ledOn = true;
    }
   
    if (ledOn && (timerA - millis()) >= 50) {
      digitalWrite(ledPin,LOW);
      ledOn = false;
    }
}

I upload and I can see the LED blinking away, but it appears to be blinking a lot more than I think it should. So I fire up the serial console and see what's being received. With the LED plugged into my breadboard I get the following output (sample):
Code:
768
768
0
768
768
0
768
768
0
768
768
0
768
767

If I remove the LED, I get the following (sample):
Code:
0
768
0
0
0
768
768
0
0
0
0
0
768
307
768
0
365
92
0
0
0
0

The second set it what I expect to see. With the LED plugged in I get a repeating pattern for sensorValue. I'm very new to this, and I'm not sure how to best troubleshoot this issue. Is it a wiring issue? Grounding? Now quite sure how to best go about this. Any advice or recommendations would be appreciated!
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 197
Posts: 12736
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Is it a wiring issue?

That's my guess.

Quote
Grounding?

From looking at your schematic ... wait, where's your schematic?

Do you have a current limiting resistor on that LED?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Coding Badly, thanks for taking the time to read my post and respond. I asked a buddy of mine to see if he had any insight and he suggested moving the ground from the LED to the Power Ground instead of the digital ground it was plugged in to. That seemed to have worked, but I'm not 100% sure why.

If you'll check the schematic...wait...yeah still no schematic!  smiley-eek (where's a good spot for a new person to draft arduino schematics to share online?)

In lieu of that here's a pic of the little project in question if that helps at all. Referencing the picture, moving the black wire from the digital ground to the power ground resolved the issue. I don't know why though as I thought all grounds were the same.


* IMAG0102.jpg (921.97 KB, 3264x1952 - viewed 31 times.)
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 197
Posts: 12736
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

where's a good spot for a new person to draft arduino schematics to share online?

If you have a scanner or digital camera, scribble something on paper and upload the image.  The vast majority of the time, anything is better than nothing.

Some folks use Fritzing.  Some folks use Eagle.  Some folks use Microsoft Paint.  I prefer AutoSketch (it's not designed for schematics so it can be tedious to use for that purpose).  This looks promising... http://www.upverter.com/
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So I tried Fritzing, Eagle, then Upverter. Upverter is fantastic and seems to me to be a lot easier than the first two, especially when creating a new part. Anyway, here's my schematic (finally). This was the wiring where I received that weird pattern.

https://upverter.com/sgt_b2002/641e2d0f0a0bd504/Arduino-RF-1/

To resolve the issue, I moved the ground wire from the digital ground to the analog ground (as the annotation in schematic shows). It was my understanding that the grounds on the arduino were all the same. Is this an incorrect assumption?

Thanks again!
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 197
Posts: 12736
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

It was my understanding that the grounds on the arduino were all the same. Is this an incorrect assumption?

According to the schematic and my multimeter they are all connected together.

Are you still having problems?
Logged

Pages: [1]   Go Up
Jump to: