Delivery detector

High frequency, antennas

Delivery detector

Postby Doug Coulter » Thu Jan 23, 2020 8:57 am

I wanted a way to know when the mail person was here, so I could go help with whatever heavy thing they seem to feel obligated to carry to my door, which is a decent trek from the road. Due to the terrain and other limitations, a raspberry pi with a camera and motion detectors can't see this spot and still be in wifi - and power supply - range. While thinking about how I'd design such a thing, I stumbled on a surplus solution that didn't seem to need much more work. But which, of course, did need a couple of tricks to make it useful, so here's the skinny,
I'm sure there are other things out there, cheap, that wouldn't need as much as this did - but it's an interesting take on a little ranch-grade engineering exercise anyway. No doubt other "solutions" would have their own issues as well.
Here's a link to the thing I got - a transmitter/receiver pair for < $3 looked worth playing with: https://www.mpja.com/315MHz-Remote-Cont ... /31960+MP/

Due to an issue I discovered, it would have been pretty useless for its original intended purpose - the output is random in no-signal conditions, and burst-error prone when a signal is there. But there's a decent and simple, if non-obvious, workaround for that when used for my application. IF you were trying for data...you'd need some really magic high overhead error detection and correction, and/or some protocol that allows retries - which means you'd need to have the other direction of data transmission, some smarts...and it gets out of hand quick.

I'm just inside wifi-with-some-retries range, and had considered an ESP 8266 class thing, but...this was more fun and will have much longer battery life even though I'll be using switched power in either case - getting on the network takes time - which also means I'd need something fancier than the trivial magnetic switch to latch power (what if the mail man is fast?) and it spirals out of hand again.

At the point of considering something like a laser I could see some modulation on via backscatter, sanity prevailed. I do have other things to do!

Here is the transmitter circuit.
RF_remote.gif
Simple power oscillator with on-off modulation

Basically an AM transmitter with on-off control. I'm running it from a 9v battery here. Current drain is on the order of 10ma when operating CW. Due to issues in the receiver, this needs to be modulated to provide a signal that can be reliably told from the noise at the receiver end. There are a ton of ways to skin that cat, but I was out of 555's and didn't want to get complex, as in an Arduino Uno clone. I also didn't want to have to come up with a stable frequency if I didn't need to, and use special components to get there. So I settled on a really simple discrete multivibrator. This does produce a somewhat variable frequency depending on supply voltage, temperature, phase of the moon and so on, but for this that's fine.

Unlike some other possible oscillator circuits, this one swings right down to ground, so it'll turn off the transistor in the modulator fully.

schiz.gif
simple...just make some predictable noise
schiz.gif (4.97 KiB) Viewed 3668 times


Parts are:
a couple of generic NPN transistors, I used 2n3904.
10k collector resistors.
100k base bias and output current reduction resistors. You don't need the 1% ones I used - I buy the stock values in bulk and they are super cheap.
.01 uf tuning capacitors. This gives around 650 Hz output, it's not critical in this design.

I didn't even use any power bypass caps - a little noise makes it more likely to reliably start oscillating. I'm switching this on and off with a standard alarm system type magnet and reed switch pair, placed so the mailbox door opening turns on power. This is the opposite switch sense from most alarm uses, as for those, the circuit is closed until the door opens. So look for a switch that allows that, for example: https://www.amazon.com/Magnetic-Switch- ... 583&sr=8-5

The range for these is listed as around 200 meters. I'm betting that double that is easy, based on signal strength measured via my RTL-SDR. If you know RF, just do the antennas marginally correctly for 1/4 wave whips over ground and you're going to be good. As used here, at something over 100 yards and with an intervening small hill, it overloads the SDR using rabbit ears on receive.

Some pix as it is. I used a nice box from Marlin Jones, which happens to perfectly fit a standard perfboard I got cheap from some Chinese vendor at Amazon. I made a bracket to replace one end so as to mount this up under the mailbox out of the weather. I made a little battery guide for the tight fit.
shrunk-20200123-1216-remote-5.jpg
Ready to deploy

shrunk-20200123-1216-remote-6.jpg
The antenna is that white wire coming out on the right
Posting as just me, not as the forum owner. Everything I say is "in my opinion" and YMMV -- which should go for everyone without saying.
User avatar
Doug Coulter
 
Posts: 3515
Joined: Wed Jul 14, 2010 7:05 pm
Location: Floyd county, VA, USA

Re: Delivery detector

Postby Doug Coulter » Thu Jan 23, 2020 10:34 am

Any purists can look away now - this is real world engineering.

The receive side of this is a little trickier. The module is an RF stage, then a super-regen detector, followed by a gain stage that is AC coupled, followed by a comparator with a little hysteresis, also AC coupled. The net result is that as-received, the output toggles randomly when there's no (deliberate) signal present. There are a couple of ways around this, read on.
Here's what's on the module:
RF_remote_rcvr.gif
As-shipped to me. This wants a 5v supply.


Plan A was going to be putting in a filter tuned to whatever the transmitter modulation frequency was. But that didn't work well unless the Q got pretty high, and then the drift range in the transmitter end would push it out of band sometimes. That thing is outside in the weather, on top of having a variable supply voltage - without a lot of effort, it's not going to be real stable.

It could be that adding more hysteresis would keep it stuck in one state with no signal, I didn't try that. It's not obvious what state it would stick in after the capacitors charge on power up.

So what I did do is to bias the comparator so that it rests in the low output state with no signal. It still toggles, but rarely enough that some simple post processing handles that case easily.
The bias is added via putting an additional 1 meg resistor from pin 3 of the onboard opamp to ground. I didn't have a cute tiny one, but even a big old tech one managed to fit and cling on there.

Following the module, I added a lowpass filter of 100k and 2uF to ground, which averages out the little bit of random toggling in the no signal case. In looking at this signal, I (re) discovered a quirk in the LM 358 opamp - it has a slightly strange output stage, being one of the first "single supply" opamps out there, and this stage doesn't pull to ground very well at all. The result is that with this load, the one on the module acts as if there was a diode in series with the output - the capacitor in the lowpass filter tends to charge up to a couple of volts when the output is toggling with a 50% duty cycle!
Well, then, the rest is simple - just put another comparator on the output of the lowpass, and bias it so that it fires when it sees that couple of volts. That stage can then be the real output, and here I just hooked it up to one of those 5v sounder parts - which in fact is almost all the power consumption of the thing. If you wanted lights or memory, you could add a flipflop so that the output going high would clock a one into it, add a LED and a reset button... But I don't think I need that, I mostly need to know the box is open when I'm home anyway, so I'll go get the new goodies, help the mail lady carry that case of V8 and soup they shipped all in one box...whatever.

Since this is for my living room, I just added a 7805 series pass regulator for power - there's already a power supply for a basement vent fan in that corner of the room, so I just piggybacked on that.
The quiescent draw is in the 10 mA range, going to around 30 mA when beeping. Most all of the 10 mA is the regulator itself. The square wave oscilliator in the sounder thing makes enough noise that it can latch on ... so this one did get a supply bypass capacitor.
Here's the buzzer I used: https://www.adafruit.com/product/1536 These are loud and annoying, which is fine for this. It's not like the mail person leaves the door open all day.

rcvr.gif
The schiz - KISS!
rcvr.gif (6.92 KiB) Viewed 3668 times

shrunk-20200123-1218-remote-8.jpg
Added 1 meg resistor - sloppy but effective

shrunk-20200123-1218-remote-7.jpg
This can just lay in the corner under the coffee table, no fancy package required.
Posting as just me, not as the forum owner. Everything I say is "in my opinion" and YMMV -- which should go for everyone without saying.
User avatar
Doug Coulter
 
Posts: 3515
Joined: Wed Jul 14, 2010 7:05 pm
Location: Floyd county, VA, USA


Return to RF

Who is online

Users browsing this forum: No registered users and 12 guests