This is for someone who has balance problems, only needs a walking cane during an episode, and can physically walk away from the cane quite a distance before it's actually needed (oops). The idea is to attach a transmitter to the cane, and let the patient carry a receiver that beeps/vibrates/etc. when it's out of range.
Use a simple 433/415MHz kit (MX-FS-03V / MX-05V or similar):
The idea is to detect whether what we're getting is signal or noise, regardless of what signal exactly - as long as it's coherent and the signal/noise ratio is high enough.
At the moment, the transmitter is attached to the cane with an elastic bandage (see photo). I'm still thinking of ways to make it look less "sick", though ;). Suggestions are welcome.
On the receiver side - I've managed to make it mighty small by reprogramming a MilCandy. It's a really small arduino-based "appliance" (i.e. comes pre-programmed). What a MilCandy usually does is fun, but pretty limited (although it's great as a "lesson 1" pitch to kids), but once you reprogram it (needs an FTDI), it has a lot to offer for such a tiny box (a rechargeable battery + charger circuit and even an analog input for reading battery level, red/green leds, a button, and even a built-in light sensor - what a pleasant surprise).
Of course - any Arduino-ish controller will do. I also have an Arduino Micro based version of it (see soap dish photos).
Feel free to skip this step. I'm just documenting how I got to this specific solution.
TL;DR: although this project succeeded, I doubt if I'll ever use 433/315MHz kits for anything serious (at least not the simple ones). The RF noise the Arduino itself generates (especially if connected to and[/or] transmitting serial) makes these things rather useless IMHO. Specifically - Arduino Micro is the much worse (and while we're at it: the Micro also takes a mighty long time to reset. There. Got it off my chest).
In the beginning, it worked
There was a working prototype (see photo). It had a different algorithm, but it worked.
Then I got back home, built it again (see Tupperware photo), it worked, but with lots of false detection (detected signal where there wasn't any), but I've managed to fine-tune stuff and it worked.
Then came the Arduino Micro
Then I tried a smaller receiver based on an Arduino Micro (see soap-dish photo), and it all went wrong: the thing could only detect signal if it was a few Cm from the transmitter (and even then it was a bit uncertain).
So I started doing some "organic debugging"(TM): I've connected the piezo buzzer straight to the data pin of the receiver, and started listening - the thing was making a lot of RF noise: even when the transmitter was off.
Even out in the fields (away from anything electric).
It got better when I told it to stop using the Serial, but still - you can listen to the attached sound (before / after I turn on the transmitter, and once it gets 20-30cm away from the transmitter).
For reference, I've built a circuit with only the receive and a piezo buzzer on the data pin. You can listen to the attached sound (before / after I turn on the transmitter, and while I [noisily] walk away ~2m).
So I decided to go mainstream
I started thinking: maybe the whole idea of not having an Arduino on the transmitter side is stupid. Maybe libraries like VirtualWire or RadioHead are there to get anything at such a low signal/noise level. So I tried a simple "Hello" example between an Arduino as transmitter and the Arduino Micro as receiver, got no reception. Switched between the Large Arduino and the Micro, Nada.
Did I burn my receiver?
After a few experiments even the "Tupperware prototype" (the one that used to work) became a lot worse. So I've decided I've damaged the receiver. Maybe during all these experiments, a transmitter sketch was uploaded to the wrong machine and sent signal to the receiver's data. Not sure it matters (if you know the answer, please comment), but when you don't know whether you've burned the only receiver you've got or not - it really sucks.
So I've ordered a few more RF kits [and waited...]
When the new kits arrived - nada. I couldn't get the VirtualWire example to work. So I've searched the forum and found someone with a similar problem (my emphasis):
I bought this kit and using VirtualWire had it working perfectly ... Then suddenly it stopped working. ... I used to get lots of noise coming through... now there's nothing.
and there's an answer saying:
USB Power source are very bad. Try powering by battery.Small distance between rx and tx are not good.Small distance to PC is not good (they are like a hf jammer).
So I tried to debug stuff without using serial or external power
As a "cordless debugging tool" I tried to use an I2C LCD, but the problem was to get it to work on battery power (a serial cable to either a PC or even wall socket jams the rf badly), but I only had an old Arduino (I'll order some modern ones soon) with a manual USB/battery selection jumper, and it wasn't trivial to get the I2C LCD monitor work while in "battery" mode (if you have similar problems, here's a howto I wrote).
Once I got the LCD problem out of the way, I wrote a version of stick2cane that presented the histogram (see algorithm later on. It's much simpler than the previous one). The trick was to see the histograms visually and study them. No amount of serial debugging could provide such insights (unless you import csv or json via serial - an idea for a future project ;) ).