Wireless switch data transfer

OK I'm really new to this, but have plenty of programming and electronics experience, just not with microcontrollers - but they seemed a good fit.

Project concept is a transmitter that receives inputs from several switches - they're simple SPST NO so they can be considered analog or digital depending on how they get wired up. At least 4 channels would be nice, more even better.

The switch states are transmitted via some form of wireless comms - needs to be reasonably secure and will be in an RF noisy environment.

The receiver(s) listen to the switch state transmission and trigger a LED based on which switch state they are a supposed to be listening to.

In theory, only one switch will ever be on at once, though it is possible this may not be the case in special circumstances.

Transmitter can easily be powered, receivers will need to work off a battery ideally.

In the best of worlds it should be possible to configure any receiver to work with any transmitter, and any receiver to respond to any switch on said transmitter.

The problem I have is choosing the most appropriate products for the job. While it would be nice to keep the cost down, this isn't a huge issue since anything I do with Arduino will be cheaper than any commercial equivalent I have found (4 chan TX $1100, RX $650 each!)

It seemed like I could use a Micro with a wireless proto shield and XBee modules. They have PAN numbers which will help with network security and running more than one system together. I can see how to program the unit to transmit the data and the receivers to decode it and respond appropriately, but how about configuration? Will I need to attach the units to a PC and "program" their channel number, or can I reasonably easily hook up some buttons and a display to make them locally addressable?

Anyone with more experience like to weigh in here????

Thanks in advance,

Andy

It can be done easily with arduino, but you havn't said the range?

You could do it cheapest with HT12E and HT12D chips and a cheapy ( such as HOPE ? ) transmitters and receivers.

Arduino and VirtualWire library would be good.

What range do you require?

You could look at the nRF24L01+ 2.4Ghz radios. These come in a 'low power', track antenna, version for about £1.32 each and also a 'high power', external antenna, version for about £7.50 each.

You can use them with the MiRF library, or the NRF24 and NRF24Network libraries from maniacbug. Used with the NRF24 libraries you give them Node addresses similar to the XBee, but they cost a fraction of the price. Data rate is up to 2Mbs.

they're simple SPST NO so they can be considered analog or digital depending on how they get wired up.

How would you wire the switch to detect 1/4 pressed, and distinguish that from 0.275 pressed?

OK, first thanks for the replies - you're right I forgot to mention range, just large room size - 100-200' that's why I thought the XBee would be OK. These rooms would have no obstructions.

As for PaulS -

Do you mean how do you detect .25" as opposed to .275" (seconds) or do you mean partially pressed? Not sure how this would be unless the button was truly analog - in other words it was capable of detecting how far it had traveled, probably by varying resistance.... That would require a voltage to be read across the switch.

We'll assume it's the other - detect button pushed, save current time, wait until button released, compare current time with saved time, determine how long it has been, act based on rules for short press/long press etc.

I can't give you the code snippet, because honestly even though I am a programmer, I haven't done anything on arduino yet.

I'm looking forward to learning.

100 - 200 ' , 70 meters range is easy if you say the Txs will be powered as this implies static and can have an antenna ( as opposed to keyfob type devices )

I have used the Radiometrix TX2 and RX2 ( 433 MHz ) for years with over 200 meters range if both have a 17cm whip antenna. OK I use them outdoors, but 70m should be nothing indoors.

I am now switching to the cheap RFM22B transceivers which have much bigger range, and can be configured as a network or self routing mesh, like the Xbee. ( its just getting my mind configured thats the hard part ! there is a RF22 library with examples of using them from Simplex, right up to mesh )

Oh yes, definitely a static device for the TX, and an antenna will be no prob, though I will prob use a rubber whip to keep it looking less like somebody's amateur radio setup and a bit more professional. Also, that means plenty of TX power available. The receivers are completely simplex - no readback of any sort, so they just have to be able to hear the signal over the noise.

Thanks for the pointers.

though I will prob use a rubber whip to keep it looking less like somebody's amateur radio setup and a bit more professional.

I am no expert on RF ( I hate RF more than I hate Facebook, but have to use both , one for projects, and the other if I want the Grandchildren to know we are still alive :slight_smile: but I found the rubber duck type 433 whips to be poor compared to a bit of wire.

Heres my " professional " whip, quarter wave length of springy curtain wire with a wire up the middle, a bit of heatshrink, and a rubber end cap.
Heath Robinson's spirit lives on !

Do you mean how do you detect .25" as opposed to .275" (seconds) or do you mean partially pressed? Not sure how this would be unless the button was truly analog - in other words it was capable of detecting how far it had traveled, probably by varying resistance.... That would require a voltage to be read across the switch.

No. You were the one that suggested that "they can be considered analog or digital depending on how they get wired up.".

I'm wondering how you wire a switch to be an analog device? Can you wire it to detect a quarter press vs. a half press?

Do you have to use fuzzy logic for that?

Yup, Boffin that's exactly what I meant! Nice unit.

Paul - no I see what you mean. You can wire a switch to an analog or digital input pin - in digital it will detect the transition from 0 to 1 or vice verse, as an analog input it would detect the voltage change that's all I meant - just means you can use whatever input isn't being used for something else.

OK as for detecting how much you pushed the switch, there are switches that detect either how far they are pushed, or how hard.

For example, camera shutter buttons on digital cameras and smartphones normally have a half pressed and fully pressed position, but that's just two sets of contacts. Keys on an electronic keyboard can sense how hard or how fast you push them so they can accurately mimic how you play piano keys (and generate the MIDI value for the note which includes this data).

There are switches that are designed to measure distance of travel - do you really want me to find you one??? :wink: