[PROJ] Scanner 3D
JeanD
Posts: 15
Hello everyone !
I'm Jean, a french student (well, I'm in my last year of high-school). I've been messing around with a BS2 this year in a school project (I can make a topic about it if someone is interested)
For two weeks now, I've been working on a top-secret project (Ooh :0). I think that I've got a neat idea, but I think sharing it with others would be enriching, plus I think that I'll have some problems so I'll probably need some help from you guys [noparse]:p[/noparse].
Codename : S3D
The·goal of this project·is to create a machine that can scan it's surrounding to create a point cloud, viewable in 3D on a computer.
After some search it seems that this kind of machine exists, but are quite expensive (starting at 100,000$).
So, my objective is to make such a machine but with a very low budget (under 1000$). Of course, mine won't be as performant as commerical ones, I aim at a cloud point of about 100,000 points and a maximum scanning range of 10 meters. Enough for indoor environnements
Theory and Principle
The scanner is composed of 3 main elements :
The rotation of the head is driven by the microcontroller, which, at the same time, get the distance from the laser sensor.
So, for each position of the rotative head, we can get a single point of the space. This is achieved with trigonometry and three values physical values :
Since I don't know how to do a schema in 3D, there are two schemas, from the front and from the side.
That's all for the moment. The project is more advanced but all I have written at the moment is in french, so I need time to translate everything.
To summerize what I've done so far·:
And here's what I need to explore :
I hope my english is not too bad !
Feel free to post.
I'll try to update soon the topic with more material.
I'm Jean, a french student (well, I'm in my last year of high-school). I've been messing around with a BS2 this year in a school project (I can make a topic about it if someone is interested)
For two weeks now, I've been working on a top-secret project (Ooh :0). I think that I've got a neat idea, but I think sharing it with others would be enriching, plus I think that I'll have some problems so I'll probably need some help from you guys [noparse]:p[/noparse].
Codename : S3D
The·goal of this project·is to create a machine that can scan it's surrounding to create a point cloud, viewable in 3D on a computer.
After some search it seems that this kind of machine exists, but are quite expensive (starting at 100,000$).
So, my objective is to make such a machine but with a very low budget (under 1000$). Of course, mine won't be as performant as commerical ones, I aim at a cloud point of about 100,000 points and a maximum scanning range of 10 meters. Enough for indoor environnements
Theory and Principle
The scanner is composed of 3 main elements :
- A laser distance sensor
- A miror mounted on a rotative head (two axes of rotation)
- The "brain" ( a microcontroller connected to a PC )
The rotation of the head is driven by the microcontroller, which, at the same time, get the distance from the laser sensor.
So, for each position of the rotative head, we can get a single point of the space. This is achieved with trigonometry and three values physical values :
- The distance from the mirror to the obstacle
- The angle of the laser ray in XY
- The angle of the ray in YZ
Since I don't know how to do a schema in 3D, there are two schemas, from the front and from the side.
That's all for the moment. The project is more advanced but all I have written at the moment is in french, so I need time to translate everything.
To summerize what I've done so far·:
- A basic solid works model of the machine
- Searches on effectors to use (I need precision !)
- Which sensor to use and how to send distance datas to the microcontroller (The IFM ref. O1D100 seems like a small and affordable sensor to me, yet efficient. It outputs an analog signal, proportionnal to the distance it detects, so I suppose a A to D chip like the MCP3001 would fit.)
And here's what I need to explore :
- Can a BS chip calculate trigonometry ?
- How can I store point coordinates on the PC that the BS send through serial or USB ?
- How to open and view the point database in a 3D software ? Which format should I use ?
- What type of servos would be precise, fast and yet affordable ?
- How to contrôle these precisely from the BS ?
- What would be the best mecanical solution for the rotative head ? It needs to be rather simple and yet precise (At most a precision of one degree, 0.5 degree would be great)
I hope my english is not too bad !
Feel free to post.
I'll try to update soon the topic with more material.
Comments
My first thought was to use servos.
But, it seems that these are not precise enough for my needs.
Since the movement of the rotative head is continuous, for both axes, I think that two stepper motors with a reductor would work great.
What about this kind of product : www.skfequipements.skf.fr/datasheet.aspx?lang=en&cou=2&pid=448687&cat=2126 ?
Each step is 7,5°, and with a reduction of 20, the output is really precise, one step is 0.375° on the output ! Considering that the scan is on 360° around Y, I can exactly get 960 points maximum.
And, considering that the mirror can only rotate on 160 degrees, it makes a resolution of 0.75°, that's about 213 points.
So, with the precision brought by such an effector, I can get 204 480 points, which is really enough.
I think that it won't be too hard to control these motors from the Basic Stamp, but if you got any links on the subject they are welcome !
This also brings another problem, 200 000 points is a lot, so I need to make the rotative head as fast as possible, and yet precise.
Considering that the laser sensor runs a 50Hz, I think that aiming that a frequency of 25Hz for the process of acquiring point datas is fair.
To get the whole cloud, 204 480 points, that would last 2 hours and 30 minuts. Hence we can drastically reduce this time by lower the resolution of point cloud.
I've also been looking for someway to bring my point datas from the BS to the PC.
Can I do that with Stamp Plot ? (I've never used this software, only the Stamp Editor actually).
And I'm still not sure about when and where should be done the calculus, since the BS doesn't support decimal numbers and tough trigonometry, I think that sending raw datas for each points to the PC is a better solution. Then the PC will be able to calculate all the coordinates.
Comments would be greatly appreciated ! [noparse]:D[/noparse]
If I get to work PLX-DAQ correctly, then everything is alright, I can treat all the informations easily in Excel to get my coordinates. Plus, it is quite easy to convert these coordinates from excel to the ".obj" format, which can be read by most of the 3D softwares.
The only things that worries me is the Speed to draw the datas from the BS, won't be long, or it would really slow down the scanning.
Anyway, even if it would be long, it would work, that is the most important right now.
Now, I have some questions considering my laser sensor. This sensor outputs an analog signal, ranging from 0V to 10V. The signal is strictly proportional to the distance it detects (0 to 10 meters). So I have to find a way to convert this Analog signal in a Digital signal, which could be read by the BS.
I found a tutorial on instructables.com, which explains how to do such a thing using an A to D chip (a MCP3001).
link : www.instructables.com/id/Digital-Voltmeter/
Sounds convenient, really fast (100ksps !), though not really precise : the MCP3001 has a precision of 10 bits, which is cleary not enough considering that the laser sensor has a range of 10m and has a precision of about 2 millimeters. And with 10 bits I would just be able to get a precison of 10cm, quite frustrating...
And those kind of chips doesn't go higher than 13bits (the MCP3301). That's a resolution of 8000, do you think I can manage to have a decent precision ? 1 mm equals 1 mV...
Since ths BS can't store variables of more than a Word, I'll have to go for a centimetric resolution, which remains decent .
It seems that there are other kinds of A to D chips, but then, even if they can store larger values, they have really low sample rates (4 to 15sps).
Do you have a solution to this problem ?
Message Edité (JeanD) : 4/21/2009 8:22:53 PM GMT
Anyway, what is great with the BS is that there are a lot of resources on the web.
I found some articles to know how to drive stepper motors with a BS, not that hard.
Same for the A to D converter, I've found some interessant tutorials. Though I'll have to stick to a 13 bits AtoD converter.
Still, it's a resolution of 1,2 mV, that is enough...
Oh, and I've made a flow chart that details the whole program (I've just replaced some part with some GOSUB, because the flow chart would have been too big and hard to read. The file is attached to this post.
And please guys, let me know what you think of it. Only 2 replies and almost 80 views ! Am I asking foolish questions ?
edit :
I forgot to detail two variables on my flowchart :
st_pos_h : Used to know if the head is in initial position (st_pos_h = 1 means that it's in position 0° in horizontal)
st_pos_v : Used to know if the head is in initial position (st_pos_v = 1 means that it's in position 0° in vertical)
Message Edité (JeanD) : 4/24/2009 8:58:01 AM GMT
Hi JeanD, I think you are off by a factor of 10.
10 meters = 10,000 mm right?
10,000 mm divided by 2 mm resolution = 5,000 steps no?
13 bits = 8,192 steps.
Am I missing something? It seems like a 13 bit ADC is a good fit.
Even the 10 bit ADC will give you centimeter resolution at 1,024 steps. 10 meters = 1,000 centimeters.
Interesting project, keep us posted!
Rich H
Post Edited (W9GFO) : 4/24/2009 5:45:26 PM GMT
But then, I realized that with 13 bits I would get a nice precision :
I really want to get on the BS2 and buy those parts, but I've got two wait, I own no BS2, I use the ones we use at school. Plus I've got two weeks of mock exams starting this monday.
Anyway, it's positive, it forces me to think and organize the project instead rushing to the soldering iron .
I'll try to get some funding from my school, since some parts are quite expensive (the laser sensor and the stepper motors mainly).
By the way, do any of you know a good laser sensor ? My searches lead me to the IFP efector pmd (O1D00), which is compact and not too expensive, but it outputs an analogue signal. A sensor with a serial outpout would be neat, but most of them are big and very, very expensive.
Still, I found some time to work on the project.
I have worked on the steppers, and I think this part is almost finished.
Here is a simulation I made in ISIS : www.youtube.com/watch?v=nPlBQN9Lhho . That's what we use at school and it's sweet since it can simulate BASIC Stamp chips !
The video shows a stepper motor driven by a BS2. It is using half-stepping. The BS2 should be connected to a SN754410 but this chip doesn't exist in the ISIS library (Is there a way to add it to the library ?). It should be wired using this scheme :
A1,A2 and B1,B2 being the wires to the motor.
So in the simulation the motor is directly connected to the BS2, but it's supposed to work the same If I add the SN754410 using the scheme up there.
Here is the program used to drive the motor, what I need to do now, is to modify it to be used and called as a sub program in my big main program. This programm is made in a way that you can precisely go one half-step forward or one half-step backward at a time. To do that, I'm keeping the half-step position in a variable, so when it needs to kgo back and forth, it knows wich "step" to activate. I hope my english is not too bad so you can understand .
[code]
' {$STAMP BS2}
' Programme de commande d'un moteur pas
As you know, I have to measure a voltage value ranging from 0V to 10V.
For this I'll be using a MCP3301.
I've been trying to simulate the thing on ISIS but it doesn't work (and I'm using the MCP3001, cause I don't have the MCP3301 in my ISIS's library, but it works ablsolutely the same way).
The problem comes after the two clock cycles of initialization and the null bit is sent, when the SHIFTIN function should be called.
In fact, it doesn't send any serial word, like it should, it just seem to skip the SHIFTIN function.
Here is the scheme in ISIS :
And here is a zoom on the logical states when it comes to the shift in function is suppose, the clock is crazy. Do you know what can be wrong ?
And here is the code I did, based on jasonbabcock’s code :
www.youtube.com/watch?v=YCz-q3BGsh4
And here is the code of my main programm, the sub-programm supposed to get the data from the MCP3301 has been removed, replace by a PAUSE. Don't worry if you see some french, I write all the important comments in english.
I've fixed my analog to digital problem, just a little problem with the ground (ISIS is a bit tricky sometimes).
I just need to buy all the parts and try the electronic in real-life conditions.
Then, I'll just have the mechanical part of my project to complete, but I'll try to get some help from my teachers since I'm not very strong in that matter.
Here is the final result in excel, as you can see all the required datas are sent, and then those are really handy to process (for instance to calculate voltage from the outputed value of the MCP3001). Oh, and I plugged a sin generator to the input of the MCP3001, to see if it worked well. And it does !