Mars two moons, Phobos and Deimos, are like the bay leaves of the solar system theyre fine I guess but what are they trying to do The larger satellite, Phobos. In this post I will show you how to measure distance with the EOPD sensor. I will explain the math and give you some data and show you how it was analyzed. TechBrick is an independent robotics and STEM education club for homeschooled, public, and private school students in Harford, Baltimore, and Cecil counties in Maryland. For more fun, if you have a second NXT brick, you can make the Segway rider on this robot lean forwards and backwards via Bluetooth remote control, which will. Microsoft Robotics Developer Studio Microsoft RDS, MRDS is a Windowsbased environment for robot control and simulation. It is aimed at academic, hobbyist, and. In recent weeks, a story about experimental Facebook machine learning research has been circulating with increasingly panicky, Skynetesque headlines. EOPD How to measure distance Hi. Technic Blog. In this post I will show you how to measure distance with the EOPD sensor. I will explain the math and give you some data and show you how it was analyzed. Equations for calculating distance as well as calibration constants will be presented. Sample code in LEGO Mindstorms NXT G and NXC. Essentials NXT G EOPD Programs for LEGO Mindstorms 1. NXT G EOPD Programs for LEGO Mindstorms 2. NXT2/segway/DCP_3117.JPG' alt='How To Program An Nxt Segway' title='How To Program An Nxt Segway' />Download past episodes or subscribe to future episodes of Conversation with the Big Guy by Conversation with the Big Guy Ryback Phoenix Marie for free. NXC EOPD Programs. Excel spreadsheet with EOPD Calculations. The EOPD Sensor, unlike the Ultrasonic sensor, does not measure distance directly. The EOPD Sensor is really a type of light sensor with one big difference it only measures light that comes back from its own LED. Since the EOPD sensor ignores ambient light, there is one less variable that determines what the sensor value is. If you think about the LEGO Light sensor, there are essentially three variables that determine the value The color or shininess of the surface. Since the LED is illuminating the surface, the more light that comes back the higher the value. White high, black low. The distance to the surface. If the surface is closer, more of the light from the LED makes it back into the sensor element so you get a higher value. More about this later. And finally, the ambient light. This is especially true when the sensor is further away from the surface. In that case the illumination from the LED is usually relatively weak compared to the ambient light so the variation can be significant. How To Program An Nxt Segway' title='How To Program An Nxt Segway' />The EOPD sensor, on the other hand, is virtually immune to variation in ambient light. That means there are only two variables left in determining the EOPD sensor value, the shininesscolor of the surface and the distance. This is very useful because if use the sensor in a situation where you can control one of these variables, then the sensor can be used to determine the other, and you dont have to worry about the variation in lighting. So how does one measure distance Well the first thing we need to do is make sure that the nature of the surface is consistent. For example, if we make it work so that we can measure the distance to a white wall, then it wont work well with a blue wall. Download Gadgets For Windows Vista Sidebar'>Download Gadgets For Windows Vista Sidebar. That is because the blue wall will absorb a lot more light than the white wall and, in effect, appear further away. But once we work out the math it will be very easy to adjust from one type of wall to another. The other thing we need to make sure is that the surface is big enough. How To Program An Nxt Segway' title='How To Program An Nxt Segway' />If we move the sensor far enough away and the whole cone of light is no longer striking the surface, then this will also throw off the distance calculation. Lets try to understand what really happens when an EOPD sensor faces a wall. Light comes out of the LED as a cone of light. This cone will then make a circle of light on the surface. Note, that the distance from the LED to the surface is not really what is important. Even though the light looks brighter on the wall when there is less distance, there is actually the same amount of light, it is just spread out over a larger area. Now the light on the surface will scatter in all directions and only some of that light will come back into the sensor element. So lets imagine just a single point on the surface. If the EOPD sensor is a certain distance to surface, then you can image another cone from the point on the surface back to the sensor, this time to the sensor element. Thats the light that we are actually measuring, well actually that plus all the light from all the other points of light on the surface. So lets say we get a certain EOPD sensor value at certain distance. For example we might get a value of 2. So what happens when the distance doubles to 4 cm Imagine that cone of light from the point on the surface going back to the sensor element. Now that cone makes a circle on the sensor cap that is twice the diameter of before. Since the area is proportional to the square of the diameter, that circle on the sensor is now four times bigger than before. That means only as much light is actually reaching the sensor element. Now repeat this for all the points of light on the surface and you can understand that the EOPD value goes down with the inverse of the square of the distance. If the distance goes to 6cm, then the circle on the sensor is now three times the diameter, thus 9 times bigger in area, thus the value should be 19 of the original value at 2cm. Thus the sensor value should be something like this Where k is some constant that sets the scale of the value. But what we want is the distance given the sensor value. With a little bit of algebra we can solve this for distance and get this Since the square root of k is just another constant, we will rename it to k. DSC_3230.JPG' alt='How To Program An Nxt Segway' title='How To Program An Nxt Segway' />Scale and get rid of the radical. So now the formula is Okay, thats the theory. The reality is really close but not exactly the same. To set the constants we will now get some sample data and enter them into a spreadsheet so we can analyze it and figure out what the ideal constant will be. Here is my test setup I used the program View. EOPD and then I recorded the raw sensor value for each distance from 1 to 1. LEGO brick wall, entered them into excel, and then graphed them so we can see what is going on. There are two main things to observe in this graph, one is that it is non linear, which is what we expected since the value is supposed to be the inverse of the square of the distance. Spore Free Full Download there. The other thing is that the data at the beginning of the graph is clearly not consistent with the rest of the graph. There are two reasons why this is happening one is that the analog sensor values on the NXT are limited to a range of 0 to 1. The sensor is electronically limited to about a range of 0 to 1. The other reason is that the sensor is so close at 1cm that the offset between the LED to the sensor element is preventing some of the light from getting in. Our goal is to calculate the distance given the raw sensor value, so now we are going to do some analysis so that we can mathematically convert the raw sensor values into the distance. To that we are going to add a column takes the inverse of the square root of the raw sensor value In this graph we can see that we have now made the data linear. The next goal is to scale it so that the linear range, at least from 3cm to 1. At 1. 0cm the value was 0. Since this represents a distance range of 7. In other words, our first good attempt at getting a distance from the raw value should be with the k. Scale constant equal to 1. Let put this into the data and see how we dok. Scale1. 09. 5. CM  Raw   SqrtRaw  Error19. As you can see, in this table I have added one more column, the error between the calculated distance and the actual distance. By looking at the error we can see that it is very consistent. If we want to be consistently close to the actual distance then all we need to do is subtract the average error as well. Here is the new formula that includes the new k. Error term, which for this data should be set to around 1. This is The Equation that we need to calculate a distance using the EOPD sensor. So why do we need an error termWe are measuring the distance to the leading edge of the sensor but that is not actually where the sensor element is. The sensor element is inside the sensor case. Also, the light does not go straight onto the sensor element but first passes through the small lens, which I think also affects the distance calculation.