Quickie Hack: Turn Your Bicycle Into A Party Machine

I was looking for a way to play tunes while biking the other day, and was too lazy to get out the CAD program and design something to print on my RepRap. Here’s a dirt cheap & quick hack to get some decent quality sound while riding your bike. All you need is 4 zip ties:

party1

party2

party3

party4

 

The only tricky part is that I criss-crossed the ties that attach it to the bike.. that is, I took the end of one tie and inserted it into the other tie, instead of its own end. This added some stability, and prevents the speaker from getting damaged due to rubbing against the handlebars. Be sure to rotate the speaker to the proper orientation for you to access its controls before tightening it up.

The speaker I used is a cheap Chinese fake Beats by Dr Dre speaker. I bought it on AliExpres for $13.88 including shipping from China. It’s also known as the “S11 bluetooth speaker,” and is available on eBay, as well. It has a built-in lithium-ion battery, Bluetooth connectivity, including speakerphone (the microphone is crap, though), and even has pause and track skipping buttons. It also has a cable for connecting it via a headphone jack, and even sports a microSD slot, so you can use it completely standalone. Not only is it loud, but the sound is actually better than lots of speakers I’ve tried that cost a lot more. The black model has a rubberized casing, which helps avoid damage from rough handling. It also comes in a rainbow of colors, some with metal casing, instead.

Now, I just keep my iPhone in my pocket, and pause/skip tracks using the buttons on the speaker. The speaker doesn’t have a volume control, but I can easily reach in my pocket and hit the volume buttons w/o looking at it. I took it on a 50 mile bike ride the other day, and the speaker didn’t vibrate off.

 

OpenWrt: Cross-compiling libmicrohttpd for TL-WR703N

Recently, I’ve been developing embedded webapps using node.js. Unfortunately, node.js is a bit bloated for resource-constrained platforms, such as the TL-WR703N running OpenWrt. Not only is it too large to fit into flash memory, requiring an external USB drive to run EXTROOT, but I’ve even encountered circumstances where I’ve been running out of RAM. Thus, I’ve been looking for a lean & mean HTTP library written in C. Right now, my top two candidates are axTLS and libmicrohttpd. Since it’s impractical to host a toolchain on the TL-WR703N, we have to cross-compile everything, which can be a bit of a chore to set up. The first step is to download and unpack the source code:

% wget http://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-0.9.38.tar.gz
% tar xzvf libmicrohttpd-0.9.38.tar.gz

If you don’t already have an OpenWrt toolchain set up, you can download and install it as follows:

% wget http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.6-linaro_uClibc-0.9.33.2.tar.bz2
% bzip2 -dc OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.6-linaro_uClibc-0.9.33.2.tar.bz2 | tar xvf -

Next, we need a build script. Save the bash script below as build_libmicrohttpd_mipsbe.sh:

#!/bin/bash
#
# compile libmicrohttpd for ar71xx (mipsbe)
#

export BASEDIR=$(pwd)

### begin configuration

# node src directory
export SRCDIR=libmicrohttpd-0.9.38

#adjust STAGING_DIR and TOOLDIR below based on location of your toolchain
#ToolChain
export STAGING_DIR=${BASEDIR}/OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.6-linaro_uClibc-0.9.33.2/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2
#export STAGING_DIR=${BASEDIR}/openwrt/attitude_adjustment/staging_dir

export TOOLDIR=${STAGING_DIR}/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2

### end configuration

 
export TARGET_PATH=${BASEDIR}/${SRCDIR}-mipsbe
export PREFIX=${TOOLDIR}/bin/mips-openwrt-linux-
export LIBPATH=${TOOLDIR}/lib/
 
# MIPS cross-compile exports
export CC=${PREFIX}gcc
export CXX=${PREFIX}g++
export AR=${PREFIX}ar
export RANLIB=${PREFIX}ranlib
export LINK=${PREFIX}g++
export CPP="${PREFIX}gcc -E"
export STRIP=${PREFIX}strip
export OBJCOPY=${PREFIX}objcopy
export LD=${PREFIX}g++
export OBJDUMP=${PREFIX}objdump
export NM=${PREFIX}nm
export AS=${PREFIX}as
export PS1="[${PREFIX}] \w$ "
export LDFLAGS='-Wl,-rpath-link '${LIBPATH}
 
rm -rf ${TARGET_PATH}
mkdir ${TARGET_PATH}
cd ${SRCDIR}
make clean
make distclean
./configure --prefix=${TARGET_PATH} --host=mips-openwrt-linux-uclibc --without-snapshot --with-mips-float-abi=soft
make
make install

If your toolchain is in a different place from the STAGING_DIR specified in the script, adjust it to point to the proper location. Finally, execute the build script:

% sh build_libmicrohttpd_mipsbe.sh

After the build is complete, you can test it out by transferring one of the example files to your TL-WR703N running OpenWrt. A good candidate would be src/examples/fileserver_example. In addition to the executable, you also need to get the shared library onto your OpenWrt machine. It is built into a strange location: src/examples/microhttpd/.libs/libmicrohttpd.so.10. Put the file in /usr/lib/libmicrohttpd.so.10 on your target machine. Finally, you should be able to execute fileserver_example on the target machine.

TL-WR703N: Attaching USB Serial Adapters – FTDI/CP2102/PL2303/CH340G

Although the TL-WR703N has a built in UART, as I have shown in my previous article, it’s rather difficult to access, and is useful as a serial console in OpenWrt. For the support of your own apps, it is far more convenient to simply plug in a cheap USB to serial adapter — this can be done without even opening the case. Since the TL-WR703N only has one USB port, if you are using EXTROOT, both the serial adapter and the USB flash drive can be attached to a USB hub: usbserialThe TL-WR703N can easily supply the required current, so an unpowered hub may be used. To add support for USB to serial hardware, use opkg to install the appropriate modules. Basic USB to serial support:

opkg install kmod-usb-serial

FTDI (FT232) support:

opkg install kmod-usb-serial-ftdi

Silicon Laboratories CP210x (CP2102) support:

opkg install kmod-usb-serial-cp210x

Nanjin QinHeng Electronics CH341 (CH340G):

opkg install kmod-usb-serial-ch341

Prolific PL2303 support:

opkg install kmod-usb-serial-pl2303

Additionally, OpenWrt has packages for a slew of other USB serial adapters that I’m not familiar with. If you are using Attitude Adjustment (12.09) and its official repository, here are the other supported adapters:

kmod-usb-serial-ark3116 kmod-usb-serial-belkin -- Belkin
kmod-usb-serial-cypress-m8
kmod-usb-serial-ipw
kmod-usb-serial-keyspan
kmod-usb-serial-mct -- Magic Control Technology
kmod-usb-serial-mos7720
kmod-usb-serial-motorola-phone
kmod-usb-serial-oti6858
kmod-usb-serial-qualcomm
kmod-usb-serial-sierrawireless
kmod-usb-serial-ti-usb
kmod-usb-serial-visor -- Handspring Visor/Palm m50x/Sony Clie

After you install the appropriate kernel modules, your USB to serial converter will show up as /dev/ttyUSBx

[ 489.990000] usb 1-1.3: new full-speed USB device number 5 using ehci-platform
[ 490.100000] ch341 1-1.3:1.0: ch341-uart converter detected
[ 490.120000] usb 1-1.3: ch341-uart converter now attached to ttyUSB0

 

How to Repair a Panasonic Massage Chair, Part 2

In my article, How to Repair a Panasonic Massage Chair, I described how I fixed my Panasonic EP1004 massage chair. The chair worked for a year or so, and then stopped working again. The symptoms this time were a bit different from when the clutches got stuck. Instead of running for a while, and then beeping and shutting itself off, the massage mechanism stopped moving up and down. The chair was just stuck in kneading mode, and wouldn’t do anything else. +I was pretty sure the problem was due to a loose belt, but just didn’t feel like taking it apart again. Tonight, I decided it was time to get it working again. I opened it up, and sure enough, one of the belts had slackened so much that the pulleys were just freewheeling. The loose belt was the small one on the far left in the photo below:

belt

 

The belt doesn’t look loose in the photo, because I forgot to take a photo of it before tightening it up. Unfortunately, there was no adjustment left to tighten the belt. It must have stretched over it’s 15+ year lifetime. I’m pretty impressed by the quality of the of the belts in this thing. They haven’t dried up at all. If you look in the photo below, there are two screws in horizontal slots between the two pulleys. Note that the screws are all the way on the left of the slots, which means that the motor has already been slid as far as it will go to the right. Yet, the belt was still quite loose. I finally jerry rigged a fix by jamming a piece of rubber hose in between the motor and the metal box it’s attached to. To stiffen up the hose, I stuffed a wood dowel into it. The rubber hose is in the photo below, under the green/yellow wire that grounds the motor to the chassis.

beltfix

The chair is now working again… until something else goes wrong.

Previous related article: How to Repair a Panasonic Massage Chair

Windows 8: How to Fix Windows Update and/or Windows Defender Check for Updates Failure

I had a very irritating problem with my Acer Aspire V5 notebook computer running Microsoft Windows 8.1 for the past several months. The computer was not able to update itself. When I launched Windows Update, it would just hang forever checking for new updates, so I couldn’t even figure out what updates were needed, let alone download and install it. At the same time, Windows Defender would constantly bug me that my virus definitions needed to be updated, but every time I tried to download the updates, it would either hang forever, or fail.

After wasting many hours trying to find a solution, I finally fixed it yesterday. It turns out that the two problems were related. It seems that Windows Defender uses Windows Update as a back end to download its virus definitions, because my fix got both of them working again. So, without adieu, here is the procedure for getting your Windows Update and Windows Defender to successfully check for updates again:

Step 1: Download Windows Update Powershell Module

Open up your favorite Web Browser, and point it to:

http://gallery.technet.microsoft.com/scriptcenter/2d191bcd-3308-4edd-9de2-88dff796b0bc

Click the blue box labeled PSWindowsUpdate.zip and save the file to your computer.

(Direct download for PSWindowsUpdate.zip: http://gallery.technet.microsoft.com/scriptcenter/2d191bcd-3308-4edd-9de2-88dff796b0bc/file/41459/43/PSWindowsUpdate.zip)

Step 2: Extract files from PSWindowsUpdate.zip

Extract the files in PSWindowsUpdate.zip to %WINDIR%\System32\WindowsPowerShell\v1.0\Modules.

If you do this step correctly, in most computers, you will have a folder called C:\Windows\System32\WindowsPowerShell\v1.0\Modules\PSWindowsUpdate

Step 3: Launch Windows Power Shell with Administrator Privileges

From the Control Panel, open Administrative Tools. Right click Windows Powershell ISE, and select Run As Administrator:

Image1

Step 4: Import the PSWindowsUpdate Module

Type Import-Module PSWindowsUpdate into the PowerShell:

Image2

Step 5: Change Execution Policy

In the PowerShell, type:  Set-ExecutionPolicy RemoteSigned

PS> Set-ExecutionPolicy RemoteSigned

You will get a security warning dialog. Click the Yes button. You don’t have to worry, because we downloaded the module directly from Microsoft.

Step 6: Run Get-WUInstall

In the Powershell, type Get-WUInstall:

PS> Get-WUInstall

Answer any prompts which may come up. My system had a lot of updates pending, so I let the module download and install them all. After it’s done, your Windows Update and Windows Defender will work correctly again!

Many thanks to the people who came up with this solution. The information came from: http://social.technet.microsoft.com/Forums/windows/en-US/afc7f693-f742-402f-b513-063989b79c2f/windows-81-enterprise-windows-updates

gCode Visualization

I was working on a project today, which had some serious overhangs. I added support material manually, but needed to make sure that slic3r was traversing a usable path through my supports. Usually, I use Repetier Host‘s excellent built-in gCode visualizer, but it only displays a layer at a time, and I needed to see the actual paths followed in each layer. After searching a bit, I found an excellent online visualizer: gcode.ws:

Image3

 

It is very full featured, with sliders that let you step through your gCode layer by layer, and also line by line within a layer. Additionally, it prints out a lot of useful statistics within your gCode.

While running it in a web browser is handy, since you don’t need to install any software, sometimes, I need to have access to it when I have no Internet access. Fortunately, the visualizer is open source, and is written in javascript, so you can also run it directly from your hard drive. First, download the zip archive from github:

https://github.com/hudbrog/gCodeViewer/archive/master.zip

Unzip the archive, and simply launch index.html. I had security issues running it in Chrome, and it froze up in Internet Explorer, but Firefox runs it just fine. To run it in Chrome, you must launch it with the command line option “–allow-file-access-from-files” in order to lower the security so that it can access files locally, but it doesn’t work if you already have a running copy of Chrome.

On Windows computers, if Firefox isn’t your default browser, you can just right-click index.html, and select Open with->Firefox.

Image3

 

Many thanks to hudbrog for making this excellent tool.

Kossel-Linco Delta Printer: Part 1 – Magnetic Effector and Arms + Vertical Carriage

I’m currently designing my first delta 3D printer. It’s based on Johann Rochell’s Kossel Mini, but I’ve modified or redesigned just about every part, except for the bottom vertices. The first design decision I made was to get rid of the expensive linear rails and sloppy Traxx joints. I like the magnetic ball joint concept, because 1) it gets rid of backlash 2) it makes it easier to assemble/reconfigure/repair the printer and 3) it’s just plain cool.

I used OpenSCAD to design the magnetic effector:

eff1

The 3/8″ chrome steel balls are each held to the effector by a 3/8×1/8″ N42 countersunk magnet stacked on top of a 3/8×1/8″ N52 disc magnet. It’s hard to see in the photo, but 3 of the six holes around the inner ring contain 1/8×1/4″ tubular magnets, allowing the toolhead to also be magnetically attached. This will allow me to quickly change toolheads on the effector without having to fiddle with bolts. I am still not sure if the toolhead magnets will be strong enough… only testing will tell. Though quick change could be done by simply swapping out effectors, I don’t like that idea for two reasons: 1) it’s more expensive and 2) different effectors will not be exactly the same, since they are printed, and can also warp, necessitating tweaking every time the effector is swapped.

The first toolhead I designed is a J-Head groove mount for a bowden extruder:

gm1

Note the 3 magnets, which attach the toolhead to the effector. There is also a lip on the bottom of the groove mount, which engages the effector to center it, and make a more firm attachment to the effector. Top view of J-Head toolhead:

gm2

Below is the assembled effector and hot end:

efh1

efh2

The most difficult problem was how to attach the chrome steel balls to my carbon fiber arms. Rather than glue the balls directly to the arms, I decided to attach the balls to screws, and then screw them into the arms. This technique has 3 advantages: 1) it gets rid of the need for accurate, square cuts on the rods, because the length can be fine-tuned by adjusting the screws , 2) the balls are easily replaced, and 3) the screw heads are magnetic, so they self-center and hold themselves to the balls while they’re being attached.

I used chrome steel ball bearings, they are very hard, and therefore wear resistant. However, chrome steel is very difficult to solder, and I don’t have access to a spot welder, so glue was the obvious choice for attachment of the balls to the screws. I tried both JB Weld and super glue:

glueballs

It was very convenient to glue the M4 hex head cap screws by simply first attaching the balls to the magnets. No clamping needed while the glue dried. I tested both for strength, and was not able to pull either of the screws off the balls by hand. Therefore, I decided to go with the super glue, because it’s easier to deal with since it dries in only a few minutes, rather than overnight, and there’s no messy mixing needed. In order to get a good bond, I first scuffed up the bolt head with some sandpaper. Then I cleaned both the bolt head and the steel ball with acetone before applying the super glue. After the glue dried, I tested the strength of each joint. 3 of them were weak enough that I could break the ball off, but after re-gluing them, they were just as strong as the others. Another advantage of using super glue was that it dissolves easily in acetone, so it was very to clean off the residual glue before re-gluing the failed joints.

Though it’s probably not needed, I am going to put tape between the balls and the magnets (note the tape under the leftmost ball):

tape
I bought some UHMW tape to try out, but it’s 7mil thick, and noticeably reduces the attraction between the ball and countersunk magnet. I’m thinking of trying out PTFE mouse tape next (it’s only about 2mil thick), but am afraid that it might be too soft, and wear down quickly. Surprisingly, regular old Scotch tape seems to work OK (it’s about 2mil thick),  so that’s another alternative to try.

For the arms, I’m using graphite strong wall rods from tridprinting.  The inner diameter of these tubes is conveniently, slightly smaller than my M4 cap screws. I used cutting wheel on a dremel with a flex shaft attachment to cut them down to size:

dremel

The flex shaft was necessary, because without it, I couldn’t cut perpendicularly to the tubing, since the cutting wheel is a smaller diameter than the dremel body. There are plenty of tutorials on how to cut carbon fiber tubes. The most important points are: 1) to put tape around the area of the cut to reduce splitting, and 2) to wear a mask to avoid inhaling the dust. To help prevent splitting when tapping out the holes for the M4 bolts, I printed out one of Ultibot’s excellent Delta Printer Arm Tap Jigs. The upper section was too long, so my tap couldn’t reach the rod, so I had to saw off a portion of it:

tap

To get the rods all the same length, just put a few bolts onto a piece of 1515 extrusion to build an assembly jig:
jig1

jig2

I didn’t end up using the nuts you see in the photos to lock the bolts, because in order to get them tight enough, they were putting too much pressure on the rods, causing them to split. Instead, I just dripped a drop of super glue into the junction of the rod & bolt. Loctite would probably be a better idea, but I didn’t have any handy. Below is my vertical carriage design:

vc1

The vertical bolt running up the right side is the tensioner. I was delighted that the carriage appears to be rock solid. I was expecting to have to refine it a few times, but my first try seems to be pretty good. We’ll see once I get the printer up and running if I’m right. I bought the roller wheels from deltaprintr.

vc2

I am not entirely happy with the deltaprintr wheels for two reasons: 1) some of them have minor flat spots, so the movement isn’t perfectly smooth, and 2) there’s no internal shim between the bearings, to keep the lateral load off the ball bearings when you tighten them down (unlike makerslide wheels), so the bearings bind a bit when you try to tighten them down. Also, the bearings will wear out faster.

Note that the designs I described above are preliminary, because I am not yet finished building the printer. There are bound to be changes once I start testing it.

RepRap: Fish Pump Hot End Tip Cooling

I have always had trouble printing small parts and overhangs, because I was too lazy to add cooling to my hot end tip. I sometimes used to just blow a USB fan at the printer, but this has two bad effects: 1) the cooling isn’t localized enough, so it doesn’t work very well, and 2) the unfocused air flow cools down the heat bed, which can cause the print to detach. I looked at a bunch of fan shrouds that other people have been using, and didn’t like the way that most of them still leak a lot of air onto the hot bed. The thought occurred to me that the air coming out of the hose of an aquarium air pump is quite focused, so I decided to hack something together to test it out.

This is a fish pump that I happened to have laying around:

fishpump

I used silicone airline tubing, because it’s more flexible than the regular clear tubing, and doesn’t harden with age, and is heat resistant. Here is my messy hack to test out the concept:

nozzlecool

The silicone tubing is held in place with a couple of bent up paper clips. I love my J-Head Mk III-B – it works flawlessly, even without fan cooling the aluminum heat sink, but one annoying thing is that the nozzle is very short, so there’s very little clearance between the nozzle tip and the heat block. This made placement of the cooling hose sub-optimal. It’s very hard to position the hose to cool the flow of plastic without hitting the print. Nevertheless, much to my delight, it works pretty well! Below is a comparison of printing with and without nozzle cooling. The part is a holder for a steel ball from Steve Graber’s Cerberus Pup. The print on the left was done without nozzle cooling, and the print on the right with cooling:

cooling1

The view above is from the bottom of the part, so the flat part inside the hole was an overhang. Note what a mess it made of the uncooled part. Below is a top view of the part:
cooling2

The cooled part was a perfect, tight fit for a 3/8″ steel ball bearing. I was amazed how accurately the part came out.

cooling3
Being the lazy person I am, I’m going to keep the jerry-rigged setup until it falls apart. So far, it’s been holding up quite well, allowing me to print out all of the parts for the Kossel-Linco delta printer that I’m designing. There are 3 main downsides to using the fish pump rather than a fan: 1) the pump is rather noisy 2) It uses AC power, so a relay is needed in order to control it via software, and 3) it’s difficult to control the air flow by software. What I’ve been doing is to start the print with the pump off, and then turn it on after the first few layers are done printing.

Slic3r Support Material Frustration

It’s been a few years since I’ve played with Slic3r, so I was eager to play with the current stable version, v1.0.1. One problem I had when playing with earlier versions of Slic3r was that the support material generation was not yet usable. A part I was designing had a big circular overhang in the middle, so it was the perfect opportunity to try out support meterial in v1.0.1 stable. Unfortunately, while the support material worked great for printing, it was almost impossible to remove! The gcode depicted below was generated using the rectlinear pattern:

slic3r101stable

The support material in the above picture is the large circular plug. Notice how it doesn’t leave a gap between the plug and the hole, so it’s completely stuck to the part! It took me almost an hour to carefully dig the support material out with and x-acto knife. Unfortunately, there’s no parameter in v1.0.1 to let you tune the spacing between the support material and vertical walls. Next, after reading that the Slic3r team had rewritten the support material code, I downloaded the latest experimental version, 1.1.4, and tried it. Much better:

slic3r114

Note the sizeable gap between the support plug and the perimeter of the hole. This time, the supports only took a few minutes to remove. The moral of the story? Use a newer version of Slic3r instead of v1.0.1 stable if you want to generate easy to remove support material. An added bonus of v1.1.4 is a new support pattern, called pillars. It looks like this:

pillars

RepRap: Printrboard Surgery

After a hiatus of a couple of years, I’m finally starting to get back into 3D printing. One of my Printrboards got messed up when some wires on my hot end shorted. The hot end temperature was no longer reading correctly. Since my other Printrboards all work correctly, I knew that the problem was not a bad thermistor or wiring. Instead of throwing out the Printrboard, I decided to try to fix it. The first step was to have a look @ the Printrboard schematic. Here’s what the temperature sensing circuit looks like:

tempckt

 

I got out my ohmmeter, and R9 was OK, but E-THERM to GND was reading as a dead short, so I assumed that C10 was bad. This was a good opportunity to play with my AOYUE INT 2702 hot air rework station, which I’d never used. I removed C10, and much to my chagrin, the reading from the hot end ADC pin was stuck at 1024. Furthermore, shorting E-THERM to ground was causing my Printrboard to reboot! This led me to conclude that something was fried inside the AT90USB1286 on the ADC pin connected to E-THERM (PF1_ADC1). Conveniently, 2 other ADC pins, ADC2 and ADC3, are broken out into an expansion header on the Printrboard. I first soldered C10 back into place. The trace connecting ADC1 to E-THERM was inaccessible, so I couldn’t cut it. Instead, I disconnected it by lifting the pin on the MCU off the PCB. Next, I connected a piece of 40AWG wire wrap wire between the A2 header pin and the E-THERM trace.

pbfix

Success, the ADC2 pin is working perfectly! The only caveat is that I have to remember to run modified firmware when using this board, reassigning the hot end thermistor pin from ADC1 to ADC2. In Marlin firmware, it’s as simple as finding the Printrboard section of pins.h, and reassigning TEMP_0_PIN from 1 to 2.