Go Down

Topic: PDT Final Year project: Seat Belt Safety Tracker (Read 1 time) previous topic - next topic


Hi All

For my final year project I am building a system that I intended to track and monitor the 'Status' of 3 point seat belts, for use in coaches, mini busses and cars etc. I am creating this thread so I can track and record all assistance so that I can declare it ant the end of the project.

It is broken into 4 main sensors and post processing. My first hurdle is to do with a continuous rotation potentiometer.

The  pot is going to track the extension of the seat belt but it can spin up to 30 times depending on which type of belt its fixed to. Each time it spins, the reading goes from 0 to 1023 over 355 degrees. Then it shoots back down to 0 over the final 5 degrees.

I need to be able to count the number of rotations, plus its current position to get an exact extension. I have tried using various 'if' statements  to track this and using a 'int' to track the number of rotations but the fact that the resistance changes smoothly at either end, even if its over 5 degrees, prevents the conditions from successfully tracking the extension. Sometimes it will count but its inconsistent at best.

Does anyone have code that can do this kind of tracking or can think of an alternative method.

An alternative method of track the extension is using the same technology inside old track-ball mice. I believe this will be better and more reliable, but for the sake of the project I have to look at and test alternatives. Does anyone have code for this kind of system; using a pair of IR LED's and receivers to map the rotation?

PS-Sorry for the lengthy post.


Instead of a potentiometer you better use a rotary encoder.
These give pulses in both directions so you "just" need to count the pulses to get the position.

This link - https://www.sparkfun.com/products/9117 - contains also some Arduino code example.
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)


Feb 22, 2013, 10:48 pm Last Edit: Feb 22, 2013, 10:54 pm by laadams85 Reason: 1
I would think that you would only need to track 2 things to properly get a counter to work.
Code: [Select]

int lastPosition = 0;
int lastDelta= 0;
int counter = 0;

    int currentPosition = analogRead(PotPin);
    int currentDelta=currentPosition-lastPosition;
         //deltas have changed sign
         int rolloverDelta = 0; // calculate a delta as if you rolled over zero;
              rolloverDelta = currentPosition + 255 - lastPosition;
         }else if(lastDelta<0){
              rolloverDelta = currentPosition -255 + lastPosition;
         //what is more likely that you rolled over zero or your delta is really high?
              count = count + 1;
              currentDelta = rolloverDelta;
    lastDelta = currentDelta;
    lastPosition = currentPosition;


Instead of a potentiometer you better use a rotary encoder.

For the sake of the 'Development Process' I have to look at and test several different ways of doing each sensor. But a rotary encoder is a good alternative and is much easier to work with so I will look into those as another option. Thank you.

I am currently trying to make the first sensor to make my own optical encoder (The same kind you find in a track ball mouse). I am using a IR LED and a IR Receiver withe basic Analog Read program but I can't get the Receiver to change its reading, whether its covered or not.
RS Online code is 708-5023 for the receiver. Pin 1 is going to Analog 0, Pin 2 to +3.3V, Pin 3 to GND. The IR LED is positioned directly in front of it, so I can slide a piece of paper between them. The reading is the same if the LED is there or not, or even on... I am missing something.


It's not what you're asking, but I'm sure you'll find that conventional seat belt sensors have a switch inside the buckle rather than monitoring extension of the belt. If you were putting this into production it would make sense to use a commercial sensor, and even for a prototype this would make more sense and be more reliable. I think the usual approach is to put a magnet on the tongue of the buckle and a reed switch in the buckle housing. Reed switches in the cushion are also used to detect whether the seat is occupied. (These could be wired together to produce a single output indicating whether the seat was occupied with the belt unfastened.)


I know that 2 switches already exist but these can easily be tricked into giving a false positive in many ways.
The reason for measuring extension of the belt; as well as using an IR heat sensor in the seat and lower back rest, is to make the system more reliable.
It will now be able to tell the difference between sitting on the seat belt, just using the laps strap and using it properly. The IR can then tell if its a person or a bag that has been put there.
I am trying to take Seat Belts to the next level, but it doesn't matter if it fails cos its all in the development and research. Though it would be great if it worked as I have planned.

Go Up