What’s up my friends, welcome back. Almost all of my DIY project have a 3D printed case of some sort of printed part. To print an object, you first need the 3D file. You have the file, you print the object. This project will do just the opposite, you have the object you get the 3D file. This machine should be able to 3D scan small objects with dimensions up to 13cm in the x and Y directions.
Below you can find a link for the STL files for the frame. Download it and print the files using your 3D printer. I've used 2 perimeters, 20% infill, 0.4mm nozzle and 0.2mm layer height.
Follow this steps and build the frame. Place the two NEMA17 motors in place on the frame base. Fix them in place with M3 screws and the printed top parts. Now, fit in place the two smooth rods. Prepare the Z-axis carrige with the linear bearings. Use zip ties and fit those in place and then, add a 8mm nut on the back.
Now place the carrige on the smooth rods, add the plastic pulley on the shaft of the motor and put the threaded rod or lead screw. Finally, add the turntable on the front motor.
The sensor will give a direct analog output according to the measured distance. Finnaly, add (or not if using no homming code) the limit switch for the Z-axis. This limit swithc is used to home the axis at the beggining of the code loop when we start the machine. The frame is ready.
This below is what we need for the electronics part. The schematic is with an end stop limit switch. If you don't want to use it, make sure to later upload the code without limit switch. The push button is used to start the scanning process.
I've made all teh connections on a drilled PCB. We have the Arduino NANO with female pins so we could remove it. The SD card module on the side and the rest of the components. The input of 12V will eb connected to those two screw PCB connectors. I've used 0.1mm wire to make the connections. Remember to add those 47uF capacitors for the motor drivers. Connect the wires from the motors and sensor to the PCB. Make sure the rotation is in the desired direction. If not, juse reverse the motor inputs.
Let's see the code. Don't change anything in the code. Just the first variables at the beginning of the code acording to the parts you have used and the layer height you want. You have a code for the schematic using limit swithc for z-axis and for the manual homming. Download from below the code you want to use. If you don't have the limit switch connected, just use the other code.
//Editable variables int scan_amount = 40; //Amaunt of scans for each point. The result is the mean. This would increase the delay for each scan. String file="scan_001.txt"; //Name of the saved file on the SD card int z_axis_height = 12; //in cm //Maximum height of the scaned file int step_delay = 3000; //in us //Delay for each step for the stepper motor in microseconds float z_layer_height = 0.5; //in mm //Layer height. The amount of mm for each layer. int lead_screw_rotations_per_cm = 8; //How many rotations needs the lead screw to make in order to make 1cm. int steps_per_rotation_for_motor = 200; //Steps that the motor needs for a full rotation. int distance_to_center = 8; //In cm. Distance from sensor to the turntable center in cm
Read all the comments in the code for better understanding. The code is simple. Create a loop that will make 360º rotation of the turntable. Each step we measure the distance. The X and Y increment is given by simple trigonommetry as seen below. Next, the x, y and z variable are stored to the SD card divided by a "," character. This step is important for later.
Place the object on the turntable in the middle. Connect power supply and wait for theamchine to home itself. When reached, press the scanning push button and wait. Depending on the layer height you choose and object size it will take more or less to complete. Once complete, remove the SD card.
Remove the SD card and copy the file to your PC. The file should have the next format. Three columns separated by a comma with the values of the x, y,and z coordinates. This are just points in a format of a point cloud. To obtain an STL file, we use the MESHLAB software which you could download from a link below.
Now go to filter, remeshing simplification and reconstruction and here select screened poisson surface reconstruction. Play with the settings if you want and then click apply. Close the window and there we have our file.
Now, the file was scanned. The precision is not that good. For learning purposes, this project is more than enough.
So, there you have it guys. The precision could get better using a better distance sensor. Maybe a laser based one would give better precision. Also have in mind that in the code, the sensor makes 40 measurements and give the mean of those in order to increase precision. Consider using a lead screw instead of a normal threaded rod, better sensor, more measurements, add an end stop switch and improve this project however you want.
Help me on PATREON.