News:

We're live! Join us!

Main Menu

x-band motion sensor from Parallax

Started by pilot0315, Jul 30, 2024, 01:21 AM

Previous topic - Next topic

pilot0315

Just started working with these. Interesting.
Demo code:



' Test X Band Motion Detector.bs2
' Test to see the number of cycles the X Band Motion Detector
' sends in response to motion.
CON
_clkmode = xtal1 + pll16x ' Crystal and PLL settings.
_xinfreq = 5_000_000 ' 5 MHz crystal x 16 = 80 MHz.
Baud115k = 115200 ' Baud rate
XbandEnPin = 9 ' Enable pin
XbandOutPin = 8 ' Output pin
HalfSecond = 500 ' ms in 1/2 s delay
MoveThreshld = 2 ' Motion threshold





OBJ
pst : "Parallax Serial Terminal" ' Serial communication object
xband : "X Band Motion Detector" ' X Band Motion Detector object
PUB go | cycles
pst.Start(Baud115k) ' Parallax Serial Terminal � cog
xband.Enable(XbandEnPin) ' Set optional enable pin
xband.Out(XbandOutPin) ' Initialize
repeat 360 ' Main loop
cycles := xband.GetCycles(HalfSecond) ' Check X Band Motion Detector
pst.Str(String(pst#HM, "cycles = ")) ' Display cycles
pst.Dec(cycles)
pst.Str(String(pst#CE, pst#NL))
if xband.GetCycles(500) > MoveThreshld ' Decide if motion & display
pst.Str(String("Motion detected!"))
else
pst.Str(String("Not detected.", pst#CE)

Anyone with experience playing with this??

Chris Savage

Quote from: pilot0315 on Jul 30, 2024, 01:21 AMJust started working with these. Interesting.
Anyone with experience playing with this??

I have used these twice in the past with the BASIC Stamp 2, just because of the simplicity of the applications. What are you interested in using it for?

Many years ago I created a project for a friend with cats called, "Cat Sentinel". He had cats that would just jump over the baby gates that kept the dogs out of certain rooms. So I helped him create a solution that used an IR beam to detect a cat (or dog) simply walking through the doorway and when detected, would blast a burst of air from a can. Over time it became so effective that, when the pets saw the device standing next to a door, they simply walked away.

Remembering that effect, I created a project back in 2013 called, "Pavlov's Cat". It used the X-Band Motion Detector to detect the cat jumping onto a counter or, at Christmas time getting near the Christmas Tree. When the cat was detected, it would simply emit a 3kHz tone. This tone would get the attention of my late wife or myself and we would go to investigate. Over time, the cat associated the tone with us coming and her knowing she was someplace she should be.

After a while when she would hear the tone, she would run away before we even showed up and eventually, she would simply stay away from the device (and / or counter) altogether. The project was so simple and put into action so quickly that I never thought to take photos or put up more than a quick forum post about it. But it was a successful project using the X-Band Motion Detector and I do still have a couple of these sensors in my parts inventory.

For those not making the association with the codename for the project, it was based on Pavlov's Dog and his experiments into classical conditioning.

Another person years ago contacted me through the Parallax Forums about his cats jumping on the counter. At first he used aluminum foil to deter them. But when they came from the side, they eventually got used to the feel and view and always did that, rather than jump from the floor. He contacted me about using a PIR sensor to sense motion and trigger a relay which would power an old blender filled with metal bits of junk. The sound it would make would scare the crap out of the cat (and would have startled ME too, TBH). Personally, I like my Pavlov's Cat project better and may build it again some day.

        I'm only responsible for what I say, not what you understand.

pilot0315

I like the cat thing. My main robot will be able to chase the cat. I will have a remote camera on it so I can get the POV from the robot.

Chris Savage

Quote from: pilot0315 on Aug 07, 2024, 04:37 AMI like the cat thing. My main robot will be able to chase the cat. I will have a remote camera on it so I can get the POV from the robot.

A cat-chasing robot...Martin, you really shouldn't give me such ideas!  ;)

        I'm only responsible for what I say, not what you understand.