# How to detect whether a bus is in motion or not

I am a university student and I need some help in a project. For the past few years now, many accidents have occurred whereby in overcrowded buses, passengers are accidentally propelled from the back emergency door. Or, sometimes because the rear door is not properly closed.The driver are unaware when this incident occurs as he has no control on the rear door. And after a deep analysis, I found that accidents like these have occurred in US and in European countries as well. Hence, I wanted to find a solution which can be implemented in any buses which will prevent these type of accidents in the future.

An automated system which will prevent the rear door from opening while the bus is in motion and will automatically unlock when the bus is at rest.

Here are some links describing accidents that have occurred:

Actually my problem is that I can't find a device which can tell me if the bus is in motion or not.

I did some initial tests with an accelerometer. But when the bus moves at constant speed, its acceleration is zero and hence the device assumes the bus has stopped.

I can use an RPM sensor but I need a solution which can be easily plugged-in in any buses. That is, the system can be implemented by anyone... something which can easily be mass produced.

• The first story had the kid opening the emergency door, you cannot lock people out of that. The second story talks about a "inoperable door open warning device", aka it should have been there but bad maintenance led to it malfunctioning or being removed. – ratchet freak Oct 23 '17 at 13:47
• Emergency doors and their mechanisms are covered in various safety standards. In the US, see CFR 571.217 . I would contact the FMCSA board and go through the appropriate committees. The FMCSA has a database of bus incidents called Safer Bus. The data is free to download. – Phil Sweet Oct 26 '17 at 23:49

## 5 Answers

I would personally use a GPS to detect movement of the bus. GPSes already outputs speed, which means you don't have to calculate it yourself. If the speed is non-zero then the bus is moving. This will also detect movement with locked wheels, e.g. sliding on slippery surface.

Almost all GPSes sends output in the form of NMEA telegrams (which is ASCII) over serial line (usually RS-422). It can also be plain ASCII over Ethernet. This is easy to interface to with an ordinary computer. Most modern computers don't have COM ports, but USB-to-COM adapters are cheap and pretty much plug-and-play. It shouldn't be a problem to interface to microcontrollers either. Modern cars (and buses for that matter) already utilize GPS speed, but I don't know if it's easy to get information from that particular GPS.

The speed telegram is called VTG. It looks like this:

\$GPVTG,360.0,T,348.7,M,000.0,N,000.0,K*43

The last number before the K is ground speed. The K indicates that the unit is knots, but it will vary between GPSes and how they are configured. A GPS will typically output this telegram once per second, but the frequency can usually be increased to 10 Hz.

The read speed will be somewhat noisy, so a deadband around zero might be needed when considering whether the bus is moving or not. A lowpass filter can also be used, but this introduces phase lag, so I'd go for deadband instead. Here is some data I gathered from a ship on DP (not moving). A bus doesn't roll and pitch like a ship, so the data would not be as noisy in your case.

For this particular graph I would consider anything below 0.1 m/s as not-moving and anything above as motion.

Disadvantages:

However, this solution has some disadvantages:

• There is no GPS coverage in tunnels.
• Very tall building can cause shadowing.
• Doesn't work when Putin is in town.
• A plain old speedometer connected directly to wheel will always be more reliable.
• Hi...Thank you very much for your answer. Which GPS do you recommend me if I am using an Arduino? – Yudhisteer Chintaram Oct 28 '17 at 8:36
• I think I would start with something cheap from Sparkfun or Aliexpress to see how it works. I assume Sparkfun has a pretty big markup on their products, but that's maybe acceptable when you are prototyping. Aliexpress is cheap, but you have to know what you're looking for. I don't know what particular model is best. You need one that outputs NMEA over serial line with either the VTG or RMC telegram available. I would recommend an update rate of at least 10 Hz. You want DGPS support, e.g. SBAS. – Mika Sundland Oct 28 '17 at 12:49
• And one more thing: the more expensive the GPS is the better the accuracy is. You don't really need very good accuracy, but you will get the jittering around zero as shown in the graph. The graph represents an expensive GPS; you will have more noise in a consumer GPS. It could go from -5 to 5 km/h for a cheap unit. You might want to merge the is-in-motion conditional with the accelerometer. So the bus is in motion if the GPS speed is over 5 km/h OR the acceleration is over a threshold. You should then be able to detmine if the bus is in motion for both low and high speeds. – Mika Sundland Oct 28 '17 at 12:58

All vehicle have an odometer. It is a device used to measure the distance a vehicle travels. Irrespective of whether the vehicle is accelerating or moving at constant speed, the odometer registers the distance traveled. This can be used as a motion detector.

Most odometers fitted to vehicles only register forward motion. If reverse motion is an issue then use two odometers: one for forward motion & the second for reverse motion and send the results to a single registration device.

Also, given that vehicles cannot move unless the drive shaft rotates, a device that detects whether a drive shaft is rotating can also be used as a motion detector.

Another thing you may want to consider is to have an electric switch, similar to the switch in car doorways which turn on the lights inside the car when the door is opened. If such a switch is placed in the rear doorway of buses and then connected to the parking brake or accelerator, when the rear door is not properly closed, the bus cannot move because either the parking brake has been activated or the accelerator is unresponsive, or both.

• In an emergency situation it's reasonable to expect that the bus may be in motion - such that the doors should remain locked by the described safety mechanism - even though the wheels/axles are not turning. – Air Oct 26 '17 at 15:59

Every bus I've been on bounces up and down while it moves. I think an accelerometer (or three) would work fine. Might take a bit of calibration, but it would be a simple solution for detecting the motion of the bus.

I would recommend you take inputs from multiple sensors for a 'foolproof' solution. Since this is a safety device, redundancy is important as well. Here are a couple of inputs that you could use.

1. Vehicle speed reported by the ECU, you could read this through the vehicle communication bus, I'm not sure if commerical busses have a standard OBD port(like in cars), but there should be a standard electrical communication bus interface that you could tap into to get onboard data.

2. Combined data from IMU and GPS modules, similar to the ones used in drones, can help you get the velocity as well. You could find these modules for cheap on eBay/Alibaba. There will be some effort involved in writing firmware for a microcontroller to fuse data from the sensors to calculate Velocity.

• Welcome to Engineering Stack Exchange. This is an excellent answer. Stack Exchange encourages creating excellent questions and answers for the People of the Future, who may not have access to tools we have today. To that end, explaining acronyms helps ensure as much clarity as possible, and links to sites for further investigation is encouraged. It also helps to link to referenced parts if possible. But this is an excellent first answer. Well done! – Mark Oct 26 '17 at 17:29

you could pick up a signal from a safety switch in the door jamb which detects whether the door is open or closed. assuming the bus has an automatic transmission, when it is stopped to pick up passengers, the driver's foot is on the brake and hence the brake lights are energized. You then design a simple circuit which sounds an alarm buzzer if the brake light is off (that is, if the driver has pulled his foot off the brake in order to start moving) AND the door is not closed.