RF Transmission and Reception using VirtualWire

465 views
Skip to first unread message

Jon Thomas

unread,
Sep 9, 2016, 3:08:05 PM9/9/16
to virtualwire
Hello,

I am using the VirtualWire.h file for sending and receiving RF transmissions. One thing I am trying to do is count the number of times a messages is received per minute or second. If a message or character is not received in enough times per minute, I will set off an LED. Does anyone have any experience with doing something like?

Thanks.

Jon

James Hamilton

unread,
Sep 9, 2016, 3:26:01 PM9/9/16
to virtu...@googlegroups.com
Is the rate important, or just the fact of a reception within a particular time window?

I had a project a couple of years ago that was a remote push-to-talk for a radio, and I wanted to ensure that if the link was lost, the PTT would open.  I set it up so that the transmit side would send a "close the PTT" button every 100ms or so while the button was pushed, then once the button was released, it would send a "release the PTT" message 5 times.  The receive side would close the PTT when the appropriate message was received, then start a 1 second timer.  Every time the "close the PTT" message was received, it would reset the timer.  If enough messages were missed, the PTT would automatically open.  (And, of course, as soon as a single "open the PTT" message was received, the PTT was opened and the timer cancelled.)

Also, you might look at the RadioHead library, which is the updated version of VirtualWire.

Cheers,

~James

--
You received this message because you are subscribed to the Google Groups "virtualwire" group.
To unsubscribe from this group and stop receiving emails from it, send an email to virtualwire+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jon Thomas

unread,
Sep 9, 2016, 3:39:36 PM9/9/16
to virtualwire
James,

Well what I am trying to do is make a range collar for a close friend. Their dog has a tendency to run off a lot in the woods. I have found some good transmitters that work great. I can walk around the entire yard and it keeps me in range. However when I go out into the woods, I want the small fob I have made to let me know that the dog is too far.

One way to do this distance calculation...but that requires ALOT. Another way is to measure the rate at which a message is received and if it falls below that, then you know the dog is too far away and the small fob alarm will go off.

So I would like to count a character or number received in a certain period of time. I am certainly open to any other ideas as well. Does this make sense?

Jon

~James

To unsubscribe from this group and stop receiving emails from it, send an email to virtualwire...@googlegroups.com.

Jon Thomas

unread,
Sep 9, 2016, 3:51:53 PM9/9/16
to virtu...@googlegroups.com
James,

Looking at your response once more, I could do something similar to you. If the link is lost, then I want the fob alarm to go off. How exactly would I go about coding this up? I'm not the best coder but I can get around.

Thanks.

--
You received this message because you are subscribed to a topic in the Google Groups "virtualwire" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/virtualwire/U1nu3npGJ3o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to virtualwire+unsubscribe@googlegroups.com.

James Hamilton

unread,
Sep 9, 2016, 3:58:42 PM9/9/16
to virtu...@googlegroups.com
For your purpose, I think your original idea of counting received message rate is a pretty good idea.  Mine is rather binary: in-range, or out-of-range.  Tracking rate of successful reception provides a little more nuance to the transition to out-of-range.  (Another idea -- albeit far more involved -- would be to put a GPS receiver in the dog's collar and track the dog that way, with a more potent beacon for sending out the location.)

I'm not sure how to track receive rate in a meaningful way, although one idea that comes to mind would be to have an array of timestamps that operates as a ring buffer.  Every time a message is successfully received, the current end of the buffer is updated to the timestamp of reception.  Then you can iterate through the buffer to determine the rate.  I'm sure there's a smarter way that involves tracking only the last reception, the current reception, and a running rate, but I don't have a particular algorithm for using those parameters in mind.

Cheers,

~James
Reply all
Reply to author
Forward
0 new messages