3-wire Serial

Discussion of issues related specifically to writing code for native mode devices. This includes ZBasic code as well as assembly language code and C code, both inline and standalone.
Post Reply
sturgessb
Posts: 287
Joined: 25 April 2008, 6:34 AM
Location: Norwich, UK

3-wire Serial

Post by sturgessb »

Hey guys

Im going to be interfacing with this https://www.sparkfun.com/datasheets/IC/nRF2401A.pdf

And just wondering if there is 3 wire support, or do I need to bit bang it in software?

And if there are any examples of this i would greatly appreciate it.

Cheers

Ben
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: 3-wire Serial

Post by dkinzer »

sturgessb wrote:And just wondering if there is 3 wire support, or do I need to bit bang it in software?
As far as I can tell, the "three-wire interface" used by this device isn't compatible with ZBasic SPI routines which are best described a "four-wire interface".

I believe that you could use ShiftInEx() and ShiftOutEx() as building blocks to implement communication with the device.

The Arduino code for the nRF2401 may be useful, either directly or as a guide.
http://playground.arduino.cc/Interfacin ... re/Nrf2401
- Don Kinzer
sturgessb
Posts: 287
Joined: 25 April 2008, 6:34 AM
Location: Norwich, UK

Post by sturgessb »

Thanks, although porting that code over is a bit above my head, I'm rusty with this stuff now :(

I'm just trying to build a simple proximity sensor, I might see if I can do this with xbee's with the power knocked right down as they are easy to work with, I ideally want around 4ft of detection range.

Ben
stevech
Posts: 715
Joined: 22 February 2006, 20:56 PM

Post by stevech »

Inverse Square Law in RF propagation....
Double the distance to halve the (received) power.

That makes signal strength based ranging hard, with line of sight.
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Post by GTBecker »

How do you propose to use this module as a proximity detector, Ben? What do you want to detect? A passive object, like a person, or another module?
Tom
sturgessb
Posts: 287
Joined: 25 April 2008, 6:34 AM
Location: Norwich, UK

Post by sturgessb »

So yes Tom I'm thinking another active module (transmitting). I just want to know if the transmitting object has come roughly within 4ft of the detector. I was thinking of having each detectable node just continuously (every few seconds) transmitting an ID to the detector. If the detector receives that ID then we know the transmitting object is 'in range'. I don't need to know ranging info or anything like that, just a a 1 or a 0, if it close or not.

Cheers
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Post by GTBecker »

You could probably make that work, yes, with a very poor, or no, antenna.

At four feet these things can probably communicate with no proper antenna (you might even need to shield them) - but the receiver might also be susceptible to desensing by other 2.4GHz devices like 802.11, Bluetooth, microwave ovens, making the detection distance unreliable. I don't see an RSSI output or data on a quick scan of the datasheet, so valid - or no - data might be the only method, as you suggest.

Worth a try, I'd say.
Tom
sturgessb
Posts: 287
Joined: 25 April 2008, 6:34 AM
Location: Norwich, UK

Post by sturgessb »

Ill give it a go, although the xbees are physically bigger that I really want so I think ill just need to try and get that 3wire interface to the nRF2401 working.
Post Reply