Well, I am taking a new approach with a project. I have a sound device that has a series of 5 LED's on it and I am porting the LED voltage into 5 of the Arduino's analog inputs - one wire is hooked to the + side of the LED (to the analog input), while the other - side goes to the Arduino ground. A full 5v on the analog input equals a full level for that particular LED, which I can then re-convert to the appropriate dB level.
I have the circuit constructed, the program working perfectly.... The problem is there are 5 LEDs and due to the nature of how the sound device is wired, if I bind one set of the five legs to ground on the Arduino, things go crazy with the LED readout of the device. The LED's are not attached to a voltage and a ground on the device - they are inline with a more complex circuit. When I ground them together it causes problems with the operation of the sound unit. Unfortunately, the only way I can get the signal to the Arduino is to hook one leg to ground and one leg to the analog input pin(s). There are only three ground spots on the Arduino and if I separate three of the five legs to the different grounds things seem to work a "little" better for some reason with the device's LED readout.
I need to figure out a way to bind all five of these legs to the ground without "shorting" them to one another. Knowing a bit about electronics I purchased a few 5.1V Zener diodes, hooked one end to the "grounding" wires, and bound the other ends into one Arduino ground. My assumption is that since a diode only allows current in one direction, it would prevent this undesired "short circuit" effect that is going on. However I must have goofed up the specs on the diodes or picked the wrong type (or perhaps I was just incorrect about the use of a diode), as the Arduino does not even see that there is a connection established to the LED array (the usual floating voltage on the pins is there and unchanged). I flipped the diodes around and tried both sides... but it does not register a voltage getting to the Arduino.
There HAS to be some way to accommodate this type of scenario using an Arduino and some specific components. I have 5 legs that have to go to ground to transmit a voltage to the Arduino, but when they touch they short out and cause problems with the audio device. ANY input or guidance would be appreciated!!
Yes, I had thought of that too, but it is not the case either. I have to be honest, I am thoroughly confused how this thing works - it is a commercial/industrial device, so it is not anything that is of amateur construction. If you meter both LED legs with a voltmeter it comes up as 8.xVDC (which does't seem correct for a 5V LED), if you meter either leg individually and a ground, it reads 0.0VDC. It took me 11 days to map the PCB to locate where I can get a clean reading between one LED leg and a source to get a 5VDC max signal. I eventually did locate the 5 sources on the PCB, and all of them have a resistor attached to them which leads to the LED. From one side of the resistor you get the 5DVC max, while the other side reads 1.xVDC max. It is a very unusual setup, and one that I have never ever seen before. I am thoroughly confused by it. However, I DO know that one leg has to go to the analog inputs of the Arduino, and I do know that the other leg has to go to ground. I tried flipping the wires between the analog in and the ground, and it only works one way. If I attach only ONE set of LED wires, everything works fine. If I attach TWO or THREE sets of LED wires to the other ground points on the Arduino, it also seems to work "OK".... but once I have to start twisting legs together to join them to a common ground the device starts acting very oddly, and I know it is because this is not a case of a simple "source and ground" setup.
So if you connect your meter to a negative (see next paragraph) on your sound equipment, you'll see voltage switch rise on the + side of the LED depending on the sound level?
For the negative, find something at the power supply on the negative side of one of the big capacitors, and then meter from there to each of the LEDs as they turn on. If you see something consistent voltage wise as each of the LEDs turn on, then connect a SINGLE wire from the negative to the arduino and a separate wire from each LED to the inputs (as russdx suggested)
Rokkit and Russdx - thank you both for your input. The PCB for this device is not large, but like I said it took me 11 days of tracing the paths to find the connections that I did. Unfortunately the common ground does not come into play with the operation of the LEDs. If I meter off of the common ground and then to each of the LED's, I get erratic readings from 2.1VDC up to about 14VDC when they are OFF. When they are on the readings are just as erratic ranging from .9VDC up to about 8VDC. Each LED is tied to another through a maze of circuitry, and as one goes up the latent voltage on the others goes down. The problem with this comes into play with the Arduino side of things, as the errant voltage greatly exceeds the 5V max of the analog pins, not to mention all the voltage gradients would be a nightmare to regulate and monitor from within the code. There is no one common wire that I can attach to the Arduino ground - that was my first thought and that is what consumed much time. However this device is constructed it goes against my higher elementary grasp of electronics.... but one would think that a ground would be a ground, and that when an LED lights up one pole must be groundable while the other has a regulated voltage applied to it.
To save much confusion and frustration trying to further figure out how and why.... my most elementary question is still regarding preventing a short circuit on the pins that I DO have going to the Arduino ground. Is there a component which will only limit one way travel of voltage/current/etc.? I would have thought a diode would do this for me, but perhaps my values are wrong since the Arduino does not recognize ANYTHING coming in when the diode is attached. Like I said, 5V is the max going into the Analog pins, so am I wrong having a 5.1V zener diode hooked to each pin going to the ground? Is that too high? Too low? Is the "zener" part incorrect???
This has me going cross-eyed trying to figure it out!!
It might be time for an opto coupler to interface between your sound board and the Arduino.
Based on what you're saying, I think this might be your solution.
This device would isolate the audio board from the Arduino.
You'd have the audio device connected to 1 and 2 on the opto coupler, and use the collector to connect to the analog inputs on the Arduino. You'd need some voltage through the switch, but you can use the Arduino for that
Rokkit.... and opto coupler, huh?? OK. That's a new one for me.
Based on your diagram can you provide me with a little more specific information??
I have FIVE wires on the device each connected to the positive leg of the LEDs. I have FIVE other wires connected to various points on the PCB which I would "equate" to the negative component of the circuit (although these points have nothing to do with the ground). So that is 10 wires total.
Your opto diagram has two input pins (1 & 2). Would one a positive and "negative" for each LED? If so, I would need 5 opto couplers? Could you provide a little more specifics on how this would actually interface between the sound board and the Arduino??
Do they have specific voltages or ratings? Would you have an example of a specific model that might work appropriately for this low voltage DC application (no more than 5V going in).
What you're looking at with the optocouplers is pins 1 & 2 are actually connected to an LED inside the optocoupler. It has the same characteristics as a standard LED, it is polarized and requires a resistor. You will need one for each LED you want to connect to, and you'll need to connect a resistor in a manner similar to the LEDs already on-board. You'll need to select a resistor which will conform to the current requirements of the optocoupler, which may not be the same as the LED on the audio device.
On the output side, each collector (output) is connected to the input of the Arduino.
I re-read your original post and am a little bit confused about the desired operation. Do these LEDs vary in brightness depending on what audio level is going through it? and why are there 5 of them? are you talking about an LED Bar graph?
Here's a drawing that might help you out. Remember to use the datasheet for the optocoupler that you decide to use and calculate the right resistor values
Rokkit, thank you for the clarification regarding the opto coupler. I have to admit though, I am still a bit confused. The image provided looks like an LED bargraph. So the opto coupler is, itself, a series of LEDs (with added features)? I am going to have to look into this further.
In response to your confusion, the device that I am trying to interface with is a dB level meter built into a larger device. The five LEDs go from green, green, yellow, orange, and finally red. The program reads the voltage going into the Arduino from the LEDs.
YES, the brightness varies as the dB intensity varies. When an LED is fully lit at about 4.9 VDC, it represents a full reading at that particular dB range. Using the analog input it is simple to determine the exact numeric dB level based on the values reaching the Arduino of the voltages.
You're going to have to use one optocoupler for each LED on your bargraph, so you're going to need to make 5 of the above drawings, one for each LED.
I only posted the picture of the bargraph the get a better feel of what you're interfacing with, it really has no bearing on the optocouplers. Sorry for the confusion!
Dan, thank you for the clarification - I understand completely now. I get how it works and why it is necessary!
Do you have any suggestions on appropriate devices? I did some searching on Mouser and Digikey, but there are hundreds of options that I just can't resolve into what would be best for this application. Logic ouputs, SCR outputs, Opto/photovoltaic outputs.... etc. I know I will have a max of 5VDC going into the optoisolator from the audio device, and I know that the Arduino can handle right around 5VDC as well. I understand I will need to use resistors to match up the values from side to side.
After I made the original drawing, I reworked it so the lines wouldn't cross, but I didn't correct the polarity of the drawing before uploading it. So if you saved my original drawing of the optocoupler, delete it, it is wrong.
Dan, EXCELLENT information and thank you again for the suggestions! I will order up a few of those and try it out. Hopefully things will work out as anticipated. I will let you know.
Rokkit - the optocouplers arrived last evening, and I just wired them up on the breadboard! THEY WORK PERFECT!!!!! That is exactly the solution I needed, and your diagram made it especially simple for me.
The only correction I had to make is that you shunted pin 4 to Arduino ground, as well as going to the Arduino input pin. This did not work for me - I was getting a massive constant voltage (7-8.5VDC). Instead I glanced at the datasheet and shunted pin 6 to Arduino ground, and just left pin 4 as the input voltage. It worked fine! I have all 5 wired up (I got a deal on ebay - 5 for $2.99), and IT WORKS!!
Once again, thank you so very much for your suggestions and insight! I would not be at this point without you.