Pages: [1] 2   Go Down
Author Topic: electronics rule broken?  (Read 1374 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

Have been trying to learn the problem with three inputs at once. Beyond the programming, there is an electrical problem I must be creating.
So I want to use three sonic sensors that take care of the open and closed situation all by themselves. When something is in front of them the circuit closes until that something moves away and then it opens. No big deal. One input is no problem for me and arduino. Two also worked fine. Well not exactly fine, there were some floating issues. I have read all about buttons but have not tried the special libraries yet. Have been really having trouble with three inputs. I finally got it working totally clean using a breadboard and DPDT switches in place of the sensors. Problem is that they only work with the switches in a particular order and I don't know why. I am putting up a picture of the breadboard swithch setup that only works in a particular order when it goes into the arduino. I have checked that 4.5+v is flowing when the switch is in the on position on all three at once. Arduino only sees three when they are in a particular order. I have confirmed this with Serial print and Toolduino from Nootropic design. This is the order that works.
What have I done that creates this problem and what can I do to avoid it?


Thanks
Don
Logged

Global Moderator
Online Online
Brattain Member
*****
Karma: 485
Posts: 18800
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I am putting up a picture of the breadboard swithch setup that only works in a particular order when it goes into the arduino.

I don't see that.

I suggest you post your code too, in code tags.

You can do that by hitting the # button above the posting area.
Logged


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

I'll try posting the picture again

(tags fixed by moderator - didn't help it seems)
« Last Edit: July 10, 2012, 10:06:52 pm by CrossRoads » Logged

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

The help section of the forums is under repair where do I put the url int
Here is the url
http://www.flickr.com/photos/22175266@N03/7546543558/in/photostream
Logged

Global Moderator
Online Online
Brattain Member
*****
Karma: 485
Posts: 18800
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The help section of the forums is under repair where do I put the url int

Oh yeah, it's been under repair for about two years now.

Quote
... and come back in a minute we will be done, for sure!.

No. Not a minute.
Logged


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

The code would just be the serial print commands with the inputs serial printing whether they are high or low.
Like I said it does it using no code at all when you check the arduino inputs with toolduino.
It is basically a troubleshooting program for arduino boards. Free and very helpful.
If you go to Nootropic design  look for toolduino and it will explain what it does and how it does it.


Thanks
Don
Logged

Global Moderator
Online Online
Brattain Member
*****
Karma: 485
Posts: 18800
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Why are you connecting the switches to both 5V and 3.3V? And why two resistors per switch?
Logged


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

Whoops, that is just a drawing error. It is connected to 5v and ground.
Here is the breadboard corrected with resistor values and a picture from a button tutorial from Adafruit.


* TripSwitch.jpg (53.15 KB, 377x417 - viewed 19 times.)

* from adafruit.jpg (88.55 KB, 751x450 - viewed 20 times.)
Logged

Show Your Work
Offline Offline
Edison Member
*
Karma: 14
Posts: 1098
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Assuming those are SPDT switches, and they sure appear to be, why not just attach one pole of each to +0V and the other to +5V and the common of each to a digital pin on the Arduino.  Set the pins as input and poll them.  When a switch is set to the +5V pole it should register on the pin as HIGH and when it is set to the +0V pole it should register as LOW.  KISS.

Yes, you can attach resistors, but the Arduino isn't going to pull significant power anyway.

SPDT:  http://en.wikipedia.org/wiki/Switch#Contact_terminology

What is going on with the Adafruit demo is different.  It is a SPST switch that is being pulled up to +5V through a 10k resistor when the switch is open and is draining that +5V to ground (thus is looks like +0V to the Arduino) when the switch is closed.  SPDT is easier to implement, you don't need to pull up or pull down although there may be a middle position on the switch that will connect neither pole to the Arduino and in that position the pin will float and might give either value.  But for this, a simple project, I would just connect it as I said, that is how I started out.

One last edit.  If you don't have this, you certainly should buy one:

http://www.amazon.com/Elenco-Electronics-LP-560-Logic-Probe/dp/B000Z9HAP4

This will tell you if a pin or wire or whatever is set high or low or has no signal.  I bet if you checked the Arduino pins  and connections along your circuit with a logic probe the circuit / Arduino pins would not be doing what you think they are doing and it would be a huge hint to let you know exactly what is wrong.  I suck at soldering.  Whenever I solder something I go over it with a logic probe before I start plugging expensive parts into my sockets.
« Last Edit: July 10, 2012, 10:57:54 pm by JoeN » Logged

I have only come here seeking knowledge. Things they would not teach me of in college.

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 626
Posts: 34183
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Assuming those are SPDT switches, and they sure appear to be, why not just attach one pole of each to +0V and the other to +5V and the common of each to a digital pin on the Arduino.
Because if they are not a break before make type you short out your power supply every time you change it over.
Logged

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

Thanks for the replies. In answer to your switch connection, I am using something to simulate the closing of a relay. The two wires from the switch are the same as N.O. contacts of a relay (attached to a sensor). When the relay closes it is like me moving the switch to connect both wires like the relay would.
The 4.5+v is definitely getting to the arduino. They all work individually but the arduino is not recognizing them unless they are is a particular order.
Stated another way, the arduino input pins don't change they are always 4, 5, and 11. If switch 1 and 2 (left to right) are in 4, and 5, then 5 doesn't go high. If switch 1 goes to 4, switch 2 goes to 11, and switch 3 goes to 5 they all go high when all the switches are closed.
So if the switches are next to each other on the breadboard they can't be next to each other in the arduino or one of the pins won't go high. This is why I thought there was some rule broken. Something rule that would lead to the switches being better isolated from each other.

The logic probe looks like a good tool to have around, thanks for the suggestion.
Toolduino gets the same job done but needs a computer. To use it you run the StandardFirmata sketch then startup Toolduino. It then gives you a graphic representation of the arduino and what is happening to all of the pins. Toolduino also shows that all three pins are not going high unless the pins have a particular switch in them. This is how I figured out that there was a way to get all three to work at the same time.

Thanks for the help and ideas

Don
Logged

Show Your Work
Offline Offline
Edison Member
*
Karma: 14
Posts: 1098
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Assuming those are SPDT switches, and they sure appear to be, why not just attach one pole of each to +0V and the other to +5V and the common of each to a digital pin on the Arduino.
Because if they are not a break before make type you short out your power supply every time you change it over.

Thank you for that bit of insight.  Is there any way to know if a SPDT switch is break before make or make before break?

The ones that I have used in my little breadboard projects are these:

http://www.amazon.com/gp/product/B006S21U2G/ref=oh_details_o00_s00_i03

(yes, I know I got ripped off, this was the second thing I bought after http://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_84961_-1 and before I even got an Arduino and got wise to how to more effectively spend my money which can be summed up as "CHINA+SAMPLES". smiley)

Have I been just getting lucky with these?  Mostly I never use them anymore, I have found SPST with a 10K pullup to be preferable anyway.
Logged

I have only come here seeking knowledge. Things they would not teach me of in college.

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 626
Posts: 34183
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Is there any way to know if a SPDT switch is break before make or make before break?
It will say it in the data sheet. Mind you that Amazon link has no data sheet associated with it so you would have to track down the manufacturers site or ask them the question.
Logged

Global Moderator
Online Online
Brattain Member
*****
Karma: 485
Posts: 18800
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The code would just be the serial print commands with the inputs serial printing whether they are high or low.

I'll try again. Your code?

Never mind what it "would be". What is it?
Logged


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

Sorry I am having such a problem making my situation clear. Have tried to explain to the best of my ability. My code works fine. This is the General Electronics section and I am only asking a question about the electronics. In the very beginning I stated that I am using sonic sensors with Normally Open relays in them. Since the drawing program used doesn't include sonic sensors I used those switches. This part seems to have been missed or I screwed up my description in another way.
I am using three relays as the switches. These relays do not include arduinos in any way. The switches shown in the picture are representations of the relays. Didn't know what else to use and didn't think it mattered that much as long as the message said they were relays.
Anyway seems the pictures have disappeared. I will repost the one that counts with a slight redraw.

Thanks
Don


* TripRelay.jpg (54.24 KB, 374x419 - viewed 23 times.)
Logged

Pages: [1] 2   Go Up
Jump to: