Pages: 1 [2]   Go Down
Author Topic: Wiring question (will this work?)  (Read 1885 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

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.

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.

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

Sorry smiley-sad
Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 524
Posts: 26473
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 524
Posts: 26473
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Wow, I feel so stupid smiley

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

Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Wait, what?

Sometimes I outdo myself with the stupidity.  smiley-sweat

Anyway, if I connect a data pin without a common ground to the Arduino, where will the current come out? Is that why there's two ground pins on an Arduino?
« Last Edit: August 08, 2011, 02:47:37 pm by Fej42 » Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 524
Posts: 26473
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

"if I connect a data pin without a common ground to the Arduino, where will the current come out?"

Exactly! You need the ground connection to complete the electrical loop.

No, there's two (three actually, and four if you count the ICSP header pin) because sometimes you need to hook up more than 1 thing.

In this case, the input pin is seeing some current from the pullup resistor, so it reads as a high.
The NPN transistor in the TSOP device turns on, takes that current away, so now the arduino input pin sees a low.

It's that simple. Go get a simple NPN transistor and convince yourself.
Drop the comparator idea, forget I mentioned it, I wouldn't have brought it up if I had realized what you were doing sooner.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I get how the transistor works. Yeah, it's pretty simple.

"if I connect a data pin without a common ground to the Arduino, where will the current come out?"

Exactly! You need the ground connection to complete the electrical loop.

I meant that literally, though. If I plug the sensor in on a digital pin, where can I get the current back from? I still need to complete the circuit by plugging it into the ground of the battery pack.
Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 524
Posts: 26473
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The digital input pin takes next to no current, it really just sees the voltage - but it needs a reference point for that voltage.

So if you have your 4.5V from the battery pack, and you connect it to a digital pin, and there is no ground connection with battery pack, the pin will have no way to tell how much voltage is there.
And if that voltage wiggles up & down from the transistor turning off & on, the digital pin won't see it as good 1's & 0's, it will just be random levels.
And in that case, you may as well just take a bare piece of wire and let ity flop in the breeze, you''ll see similar results.
If you have the digital pin pullup resistor enabled, then you will just see a 1 all the time.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah, so I need a ground connection. Here's a diagram.



Where can I plug in the wire with the "?" at the end so that the Arduino has a reference point, and so that the circuit loop can be completed?

(Also, is 100 ohms too small for a pull-up resistor? I was wondering, since the sensors output so little. Would 1k or even 4.7k be a better choice?)
Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 524
Posts: 26473
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If the wires are short, try it with No pullup. The TSOP has a weak internal pullup. You could also turn on the D6 internal pullup

pinMode (D6, INPUT);
digitalWrite (D6, HIGH);  // connects the internal pullup.

Connect TSOP pin2 to a GND pin on the arduino; there's 3 of them, they are all connected. Pin1 to D6.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Pages: 1 [2]   Go Up
Jump to: