Qs: Simple wireless communication over a 3 meter range

Hi,

I’m new to this forum and to the electronics/RF communications world.

I have a few questions and I hope you can help me get some answers or at least point me in the right direction. I know it’s no good that my first post is a question, but rest assured that I will be giving back to the community in the future.

My questions:

What recommendations do you have for beginners in the RF/Wireless communication

field (online videos, dvds, online tutorials, books) ?

What technologies are available to connect two devices over a 3 meter range (no more than 3 meters)? (assume minimal data is going to be sent over the connection, such as an ID no )

Can RFID do the above?

Do you recommend any starters kits, that provide step-by-step tutorials on how to build devices that connect over a small range ( 2 to 5 meters)?

Thanks in advance,

Thaer

What is your experience with electronics, microcontrollers etc? Do you have an existing piece of hardware you’re trying to add a wireless capability to? Is the data link bi-directional? What data rate / repetition rate?

I don’t think RFID will be easy at distances of several meters - normally it is limited to a few centimeters (at least with passive tags). With active receivers the distance can be greater, but such modules seem to be harder to find.

MichaelN:
What is your experience with electronics, microcontrollers etc? Do you have an existing piece of hardware you’re trying to add a wireless capability to? Is the data link bi-directional? What data rate / repetition rate?

I don’t think RFID will be easy at distances of several meters - normally it is limited to a few centimeters (at least with passive tags). With active receivers the distance can be greater, but such modules seem to be harder to find.

Thanks Micheal for your reply

  1. I have no previous experience with electronics but I’m reading online articles and watching tutorials on YouTube daily.

  2. No, I don’t want to add wireless capabilities to an existing piece of hardware, but I would like to make two pieces of hardware that are really small and communicate to each other one thing -their IDs- (Over a 3 meter range).

  3. Preferably.

  4. If you mean by that, what intervals are they going to be communicating at? Every 3 seconds. (I hope I’m making sense)

Thank you in advance

PS. I just found this cute little piece of hardware ([HERE) on SparkFun, can this be of any use to me? What do you do with a piece like this?

–](RFM22B-S2 SMD Wireless Transceiver - 434MHz - WRL-10153 - SparkFun Electronics)

Thaer:

PS. I just found this cute little piece of hardware ([HERE) on SparkFun, can this be of any use to me? What do you do with a piece like this?[/quote]
That’s a nice transceiver, but could be “overkill” for your application. You’d need to provide a microcontroller to drive it (I suggest Arduino or Picaxe if you’re a beginner), as well as an antenna and power. Normally you’d make a PCB to connect everything together, but you could mount it on Veroboard / stripboard.

You might like to look at the Nordic FOB, since it contains a short-range transceiver as well as buttons and battery in a neat key fob:

http://www.sparkfun.com/products/8602

You’d presumably change the code so it wakes up for a very short time (perhaps 10’s of milliseconds) every 5 seconds, then goes back to sleep if it doesn’t receive any data in that time. You need to do this kind of thing to preserve battery life.

If you go this way, you’d need to get an in-circuit AVR programmer such as Atmel’s “AVR ISP” (there are plenty of clones available cheaply online). Use AVRStudio to write the code in C, compile and program the fob. If you don’t know C, I suggest you learn!](RFM22B-S2 SMD Wireless Transceiver - 434MHz - WRL-10153 - SparkFun Electronics)

JeeNode from JeeLabs.

http://jeelabs.com/products/jeenode

Peruse his website, and your head is likely to explode.

As a newbie you need to learn a lot before you even get to RF, but 2 jeenodes will get you from A to B with a lot of patience and work. The RF software could be better, and I dislike his use of ports and the ports library, but it does work.

MichaelN:

Thaer:

PS. I just found this cute little piece of hardware ([HERE) on SparkFun, can this be of any use to me? What do you do with a piece like this?[/quote]
That’s a nice transceiver, but could be “overkill” for your application. You’d need to provide a microcontroller to drive it (I suggest Arduino or Picaxe if you’re a beginner), as well as an antenna and power. Normally you’d make a PCB to connect everything together, but you could mount it on Veroboard / stripboard.

You might like to look at the Nordic FOB, since it contains a short-range transceiver as well as buttons and battery in a neat key fob:

http://www.sparkfun.com/products/8602

You’d presumably change the code so it wakes up for a very short time (perhaps 10’s of milliseconds) every 5 seconds, then goes back to sleep if it doesn’t receive any data in that time. You need to do this kind of thing to preserve battery life.

If you go this way, you’d need to get an in-circuit AVR programmer such as Atmel’s “AVR ISP” (there are plenty of clones available cheaply online). Use AVRStudio to write the code in C, compile and program the fob. If you don’t know C, I suggest you learn![/quote]

I forgot to mention this, the device I want to build has to be really small and portable and it has to run on batteries.

So having a micro controller, an antenna and a USB connection in a permanent way will not work for what I’m trying to do.

Thank you again Micheal for the great suggestion. This is exactly what I’m looking for. The only problem is it has a 100ft range which is too wide. Can I lower the range on this device to 3 meters?

Great idea. I will look into it when I get to that stage in the process.

I looked up the AVR ISP and it came up with a whole bunch of them on ([THIS PAGE). Which one fits the Nordic FOB best? Does SparkFun offer any AVR ISP (I’m falling in love with this website quickly)?

I do not know much C, but I write VB and JavaScript well. I’m guessing VB is of no use here? I will learn C no problem.

Do I need to get two FOBs to make them connect to each other?

motopic:
JeeNode from JeeLabs.

http://jeelabs.com/products/jeenode

Peruse his website, and your head is likely to explode.

As a newbie you need to learn a lot before you even get to RF, but 2 jeenodes will get you from A to B with a lot of patience and work. The RF software could be better, and I dislike his use of ports and the ports library, but it does work.

Thanks Motopic, I’ll definitely check it out

PS. Just a little contribution, I found this channel on YouTube which has tutorials on using Arduino for beginners ([HERE).](http://www.youtube.com/user/sciguy14)](http://www.optimal-microsystems.com/store/index.php?cPath=22&gclid=CLLvrcyr9KcCFYhM2god6DKzcQ)](RFM22B-S2 SMD Wireless Transceiver - 434MHz - WRL-10153 - SparkFun Electronics)

MichaelN:
You might like to look at the Nordic FOB, since it contains a short-range transceiver as well as buttons and battery in a neat key fob:

http://www.sparkfun.com/products/8602

Thaer:
This is exactly what I’m looking for. The only problem is it has a 100ft range which is too wide. Can I lower the range on this device to 3 meters?

The transmit power of the fob can be adjusted in software, so this is no problem. See the datasheet for the nRF24L01 wireless chip for more details.

MichaelN:
If you go this way, you’d need to get an in-circuit AVR programmer such as Atmel’s “AVR ISP” (there are plenty of clones available cheaply online). Use AVRStudio to write the code in C, compile and program the fob. If you don’t know C, I suggest you learn!

Thaer:
I looked up the AVR ISP and it came up with a whole bunch of them on ([THIS PAGE). Which one fits the Nordic FOB best? Does SparkFun offer any AVR ISP (I’m falling in love with this website quickly)?[/quote]
Either of these should do the job:

http://www.optimal-microsystems.com/sto … 0dead4060c

http://www.optimal-microsystems.com/sto … 0dead4060c

Sparkfun has some suitable programmers, eg:

http://www.sparkfun.com/products/8702

If you’re on a budget, you could get one of these, but I don’t think it works in AVRStudio (ie, you’ll need “AVR Dude” or “Pony Prog”):

http://www.sparkfun.com/products/9

If it was me I’d probably get programmer on ebay, such as this:

http://cgi.ebay.com/Mini-AVRISP-Atmel-S … 19c3a50c56

Thaer:
I do not know much C, but I write VB and JavaScript well. I’m guessing VB is of no use here? I will learn C no problem.

The fact that you have programming experience will I'm sure be very useful in learning C, although the languages are fairly different. The main difference (compared to high-level programming in VB) will be that with embedded programming, you have to do more of the "low level" work yourself to make the hardware function. This often means spending time reading microcontroller datasheets to figure out exactly which registers to use, although there are a lot of pre-written C libraries out there.

Thaer:
Do I need to get two FOBs to make them connect to each other?

Um, yes - if you want them to talk you'll need more than one. :)

As I hinted at earlier, your biggest challenge will probably be coming up with a protocol that minimises battery drain - they can’t really be “awake” (listening) all the time, or battery life won’t be very good.](http://www.optimal-microsystems.com/store/index.php?cPath=22&gclid=CLLvrcyr9KcCFYhM2god6DKzcQ)

So, the things I need to buy are:

2 x Nordic FOB

1 x Atmel STK500 AVR ISP programmer USB

?

Do I need to buy some sort of pins to connect the programmer to the FOB (I dont see any pins or sockets on the FOB)?

Does the programmer require any special drivers or set up?

What software do I need to program the FOB (Write the C code, and compile it)?

Are there any other electronics, hardware, tools or software that I need to buy?

Where can I learn electronics C programming? Are there any simulator software or do I need to have the FOB and compile the program every time to test it?

Why would coming up with the protocol be the hardest part? (I just want to see what I’m getting myself into, but I will work on that when I get to that stage)

I bought a copy of Short-range Wireless Communication: Fundamentals of RF System Design and Application by Alan Bensky. Do you recommend any other books for beginners?

Thanks in advance, your help is greatly appreciated!

Edit: I need the AVR Studio software. Right? I already downloaded it anyway.

Edit: One more question, can I add an LED or a small buzzer to the FOB to indicate that they’re connected/not connected (I hope so)? If not, how else will I know that they are connected?

Thaer:
So, the things I need to buy are:

2 x Nordic FOB

1 x Atmel STK500 AVR ISP programmer USB

?

Do I need to buy some sort of pins to connect the programmer to the FOB (I dont see any pins or sockets on the FOB)?

You need to solder a 6-pin (dual row x 3) header to the holes in the PCB.

Thaer:
Does the programmer require any special drivers or set up?

What software do I need to program the FOB (Write the C code, and compile it)?

Are there any other electronics, hardware, tools or software that I need to buy?

Where can I learn electronics C programming? Are there any simulator software or do I need to have the FOB and compile the program every time to test it?

You need AVRStudio, as well as a C compiler. Most people use WinAVR, which is free. Once installed, AVRStudio should recognize it and you'll seamlessly be able to compile:

http://winavr.sourceforge.net/

www.avrfreaks.net is a good place to learn about Atmel microcontrollers, and there’s tons of sample code and tutorials on the net. The sparkfun product page has useful comments from other users, as well as a link to Nordic tutorials: http://blog.diyembedded.com/

Thaer:
Why would coming up with the protocol be the hardest part? (I just want to see what I’m getting myself into, but I will work on that when I get to that stage)

If you didn't care about battery life, you could have the receiver always on, and every few seconds transmit a very short data stream. Any other device in the area would recognize this and respond appropriately. You would want to use some random delays though, to help prevent multiple devices responding and interfering with each other. However, having the receiver always on will use more than 10mA of current, which will drain the battery rather quickly. If you want decent battery life, you need to come up with a protocol that allows the wireless chip to be in "standby" most of the time.

Thaer:
One more question, can I add an LED or a small buzzer to the FOB to indicate that they’re connected/not connected (I hope so)? If not, how else will I know that they are connected?

Yes, you can use the MISO, MOSI and SCK pins on the programming header as general-purpose IO pins, when they aren't being used for programming. I suggest you have a buzzer / LED mounted to a connector that can plug into the programming header when it isn't being used for programming (otherwise they could interfere with programming. If you use a buzzer, either use a piezo type (which draws low current), or a transistor to drive a magnetic type (which uses much more current).

Actually, it seems that the 2 cheap programmers I mentioned previously aren’t suitable: the sparkfun unit is for PIC micros (not Atmel), and the other unit doesn’t look like it will program the ATTiny24 used on the fob:

MichaelN:
http://www.optimal-microsystems.com/sto … 0dead4060c

http://www.sparkfun.com/products/9

Either the AVR-ISP500 Olimex unit (sold by Sparkfun / Optimal Micro / Olimex), or the Ebay unit I mentioned would work.

Thank you Micheal for your generosity. I downloaded the software, read and bookmarked tutorials. I’m going to order the hardware you suggested tomorrow.

OK, so I ordered the following items (Hopefully I didn’t miss anything):

2 x Nordic FOB $54.95

Atmel AVRISP STK500 USB ISP Programmer $34.52

Cordless Soldering Iron Gun Solder Welding w/ LED Light* $21.32

NEW DIGITAL VOLTAGE VOLT METER MULTI TESTER MULTIMETER $9.78

1 x Bread board Clear - 8.2 x 5.3cm (STR101C2M) $5.50

2 x Piezo Piazo Buzzer Alarm Speaker Transducer $5.46

1 x 20 in 1!Basic components mixed pack (COM103B2P) $4.90

60/40 ROSIN CORE SOLDER SOLDERING WIRE W DISPENSER TUBE $4.25

6 PIN HEADER/CONNECTO. STRT MALE 2.54mm/.100" PITCH x10 $3.93

1 x 20 pin dual female splittable jumper wire - 300mm (CAB115C3O) $2.99

1 x Twig - Buzzer (COM22458P) $2.50

For a total of $150.10

If I missed any items/tools or if ordered the wrong items please let me know. Thank you.

http://s2.postimage.org/6a2b8l45f/Presentation1.jpg

Thaer:
OK, so I ordered the following items (Hopefully I didn’t miss anything):

Cordless Soldering Iron Gun Solder Welding w/ LED Light* $21.32

Generally looks OK, but I'd prefer a proper soldering station. Some of the Chinese copies of Hakko / Weller units are actually not bad if you're on a budget, but I'd personally try to pick up a Hakko 936 (or similar) if you're looking to do a lot of soldering.

MichaelN:

Thaer:
OK, so I ordered the following items (Hopefully I didn’t miss anything):

Cordless Soldering Iron Gun Solder Welding w/ LED Light* $21.32

Generally looks OK, but I'd prefer a proper soldering station. Some of the Chinese copies of Hakko / Weller units are actually not bad if you're on a budget, but I'd personally try to pick up a Hakko 936 (or similar) if you're looking to do a lot of soldering.

I bought the soldering iron to solder the pins to the FOB. I don’t see myself doing much soldering.

AVR Studio 5 Beta is out ([HERE). Should I install it? or will it create comparability issues?](http://www.atmel.com/dyn/products/tools_card.asp?tool_id=17212)

Thaer:
AVR Studio 5 Beta is out ([HERE). Should I install it? or will it create comparability issues?[/quote]
That I couldn’t say. Check what others are saying on AVRfreaks etc…](http://www.atmel.com/dyn/products/tools_card.asp?tool_id=17212)

Studio 5 needs to mature more, unless you are interested in the pains of early beta

Thanks Micheal. I will head to their website right away.

stevech:
Studio 5 needs to mature more, unless you are interested in the pains of early beta

Thank you Steve

I think the pain of putting the hardware together, and getting a little bit of coding done will be enough for me at this stage. No, the thing that I loved about AVR Studio 5 (From watching these [YouTube videos ) is the editor features. I think the auto completion feature, the detailed debugging and the built in samples are all features that I’m gonna need as a beginner.

I was wondering if I can use AVR Studio, to write some code and compile it to a “simulation device” (if such a thing exists) , till I get the hardware that I recently ordered?](http://www.youtube.com/watch?v=lsammK3FfEg)

Thaer:
I was wondering if I can use AVR Studio, to write some code and compile it to a “simulation device” (if such a thing exists) , till I get the hardware that I recently ordered?

Proteus has a circuit simulator that you can use to simulate the microcontroller running code (with the appropriate add-on module):

http://www.labcenter.com/products/avr.cfm

However, I think you’ll have trouble trying to simulate the wireless chip, unless there is already a model for it.

good way to simulate wireless link is to simply interconnect UARTs. Debug the application layer protcol. Then add some sim code to induce errors such as data receipt timeout, missing bytes, corrupted bytes, bad error checks, etc. This done, you can insert the real wireless device.

MichaelN:

Thaer:
I was wondering if I can use AVR Studio, to write some code and compile it to a “simulation device” (if such a thing exists) , till I get the hardware that I recently ordered?

Proteus has a circuit simulator that you can use to simulate the microcontroller running code (with the appropriate add-on module):

http://www.labcenter.com/products/avr.cfm

However, I think you’ll have trouble trying to simulate the wireless chip, unless there is already a model for it.

I downloaded the software for Atmel AVR. This software is way over my head. I’m going to read the help files and see if I can gather something out of them.

http://s2.postimage.org/e55u5tvn/Untitled.jpg

stevech:
good way to simulate wireless link is to simply interconnect UARTs. Debug the application layer protcol. Then add some sim code to induce errors such as data receipt timeout, missing bytes, corrupted bytes, bad error checks, etc. This done, you can insert the real wireless device.

Thanks Steve, but I don’t understand what this means.

EDIT: The software is not a hard as I thought. I was able to design some circuits with LEDs, buzzers and test them. You can actually hear the buzzer going off when you run the circuit. It’s pretty neat. Thanks Micheal.