Tuesday, October 25, 2011

3D Printer Build Post 1 (RepRap Prusa Mendel)

The long journey to building a 3D printer has been underway for quite a while now. With the complete set of parts ordered and much of the construction finished I decided to share the progress; outline my frustrations, and post about how you can benefit from my mistakes.

I have been building the printer for over a month; and the last batch of parts arrived early this week. What can clearly be said about this project is that you will underestimate it. The original plan was to get this working in six months. Once construction was underway; it seemed more like a month. It now looks like this could really take up to six months (to produce a quality 3D printed part). In this part of the coverage; I hope to outline the budget and basic build so far; finally going over some problems and warning points.

The budget for this printer is quite high. It is a mid-range open source 3D printer known as a Prusa Mendel. You can find the wiki for it here. I chose to start with the basics (more on this later). So here is the budget:
  • The starter kit $195.00 (from this ebay auction)
  • Rods - Threaded and Smooth, $68.17 (McMaster.com)
  • Motors - Pololu Nema 17 x 5 $104.70 (Pololu.com, item link)
  • Hot End and Ramps 1.4  $364.00 (Ultimachine.com)
  • Wire, digital caliper, etc. ~50.00
So the total budget so far for the printer is ~$782.00

Here are the basic pictures; showing various steps of the frame building process. I cut the rods myself; making a jig according to this page. I then used the electric saw to get through them quickly.

Preview...








At this point I lost my memory card; so there is a gap of missing pictures. They weren't very interesting anyways. The pictures resume with motors in place and the y-axis completed.




The extruder which feeds plastic into the hot end has to be 'hobbed'; basically you give it teeth so that it grips the plastic. The extruder can then force plastic into the hot end which acts as a glue gun (but for plastic). I hobbed by hand. Following that sparks are some pictures of the extruder; which came together easily.





With the extruder completed, tested, and mounted - the basic build was complete. I didn't want to start wiring things up until I got some chores out of the way. So the second picture below is my converted ATX power supply. I may do a complete post on this; as it is very useful for anyone doing robotics/arduino. The short and sweet? Connect the green to ground; then all of the orange (3.3v), red (5v), and yellow (12v) become easy power. The other wires can be removed.



Before putting the top back on.

At this point I have begun working on the wiring and getting everything to the final setup. There is still a ton of work to do however and I do not think that my carriages move as freely as they should. That said; I did want to share some of my sticking points in case you are considering this venture for yourself. So; consider these points before you start and you can benefit from my troubles.
  1. A dremel is NOT an optional tool. You will need to correct parts, cut parts; etc.
  2. Have a large work area available; I am using both my full desk; a table I purchased and a couple shelves.
  3. Have something to organize parts; similar to component bins. There are a LOT of nuts, bolts and washers.
  4. Have a small enough level; if your level is too big; it doesn't fit against the rods and you will have trouble leveling. You could also have a spacer ready; but remember you need to level various parts.
  5. A digital caliper is highly recommended for accuracy.
  6. Plan for the 'breaks'; you will have two glue steps where you glue and walk away. You will also apply ceramic to the hot-end and it should sit overnight.
  7. Have your PSU ready before you attempt to build your hot-end; you will need the +12v for curing.
 There are also various problems I'm running into that I can't seem to find resources for. Be wary of these; or if you know the answer - let me know!
  1. How does the hot end attach to the extruder? I really cannot find this!
  2. Preparing the default bed; do I just put aluminum foil on it? All documentation seems to simply skip this and references the 'prepared print bed'.
  3. I will know more tonight; but you apparently need a linux box to build and upgrade the firmware. I will update this entry based on my findings.
  4. How should the Arduino Mega be powered; usb?
That wraps up this post. Hopefully my next post about this will include a first print and more information to help you build your printer.







Saturday, October 15, 2011

Arduino Robot 3 - Part 1 - Reflectance Sensor

This is the first part of my post covering my creation of the line following Arduino robot. In this post I will talk about the costs; setup and preparation for creating the robot. I will also discuss a few different approaches to line following that I explored. We will get the sensor attached to the robot and retrieving data. In the next part, we will cover the final approach used; tour the code, and see the full video.

The budget for this tank is quite low, because we start with Robot 1. I chose to add a single reflectance sensor to the bottom of Wandering Tank; and remove the wall avoidance equipment. So, the budget:
So Line Following Tank has an estimated budget of $105.00 to build.

Since there is no need for the parts from Robot 2, the cost is very low. I would suggest coming up with a few other things to order so that you don't pay more in shipping and handling than for the sensor. I ordered a couple sensors and of course, more of these. Time to build!

Building this robot is not as simple as ordering the parts. I could find no reliable way to attach the sensor to the bottom front of the robot. I ended cutting a strip of double sided tape up into squares and stacking them to a desired height. Wiring the robot is simple; I used digital pin 5; which is pin 19 on the Arduino. Here are some pictures as a guide:



Soldering the wires to the sensor is easy. You are simply giving it 5V to operate with, grounding it, and giving it somewhere to send data. You must add the Arduino Library For Pololu QTR Sensors to your Arduino IDE before working with the sensor.

In preparing to create the line follower; I had to do a lot of research and of course make sure I was ready to use the sensor in code. Using the sensor in code is easy. I will show the code to use the robot as a color detector. The speaker will make noise to reflect (get it?) the color seen by the sensor. As I wave the robot over a dark line; the frequency will change.

/*
 * George Frick (george.frick@gmail.com)
 * October 2011.
 * Arduino Robot 3 - Sensor Wave Test
 * This isn't a robot; but uses the build line following robot to test the reflectance
 * sensor. The robot starts up and beeps to notify the user to calibrate (wave robot
 * back and forth over line), then beeps again before starting. Once started the robot
 * calls buzz with the detected color value as the frequency.
 * This tests runs continuously. The user may choose to view Serial output.
 */
#include <PololuQTRSensors.h>

const int qtrPin = 19; // pin 5 as digital is pin 19
const int buzzerPin = 14;

// create an object for your type of sensor (RC or Analog)
// in this example there is one sensor on qtrPin
PololuQTRSensorsRC qtr(( unsigned char[]) {qtrPin}, 1);

void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps  
  pinMode(buzzerPin, OUTPUT);
  buzz(buzzerPin, 1000, 100);
  calibrateQTR(); // Wave the sensor accross the color specture during this time!!!
  buzz(buzzerPin, 2000, 200);
}

void loop() {
  delay(250); 
  unsigned int a[] = { 0 }; // One sensor!
  qtr.readCalibrated(a);    // It will fill the array from the sensor array.
  Serial.println(a[0]);     // Use a[0] to get the only entry.
  buzz(buzzerPin, a[0] - 50, 100); // the minus 50 is arbitrary.
}

void calibrateQTR() {
  // start calibration phase and move the sensors over both
  // reflectance extremes they will encounter in your application:
  int i;
  for (i = 0; i < 250; i++) {
    qtr.calibrate();
    delay(50);
  }
}

void buzz(int targetPin, long frequency, long length) {
  long delayValue = 1000000/frequency/2; // calculate the delay value between transitions
  // 1 second's worth of microseconds, divided by the frequency, then split in half since
  // there are two phases to each cycle
  long numCycles = frequency * length/ 1000; // calculate the number of cycles for proper timing
  // multiply frequency, which is really cycles per second, by the number of seconds to 
  // get the total number of cycles to produce
  for (long i=0; i < numCycles; i++){ // for the calculated length of time...
    digitalWrite(targetPin,HIGH); // write the buzzer pin high to push out the diaphram
    delayMicroseconds(delayValue); // wait for the calculated delay value
    digitalWrite(targetPin,LOW); // write the buzzer pin low to pull back the diaphram
    delayMicroseconds(delayValue); // wait againf or the calculated delay value
  }
} 
/* EOF */ 

In the video; you will notice me waving the robot in the beginning with no sound. This is during the calibration phase when you want to show the sensor different colors. Once calibrated another beep announces the 'wand' is ready.



The final discussion is the approach to line following. With only one sensor; it gets tricky. If you have more than one sensor; you can find the line and keep it between two sensors; etc. With one; you have to make an effort to say on the line. As of writing this; I am aware of a few approaches:
  1. Drive forward if on the line. When the robot leaves the line, sweep left and right until the line is found again; then continue forward. This has several problems; the largest of which is a simple 90 degree turn; in which the robot may end up going back along the line.
  2. Constantly sweep back and forth. I have seen this implemented on Youtube and other places. I don't like it and I don't think the robot should have to 'dance' in this way.
  3. I am working on this :-) Depending on how it turns out; it will be the next post. Otherwise I may settle for one of the other two approaches.
So; the robot is built and the code works. It's time to implement approaches to line following and see what kind of results I can get. The follow up post to this will share the finished robot and code!




Saturday, October 08, 2011

Resuming My Robot Work With Bonus 3D Printer Project

Well after a long break of working on the house; this blog will be returning to a primarily robot programming focus. My work on the house is shared elsewhere...

So; I've resumed work on my robot and added a second Arduino to my arsenal; this way I can prototype ideas without disassembling the robot. I have used it to go through the tutorial for the TFT screen:



The new Arduino is an UNO; they come in much more sophisticated packaging than their predecessor:






That is a sticker sheet on the right and a EULA in the middle. The first nice thing to notice about the UNO is it auto switches the power source. You can see this difference and other slight changes in the comparison here:


So; I will post about the robot again when line following can be demonstrated and the code is ready to share. I hope to share two versions (with and without TFT info printing).

With that; the other exciting news is that I am building a 3D printer; which I will document here and share my problems (and answer any questions the best I can). I hope to be able to print robot parts in the spring; as I have more than once been held back by the ability to mount parts. It has driven me towards switching back to Lego; which I do not want to do. The printer being targeted is the RepRap Prusa Mendel.

I have made first acquisitions and the plan is to build the printer for around $600.00. The initial set of parts (the printed ones, etc) were purchased on Ebay; this guy sells them. I then purchased the rods (uncut) from McMaster; who I had never heard of, but find very awesome! The next purchase was the stepper motors; which I of course got from Pololu.

The build has not been started yet; the parts need to be confirmed and some need to be cleaned up with the Dremel. There is also the cutting of the rods (ordered in 2 meter lengths). I'll close this post off with some more pics.


Create a "GG Button" With an IOT Button on Discord

I was having some fun with my internet button (found here: https://store.particle.io/collections/shields-and-kits), and also working on some...