Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
Solved

# Finding direction of rotation

Posted on 2011-03-08
Medium Priority
2,417 Views
Last Modified: 2012-05-11
There is a disk on a turn table. Half of it is black, and the other half is white. It is rotating in constant speed, but it's rotating fast so that you can't see whether it's going clockwise or counterclockwise. You also have a set of stationary sensors you can install anywhere which can tell whether the color of a spot has changed from black to white, or vice versa. What is the minimum number of sensors needed to find out which way the disk is rotating? What is the best, average, worst time to figure out the direction? If you use more sensors, can you improve the best, average, worst time? How can you accomplish that? If you are given only one sensor, how can you find out the direction, assuming you can change one constraint of the problem?
0
Question by:surajguptha
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• Learn & ask questions
7 Comments

LVL 63

Expert Comment

ID: 35072981
Popular interview question this year
Try this
0

LVL 21

Author Comment

ID: 35073242
If the sensor could just find if something has changed from white to black or black to white and there are two of them, how can you determine the direction of flow? I still don't get it. The sensor would just say white-black or black white. I can't seem to write a computer program that takes these values and makes a decision even if I know the speed of the turn table. I am feeling dumb, Can you kindly break it down for me?
0

LVL 32

Accepted Solution

phoffric earned 672 total points
ID: 35073509
OK to assume that the black covers 1/2 semi-circle and white the other half?
OK to assume that no matter how fast the RPM is, the sensor is able to send a signal when there is a change in color?
If so...

>> You also have a set of stationary sensors you can install anywhere which can tell whether the color of a spot has changed from black to white, or vice versa.

The sensors don't even have to be able to tell whether black turned to white, or vice versa. It just needs to send a signal indicating that a color transition occurred.

Two sensors very close to each other near the rim of the turn table should suffice. Facing the turntable at level position, you can call them L and R for left and right. When a color state change is detected, then a signal is sent to the computer which has two channels, one for L and one for R. So the computer reads 0 or 1; 0 means no state change detected; 1 means a state change has occurred.

Consider the sequence.
L R
0 0  // no state change for either sensor
0 1  // the right one has seen a transition
1 0  // the left one a short distance away has seen a transition
0 0  // the transition has past both

This sequence means that the dividing line between the two colors went from right to left, which mean clock-wise.
0

LVL 63

Assisted Solution

☠ MASQ ☠ earned 664 total points
ID: 35073545
If the disk is half black and half white you have a single line running along the diameter which represents the change in state (if you like on or off) when viewed by the sensor.

Grab two sensors and place them at equal distances from the center of the disk so they measure the same point on that line.  Place them a short distance apart, maybe 15 degrees.  Then record the time between them being triggered by a change of state.

Does this allow you to determine the direction of spin?
0

LVL 16

Assisted Solution

HooKooDooKu earned 664 total points
ID: 35073680
With some assuptions, the two sensors can be used to determine the direction of by tracking the timing of when the sensors detect the white to black and black to white transition.

Now a few of the assuptions:
1. The two sensors can not be directly opposite each other, and you know their relative locations.
2. You get to either query the sensors and they tell you the current color under them, or the sensors are linked to your computer in an interupt pattern such that each time a sensor changes, an event is triggered in your program.
3. The speed of the sensors and your computer are MUCH faster than the disk (i.e. if you are having to pole the sensors, you can pole the sensors MANY times in one disk revolution.

Now all you need to do is build a time history of the change to determine the pattern of the black-to-white and white-to-black transitions and determine at any given moment where each sensor is in the pattern and what their current value is.

For example, lets say that we can sample the disk 12 times per revolution and the disk is painted with the left side black and the right side white (i.e. in one revolution there is only one transition from black to white and one from white to black).  Lets also say the sensors are 90 degrees appart.

With this setup, we can reprsent the history of what the sensors sees like this: "BBBBBBWWWWWWBBBBBBWWWWWW".  Basically, the first 6 samples saw black, the next 6 samples saw white, etc.

Now just look at the side by side history of the two sensors.

If Sensor 1 is at the 12 o'clock position and sensor 2 is at the 3 o'clock position, and the history pattern of the two sensors looks like this:
Sensor 1 "BBBBBBWWWWWWBBBBBBWWWWWW"
Sensor2 "BBBWWWWWWBBBBBBWWWWWWBBB"
You can see that the transition from black to white happens in sensor 2 before it happens in sensor 1, so the disk must be spinning counter clock wise.
we don't have a star-burst pattern of alternating black and
2. The sensors are either is is a dynamic system (i.e. the disk is spinning, the sensors
If the black/white pattern is different that the spacing of the sensors (i.e. if the left side is black and the right side isthe two sensors are NOT directly opposite each other, and the spacing of the black/white pattern is differe , and you are somehow getting data in something of real time (i.e. either as the sensors are constantly sending data
0

LVL 101

Expert Comment

ID: 36275164
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This algorithm (in C#) will resize any image down to a given size while maintaining the original aspect ratio. The maximum width and max height are both optional but if neither are given, the original image is returned. This example is designed t…
One of Google's most recent algorithm changes affecting local searches is entitled "The Pigeon Update." This update has dramatically enhanced search inquires for the keyword "Yelp." Google searches with the word "Yelp" included will now yield Yelp a…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
###### Suggested Courses
Course of the Month12 days, 2 hours left to enroll

#### 636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.