Finding direction of rotation

Posted on 2011-03-08
Medium Priority
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?
Question by:surajguptha
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
LVL 63

Expert Comment

by:☠ MASQ ☠
ID: 35072981
Popular interview question this year
Try this
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?
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.
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.
Need protection from advanced malware attacks?

Look no further than WatchGuard's Total Security Suite, providing defense in depth against today's most headlining attacks like Petya 2.0 and WannaCry. Keep your organization out of the news with protection from known and unknown threats.

LVL 63

Assisted Solution

by:☠ MASQ ☠
☠ 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?
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:
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
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.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The greatest common divisor (gcd) of two positive integers is their largest common divisor. Let's consider two numbers 12 and 20. The divisors of 12 are 1, 2, 3, 4, 6, 12 The divisors of 20 are 1, 2, 4, 5, 10 20 The highest number among the c…
Prime numbers are natural numbers greater than 1 that have only two divisors (the number itself and 1). By “divisible” we mean dividend % divisor = 0 (% indicates MODULAR. It gives the reminder of a division operation). We’ll follow multiple approac…
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…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month14 days, 4 hours left to enroll

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

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

Join & Ask a Question