As I noticed, fixed dimensions of laser cutters, plotter CNCs and 3D printers also the high cost are the main limitations of using these machines; so my idea is to make a free size, low cost small car robot which has changable pen's ability to be used for both cutting on a piece of paper with pen knife and drawing any shape with pen on any flate surface. This robot will help the people who works in paper crafts and architecture students to build their prototype models at low cost and without the size limitation of CNC machines and laser cutters.
In fact, one of the most important skill in my project is a 3D desgin because I decide to do the most of components rather than buy them. According to my good experience in Solidworks
and the power of the software in both part design and assembly I used it to design all parts. Then to 3D print designed parts I used software to define suitable
settings for each part.
These are the parts I designed and printed:
Actually, I designed and printed the stepper motor holder in 3D Scanning and Printing week So there I have detailed documentation..
This is the final design:
I used these settings in Cura to print the holder:
The final result after print completed :
I spend long time designing and printing my wheels which have two parts rim and tire. Finally, I succeeded to have a functional, good look wheels. I documented all works I did in 3D Scanning and Printing week
HERE.
After that week I change my rim little bit to have a hole for a screw to fix it on the motor shaft.
The final rim design:
The final design of the tire:
The wheel after assembled in Solidworks:
Final successful Cura settings for the rim:
Cura settings for the tire which printed using FilaFlex 3D flexable material on Witbox 2 printer.
Ready wheel after printed :
To fix servo motor to the base I designed small piece has holes compatible with servo's screws position shown in the datasheet:
The designed piece:
Cura printing settings:
I want to design a flexible holder to the pen to let me change it easily with a pen knife. In order to design something compatible with the pen knife I have I just draw an approximate shape similar to it:
Then I designed small part to connect the pen with moving rack which will be shown in the next section.
Printing settings
After printing
The appearance is very important in the project evaluation so I decided to design a cute cover for my car. It has three parts, two parts in the bottom to hide the motors and other parts. The upper one is like a cute toy car with 3 openings to easily the pen to change it and PCB to connect wires for programming. The cover will fixed on the base using M4 screws.
I designed the two bottom cover parts in one part and then I saved them separately as two bodies to print each one alone because they are bigger than Ultimaker's bed size.
The bottom cover design:
I used the same settings for each part:
The parts while printing
I spend long time trying to design a Cute case for my car!. I started with the base sketch and I bulid my case on it. The following photos show design steps:
I couldn't print the case using Ultimaker because it's big size, so I used 1.75mm PLA filament with Witbox2 printer. The settings:
While printing
After complete printing
I assembled all designed parts together to see how my car will look like. This picture shows everything except the cover:
This is my car with cover.
After that I rendered this photo using Photoview 360 Add in in solidworks:
I used laser cutting machine to fabricate two main parts of my project Base and Pen up and down axis. Because I want to assemble all parts together to make sure every thing is fit, I used also Solidworks to design, then I saved files in .DXF for format, transfer them to Inkscape for some editing before cut them with the laser machine. A detailed documentation of how to edit dxf file in inkscape and how to cut using a laser cutter could be found on Computer Controlled Cutting Week .
Final base design with description of each hole function:
Base DXF file
Base after editing in Inkscape. Red color stroke and 0.1 line width.
To cut the base I used 5mm thickness MDF wood with these settings: Power= 100, Speed= 0.3 and Frequancy= 2000.
Bottom view of the base with parts connected to it:
I used Rack and Pinion mechanism to move the pen up and down. I added them from Solidworks Design Library as shown:
The following pictures show the properties of the pinion and rack respectively:
After that I added some holes to the pinion and assembled it with the servo motor and designed a holder for the rack. This is the final axis assembly:
I designed a holder as a 3D part with 9mm thickness in order to fabricate it from three layers of 3mm acrylic using laser cutter. To save 2D DXF file for these layers I used a trick which is select desired faces, then right click and press on Export to DXF feature as shown:
To save the middle layer I draw a sketch with 3mm thickness and Extrude cut the part to reach to the wanted faces, then select them and saved them as the previous step:
All axis part in Inkscape before transfer them to laser cutter:
I used 3mm thickness acrylic with these settings for laser cutting: Power= 100, Speed= 0.25 and Frequancy= 15000.
All parts after cutting and cleaning:
I used Eagle software to design my board as I did in Electronics Design week.
I want to use two stepper motors for my car, so I decided to use Pololu A4899 stepper driver which we use during machine building week but instead of using a commercial CNC shield I want to put two drivers on my board. I searched for an Eagle library for the driver, but unfortunately I didn't find any compatible one. So I decided to design my own library ;).
I started with adding a new library. The main parts should I define in the library are Device ,Package and Symbol
``Back to datasheet to see the dimentions of the drive:
From Add Package icon, I started to draw the shape of the driver which will be appearing in the layout and define the layer of each added components, Begin with 0.8'' X 0.6'' outter rectangle. Then I added pads, with standard dimension between them 0.1'', also added the name and the center of the package.
Then I added Symbol to be used in the schematic design. I named each pin the same as a datasheet.
After that I added a Device to connect the schematic symbol with package layout. Then I saved my library. Now it is ready to use ^_^
The next step is to test if my library works well or not. This is how my driver looks in ADD list
The driver layout:
Then I followed the procedure of Electronics Design week to mill it. This is the result after adding females pin header and mount driver on them. It was a perfect result!!
I used ATMEG p328 microcontroller as I did in Electronics Design week with my general purpose board. The chip pinout:
In the schematic I started adding main components. First thing was the controller as shown:
Then I added some capacitors for power stable and an LED between VCC and ground to light when the power reaches the board.
Crystal and some capacitors
Pinheader connected to progranmming pins and LED to SCK pin to light while programming.
Two drivers with 4 pin headers for each one to connect stepper motor wires to them.
The last thing I did was to make pin header for Servo motor Bluetooth and many sensor may I used in future.
The microcontroller after connecting everything.
Now move to board layout. As usual I spend alot of time in this step. I had trouble with VCC, A frind help me to solve it by a trick of making a double side hole and connect it from the buttom of the board with a wire. some steps :
When I finished my board I exported the shown PNG image:
To fabricte my board using Roland machine I folloewd steps of Electronics Production week. I started with cutting inside traces
Fab Modules settings:
Then I fixed my board, defined zero of X, Y and Z axes as I did in Electronics Production week.
The second job was hole drilling. The layout of holes:
Fab Modules settings:
I designed my board to be fit with boards dimentions 70x50mm so no need for out cut job
My board after both job completed
The next step is to solder my board. The figure below shows board after MCU chip soldring:
After I complete soldring:
Before I'm using sensors and motors in my car I wanted to test them separately to see how could I control them.
In the following tests I used these components: Arduino UNO, bipolar Nema 17 stepper motor and Pololu A4988 driver also breadboard and some jumpers.
I began with connecting one stepper motor with Pololu A4988 driver and Arduino UNO using this connection from Pololu website
I uploaded this simple code which will rotate the stepper in one diriction to the Arduino
The results in this video:
In this code I tried to change rotation direction.
The results in this video:
What I did next is to connect two drivers and two motors with common direction and step Arduino pins so they will recive the same pulses and moves in the same direction. I used previous code with different delay times to test different speed. I did this test with my first version Four wheels car.
The connections:
This video shows one of the results
In the following tests I used Arduino UNO and HS_422 servo motor with some buttons and jumpers.
I started playing
with this servo for the first time. It is really easy to connect and control it. It has just 3 pins, two for power and the third connected to Arduino digital pin to control the position of the servo. In fact, I found two types of this servo in the lab one with limit switch inside it so it will rotate for angles less than one rotation I think 180 degrees. The other type is modified to give continuous rotation.
At the beginning I wrongly thought that a half revolution is not enough for my pen axis movement so I decided to play with continous servo at this step.
In ArduinoIDE there is a library for servo. I used it control my servo. After I read about continous servo i discovered that I couldn't control the angle of it even that I give it sertain angle it will just rotate ether CW when I give it 0 degree CCW when 180 and stop at 0. I started with this simple code:
Video of this test result
After that I added a push button and improved the code to test if I want to use a limit switch. The servo will rotate until the button pressed. This is the code:
Watch the result
I used Arduino UNO and IR sensor shown below:
In 2D Design and Laser Cutting section I explained how I designed and fabricated the pen axis mechanism. In this part I will illustrate how I assembled it and fix it to the car base. Firstly, I connected pin Holder 3D printed part to the acrylic rack using screws as shown:
Secondly, I laied first layer acrylic part, then the second layer with the rack int the gap of it, the third layer at the top, then I fixed them with M3 screws and nuts put I noticed if I tied the middle screws the rack's sliding motion became difficult.
Also I connected pinion to the servo motor using small screws comes with the motor.
This is really tricky step. I had to fix the servo in the write position so the pinion contact with the rack and move smoothly then fix the mechanism. I struggled with this procedure, but finally I mounted everything successfully ^_^.
I started by fixing servo motor support 3D printed parts with the base using screws, then put the servos with screws, but without tying them, then I put the mechanism and checked tying if it is moving smoothly, when I found the best position I fixed the mechanism with super glue and tied screws. The Final results in these pictures:
Before moving to the next step I tried to run the servo to check if the mechanism works fine or not. I used the same code and connections I did in the previous experiment servo section. This video shows the results:
Fortunately, I designed holes for stepper motor holders and also for universal wheel. Firstly, I fixed stepper motors with the stepper 3D printed holders using M4 screws then connect the wheels to the motor shaft after that I fixed the holders with base using M4 screws and nuts. When I moved to universal wheel I discovered that it will be shorter than the other wheels so the car base will be sloping so I used plastic extension parts I don't really know their names anyway the used in some robotics kits in the lab. See them in the figure below:
The results after completeing:
Actually, before I connected my board to run my car I used commercial Arduino UNO. The detailed documentation will be in the next section, but I put this part here because I want to document all assembly steps in one section.
Before I connected stepper motors to my board I cut their tall wires and cut female female jumpers and soldered them with motors wires to easily connect them to my board.
After I complete soldering I connect stepper wires, servo wires and IR wires to my board, then I had a power jack head, I soldered two wires to it and connect it to the board's power jack these two wires I will connect them to the power supply, also I can easily remove this head and connect the battery instead. All connections appear in this photo:
The final result of wires before adding cover:
To make my car looks cute, I added two LEDs to be like car front lights, I soldered a 330 ohm resistor to each LED also I added long wires to reach the PCB board on the pack of the car. The LEDs after soldering
After that I glued the LEDs on the holes I designed in the front of the car as shown:
Then, I simply connected each pin to the VCC and GND pin headres in the board. when I connect my board to the power the LEDs will light as shown:
This step was the last step in the project development. I connected Upper case with the base and bottom case parts using M4 screws, each screw goes through all parts.
My car after assembly, looks so cute isn't it?
The back side view of my car
The inside view
What about taking a tour inside my car now?
This is the most exciting and challenging part in my project. At different steps I tried many codes and have different results. I want to document all of these code tests sequentially in one section.
I found a useful library for many of Pololu drivers HERE. I started trying it by connecting two drivers at the same STEP and DIR so the two motors will move at the same speed and direction. At this stage I want just to test if the library works or not, and if two wheels moving synchronously. This is the code with explanation comment lines
This video shows the implementation of the previous code:
In the next step I added a pen to my car and start Playing
with the previous code and changing RBM, Microsteps delays and the number of degrees and steps sends to the robot. One of my first drawn lines in this video:
I noticed that when the motion starts and ends the car jump
a llitle bit. This because the motion start suddenly from static to the full speed and stops suddenly from full speed to zero. I found one of the solutions of this problem in the same library. Using this instructions stepper.setSpeedProfile(stepper.LINEAR_SPEED, MOTOR_ACCEL, MOTOR_DECEL);
I could define the speed profile.
This is the code I tried:
Notice the smooth starting and ending motion in this vedio
Until this stage I just give number of steps or angles in the code, but the car didn't move in predefined distances because until now I didn't write calculation in the code to transfer given mm distances to a number of steps the motor should move to achieve this distance. The main idea of the calculations is to measure the diameter of the wheel, then the circumference of the wheel then find the number of steps per mm. I wrote all numbers and calculations in the shown code, to organize my code I wrote two functions forward and reverse. I just call the function with the desired distance and the car will move at this distance. I spend time testing the motion and changing microsteps to achieve the best results.
The code I improved:
Important note: if I change MICROSTEPS
definition in the code without connection MS1, MS2 and MS3 driver pins to high or low logic ( as shown in the table below) the distance will not be exactly the same of desired distance wrote in the code, but it will move a multiplication distance (if desired distance equal 50mm and microsteps defined as 2 without hardware connection the car will move 100mm)
The following pictures shows some result of trying differant distance with diferent microsteping. The final result was the best one when I define MICROSTEPS 4
and moves 10 cm.
Until this stage I controlled both wheel's drivers using one step and one direction pins so the car could only move forward or reverse. So to add the ability to draw different shapes I should control each driver separatly. This what I did in this step. I connect each driver to seperate step and direction pins, define different RPM for each stepper. I generated very nice shapes while playing
with several codes.
I started with simple codes moves one wheel at a time without any calculations for the angle the wheel will rotate or the arc's length. This is the code:
Watch while car moving:
I found a useful feature in the used library which is the ability to control more than one motor in the same command controller.move( ). In the following experiment, I tried to move each motor with different number of steps and I had very nice result shown in the video below.
The code and the video:
At this step I wrote a code to move the pen knife up to a safe position at the beginning of the code, then slowly move down to let knife go through a paper. I tried many times to find the positions the pen mechanism should start and end. I can easily increase or decrease the servo angles if I want to change the final position. This code just moves pen up and down without moving the car. In the next code I replaced the pen with a pen knife and try to cut a line.
Testing servo code
Test result:
After that I compined the servo pen code with the forward moving code and replace the pen with a pen knife then I tried to cut a line. The code was:
My cutie car cutting the first line in her life ^_^
I added an IR sensor to my car to avoid falling down while moving, at this step I simply add one sensor in the front of the car and connect it to interrupt pen. When the sensor sense there is a surface under the car it will give high volt and a LED connecting to it will light. If there is no surface, it will give low volt the LED will turn off, that means if the car continue moving it will fall. In the code I defined interrupt pin when to be activated when low signal enter it. At that moment the car will freeze at its current position waiting for somebody to change it's direction and press reset button to repeat the job.
This video shows the car freezing then restart after reset.
If you notice all tests until now implemented using a commercial Arduino UNO board. I just want to make sure that all subsystems and codes work fine before connecting my board because if any problem happened, it will be easier to know it at least everything is working before this step so for sure the PCB is the source of the problems.
Before connecting my board I should go back to the schematic design to see the correct pin numbers, then edit them and upload the code to my car. At this stage I want to draw a circle by moving one wheel. I fixed the pen to draw it, then I tried with pen knife to cut a circle with the same code but less speed. Fortunately, my great car did them both. This is the code:
Cutie car drawing a circle:
The drawn circle:
Cutie car cutting a circle
The resulting circle
I noticed, when I wirte my code using the library I mentioned in the previous test, that there is some problem while using, it especially with moving two stepper simultaneously using controller.move();
and controller.rotate();
instructions. So I decided to make my own code without using any library. I know it will be tricky, but I start trying... honestly, I didn't until know have good results with these tries. But I will update this part when I have any progress.
This is my code until now:
I have many features I want to add to my cutie car. I will list the main ideas I have: