PDA

View Full Version : Looking for some project guidance



bird_e
- 19th March 2009, 01:27
Hello all, I'm new to the forum and this is my first post. I have been using PBP for some time doing really basic stuff. I pretty familiar with the basics but I have a project and looking for a little guidance to get me started.

This is what I'm trying to acheive:

I want to have 5 small hand held boxes with a single button on them. Each time the button is pressed on any box I want a counter to increment and send the "ID" of the box and the count to a single receiver wirelessly. The single receiver would receive the data from anyone of the boxes. Lets call them
Id1,Id2, Id3, Id4 and Id5. The receiver would then spit out a serial packet to a PC with each ID and count every second, or some time period, doesn't need to be real fast, once per second would be more the fast enough.

Heres where I'm struggling.... I need the boxes to run on battery power and last for like 6 months to a year on a battery. So therefore I would assume I need to use some kind of low power mode. I have never used interupts before in any of my past projects but I think I need to use an interrupt so that I can take advantage of sleep and a button press would "wake up" the pic.

So the basis of the program I have in my head goes like this.
The Pic is in sleep mode, the button is pressed (using an interrupt routine the pic wakes up and increments the count by 1 and then sends the packet to the receiver) Now, because another box *may* be transmitting at the same time or interferrence or what ever, the receiver may miss this single packet, so I want the transmitter to transmit the ID and count once per second for like 30 seconds and then go into sleep mode. I think I need to do this just to make sure the receiver does infact receive the packet. However, during this 30 second period of awake time I also need to increment the count if the button is pressed again...

I'm also thinking about using the Linx RF module for this type of thing, the transmitting range would be no more then 200 feet.

Am I on the right track? Am I going about this in the wrong way? or is there a better way?

Any input would be greatly appreciated!
Thanks!
Bob


:confused:

Jerson
- 19th March 2009, 03:42
Bird_e

If you are only looking for a 1 way communication from the boxes to the receiver, your strategy is correct. If, however, you choose to do a 2 way communication, you could simply have an ACK/NAK type protocol which tells you if your packet has been received. However, as you would've already guessed, it needs more coding and possibly interrupts for receiver too. But, having 2 way comms means you can now eavesdrop on the channel before transmitting. This is like having collision avoidance.

Going with your strategy, you may not need to use interrupts at all. See, when you put the PIC to sleep, you could set the wakeup on change interrupt so that the pic wakes up from sleep. You do not need to enable or service the interrupt though. The PIC will simply continue after the sleep instruction. Timing for 30 seconds can be done with software loops and timers. So, no need to make it complicated unless you wish to.

You will need to work out a scheme where you can be sure that the packet is received by the receiver under conditions that could include 2 or more boxes talking at the same time for 30 Seconds.