Pages: [1]   Go Down
Author Topic: multiple sensors on one pin  (Read 1464 times)
0 Members and 1 Guest are viewing this topic.
argentina
Offline Offline
Newbie
*
Karma: 0
Posts: 31
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm copying this thread from home improvement since this seems like the proper board
http://arduino.cc/forum/index.php/board,16.0.html

I'm building a garduino system and i'm gonna use galvanized nails to do it (i'm aware this method got its drawbacks, but this is the only one i know of). The thing is i want to measure multiple pots, so i want to connect the various sensors to a single analog pin and switch between them using the digital pins.
I've come up with this circuit: the left circles are connected to the digital pins and the right circle is connected to the analog pin. would this work without having the other pots interfering? i've put the transistors before the sensors (R3 and R4 in the diagram) because i don't want there to be current flowing unless they're about to be read. should i put transistors after them to avoid the other sensors affecting the measurement?
thanks


* schem.png (13.99 KB, 755x477 - viewed 37 times.)

* schem.png (13.99 KB, 755x477 - viewed 31 times.)
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 108
Posts: 5144
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I would combine R1 and R2 into one (because they act as one resistor anyway). I guess R3 and R4 are the DIY sensors, are they? In this case it might work, but you should use PNP transistors if connected this way.
Logged

argentina
Offline Offline
Newbie
*
Karma: 0
Posts: 31
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

pnp?
don't i need to lower the base to gnd for it to switch? in that case, the digital pins are up the whole time and down when it's taking a read, right?
i'm confused now  smiley-confuse
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 108
Posts: 5144
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Correct. You also need a resistor between the Arduino's GPIO and the transistor's base (current limiter).
Logged

argentina
Offline Offline
Newbie
*
Karma: 0
Posts: 31
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok, this is a very noob question for sure. but wouldn't keeping the pin up draw power from it? i'm guessing not because there is no current flowing but for some reason i think that keepin it up draws current. am i wrong?
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 108
Posts: 5144
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
wouldn't keeping the pin up draw power from it?

No, not without a load on it. To let current flow you have to have two different potentials (voltages). If you connect two points, both on 5V, no current will flow although both are HIGH.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

what is the suitable transceiver model that can receive multiple transmitted data in serial at same time with minimal cost?
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 108
Posts: 5144
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Maybe it's because I'm not a native speaker but I don't understand your question.
Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Your approach will not work: it got the lower resistors all tied together.

Try to use resistors to isolate each divider pair, and switch in / out of the divider pairs with a digital pin, either on the top or on the ground.

What you will find is that you save no pin with this approach. It is just much simpler to use multiple adc pins or to use a mux to switch among them.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I have been searching through the forums, before I got here with my question. I really don't have any electronics / engineering knowledge, I'm just a programmer whom can google for things and make the wiring from the tutorials, so please don't take my question as a dumb or silly thing.

So I have my own project, where there are some sensors and electronic modules (TFT LCD) that need to use the same hardware pins like SPI hardware (pins 50-53) and TWI hardware (pins 20-21).
So based on my googleing, and this forum, I see it is possible, but how?
Should I only use a simple wiring, where all wires of these sensors go to the same pins (so like all SDA requirements goes to pin 20), and do I just have to adjust a code for this behaviour?

Like I read a sensor, write a low voltage to the pin, and then read from the other sensor? Or do I need anything else? Do you have a sample scratch, or a tutorial, where I could start with?

Thank You!
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 108
Posts: 5144
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You should have started your own thread, because your question is not related to this threads subject.

The SPI and I2C (TWI) interfaces are buses and explicitly allow multiple sensors to connected concurrently. On the SPI bus every device gets it's own SS pin (shouldn't be a problem with a Mega) while on the I2C bus every device has to have a unique address in the range 0-127. Many chips provide (an) address pin(s) for that purpose to allow several chips of the same type to be connected.

For more information you need to specify what kind of sensors you want to connect and provide links to their datasheets.
Logged

Pages: [1]   Go Up
Jump to: