# Wiring question (will this work?)

Hey everyone!

I have a simple question...incredibly noobish, it's basic electronics. I have a (theoretical) circuit; here is a diagram. (The diagram is much simpler than what it'll actually look like.)

My question is, will it work? By that I mean, I know that the IR reciever (the TSOP34856) will turn on, but will it be able to output any data? No, right? If not, how can I make this work?

Thanks all!

From spec sheet:

Supply voltage: 2.5 V to 5.5 V

You are providing the voltage of 6 AA batteries, around 9V. So it is too high. If you have a 3-AA battery pack, it will work. Or if you connect the power to arduino 5V directly. Why didn't you use arduino's 5V power for the sensor?

That's pretty much what the application circuit is http://www.vishay.com/docs/81732/tsop348.pdf Just put 100nF cap across +5 & GND. Supply it from 3 batteries instead of 6, so you're at 4.5V. Arduino will like that too, connect to the 5v pin on the power header.

You have a source putting out 56 KHz IR pulses it can recieve?

No common GND connection?

pwillard: No common GND connection?

Did not catch that.

So OP, why do you want to power this sensor with a separate battery from arduino?

liudr: From spec sheet:

Supply voltage: 2.5 V to 5.5 V

You are providing the voltage of 6 AA batteries, around 9V. So it is too high. If you have a 3-AA battery pack, it will work. Or if you connect the power to arduino 5V directly.

I cannot believe I forgot about that - thanks for reminding me!

liudr:

pwillard: No common GND connection?

Did not catch that.

So OP, why do you want to power this sensor with a separate battery from arduino?

I knew it was a bad idea to not tell you guys the whole story.

Okay, so I have some circuit boards. Here's the schematic for how they're supposed to work. The plan is, there are 3 PCBs, each with 3 sensors and an LED. (Yes, it is ok to use 3 sensors.) The LEDs draw about 98 mA, each, with the 51 ohm resistor they recommend. I can't use the Arduino to power them because it is already going to provide power to, let's see here: A 16x2 character LCD, an XBee, an Adafruit Wave Shield, possibly a small amp, and a PCF8574 I2C port expander. (I'm not even sure if it can handle all of that, yet.)

The 3 PCBs will be wired together like this. ("To tagger" refers to the uC.)

The problem is, everything on the PCB (the 3 sensors and the LED) need to be powered by the same source. The PCB has 4 spaces to solder wires in, shown in the schematic - +5v, ground, data, and hit LED.

My new idea is: +5v and ground will be taken care of by the battery pack. Hit LED is simple - just tie it to ground, and trigger it with a MOSFET. Now the data pin...here is where I'm stuck.

I have a schematic of my idea here. What I need is: on the schematic, there is a part labeled "???". I don't know if this kind of part exists, but I'll ask anyway. What I kinda need is a reverse MOSFET - where power can flow freely between drain and source, but while power is flowing, the gate pin outputs a 1. When power is not flowing, it outputs a 0. I imagine something like this would need to be powered as well.

What I'm asking is - does something like this exist?

(By the way - none of this matters if I can just use the data pin with the Arduino, without a common ground. I can't do that, right?)

Thanks!

“What I kinda need is a reverse MOSFET - where power can flow freely between drain and source, but while power is flowing, the gate pin outputs a 1. When power is not flowing, it outputs a 0.”

CrossRoads: "What I kinda need is a reverse MOSFET - where power can flow freely between drain and source, but while power is flowing, the gate pin outputs a 1. When power is not flowing, it outputs a 0." How about a PNP transister?

I...do not know. I have tried to look this up, but I'm having trouble making sense of it. Tell me if I'm wrong...a PNP transistor is a switch, where an electrical pathway inside the transistor can be switched on or off, depending if something is sinking current from a third pin, the name of which eludes me.

If I'm right, then that type of part won't work. I need something to check if a wire is passing current through it, and relay that to the uC.

Also, I think my (theoretical) MOSFET setups won't work either, as they lack a common ground - same mistake. Can anyone link me to a schematic of a simple way to wire up an N-channel MOSFET? (With the default setting (with gate set to 0) set to off? I'm just trying to trigger LEDs.)

Thanks guys!

Replace motor/diode with LED.

The other - how about measuring voltage across a shunt resister?
If need a high/low signal instead, then run the voltage into + input of a comparator, -input from a trimpot between +5 & Gnd, will get a high out when shunt voltage exceeds trim pot. Amplify the shunt voltage with an op amp if need larger comparison range.

http://www.dipmicro.com/store/index.php?searchStr=shunt&act=viewCat&Submit=Search

The other - how about measuring voltage across a shunt resister? If need a high/low signal instead, then run the voltage into + input of a comparator, -input from a trimpot between +5 & Gnd, will get a high out when shunt voltage exceeds trim pot. Amplify the shunt voltage with an op amp if need larger comparison range.

http://www.dipmicro.com/store/index.php?searchStr=shunt&act=viewCat&Submit=Search

Thanks for the MOSFET schematic!

The resistors in that, though - they do change based on the application, right? What should they be?

The shunt resistor/comparator idea seems good, thanks! They do come in lower resistances though, correct?

Resisters on the gate are not critical, MOSFET input is voltage driven, not current. Mostly they ensure the part is off when arduino starts up & inputs, are, well, inputs, and levels are floating. Current limit resister for the LED is important. Make sure to select a logic level MOSFET.

Shunt - how low do you want it? Needs to have some resistance, or else no workable voltage is developed to make a measurement on.

5A thru a 10mOhm shunt is only going to develop 50mV. How much current are you expecting?

CrossRoads: Resisters on the gate are not critical, MOSFET input is voltage driven, not current. Mostly they ensure the part is off when arduino starts up & inputs, are, well, inputs, and levels are floating. Current limit resister for the LED is important. Make sure to select a logic level MOSFET.

This is the MOSFET I chose. It was recommended to me by a person from another forum...is it good?

The 1K resistor in the schematic doesn't need to be changed? I read somewhere that it's important to have the right resistor based on the current going through the MOSFET.

CrossRoads: Shunt - how low do you want it? Needs to have some resistance, or else no workable voltage is developed to make a measurement on.

5A thru a 10mOhm shunt is only going to develop 50mV. How much current are you expecting?

Let's see here...using a 3-AA battery pack, so 4.5v...

3xLED, 4.5v with 51ohm resistor, roughly 88 mA each, so a total of about 265 mA 9xTSOP sensor, 4.5v with 100ohm resistor, 45 mA each. Wait a second...the datasheet says it can't handle any more than 3 mA. What does that 10uF cap do to my calculations?

Sorry, I'm not quite sure how much current I need right now.

Do I even need a shunt resistor? Couldn't I just tie the comparator directly into the wiring? I'm looking at this one. Also, will I need a resistor for a comparator? (It only uses 1 mA...)

Thanks!

MOSFET looks good. 1K, 10K, not critical. Voltage at the MOSFET Gate will be 0/5V from the arduino. Could be as low as 180 ohm with series resister between arduino & gate and will still work. You've got so many pieces now I can't keep track. Can you post a complete diagram and show where you want to get 0/1 indication from?

CrossRoads: MOSFET looks good. 1K, 10K, not critical. Voltage at the MOSFET Gate will be 0/5V from the arduino. Could be as low as 180 ohm with series resister between arduino & gate and will still work.

Great, thanks!

CrossRoads: You've got so many pieces now I can't keep track. Can you post a complete diagram and show where you want to get 0/1 indication from?

Yeah, I can't keep track either. My brain's going nuts! Here's the diagram. Sorry if it's a bit messy.

Thanks for helping me so much!

Much better. You need battery ground connected to arduino ground. I need to look up TSOP34856 again to see what it puts out.

Looks like you want to know if any of the three devices are active, you turn on the Hit light? Connect them like this. We could have resolved this days ago if you had shown this kind of picture to start.

CrossRoads: Much better. You need battery ground connected to arduino ground.

Ok. Just out of curiosity...why? (Seriously, I'm clueless)

CrossRoads: I need to look up TSOP34856 again to see what it puts out.

Here's the datasheet. It doesn't seem to put out much.

CrossRoads: Looks like you want to know if any of the three devices are active, you turn on the Hit light? Connect them like this.

No, actually, if I did that, then the LEDs would be on for too short a time - that's why I'm going to have them hooked up with a MOSFET.

CrossRoads: We could have resolved this days ago if you had shown this kind of picture to start.

Sorry :(

The Mosfet is controlled by a voltage leve the arduino puts out. Without common ground the Mosfet's gate is just floating for practical purposes, with defined high or low. Same for the TSOP's output. They will connect to an arduino input that is pulled high - when the NPN turns on, the emitter needs to be at the arduino ground or the input will not be seen as low when the NPN turns on.

"It doesn't seem to put out much." Correct - just 0.167Ma if pin3 is connected to +5V and pin2 is grounded. However, pin2 can Sink current - that is, pull an outside line low. So you wire up an external pullup resister, and let the NPN pull it low.

"if any of the three devices are active, you turn on the Hit light" I realize that, I see the arduino wired to the LED - I didn't say the receiver(s) would turn it on.

Let us know how you make out.

Why do I need all of those transistors? All I need to do at this point is take one data line and connect it to the Arduino, somehow. It doesn’t have a common ground with the Arduino, so instead of just connecting it directly, you said I could use a voltage comparator, correct?

Just one thing left - I’m not quite sure how to use a voltage comparator. I’m looking at this one. I see Vcc and ground; obvious. Then there’s inputs A and output A. Output A will output a 0 or 1 based on inputs A. Inputs A will be connected to the two lines I want to compare, and I’ll tie the comparator’s ground to the two lines’ respective grounds. Does that sound about right? (Also, in the datasheet - it says max output sink current is 20 mA. They are talking about how much can go through inputs A and B to ground, right? In which case, I’ll have to find another comparator)

Thanks!

What?? The transistors represent the output stage of your TSOP parts; go look at the datasheet. They are open collector - a resistor pulls them high, when they get a 56KHz signal the NPN is turned on and brings pin 2 low.

You don't need a voltage comparator just wire them in parallel like I show, and connect the grounds. Otherwise it is like trying to use a multimeter with just 1 lead. The 2nd has to be connected - in this case that is the ground.

So wait, there's a route on the Arduino board from the digital pins to the ground pins?

Wow, I feel so stupid :)

Well, thanks for all the help! Tomorrow I'll go get some resistors, and I'll let you know if it works.