Thursday, July 31, 2014

Failed attempts to get HC-SR04 sonar module working underwater



Over the last few months I've been looking at building a sonar sensor for underwater robotics. I've been mostly focused on learning some basic signal processing to detect the echos. As documented in a previous post, I've gotten it working in air on a PC using the sound card, and have also recently gotten a TI-Launchpad based version working in air. (More on that later).

However, since the HC-SR04 is so inexpensive and works so well in the air, I could not resist trying to make it work in water. It would be cheaper, easier, and use less power if I could make it work.



Previous reading on making hydrophones indicated that simply dunking a microphone in a film canister full of mineral oil would effectively couple it to the water around it, and let you hear the sounds in the water. That's what I intend to do with the Launchpad based digital sonar. Since mineral oil is non-conductive, I figured it was worth a try to seal a HC-SR04 in a container of mineral oil and see what it did.

The HC-SR04 emits a short pulse of ultrasound and then waits for the first echo. It then outputs a pulse with a length corresponding to the time it took to hear it. From that, you can calculate the distance to the target.

This has some advantages and disadvantages. It's really easy to use and process the data. However, you only get one data point - you only hear one echo. The digital sonar approach gives you all the echoes back, not just one, with relative intensity information, like this:



I figured that the HC-SR04 must be waiting a small amount of time after sending the initial pulse to prevent it from triggering on the ringing of the sending transducer. If I could get the pulse out of the pill bottle before that window, it should work.

I first got the HC-SR04 working in air with a Stellaris Launchpad. I then sealed up the HC-SR04 in a medicine container full of mineral oil.






Results:
The module worked in the oil, but didn't return data that I could correlate in any useful way with distance to target.

With the sensor out of the water, it repeatedly returned a very small value (100 or so).

With the sensor in the water, it alternated between sending an extremely small value (~50) and a very large one (600,000+). It did this pretty much regardless of what it was pointed at, and quite regularly. 50, 600000, 50, 600000, 50..... I'm not sure what was happening, exactly.

I've decided to give up on this approach and return to the Stellaris Launchpad-based digital signal processing approach. That will give me a lot more information since I can look at all the echoes graphically. Bummer. It would have been really cool if it worked.

Tuesday, May 13, 2014

Adding a Heated Print Bed to the Printrbot Simple (Plywood Bed Edition)



After struggling with warping on larger prints, I decided to try adding a heated bed to my Simple. I am delighted with the results. It has completely eliminated the warping problem and allows me to print at full speed.

Here's what I used. As usual, you use information from the internet at your own risk, and if you are not comfortable with things like voltage and current ratings, get help from someone who is. Electricity at the current levels involved here are a modest fire hazard if adequate safeguards are not in place.

1) MakerFarm 4.5x6" Heated Bed  with Prewired Thermistor



I could have individually bought the high temp wire and sleeving and assembled it, but the price difference was very small.

2)  3/16"x 4 x 5 Borosilicate Glass from McMaster Carr

Borosilicate glass is less likely to break when warmed and cooled. I figured the thicker stuff would be less likely to break when I pried things off the bed.

3) A solid state relay to control the bed. The Printrboard has an output that can directly drive a heated bed this size, but there are reports that the Molex connector isn't up to the task and can overheat. Additionally, a short on the bed could damage the Printrboard. The Printrboard is an expensive piece of hardware, so I chose to isolate it from the bed.

Update: I added a heat sink to the SSR. It got fairly hot during long prints, even running at 50% of it's rated current capacity. The heat sink helped a great deal.



In this configuration, the relay is the only load driven by the PrintrBoard's heat bed output. The relay has to be driven by the 12V output, and be able to switch enough DC current and voltage to run the bed with a margin of safety.  Also be aware that the control outputs on the solid state relay have a polarity that must be observed. There is good information on wiring up the SSR here. Be aware that unlike typical magnetic relays, SSRs have a polarity on both the driven side and the load side.

4) A large 12V power supply I already own. The power supply that comes with the Simple is not sized to run a heated bed. Since I was using a relay it was easy to power the bed from another supply. Some people are using a modified ATX computer supply, or 12V supplies are available in a variety of capacities. MakerFarm says the bed alone can draw up to 8 amps.

5) 4 medium sized binder paper clips to hold the heated bed and glass to the plywood bed.

6) Permatex Ultra Copper high temperature silicone sealant to secure the thermistor to the heat bed.

An interesting note on the relay: I first chose a mechanical relay. It turns out that the Printrboard's firmware is set up to run a fast PID loop  which is well suited to run semiconductors. It causes a mechanical relay to chatter several times per second. Changing it to a mode more suitable for a mechanical relay requires recompiling and flashing the Printrboard firmware. That's a lot of work, and carries a bit of risk, so I chose to buy the solid state relay.

The first part of the process was to secure the thermistor to the underside of the heated bed. I placed the thermistor where I wanted it, taped the wires to hold it in place, and then put a blob of Permatex Ultra Copper over it to hold it down. I was careful not to put any Permatex between the thermistor and bed.



Next, I marked the plywood bed of my printer for cutouts so that the heated bed would fit flush on it. That required cutouts for the bed wires and the thermistor. The circular cutout for the thermistor was done with a Forstner bit. The small cutouts for the wires was done with a hobby knife.


Once I was able to test fit the bed and it sat flat, I placed the glass over it and secured it with the office binder clips. I had to remove the steel arms that you pinch to open the jaws of the clips.

I then found that the full width clips limited my print area a bit - the head would smack one when it went home. I used a bench grinder to cut them in half.



I then reset the Z home level - this is critical, since the hot end will crash into the glass if you don't. You do lose a bit of Z printing height, the thickness of the glass + PCB. 

I got good results heating the bed to 55C, with blue tape on the glass. Prints come out perfectly flat and are hard to get off the bed. A friend tells me hairspray works well on the heated glass on his Rostock Max and the parts come off the bed more easily, so I intend to try that soon.


I have been extremely pleased with this so far - it resolved my warping issue entirely, allows me to print at normal speeds, and in theory, I should be able to print ABS now. Total cost was around $65, since I had the power supply already.

Tuesday, April 8, 2014

Troubleshooting And Fixing Extruder Jams On The Printrbot SImple



I am in the process of printing off parts for a friend's Kossel. The lower frame mounts are the largest parts, and are near the limits of what a Simple can print. It proved rather challenging to print them reliably and without warping.

My printer lives in a basement that stays at about 58 degrees F. I am using Zen Toolworks PLA which seems to work best at around 210 C. To keep warps to a minimum I print inside a plastic enclosure, which raises the temps about 15 degrees, onto blue tape cleaned with alcohol, and I have to print SLOW. 10 mm per second is the travel rate for the perimeters and infill. Even with that, I have to print on a 8 layer raft to get large parts to print without appreciable curling at the edges.

God, I want a heated print bed. But that will be the subject of another post...

So anyway. With these settings, the lower vertex of a Kossel takes 11 hours to print. I was fine with that - I'm in no real hurry and want the best print I can make. However, printing that long introduces it's own issues. I experienced consistent filament stoppages at about 1.5-2 hours, after which the printer would continue to go through the motions and leave nothing behind.

So I tried the obvious stuff. I cleaned and adjusted the extruder. I levelled the bed. Twice. I tore down the extruder and cleaned up the internal edges to reduce friction. Still no go. Jammed at about the same point.

I then read about extruder motor temperature - that a hot motor can transfer enough heat to the filament to soften it before it goes into the extruder. My motor was indeed running hot to the touch. I dialed back the current on the Printrboard until it was just warm to the touch and wasn't skipping. I excitedly started a print and went to bed.

I woke up to another filament jam. There was some swearing, and a bunch of wasted plastic.

What finally fixed it was removing the 40 mm fan from it's normal place blowing on the extruder and tacking it with CA glue to the side of the extruder, blowing into the chamber that the filament passes through on it's way to the hot end. After all, I was not using the fan anyway, since my layers were so slow.

I turned on the fan 100% full blast in software, and started the print in the middle of the day. Five hours in, the extruder motor was cool to the touch, below body temperature, and no jams. I have since completed two back to back 11 hour prints. It's fixed.

If you have a Printrbot Simple that is regularly jamming the filament, I encourage you to put a cooling fan on the extruder. The difference was immediate and remarkable. If your extruder motor even feels a little warm, it can start to soften PLA on long prints.

After the Kossel parts are done, I intend to make this mount for a more dignified fix:

40mm Diameter Fan mount for Printrbot siple with a wooden extruder



Saturday, March 15, 2014

Reducing Warped Prints With The Printrbot Simple


Update: I eliminated the warping issue by installing a heated bed. Details here.

I was recently pondering extending the X axis on my Simple, using the extensible X axis brackets. I decided to try printing a small, simple project enclosure first, since I had really only printed fairly tall things with small bases. The only previous print I had tried that was fairly wide was an 808 camera mount for a friend's drone and it had warped badly. I had been able to straighten it by softening it under some really hot water, but I wanted to understand how big a problem it was.



I printed a box, and it came out looking like this. Ouch. Off to do some research.

Warping is caused by uneven cooling of the part. Objects longer in one direction than the other tend to do it more, and it's worse as you add layers. ABS apparently does it a whole lot more than the PLA my Simple uses, but I wanted to figure out how to fix it. A very good Makerbot blog post describes some common solutions, and variations of them worked for me.

I print in my unheated basement, which runs a pretty constant 58 degrees F. I think this contributes greatly to the problem.

The Printrbot Simple is a very cool piece of machinery, but you do sacrifice some features to have a lower cost. One of the biggest ones is a heated print bed, which most people indicate solve the problem completely in PLA and is necessary in ABS. There is not yet a kit for the Printrbot Simple to add one.

Here's what worked well for me:

1) Clean your blue tape on the bed with rubbing alcohol after you apply it, and then don't touch it. This removes wax and oils that your skin leaves behind that prevent sticking.

2) Turn on "Brim" in Slic3r, maybe 5mm around. This increases the surface area adhering your part to the bed, reducing the odds it will curl off the bed.

These two things alone helped a lot, but I still had a small amount of curling.

3) Want it to really stick? Tell Slic3r to print a "raft" of perhaps 5-8 layers. This works very well but requires you to cut or sand the raft off your part. The raft is sacrificial support material that warps instead of your part. This worked, but would be a hassle, so I kept tinkering. Here's what the raft material looked like:



But hey, it's a lot flatter. I'll keep it in mind for parts I can't print flat any other way. A lot of guys on the forums sneer at rafts, saying the are obsolete, no one uses them, they are old school. Those guys have printed heat beds. My Simple does not. So if I need to print a raft occasionally, so be it.

4) Make a "slow" saved settings for Slic3r that you use when you want to minimize warps. I set it to print at 10 mm/sec, 1/3 the speed the Printrbot usually prints at. Sure, it takes a while. I value print quality over speed.

5) If your printer is in a chilly environment, you might consider enclosing it. I found that simply parking a large cardboard box over the printer, with a hole cut for the filament to enter, caused the air in the box to rise 20 degrees F to 80F. With that, my warping went away entirely with no raft. I did use a 5mm brim.



It stuck to the bed so well I had to use a putty knife to pry it off. Victory. I think that the box causes the print to stay at a more even temperature, reduces the temperature delta from the bottom of the print to the top layers, and causes the whole thing to cool more evenly.

Please consider the risk of fire if you choose to enclose your printer. I used the cardboard as an experiment only, and will be replacing it with something more fire resistant. Your safety is your own responsibility.


Monday, February 17, 2014

More fun with the Printrbot Simple, and an easy spool solution




I have spent some time calibrating my Printrbot Simple, and am having excellent results. It took some experimentation and a good set of calipers and about a dozen little test prints, but I think it's there. :-)

I found that though the X/Y/Z steps per mm were right on, I was overextruding by about 8%. This didn't show up when I measured the amount of filament being moved - in fact, with the stock settings, it appeared that I should be under-extruding. But the symptoms were consistent - my prints were about .3mm too big in all directions on the external dimensions, and holes and slots were printing too small. Dialing back my extrusion multiplier to .9250 did the trick - prints are smooth and fit together.

I also switched filaments to Zen Toolworks PLA in white, and I am very pleased. I found that in my cool basement I had to run it at 210C to get good layer adhesion, but once I figured out that, man, it's nice.




I found a simple way to hang a filament spool, which eliminates tangles on long prints. I had a wide hook designed for hanging things on garage walls that was the right size. I had binding until I removed the rubber coating, exposing the steel. Works great.




Sunday, February 2, 2014

Estimating Cost of 3D Prints in PLA



When I first decided to get a 3D printer, I had no real understanding of what it cost to operate. It's useful to be able to know what a part costs before you print it.

It turns out this is pretty easy. Repetier Host (and probably anything that uses Slic3r as the slicing tool) will output the length of filament, as well as the volume, that the print will consume. For example, the print below shows that it will need 3.5 cubic centimeters of PLA plastic to complete.



An internet search shows that the density of PLA plastic is 1.25 grams per cubic centimeter. A 2 kilogram (2000 gram) spool of PLA costs about $30.

Now we can set up a simple ratio:

1000 grams/$30.00 = 1.25 grams/ (dollars per cubic centimeter)

Dollars per cubic centimeter = 0.0375, or just shy of 4 cents. So the above sample print, at 3.5 cubic centimeters, would cost about (4 x 3.5) = 14 cents.

If your design does not require printed support scaffolding, you can also easily calculate what it will weigh. This is useful for robotics and RC models. 3.5 cubic centimeters x 1.25 grams per cubic centimeter is about 4.4 grams.




Sunday, January 26, 2014

Printrbot Simple Kit Review And Getting Started Hints



I received a Printrbot Simple V2 (pre-2014 model) with the large motors and endstop switches for Christmas. My goal is to print parts for hobby robotics and R/C vehicles, as well as make parts for friends, and just learn about the technology.

Before you begin building your PrintrBot Simple, make sure to have some super glue and some blue Loctite on hand in addition to the required tools. You need the superglue pretty early in the process. The Loctite comes later.

Executive summary

The Printrbot Simple is an awesome value. It requires some work on your part to build, tune, and learn to operate. The instructions are good, but lacking in some key areas at the time of writing. If you want to learn how 3D printers work, and be able to make small parts in PLA plastic, it is both functional and tremendous fun. If you want a turnkey experience to just make parts, without tinkering,  it may not be for you. You can buy it preassembled and save some time, but a bit of mechanical understanding is still required to debug issues and set it up.

I love to tinker, and I enjoy learning to use new tools. I am very happy with the Simple. It's really neat to see a part slowly appear on the print bed. The design is well engineered - it's as strong as it needs to be, reasonably precise, and affordable enough that a hobbyist can get one.

Update: The 1/2 lb of filament that ships with the printer goes a surprisingly long way. It is plenty to get the machine calibrated and make a number of test parts.

Kit Assembly

The kit took me about 8 hours to assemble over two sessions, and then another 3-4 hours to test, tweak, and calibrate before my first print. The kit requires moderate mechanical skills to assemble - if you have ever built a balsa model airplane, the process is very similar. The laser cut ply parts are extremely clever in their design - they heavily interlock to make a very rigid structure. I found one hole that was cut in the wrong place - it took much longer to convince myself that I had not made an error than to actually fix the issue.

Follow the instructions carefully, compare each step to the pictures, and it's not difficult. The extruder assembly is not well documented, in my opinion, but the rest is fine. I can tell they put a lot of effort into the build document.

There are photos of the assembly process of my printer here.

Testing and Calibration

First, be aware that there are older versions of the Getting Started document that will show up very high in Google searches. They don't match the current version, and some of the settings in the control software are different. Make sure to grab the latest version from the Printrbot support page.

I found that the latest version of the control and slicing software, Repetier Host, did not run on my laptop with Win7. It failed with an OpenGL error. I stepped back one version and it works fine.

The Getting Started document is a tremendous help, but it is lacking some is in some key areas at the time of writing. I will attempt to supplement that here.

1) The current version references an older version of the Simple that did not have end stops. The process of setting the home position is very different than older versions, but they just left it out. If your Simple does have endstops, then you don't have to manually home it - but you DO need to make sure the endstops work first, and adjust the Z axis carefully before allowing Repetier Host to try to set the print head to the home position

To set the Z axis, I put a piece of paper on the print bed, run the Z axis down until the print head just touches the paper, and then adjust the 3 1/2" screw above the Z axis endstop switch until it just clicks the switch. That screw sets the Z home position - you want the switch to click when it is one paper's width above the print bed. Note that you probably want to do this with blue painter's tape on the bed, since most people print that way to make the part easier to remove.

Once that's accomplished, you can use the home button on the manual control tab to send the print head to the home position on each axis, one at a time. That minimizes the risk in case one of the switches is not hooked up correctly.

With the endstops adjusted, Repetier will automatically return to the home position at the beginning of each print.

2) The process of leveling the bed is not documented in the Getting Started document. This is a misnomer - you are not leveling the bed against gravity - you are making sure the print bed is an equal distance from the print head no matter where the print head is.

I put on blue tape, then manually moved the print head to the front left corner (home). These directions are relative to the printer facing you - the "front" of the bed is closest to you. Make sure the print head is just over the bed, so that you can slip a piece of paper between them, and encounter a small amount of resistance when you pull it out.

Then manually move the print head to each corner and check that the height is the same. If not, tighten or loosen the hex screw in that corner to remove the warp in the print bed. Repeat this for all four corners. This way, no matter where on the bed it is, the head will always be a paper thickness's height above the bed. This prevents the head from smacking the bed as it prints the first layer.

3) Loading filament is not hard to figure out, but it's not discussed much in the documentation. The assembly that the fan is attached to also houses a large ball bearing. This bearing pushes the filament up against the hob bolt. Once the extruder is up to temperature, unlock the fan assembly and pivot it towards the front of the printer. That will expose the plastic tube that the filament feeds through. Push the filament through the tube, perhaps 5 cm, until you encounter some resistance. Gentle pressure will result in a bit of filament squirting out the hot end. Rotate the fan assembly back into position and lock it - the bearing is now pressing the filament against the hobbed bolt.

4) The Getting Started guide gives excellent instructions on how to test the X, Y and Z axis, but nothing about how to test the extruder. On the manual control tab in Repetier, there are buttons to extrude and retract the filament. It may take 20-30 mm of extrusion before you get filament squirting out the print head. I put a piece of cardboard under the extruder to catch it. I found it useful to do this right before every print.

5) Very low ambient temperatures will cause the extruder and all control motors to shut down. I tried to test mine in a garage in January in Ohio. Temps below 5 degrees Celsius will trigger a MINTEMP log event, which is the controller board's way of protecting you from a broken thermistor on the print head. However, Repetier doesn't do anything but quietly log it, so it can easily convince you that your new toy is dead. :-) I brought inside to warm up and POOF, it came to life.

I have mine set up in the basement, and 195 deg C works well on my machine.

6) The current version of the Getting Started guide tells you to disable the cooling fan option in Repetier, since the Simple does not have a fan. This is no longer the case - enabling the fan with the default options worked well for me.

First prints!

After leveling the bed, testing the motors, and configuring the software, I loaded up the 5mm Calibration Cube Steps, sliced it with the default settings, crossed my fingers, and hit Run. I was expecting a mess on the first run - a glob of spaghetti vaguely distributed in the shape that I was intending to print. I figured it would take days to get it adjusted to print accurately.

I was wrong. It worked perfectly the very first time. I consider that a testament to Brook Drumm's design, and the quality of the support documentation.


It was absolutely mesmerizing.

The second print, I ran into an issue. My extruder stopped feeding. It took a while to notice - there is little visual indication when that happens. I finally figured it out by marking the filament with a dot from a Sharpie marker. It it stops moving into the extruder, it's pretty obvious, and I recommend that for your first couple prints.

A little digging showed that the filament had slipped off the roller bearing and jammed against the side of the slot. A forum post indicated that this can be caused by a loose motor mount screw, the one on the lower right if you are facing the motor shaft. I tightened that, and it got better, but still jammed after a few minutes of printing if I didn't guide the filament by hand. Another forum post pointed me at this cool filament guide and I printed it out.

It solved the problem - I have had no feed problems since. I intend to make a spool to feed the filament from for longer prints.




There is something seriously neat about using a tool to make a part to upgrade itself. It is officially my first useful print.

To confirm that the feed issue was truly fixed, I wanted to print something a bit bigger. A good friend has an ARDrone and was looking for a good camera mount for it. This 808 camera mount for the ARDrone uses rubber bands to isolate the camera on a suspended platform.


Both prints were completely uneventful. And that's awesome. It just worked. Testing the mount will need to wait until warmer weather.

So there it is. I am thrilled with it. I am working on getting better in Sketchup and learning some OpenSCAD so that I can design my own parts.

Oh yeah: if you put a square of thin carpet under the printer, it has less tendency to vibrate and move around, and is also quieter.






PrintrBot Simple Calibration Print from Jason Bowling on Vimeo.