Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

16 to 4

Status
Not open for further replies.
Am sure we could come up with a programmed PIC and then you just need to insert into circuit
 
Thank you ,
I am not good with PIC`s ,
I need time to learn the basic theory of PIC , but have no time ,
I`l think it over and thanks again

That's why I offered to do it for you. Once the PIC is programmed, it wouldn't be anymore difficult to use than an IC purpose built for the task. It would simply require you to follow a schematic and assemble the components.
 
with alot less parts
I was thinking along the lines of just using either 8 input pins or 16. sixteen would make for a very simple PIC program. Just poll all 16 inputs and which ever one goes LOW then display the switch number using an LCD or multi digit LED display. I oped for the LCD
wouldn't be much to add a time of switch closing routine as well?
an experienced programmer = about 20 miniutes?
 
with alot less parts
I was thinking along the lines of just using either 8 input pins or 16. sixteen would make for a very simple PIC program. Just poll all 16 inputs and which ever one goes LOW then display the switch number using an LCD or multi digit LED display. I oped for the LCD
wouldn't be much to add a time of switch closing routine as well?
an experienced programmer = about 20 miniutes?

MrDEB,

I like your idea. It's nice and simple. My idea was to have 2 PICs linked by I2C. There would be a slave placed in the room with the 16 pushbuttons. I would dedicate 8 pins to the pushbuttons and scan the pushbuttons with a 4 x 4matrix setup. For the slave I was going to use a smaller 12 or 14 pin PIC. The master PIC would be in the other room and would repeatedly ask the slave PIC (maybe once every 1 or 2 ms) via I2C to report what buttons were pushed. The master PIC would have to be a little bigger to drive the LCD display. I was also going to look into using an LCD driver IC that the master PIC could send data via I2C so I could get away with using an smaller PIC for the master as well. The 4 wire requirement of the OP would be satisfied. The 4 wires would be:

VDD
VSS
SDA
SCL
 
only need 2 wires

the schmitt trigger inputs to prevent switch bounce as the switches are a distance away. A cmos version? unless 74C14
one PIC, 16 N/O pushbuttons, 3-7416's, a 5 pin header (not really needed but?, about 20 resistors, a diode and a well regulated 5volt power supply. A wall wart would do the deed but use a regulator anyway.
whole setup less enclosures about $20
the LCD could be a 16 x 2 =$6
the PIC chip can be had for FREE or under $5
a perf board unless a custom pcboard (am in process of designing very similar for a tempeature sensing unit)
The hard part is the 40 pins to deal with on a perf board. much easier using a pc board with header plugs to keep things straight.
Lets see if I got this right=16 seperate switches in 16 different locations. two wires to each switch.
am contemplating a one wire scheem. I wonder if Maxium has such a beast?
 

Attachments

  • 16 to 4 switches.PNG
    16 to 4 switches.PNG
    42.3 KB · Views: 163
A one wire setup would really simplify this whole scheme
**broken link removed**
look at
DS1904 RTC ibutton
DS2401
DS2417
the press of a button and you have a time stamp. At least thats how I read it.
 
the schmitt trigger inputs to prevent switch bounce as the switches are a distance away. A cmos version? unless 74C14
one PIC, 16 N/O pushbuttons, 3-7416's, a 5 pin header (not really needed but?, about 20 resistors, a diode and a well regulated 5volt power supply. A wall wart would do the deed but use a regulator anyway.
whole setup less enclosures about $20
the LCD could be a 16 x 2 =$6
the PIC chip can be had for FREE or under $5
a perf board unless a custom pcboard (am in process of designing very similar for a tempeature sensing unit)
The hard part is the 40 pins to deal with on a perf board. much easier using a pc board with header plugs to keep things straight.
Lets see if I got this right=16 seperate switches in 16 different locations. two wires to each switch.
am contemplating a one wire scheem. I wonder if Maxium has such a beast?

2 wires per switch x 16 switches would result in 32 wires between the rooms. Even 1 wire per switch would be 16. I thought only 4 were allowed. Am I missing something here because it seems like your scheme will not satisfy the OP's requirement.
 
I might be wrong but if he uses a one wire set up then all the switches can be bussed on one wire (plus Vcc and Grd.
depends on amount of money the op wants to spend.
another solution is to use diodes or gates to make ones own 4 bit coded switches
switch 1 = 1000, switch two = 0100 etc. then the problem comes in if two switches are closed at the same time = really top level confusion for sure.
another solution would be DTMF (think telephone)
this might even be the easiest to implement??
using ONLY 4 wires --can be done just how much cost.
 
you could also do it with a diode array. a bit of a complex solution, but it works. it would require 32 diodes.
 
I might be wrong but if he uses a one wire set up then all the switches can be bussed on one wire (plus Vcc and Grd.
depends on amount of money the op wants to spend.
another solution is to use diodes or gates to make ones own 4 bit coded switches
switch 1 = 1000, switch two = 0100 etc. then the problem comes in if two switches are closed at the same time = really top level confusion for sure.
another solution would be DTMF (think telephone)
this might even be the easiest to implement??
using ONLY 4 wires --can be done just how much cost.

I'm still not really understanding your idea. You could use 4 wires each as one bit but that wouldn't handle multiple pushbuttons simultaneously and you would require a seperate power supply in the other room. This is what I had in mind:

PIC_Master_Slave_PBs.PNG

There's 2 PICs each less than $2, 8 resistors mayby .05 each, the LCD, and the pushbuttons. In the finished circuit you'd need a few caps here and there and maybe some pull up resistors on the I2C lines but that's about it.
 
I'm still not really understanding your idea. You could use 4 wires each as one bit but that wouldn't handle multiple pushbuttons simultaneously and you would require a seperate power supply in the other room. This is what I had in mind:

View attachment 38149

There's 2 PICs each less than $2, 8 resistors mayby .05 each, the LCD, and the pushbuttons. In the finished circuit you'd need a few caps here and there and maybe some pull up resistors on the I2C lines but that's about it.

in the original post it wasn't stated you wanted to monitor simultaneous button presses.
 
I didn't say that it was a requirement but why not if you had the capability and it was simply a matter of a few extra lines of code. The only requirement I recall was to use only 4 wires in between rooms. This does that.
 
...
I am not good with PIC`s ,
...

Oh good, then you will appreciate my solution: Two wires and 16 1% resistors...
 

Attachments

  • TwoWire.png
    TwoWire.png
    13.4 KB · Views: 135
but I limit on amount of wires , can I use only 4 wires (for data) and send data though .
Does the 4 wires include ground? If so, a 16 to 4 encoder won't work as you'll need 5 wires in total. You could link a couple of shift registers and send the data serially with 4 wires (clock, data, reset & ground). but, as mentioned earlier, a couple of PICs would work the best because you can add error and fault correction easily.
 
Thank you guys ,

As I said from the first post , it is just a part of my project ,
And you re right two Pic`s `d do the job, but I have some electronic skill , but dont know where to start with PIC`s
I need some time and look into it , I will keep u in touch ,
 
several problems
in post #30 by vn147 I count 8 wires to the switches
Post #33 by mikemi if more than one switch is pressed then you have two or more resistors in parallel which could cause a false switch indicator.
best solution is either DTMF or 1wire setup by Maxium. these as I see it are the only two reliable solutions that meet the 4 wire requirement.
 
...
Post #33 by mikemi if more than one switch is pressed then you have two or more resistors in parallel which could cause a false switch indicator...

Not with 1% resistors. There will be sufficient resolution to detect pairs vs singles. Besides, the OP never specified the need to sort out multiple buttons. Besides, I posted this somewhat tongue-in-cheek, just to get folks thinking...
 
I had a similar idea but you still must deal with possable parallel resistors
good idea for sure. maybe a diode to isolate each resistor??
 
several problems
in post #30 by vn147 I count 8 wires to the switches

Yes, there are 8 wires to the switches, but only 4 wires that run in between rooms. I interpretted the 4 wire requirement from the OP's original post to only apply to the wires that run in between rooms. The Slave MCU, resistors, and pushbuttons will all be in the other room so the only wires running in between rooms will be VDD, VSS, SCL, and SDA. The original post wasn't really specific so if my interpretation is not correct the OP can clarify. It doesn't really matter I suppose as the OP seems dead set on over complicating this and not using PICs.
 
Last edited:
this won't be the first time someone wants a circuit then overly complicates matters
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top