Help please. What sensor is best used for detecting motion but is attached to something moving

Hi, I am new to this so please be kind ha. What I am trying to nut out is, can I attach a sensor to a moving object, that also detects motion? The detector needs to work like a break beam sensor, but only one side of the sensor is attached (like a motion sensor). Then be able to run off a small battery with the module Bluetooth or RFID capable, to be able to send the data back to an app or communicate with something that is no directly connected to the module.

A is a sensor that detects motion passing directly in front of it, and only needs to be able to detect max of 2 - 2.5 m. A is also moving around. Not much but on up and down and side to side roughly 20cm in each direction.

B is the cable from A (1.5m roughly). The battery (rechargeable) and the module (as small as possible)

Then C is where the info from B gets sent to. (Eventually in the form of an app) really basic only needed mainly for receiving the information.

1 Like

It sounds like something that could be solved with an ultrasonic range module. There’s some info on the Internet (of course there is) that may not be applicable to your project but might give you some ideas. An example How to Set Up an Ultrasonic Range Finder on an Arduino
There’s a lot to think about. An ultrasonic sensor can measure if something is coming toward or away from it, because the distance is changing. But it won’t work for something travelling from side to side because the distance is constant. However, it will either detect if an object is there or not (which is what a break beam sensor does - it doesn’t detect motion, but implies motion because something wasn’t there and now it is, so it must have moved to get there). Will the object reflect ultrasonic waves? is there a detector that works up to the required distance? how to separate object from background? How fast does this need to happen? what about stray cockroaches? will the motion of the detector need to be compensated for (maybe need an inertial sensor too)?

1 Like

Hi Sarah,

Alan has started you down the right path, but I thought I’d start up some more discussion:

  • What is the intended purpose of this project? Proper problem identification can save you a lot of “barking up the wrong tree” electronically.
  • Take a look at our laser distance sensor, it’s smaller than an ultrasonic unit, and can be configured to look at a smaller area of interest at the expense of range and dark surface detection (though this relies on a fair bit of embedded experience on your end)
  • Our PiicoDev Transciever and OLED units could be used to display data remotely. BLE and an App is often the way commercial products do it, but I wouldn’t unless you have extensive experience in app development.

I’m keen to hear your thoughts on the above!

Do you need to detect A movement, or is A movement relevant because you need to ignore false detections that might result from the movement of A?

Also, what sort of movement for A do you want to detect. For instance, is it “A was moving but is now stationary again” or “A is moving and distance and direction need to be calculated” or “A might have moved so I need to work out where it is” or something else, because that will significantly affect what sensors are suitable for detecting A movement.

Hi All
A bit confusing but as I see it both the super sonic and laser would only detect motion to and from, not sideways. It looks like the sensor itself is mounted onto the object that is likely to move. If this is so could an accelerometer be sensitive enough to pick up a 20cm movement. If this is so these things I think operate in 3 axis (X, Y and Z)so should pretty well detect motion in any direction.
Cheers Bob

1 Like

Bob’s right, distance based sensors wont achieve what you intend, unless I am misunderstanding the parameters.
As I understand it, you want the sensor to be mounted to something that is moving horizontally left to right, 20cm, and you want it to detect motion in its’ sweep up to 2-2.5m away.

Range sensors will only tell you how far away the moving thing is and give you the same reading no matter what part of the frame of reference it is in, for lateral movement.

If the object is moving closer or further away, however, then that will absolutely work.

So @Sarah240478 the question is, what motion are you trying to detect?

1 Like

Is this a clock pendulum by any chance??? If so you will not be able to mount anything on it without upsetting the timing.
Cheers Bob

Gentlemen, thank you very much for responding and so quickly. Your replies made me re-read my very vague description and conclusion is, that I think I may even be a bit confused haha.
So, when I say one of the objects are moving around, (20cm) it’s a person/people. It’s hard to explain but I think this describes it best. If you can picture 2 people holding an end of a pole each. They’re standing there holding it while someone comes running up and has to jump up and over it. Kind of like pole jumping/vaulting;… if you will. So although the 2 people holding the pole will keep movement to a minimum there’s still that movement I have to allow for. So, here’s the tricky bit. There is a (insert sensor type here) on the end of the pole. So when the “jumper” goes to jump up and over, it needs to detect that something has reached whatever height it is (it will vary with the pole being moved up or down.) I’m not sure yet if I want it to be able to just sense that the point has been reached, or the height as well. That call all depends on how hard this could potentially become haha.
I could be way off here, but I thought if maybe I used a retro reflective sensor, could the object that is “the jumper” simply have reflective tape similar to the reflective plates used for this type of sensor? This is where I was concerned with the “pole holders” minimal movement. It is still minimal but for that reason I couldn’t use something like the … is it a diffuse sensor that has the sensors on either end? because they have to be stationary and pointing in each others direction. Is that right?
I hope that makes a little bit more sense this time around!
I very much appreciate the suggestions and advice guys. I can take criticism too it so if you think I am wasting my time please absolutely say so.
Sorry I haven’t replied to you individually. I figured another go at the description would be the best place to start.
Thanks again

So let me break that down to the simplest first principals.
Someone has to jump over a pole and you want to know how high the pole was basically that the person made it over, kinda like high jump?

I would put the sensor on the pole pointing down and read the poles height and then detect if the pole was knocked out of the holding persons hands (or stand or whatever).
That will tell you what the height was without having to get really convoluted method to calculate the jumpers height.

1 Like

Yes exactly like that. So the height will change. There will always be 2 people on either end as well. What type of sensor would you suggest? The idea was when that height is reached, it sends the “alert” through the module and ideally records it. Which, like I mentioned the retro-reflective sensor, would reflective tape or similar be effective if used as a band or something to trigger the sensor?
Thanks AndrewBG! :slight_smile:

1 Like

OK, so, I would 3D print an enclosure to use an Arduino or Raspberry Pi Pico WiFi and an Ultrasonic sensor and battery that had the sensor pointing down.
you then have two options:

  1. put a pushbutton on one end of the pole that when pushed the sensor is read and the value sent to the receiver.
  2. put a second ultrasonic sensor pointing up, in the same space that the ‘jumper’ will go over the pole and when the upper sensor sees a change in the distance measured, it sends both values to the remote unit recording not only the height of the pole but also the height of the jumper’s lowest point.

option two is probably the more difficult, but will give you more data.

1 Like

You’re a legend AndrewBG. Which has given me another idea. Could I have a height sensor like a ride height sensor, pre-set with x levels. Then an alarm/beep of sorts sounds to advise when either end is at the pre-set height. Then, as you said with the push button, use it to send a “yes” as to whether the level was met? I would need a height sensor on either end of course, but would that be easier? I would still want the results sent back to an app but only need the yes rather than all the extra data.
I have looked myself but can I ask your advice, if I was to do the above with the height sensor, could I have it Bluetooth capable rather than Wi-Fi? Then would I still be able to have the unit all in one with the rechargeable battery? The push button would be ok to be on the same unit too, but preferable if it had a cord with the button on the end.

So the functionality would totally depend on your code.
It should be trivial to have a piezo buzzer to sound when the bar is within the bounds of a preset distance.
You could even, if you use case requires, have it so that the bar holding people hold it close to the ground till it beeps, then go up a distance till it beeps, then higher, etc etc.

The Raspberry Pi Pico W supports bluetooth so that should be ok too.
I’d have the push button on a cord away from the main unit for usability but you can built it out however you want.

Yeah, this is exactly what I meant! So, say it would start at its first pre-set level of 10cm from the ground and have only 5 or 6 levels. After the jumper reaches the oh so very high 10cm, the push button is hit, then they can move it up again to 40cm, and will beep or whatever when it’s at the 40cm height. Then the button is pushed when the jumper reaches that and so on.
This would work do you think? Apart from the coding part haha. What sort of sensors would you suggest?
You know I almost didn’t post the question asking for help. So glad I did now!

Perfect, I was hoping you would say that.

Yeah that is how I was thinking that you would want it to work.
Pretty simple to do really.
You’ve got some choices on hardware, either Ultrasonic or Laser rangefinders, scroll back up to Allan and James posts for the hardware and some guides on how to use them.

1 Like