Four switch positions, two AVR inputs

Go To Last Post
21 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK, Sparkys--

Imagine I have a 4-position selector switch. At each position one set of dry contacts is made.

But I have only two AVR inputs, so I want the four positions 1-of-4 to be turned into binary 00-01-10-11. (Actually, I only have two fully-protected and conditioned "channels" on my board into two AVR inputs.)

There has to be some way to use diodes and jumpers and such to achieve this. But my head hurts after a while thinking about it...

If it helps, the contacts can be NO or NC or a mix.

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Enable pull-ups on both i/p's.

Use four diodes two anodes to i/p A, two anodes to i/p B.

switch position 1. o/c                         reads 11
switch position 2. one cathode of A pair.      reads 01
switch position 3. one cathode of B pair       reads 10
switch position 4. to both remaining cathodes  reads 00

Did you see the link to the DB tractors?

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Did you see the link to the DB tractors?

Yep. Not many Farmalls in the parade, but lots of old-reliables.

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The Cratfield run was on a really miserable day. From memory there were about six or eight Farmalls. You find vintage Farmalls throughout the country.

Did you ever have David Brown's in the U.S.? There are an awful lot in Norfolk/Suffolk.
I cannot really picture Wisconsin farmers driving tractors with pink ribbons!

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

The Cratfield run was on a really miserable day.

I noticed that. :)

Quote:

Did you ever have David Brown's in the U.S.?

Yes, there are some. Nowadays with the consolidation of the industry there are really only a few brands left in the Western world. In the Midwest USA it seems many utility tractors are now from the Far East--Kubota and the like.

Many/most of the old tractor brands were made in the Midwest USA. So a short list of commonly-seen colors circa 1960:

Allis-Chalmers orange -- Milwaukee WI (actually West Allis)
International Harvester/Farmall red -- IL
John Deere green -- Quad Cities
Minneapolis-Moline yellow -- Minnesota, Illinois
Massey-Harris red -- Ontario Canada?

Ford-Ferguson gray -- now, >>this<< is going to be pertinent.
http://en.wikipedia.org/wiki/Fer...
David Brown+Ferguson in Britain; Henry Ford+Ferguson in the US
Thus the great similarity to the many low gray (grey?) tractors in your parade and the ubiquitous low gray Ford utilities in my area.

Ford gray -- Ford brand from 1946. Michigan. "8N ... the most popular farm tractor of all time in North America."

Case orange -- Racine, WI
Oliver green -- IN, IA.

There were a few others such as Montgomery Wards but they were exceptions in my area. Circa 1960 farms were small (compared to now), and 5-10 farms/square mile each with one or two of the tractor brands listed above there was a lot of exposure. by that time generally the modern post-war tractors such as the Farmall letter-series A/C/H/M, Allis WD, etc. were the mainstream. I have little exposure to models pre-war that really look antique like Farmall F20.

My father bought a new Farmall 300 in 1955 that is still running today, and looks great after a repaint a few years ago. Driving in this area it is not unusual to see Farmall H/M in obvious daily use. As these were last produced circa 1955 that is 50+ years.

You would like our local country fair that has a tractor pulling contest. On one of the days it is for "classic" models as we are discussing--I think it is pre-1960.

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh, yeah, why I originally came back: The description that you gave for the diode circuit would indeed work fine with one side of the switches grounded and the other pulled up at A/B. However, A/B are inputs to signal conditioning to opto to AVR. The normal use is for +V (24VDC or 120VAC) "active high", and a pull-down as part ocf the conditioning voltage divider to give a low when not made.

+24VDC is available for the common side of the switches. Do you have an alternate configuration of the diodes for "active high"?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, you just invert the logic. You need external pull-down resistors, with the switch common at your 24V. The diode anodes go to the switch positions and cathodes to the A, B. You obviously divide the 24V down to 5V.

I still reckon that active-low is easier to condition and implement. Your optos can switch to GND. You will probably have a low-pass filter on the Live side of the opto.

In the 60's UK, farms were small. We ran several MF135's and a 'big' MF188. Massey-Ferguson, Fordson, International Harvester and John Deere were the big name brands. David Brown, Leyland etc were smaller. Very few European tractors were ever seen.

My local MF dealer used to shift 30 tractors a month. Nowadays those small dealers have gone but the county-wide dealers are lucky to shift 30 tractors in a year. OTOH each tractor is bigger and more expensive.

As you have noted, tractor manufacturers have amalgamated and the colours have varied. Incidentally New Holland - Ford - FiatAgri have great difficulty with the Fiat name. And they stick with Fordson Blue
while calling themselves New Holland.
I-H is branded as Case.

I do not know what happened in the U.S. As extra power was needed, 2-wheel drive becomes impractical. In the UK several small companies like County, Roadless, TW 'converted' Ford 2-wheel drive tractors to 4-wheel drive. Typically 4 equal size wheels with a rigid frame.

The regular manufacturers now produce 4-wheel drive as standard. The largest tractors being articulated or half-track. County Tractors and their ilk died a death in the 1980's.

You still see 35-70HP tractors doing 'small' jobs and they sell for serious money. A larger 200-300HP tractor does 10,000 hours on an arable farm and sells for peanuts.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You could do without diodes if you had dual 1-of-4 selector. Then you can select the logic state for both pins in all 4 positions. I don't know what kind of selector you have, but many rotary switches are available in different configurations.

Since you have optos and perhaps filtering, it poses a nice debounce problem - when a change is seen, you must wait until both lines have been stable for long enough (10ms perhaps) before you signal the new state to other parts of the software.

Normally open or normally connected, you may have glitches between states, so do hope that someone does not keep the selector too long in the middle of two states.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

And about the tractor talk

David Brown is called Case in US.

When I was a kid I had a McCormick D 320 the hood showed it was a International, and in us it would have been called a farmall.

Now I just have an old MF65 and a Balarus MTZ70.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

When I was a kid I had a McCormick D 320

Hmmm--that would be a new one on me. Perhaps 230? That model shows up at http://www.tractordata.com/farm-...

The 230 looks a lot like a SuperC. The 300/400 were a step up to more modern arrangement compared to the letter series H/M. They "sat better". Live PTO and live hydraulics built-in, and the TA dropped about a gear without clutching or stopping. (IMO it should have been more like 1/2 gear to get ~8 usable forward speeds but what do I know.)

Back on-topic. ;) The selector switch will be wired to the same input board that takes "field" inputs, that in this app are active-high/+V for make and float for break. Thus, the signal conditioning with a pulldown.

The IDEC HW series is selected because of the sealed nature at a reasonable cost. The Contact arrangement is via modular switch blocks and not the more common "wafer". I'm open to other fully-sealed assemblies at the same price point--US$10-20. I haven't found any. Most preferably 22mm 'cause the stainless cases are punched for that.
http://www.idec.com/language/eng...

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

Last Edited: Fri. Jul 30, 2010 - 03:28 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Lee isn't your problem crying out for the switched resistor ladder and one ADC pin solution? In this case there's no issue about multiple-selections ;-)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Lee isn't your problem crying out for the switched resistor ladder and one ADC pin solution? In this case there's no issue about multiple-selections

No, because I don't want to go directly into the AVR pins. Not in this case. Family-of-products thing. Various of the IDEC HW-family operators are used. Just ended up "one input short" in this case.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
The IDEC HW series is selected because of the sealed nature at a reasonable cost. The Contact arrangement is via modular switch blocks and not the more common "wafer". I'm open to other fully-sealed assemblies at the same price point--US$10-20. I haven't found any. Most preferably 22mm 'cause the stainless cases are punched for that.
http://www.idec.com/language/eng... ... hure05.pdf

They look quite nicely made. I used to use the Telemecanique range. They are nice and shiny when new. Not so special in a hostile environment. The screw clamp terminals were sheradised steel. Do you know what cowshit does to sheradised steel?

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

It was one like this
http://commons.wikimedia.org/wik... ... _D-320.jpg

Aaah--a bit of digging:
http://www.tractordata.com/td/00...

[That site is fun!]

I'd never seen Farmall/IH of that era with a flat grille, yet the styling isn't the same as later e.g. 560 series with the flat grill. The limited data in the link above does make sense, though. The D is indeed Diesel as I guessed, and the model line(s) were made in Germany. So it makes sense that I would not have seen any in the US.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The sad part is that my father sold it for about $80, very rusty, the only good part was that it was sold to a museum and not just old scrap.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Lee,
Is this a production product or a 'few of it's kind'?
If it is a small run, I can program a few small PLD's for you and ship them. Four pins for the inputs, two pins for outputs to the AVR, and another pin that selects NO or NC.

Let me know. It wont take me much time to fire one off.

Jim

Edit:
The NO/NC pin select allows you to use whatever selector rotary you want.

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK OK OK OK, I just had another brain fart.......

Lee,
Why not use a tiny avr to read the four inputs and create the corresponding two line output to the second AVR??

you can use the internal oscillator for clocking as freqency stability does not seem to be an issue.

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

OK OK OK OK, I just had another brain fart.......

Lee,
Why not use a tiny avr to read the four inputs and create the corresponding two line output to the second AVR??


I already >>have<< an input board (with an AVR) with fully-conditioned input channels. See above, interspersed with the tractor talk. ;) I'm just ending up one short in this app. If I can make a $1 addition of diodes for an admittedly trivial excitation job that isn't directly subject to the real world, then it beats re-laying out the board, with a larger connector, and etc.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Not sure if this helps. Just connect the switch net to either A, B, C or D.

I've put the opto in, you could run this opto low or high side into the AVR depending on what you prefer.

Can't offer much tractor advice, John Deere is popular in the Granite Belt in Australia so I heard.

oddbudman

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

theusch wrote:
... interspersed with the tractor talk.
Is that like talking dirty ... never knew what it meant myself. :lol:

Ross McKenzie ValuSoft Melbourne Australia