Go Down

Topic: Strange grounding issue (Read 3779 times) previous topic - next topic

NeX

hi all,
sorry for my ignorance but i have spent a full day trying to work out whats happening and i am at a loss.

here is what i am trying to do:
i have a car CD player, powered by a car battery, i want to control it with my laptop. i have used the arduino IRremote library to learn the codes of the infrared remote, and with an infrared LED on the arduino and sending serial data from the laptop to the arduino i can control the CD player,

but what i would like to do is hardwire it, so that i have a small arduino inside the CD player, and a wire directly from the arduino to the infrared sensor on the CD player, so no optics involved.

the infrared is inverted, so the output from the arduino drives a transistor which is across the IR sensor in the CD player, the arduino is also grounded to the CD player to complete the circuit.



here is where the problem starts. this setup only works if i have one hand on the battery negative and one hand touching the IR sensor output pin.

obviously this seems to be a ground issue, so i soldered a thick ground wire from the CD player, to the arduino (to the exact same place as the transistor is wired) but that didn't work.

i thought that maybe the output pin of the IR sensor (active low) wasn't going low enough, and maybe the internal pull up resistor of the IR sensor was some how keeping it from going fully low. but putting a 10k pull down resistor between the output pin and ground, also did nothing.


so now i am at a loss, the project is so close to being complete, but for some stupid ground issue. i have tried capacitors to filter any noise, pull up and pull down resistors, loads of ground wires, nothing changes.

the only way to get it to work is to hold the output pin and touch something grounded, then it works fine. it only works if i touch the output pin as well.


please help, i am at the limit of my knowledge here and i could use the advice of some smarter people.

thanks!

Docedison

measuring across the IR sensor from output to ground on the IR sensor, do you have full logic level voltage swing and is it the same as when you use the IR remote to do the same thing. This may well require an oscilloscope to determine. I'm thinking that you don't have a good idea of how the IR sensor is connected to the CD player. Placing your finger from the sensor output point to ground does 2 things, 1, is to introduce some resistance from the contact point to ground and 2, is to place some small capacitance from the contact point to ground. A "Normal" "Dry" finger to finger measurement is about 20K give or take a few K (the usual range from the time when I made GSR "meters" for bio feedback was 10 to 30 K for "normal dry fingers". It is entirely possible that the pull down isn't small enough to pull the point low enough to work and measuring across the sensor for both conditions should point you in the correct direction.

Bob
--> WA7EMS <--
"The solution of every problem is another problem." -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

dc42

Please provide a schematic of how you have connected the Arduino, the transistor, and the CD infrared sensor - hand-drawn and scanned will do.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

NeX


measuring across the IR sensor from output to ground on the IR sensor, do you have full logic level voltage swing and is it the same as when you use the IR remote to do the same thing. This may well require an oscilloscope to determine. I'm thinking that you don't have a good idea of how the IR sensor is connected to the CD player. Placing your finger from the sensor output point to ground does 2 things, 1, is to introduce some resistance from the contact point to ground and 2, is to place some small capacitance from the contact point to ground. A "Normal" "Dry" finger to finger measurement is about 20K give or take a few K (the usual range from the time when I made GSR "meters" for bio feedback was 10 to 30 K for "normal dry fingers". It is entirely possible that the pull down isn't small enough to pull the point low enough to work and measuring across the sensor for both conditions should point you in the correct direction.

Bob


the IR sensor is a 3v sensor according to the datasheet, and the multimeter confirms that it is supplied with 3v,

unfortunately the pulse width is too small for me to measure with a multimeter and i don't have access to a scope so i can't see if it goes to true ground, but also it is supposed to be normally high and it reads 2.8v so i know that its not fully high but that shouldn't be a problem.

i don't know exactly how the sensor is connected to the CD player, but i know that it is supplied with 3v and ground, and the output pin goes directly to a microprocessor, as far as i can tell it goes to a serial RX pin on the micro processor.
i understand also that infrared is modulated and that the sensor automatically demodulates the signal, which may have something to do with it, as i am sending the raw PWM signal from the arduino into the output pin of the IR sensor which i assume is actually expecting a demodulated signal. if this is true then maybe my body is acting like a capacitor which is filtering out the PWM and giving a demodulated signal, but i cannot simulate this with a normal capacitor.

it actually only really works properly with wet fingers, so its a lower than normal dry finger resistance, but i am wondering if its actually the capacitive effect which is solving the problem.

thanks for all your help!


also i can upload a diagram that is no problem, but can i host it on this site or will i have to host it somewhere else?

i can do a rough flow diagram:

arduino digital pin 3 --> 10k resistor -->  base of the transistor (BC182B)

transistor emitter --> ground

transistor collector --> output pin of the IR sensor

IR sensor has 3 pins: output, ground, 3v.  the ground of the IR sensor is connected to the ground on the arduino.

dc42

#4
Oct 14, 2012, 09:48 pm Last Edit: Oct 14, 2012, 09:50 pm by dc42 Reason: 1
You can upload files with your post, just click on "Additional options" when composing your reply.

If the IR sensor is something like this http://www.adafruit.com/datasheets/tsop382.pdf then you should feed the transistor just the modulation signal, not the carrier. If you post your sketch, I or someone else may be able to advise what changes you need to make to send just the carrier. You might get away we connecting a capacitor of a few hundred pF between the transistor collector and ground, but it is better not to transmit the carrier in the first place.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Docedison

Thank You Sir for that valuable information, I had never considered that fact.

Bob
--> WA7EMS <--
"The solution of every problem is another problem." -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

NeX


You can upload files with your post, just click on "Additional options" when composing your reply.

If the IR sensor is something like this http://www.adafruit.com/datasheets/tsop382.pdf then you should feed the transistor just the modulation signal, not the carrier. If you post your sketch, I or someone else may be able to advise what changes you need to make to send just the carrier. You might get away we connecting a capacitor of a few hundred pF between the transistor collector and ground, but it is better not to transmit the carrier in the first place.


ok here is the IR sensor in the CD player, as far as i can tell. it doesn't have a part number but it has the "Sharp" logo on the back, and matches the look of the one in the datasheet, as well as the voltage provided by the PCB: http://www.farnell.com/datasheets/320230.pdf

i have attached my sketch (pioneer.uno). this one is the one that works but only if i touch the output pin and ground. the sketch feeds the output pin the carrier signal, so theoretically it shouldn't work in any way.

a smart friend of mine came up with some modifications to my code which transmits the signal without modulation, and also inverts the signal so that the transistor is not needed, but that doesn't work at all.
these are the two sketches my friend made: pioneer_unmod.cpp and pioneer_unmod_hiz.cpp

diagram.jpg is a very crude drawing in paint which shows the setup i have.


i hope this helps, i will try again with a small capacitor in place and see if that fixes anything. thanks for your suggestions

NeX

ok UPDATE!:

it is now working, with a 560pf capacitor between the output pin and ground.

thanks very much to everyone especially DC42 for suggesting the cap. i tried many electrolytic capacitors in the same location but they must have had the wrong values.

now i would like to understand why it works. especially as it is working with a modulated signal.

dc42


now i would like to understand why it works. especially as it is working with a modulated signal.


The transmitted signal comprises bursts of the modulation frequency to represent logic 1 and periods of no transmission to represent logic 0. (I have assigned the 0 and 1 states arbitrarily).

When a logic 1 is transmitted, the transistor turns on and off at the modulation frequency. When the transistor is on, it provides a low resistance to ground, discharging the capacitor. When it is off, the capacitor charges slowly through a pullup resistor. However, it doesn't have time to charge much before the transistor turns on again. So the output never rises to a logic high.

When a logic 0 is being transmitted, the transistor remains off, so the capacitor gets a chance to charge up to 3V and the mcu sees a logic high.

So the transistor, resistor and capacitor form a demodulator.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

NeX



now i would like to understand why it works. especially as it is working with a modulated signal.


The transmitted signal comprises bursts of the modulation frequency to represent logic 1 and periods of no transmission to represent logic 0. (I have assigned the 0 and 1 states arbitrarily).

When a logic 1 is transmitted, the transistor turns on and off at the modulation frequency. When the transistor is on, it provides a low resistance to ground, discharging the capacitor. When it is off, the capacitor charges slowly through a pullup resistor. However, it doesn't have time to charge much before the transistor turns on again. So the output never rises to a logic high.

When a logic 0 is being transmitted, the transistor remains off, so the capacitor gets a chance to charge up to 3V and the mcu sees a logic high.

So the transistor, resistor and capacitor form a demodulator.


thanks for the detailed explanation, so basically when i was touching the pins i was demodulating the IR carrier so the CD player was able to understand the arduino.

so in theory, if i can get it to send just the data, it should work without the capacitor

dc42


so in theory, if i can get it to send just the data, it should work without the capacitor


That't right. You will still need the NPN transistor, so that it can share the mcu input with the IR sensor nicely.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

NeX



so in theory, if i can get it to send just the data, it should work without the capacitor


That't right. You will still need the NPN transistor, so that it can share the mcu input with the IR sensor nicely.


thanks again for the help. i have actually got it working now without the transistor or the capacitor. doing everything in code now. and the original IR remote still works too, so the arduino isn't interfering with that, which is great.

dc42

#12
Oct 17, 2012, 09:43 pm Last Edit: Oct 17, 2012, 09:45 pm by dc42 Reason: 1
If you've connected the Arduino pin directly to the IR sensor output, that's a bad idea. When the sensor tries to drive the output low and the Arduino tries to drive it high, you are likely to exceed the current rating of the IR sensor, the Arduino output pin, or both. Unless you've written the code very carefully to only make the pin an output when you drive it low, and make it an input the rest of the time. Also, you should consider what happens when the Arduino is powered down and you want to use the IR remote, unless the Arduino and the IR receiver are powered form the same source.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

NeX


If you've connected the Arduino pin directly to the IR sensor output, that's a bad idea. When the sensor tries to drive the output low and the Arduino tries to drive it high, you are likely to exceed the current rating of the IR sensor, the Arduino output pin, or both. Unless you've written the code very carefully to only make the pin an output when you drive it low, and make it an input the rest of the time. Also, you should consider what happens when the Arduino is powered down and you want to use the IR remote, unless the Arduino and the IR receiver are powered form the same source.


thanks for the info,

what about a diode from the arduino? i could write the software so that it only turns to an output when sending commands.

the arduino is powered from the CD player, so thats no problem, and its unlikely that the arduino and the remote would be used at the same time, but still its good to have precautions.


dc42

Yes, a diode between the Arduino and the remote sensor, cathode to Arduino, will protect against the Arduino driving high and the sensor driving low at the same time.

If you want to connect them directly, then use this scheme. Configure the pin as an input, and digitalWrite(LOW) to it when not sending a command. When you want to send a command, instead of doing digitalWrite(LOW), do pinMode(OUTPUT); and instead of doing digitalWrite(HIGH) do pinMode(INPUT).
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Go Up