Maker Pro
Maker Pro

LED's turning on if hand crosses area.

Hi, I'm trying to simulate a CAN operation within a vehicle. I am currently using a switch to simulate the opening and closing of 4 doors and the trunk. The code works, however, there seem to be an issue with the circuit. Whenever I cross my hand over or between where the switch is plugged in random LEDs, simulating the door is open, comes on. I took out the switch altogether meaning it's open circuit and random LEDs still comes on. Any thoughts?
 

KrisBlueNZ

Sadly passed away in 2015
Not sure if this is relevant, but this problem description reminds me of a problem I had once that turned out to be caused by LEDs responding to light from my desk lamp. In my case, when this light fell on the LEDs, they would generate a voltage, which would bias the input circuits of a tri-stated buffer that was driving the LEDs, and put them into linear mode, increasing the current consumption. When I moved my hand around and blocked off the light, the current consumption returned to normal! If I believed in ghosts, I would have said it was haunted!

Depending on what your LEDs are connected to, and how they're connected, this could possibly cause the symptoms you're seeing. To find out, just turn off the lights in the room and see whether the unit stops responding to hand movements.
 
I was so hoping this would work but it didn't. It did look cool in the dark though..lol. On a more serious not someone said it could be that there is simply a short circuit or some how my body's capacitance may be triggering the LED or a driver circuit.
 

KrisBlueNZ

Sadly passed away in 2015
Do you have pullup or pulldown resistors on the inputs from the switch? That is, a resistor to pull the signal to a defined state when the switch is open?

Is the circuit's common rail connected to mains earth?

What is the circuit powered from? What kind of power supply?

Are you wearing an anti-static strap and is it connected properly?

If you hold a long metal object and move that around, without going too close yourself, does that cause the same symptoms?

What about a non-conductive object like a piece of expanded polystyrene?

Can you try to find out which part of the circuit is most sensitive?
 
I'll try to answer a few for now, I'm taking a short break(hour or 2) from it. I have 10k resistors going to the switch to drop the current since it is going into a pic18F4680 chip.

The board is a project board bread board so everything is connected to the ground provided.

THe circuit is powered from the +5V connection on the board.

I'm not wearing anti static gloves.

I tried using a pen, it didn't really happen that much but when I turn on a switch it often led to another turning on but dimmer than the one that is supposed to be on.

There seems to only be one sensitive part that is the are where the an 8 port switch is located and more on the output side. Also If I remove the switch which effectively causes an open circuit and then I move my hand through the area they still come on!!

The outputs from the switch goes to 5 different pins on a port that is configured for input and the code turns on the led's from another port only if the input is high and turns it off if the input is low.
 

KrisBlueNZ

Sadly passed away in 2015
I'll try to answer a few for now, I'm taking a short break(hour or 2) from it. I have 10k resistors going to the switch to drop the current since it is going into a pic18F4680 chip.
You mean drop the voltage? Do you have pulldown resistors? If you're not sure, upload a schematic of what you have so far, and/or a photo of the breadboard layout.
The board is a project board bread board so everything is connected to the ground provided.
Right, but does that connect to the real earth at the AC mains socket?
THe circuit is powered from the +5V connection on the board.
Right, but where is that powered from? Is there a power supply under the breadboard or something?
I tried using a pen, it didn't really happen that much but when I turn on a switch it often led to another turning on but dimmer than the one that is supposed to be on.
Do you have an oscilloscope? If so, connect it to one of the PIC pins that drives an LED, and see what it displays when you move your hand near it to cause the LED to glow. If it's an AC waveform, instead of a steady DC voltage, figure out the frequency of it and see if it matches your AC mains frequency.
 
Hi, I don't still quite know what was causing the problem, but I left it over night and when I tried it this morning it was working near optimal. The lights only came on if I touched the wire. I was told that I probably should place both a pull down and pull up resistors at two different points. Again will let you know the outcome of that.
 
Sounds like you have floating inputs. They are high impedance, so electric fields from your body can trigger the inputs, if they aren't connected to either the power rail or ground, when the switch controlling the input is open.

Digital inputs should always be connected to either high (Vcc/Vdd) or ground (0v), not left floating. If you're using switches, add pull-up or pull-down resistors as needed to pull the inputs to the opposite state when the switch is open. So, if the switch connects between 5V and the input, add a pull-down resistor between the input and Gnd. If the switch connects between Gnd and the input, add a pull-up resistor to 5V.

10K is a good pull-up/pull-down resistor value to use.

Can you post a schematic?
 
You don't want both a pull-up and a pull-down resistor on the same input since then they'll act as a voltage divider and you'll end up with some voltage in between high and low on the input and your circuit will draw more current and behave unpredictably.

You don't need 10k resistors to limit current going to the PIC inputs, unless the input voltage exceeds Vdd (5V) by more than 0.6V or so.

How are your switches connected?
 
Top