smellsofbikes: (Default)
2017-04-03 08:25 pm


Testing whether I can still crosspost from dreamwidth.
smellsofbikes: (Default)
2015-03-15 11:29 pm

(no subject)

This is purely to get something spliced in.
smellsofbikes: (Default)
2015-03-12 11:03 pm

notes on beaglebone 2: systemd

You want a program to start running every time the beaglebone boots.
Use systemd because it's there and it actually works okay.

In /lib/systemd/system/ make a file (programname).service
So for this example, blinker.service

It should look like this:




Then go to /etc/systemd/system/ and make a symlink to that file.

ln -s /lib/systemd/system/blinker.service /etc/systemd/system/

The file itself, if it's python, must begin with #!/usr/bin/python (or wherever you have python installed) and be executable.

Then, systemctl --system daemon-reload
and systemctl start blinker.service

and your program should start immediately and also start every time you boot the beaglebone.

If your program is dependent on other services before it starts, you can add those under the [unit] group, like:

That way it will wait until the network is up before running -- which, in the case of what I'm building, is nice, because it's streaming internet radio.
smellsofbikes: (Default)
2015-03-12 10:59 pm

notes on beaglebone 1: setup

First step: installing software.
I'm type 2 lazy, meaning I do a bunch of work so I can sit in my chair later. As such, I set up port forwarding on my laptop so I can do all my upgrades and work from the laptop rather than having to walk downstairs where the ethernet cable lives.
So: USB connecting bbb to laptop, allowing me to ssh into the bbb and run it. Cat5 cable from bbb to laptop, with port forwarding set up.
On bbb:
ifconfig eth0
ifconfig add default gw
On laptop, start with an ifconfig and look at the output. There should be two eth[x] entries, one of which will include the entry. That's actually the usb. So you want to configure the other one, which is the hardware associated with the port where the cat5 cable lives. For this example I'm presuming it's eth1, and your wireless connection is wlan1.
sudo ifconfig eth1
sudo iptables --table nat --append POSTROUTING --out-interface eth1 -j MASQUERADE
sudo iptables --append FORWARD --in-interface wlan1 -j ACCEPT
sudo echo 1 > /proc/sys/net/ipv4/ip_forward

If you're using xubuntu (or apparently a few other distros) that last line won't work because for whatever reason '>' doesn't inherit sudo permissions. So you have to punt:

echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward

Now you can start work on the bbb.
apt-get update
apt-get upgrade
apt-get install alsa-base alsa-utils

Mine already had all the alsa stuff installed. A bunch of programs didn't successfully upgrade, like apache and dbus, which I need to look into later, but I don't actually use any of those for this project so I don't care. [note 1]

Now, disable HDMI so that we can get audio to the usb.

Go to /boot/uboot and edit uEnv.txt to remove the comment status from the line disabling hdmi. It'll be optargs=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN
Then go to /etc/modprobe.d/alsa-base.conf and edit it to change the index on snd-usb-audio from -2 to 0.
Reboot the bbb with your usb soundcard plugged in.
For me, this resulted in being able to play music. I needed some music to play and a player.

apt-get install mpg321

(you might want to change your working directory to /home/debian before doing that, rather than sticking an mp3 in /etc/modprobe.d)
and then you can mpg321 1456.mp3 and hear some noise.
mpg321 will also accept url's, so:
will bring up a menu of soma's indiepop streams that you can connect to and start playing. Take note of the stream names and you can use them directly without having to select This is useful for completely headless operation.
I used a Syba usb soundcard. It works beautifully.

[note 1]
For some reason, is a screwed-up file, and prevents apt-get update from working correctly on half a dozen packages.
From here:!topic/beagleboard/LPjCn4LEY2I
do this:
Replace the existing /etc/init.d/ script with:

#!/bin/sh -e
# Provides:
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start LED aging
# Description: Starts LED aging (whatever that is)

x=$(/bin/ps -ef | /bin/grep "[l]ed_acc")
if [ ! -n "$x" -a -x /usr/bin/led_acc ]; then
/usr/bin/led_acc &
smellsofbikes: (Default)
2013-11-10 09:36 pm

Trial scan-to-pcb post

working on formatting and flow.
You can get (much) larger versions of most pictures by clicking on them. I will probably use larger pics in the final version of this writeup.

I have this old Triumph Spitfire. When I got it the turn signal consisted of a standard Digikey toggle switch with a ball point pen body stuck on the toggle. I bought a new replacement for the turn signal and installed that but even though it's listed as the stock replacement, it doesn't cancel when you come out of a turn.
The original owner, however, still had the old one and gave it to me.
So I took it apart to find out why it was broken.


There's a big hole burned through one part where it shorted.


The material is phenolic with copper on top, 0.031" in thickness: a standard printed circuit board, with a very specific outline.

Well, I thought it would be interesting to learn how to take a picture of something and turn that into a copy of the object. I've gone down this route in several different ways, and in this case I'm going to cover what's probably the fastest, if not the most precise or beautiful, manner for converting a scanned image to a circuit board, using Inkscape, pstoedit, and geda pcb.

I put a piece of graph paper on the scanner back, and the burnt-up circuit board on the face, and closed the scanner, so I could get a scan with a light, calibrated background. Having a calibrated background matters because inkscape (and scanning in general) doesn't always honor size information.

So, a scan.


First thing is to box it in. I draw a box larger than any part of the scan, on the graph paper, because that way I can group the scan and the box, and resize it to the size I know it is from the graph paper's scale, and know that the result is the size it should be regardless of what the scan or inkscape import process does.


At this point I zoom in on the image, add a new layer (in this case, I'm calling it 'outline') and hand-trace the outline using the bezier tool. (I'll cover various autotracing options some other time.)


In this case, I will need two layers: board outlines, and copper traces. The reason for this is that I'm going to export this in those two groups and process them individually, one as polylines and one as filled copper area, using pstoedit.

Because they have to be processed separately, and for reasons I don't fully understand, pstoedit converts them differently, I need to retain the box surrounding the features all the way into the pcb layout program, so I can align the two different groups once in pcb layout.

So, two layers. In this shot you can see I actually had three layers: inside, outside, and copper. One of the two pcb fabrication processes I use cuts to the line, and you specify inside or outside, so for that I want to identify each individually. The other fabrication process cuts right down the middle of lines, so it doesn't matter what you call them, and you have to handle cutter diameter by moving the entire line in or out. Both have their good and bad sides.


Then I click on the image somewhere, outside the bounding box I drew, and drag it off to one side, to make sure I got everything traced that I wanted, and then I delete the image.


Then, select all, group. I know that the box width is 5 inches, because I'm using Imperial graph paper, so I resize the image to 5 inches (or 5000 mils).


And I drag it down close to what Inkscape considers the picture origin, in the bottom left corner of the page, where it now looks very tiny.


And I group all the copper bits into one group.


Some tricky bits ensue. I want to export the copper traces as fills, so what comes into the pcb layout is nice solid copper chunks, not outlines. That requires closed polygons. Well, I have three closed polygons in the center, and I have them inside of a box. If I export them this way I'll get a huge solid copper box with them hidden somewhere in the middle. That is actually usable but it's not what I want. If I delete the box, I can't accurately align the copper to the pcb. So what I do is I draw four boxes, one in each corner of the bounding box.


Now I'm ready to start exporting stuff.
I choose what I do _not_ want to export, and hide it.


In this case, I do this with the inner and outer outlines and the bounding box, leaving just the copper and the four boxes I've drawn at the bounding box corners, leaving me with just the bits I want visible. I group what's left, go to 'properties', and give it a name. (Remember to hit 'set' after naming it.)


I then export that as an Encapsulated Postscript, exporting only the object/group I just named copper. That'll produce a [name].eps file.


That ends up with an image that looks like this.


I do the same thing with the outline. (This requires 'select all in all layers' then 'unhide' and then I group the outlines with the bounding box, give them a name, hide the copper and the copper fiducials in the corners, and export the outline as a second encapsulated postscript.)

So now I have two encapsulated postscript files, and it's on to pstoedit. (Which I always type as ps2edit the first time, since that's the way most unix programs are foreshortened.) I'm going to refer to the two files as lucas_copper.eps and lucas_outline.eps

You can use pstoedit to convert a postscript-like file to just about anything. I'm using the program's hooks into gEDA's pcb layout program here.

So, I open a terminal, and:
pstoedit lucas_copper.eps -f pcbfill lucas_copper.pcb
and likewise
pstoedit lucas_outline.eps -f pcb lucas_outline.pcb

Now I have two pcb files.
Open one: 'pcb lucas_outline.pcb' and you find your outline.


Go to import layout data, choose the other pcb, and it'll appear as a draggable object on top of your first pcb.


Drag them so the fiducials match in the corners, click to set it, delete all the fiducials, and drag the resulting two layers up into the top left corner as a pair.


One came in on the layer called Spare, and the other on Silk, neither of which is what we want. Save, then go into the pcb file with VI or EMACS or gedit or whatever and cut out the copper fill under the Silk layer and copy it into the Component layer, and likewise with the outlines from the Spare layer to the Outline layer. Or just swap the names in the pcb file.


So in this case, copying all the Polygon("clearpoly") entries under Layer (10, "Silk") to Layer (1, "top") will make them become copper on the top gerber. (You can leave them on 10, if you want, or delete them: you won't be using that gerber anyway.)

Then create gerbers and run it.
I milled this on my machine at home, using a 1mm router bit after an engraving bit did the copper etching.


To be fair, when I made this I did rotate it slightly in inkscape so the sides were straight lines, and a few other cleanup bits. I also put in drilled holes for the wiring connections. I also won't be using this board as my final board because the final one needs to be in thinner (0.031" rather than standard 0.062") material and should have a bunch of vias through the material to help the copper stick to the underlying substrate more tightly. But this certainly showed that I could make a complex outline fit into a complex enclosure correctly.
smellsofbikes: (Default)
2012-10-10 10:20 pm

Vacuum bazooka

I got the idea of a vacuum bazooka from the superb book, "The Ultimate Book Of Saturday Science" by Neil Downie. It was awesome, with 40 or 50 projects, each of which can be done in a weekend (most in more like a couple of hours.) Each also has a fairly technical writeup about what's happening, although the projects are largely suitable for kids in the approaching-teenager age range.

The idea of a vacuum bazooka is: you use a vacuum cleaner to evacuate a pipe, with a valve over one end. You stick a dowel in the other end, it accelerates down the tube, pushed by pressure behind it, shoots right past the vacuum inlet, through the flap, and flies off into the blue yonder. It's a pretty quick build.

I chose 3/4" (inside diameter) white pvc pipe because it's cheap, and fits a 3/4" pine dowel reasonably well. Smaller diameters are even cheaper but the dowels don't fly as far because they don't have a lot of inertia; larger diameters work great but a piece of 1" or larger wooden dowel can go through a window.

The traditional version uses a T-fitting with the long barrel leading to the breech going out of one end, and a short stub leading to a flat-faced fitting with the valve, on the other end, and the vacuum cleaner on the right angle of the T. I didn't like that as much because A: the dowel bullet could get sucked against the single vacuum inlet and get slowed down, and B: I didn't want to have a joint in the barrel, where the dowel could jam. I bought an X-joint instead and bored out the inside so the barrel slid right through it. However, while I was there I found a fitting like this
That would work great, and would be much simpler than my solution.
The bulkhead on the end is a 3/4"-to-1 1/2" adapter.
When I started, it was like this

I needed to use it reversed, so I cut off the back, basically. I also faced off the front on the lathe to provide a dead flat surface for the valve to seal against, but that's not actually necessary.

Here's a shot showing the parts, somewhat disassembled, with all the interesting bits exposed:
vacuum bazooka assembly

You can see the back-side of the cut-off adapter, the barrel with a hole drilled through, that lines up with the cross-arms, and the cross-arm assembly with two sets of 3/4" curves going to a 3/4x3/4x1" tee. All the fittings are connected with pieces of 1 1/2" long pvc cut from the end of the barrel. I didn't glue anything together because it's totally not necessary: they're just dry-fit and shoved together. The amount of air the shopvac pulls means minor leaks are completely unimportant.
Here it is, assembled:
vacuum bazooka closeup

There's an adapter I cut using a hole saw or three, that connects the 1" ID T to the 2" ID end of the shopvac hose. I have an adjustable-diameter hole saw, so I cut the OD of each tube halfway into a piece of pine, one from each side, and then a roughly 1" ID all the way through. This is totally unnecessary: a big wrap of duct tape would do a better job.
Also I didn't get the picture in focus, and also the piece of pine is a waste board I was using on the milling machine so it has holes and slots all over it.
vacuum bazooka adapter

Here's the whole assembly.
vacuum bazooka

The flap on the end is a piece of 0.006" thick aluminium gutter drip-edge, cut to about the same size as the faceplate, with a bit of electrical tape holding it on. (This only lasts about four shots before getting blown off. I'm certain you can come up with a more durable solution, as will I at some point.)

I cut off pieces of 3/4" dowel, about 1" long, on a chopsaw, and if I'm feeling fancy I run a file across the faces to remove splinters. Turn on the shopvac and put the dowel piece within about 1" of the breech, and it makes the most delightful THWOOOP-ptak! as it shoots down the barrel and knocks the flap open.

Firing from about a meter high, on a flat trajectory, it shoots about 15 meters before it hits the ground. When I'm not completely overwhelmed with work, I'll try setting it at a 45 degree angle and measuring its maximum distance.

One obvious and very exciting extension of this would be to find a big bucket full of superballs that are the right diameter for the barrel... and just suck it dry, firing a barrage of superballs all over creation. I have not yet found 3/4" superballs. However, when I find any source of cheap superballs I'm going to bore a piece of tubing to match them and try it out.

There are many other varieties and plans online for good cheap ways to do this, that don't even involve drilling holes in the tube. I wish I'd thought of some of them before assembling this.

smellsofbikes: (Default)
2012-08-14 11:46 pm

Laser diode driver using high-power LED driver

I wanted to put a laser scribe on the CNC mill. Since we build LED drivers at work, that seemed like a good way of controlling the laser diode. This is set up to supply about 700mA or so -- a value determined by a sub-ohm sense resistor -- to power the 120mW red laser diode module.

I put together a schematic based on the LM3402 because I know it really well since I designed the official evaluation board for it. I ran the laser diode current requirements through Webench (on the right-hand side of the page) and took the schematic it produced and ran that into geda's schematic entry tool to come up with my working schematic.
lm3402 schematic

I ran that into PCB and did a layout.

I'd like to talk about that layout a little bit. This particular chip has an exposed pad on the bottom of the chip to dissipate heat from the internal switching mosfet, so the layout requires exposed ground beneath the chip. To solder this down, the best way I've found is to flow solder on the ground area so the whole area under the chip is coated, then solderwick it all back off, and add one tiny point under the chip. You put the chip down and it rocks on that point. You put the soldering iron down beside it and add a little solder, and when the chip suddenly drops down flat you know that it's down and attached, and then you can solder down the legs.

In any switching power supply you want to have the shortest traces possible on the loud and noisy nodes, most notably (in this case) the pin that switches the inductor. It's a good idea to make that just a single small copper pour with all the parts on that node as close as possible to each other so it's not spraying noise all over the place. Lots and lots of ground -- as much ground as possible, in fact, and for small power layouts you don't want thermal relief around your pads. (Which in geda/pcb means making parts with pads that have zero clearance, an experts-only move because if you don't do your layout right you'll have shorts and the program won't tell you.) I snaked the 'enable' pin around the inductor because it doesn't seem to care much about noise.

For this layout, the chip will take anything from about 7-35v as its supply, and converts that to the laser diode drive with between 80-90% efficiency.

You should have something like a 10k resistor from the enable to ground, so the chip powers up OFF rather than ON because unexpected lasers are really bad for your eyes. (In this case the controller takes care of that, but it's an extremely good idea to have it there even if the controller comes up with the IO pins grounded.) In this case the ENABLE pin is labeled DIM on the schematic.

When I run a file through a gcode processor it produces lots of Z up/down moves. I then take a look at those and use sed to change Z up moves into digital pin off moves, and Z down moves into digital pin on moves: "sed 's/Z-10.000000 F100.0/M64 P01.0/' for instance.

SO! with that done, here's a video of the result.

Need I point out that you absolutely positively must have approved laser goggles that filter the wavelength you're using? Visible lasers that are over 10mW are really bad for your eyes. Even with actual laser goggles, if I look at the burn spot for any length of time I see spots. Be careful with your eyes: you only get two and they're very delicate.

smellsofbikes: (Default)
2011-05-07 11:50 pm

Pender Harbour April Tools Boat Challenge

So fishy talked neuro, gcc, and I into trying the April Tools Challenge in Pender Harbour, British Columbia. The idea is you show up, they give you a surprise pile of materials, and you get to plan and build a boat out of the materials (and nothing more) in four hours, using nothing but hand tools. (And power screwdrivers.)

Insofar as I have a lot of woodworking tools, and I like crashing about the country, and renting a car to drive out of the country is difficult and expensive, I drove up to Seattle, then up to Vancouver, picked up N, met up with fishy, neuro, gcc, and friends, took a ferry to the Sunshine Coast of Canada, and drove up to Pender Harbour. We built a boat, then we all drove back, and I drove back to Denver.

That's the short version.
Click here to see the long version, with pictures n stuff. )
smellsofbikes: (Default)
2011-05-07 07:48 pm

(no subject)

Aaaand a second try to see if I can get the dreamwidth footer in place (although I'm not sure that's necessary or even useful.)
smellsofbikes: (Default)
2011-05-07 07:43 pm

(no subject)

This is a test post to set up cross-posting and play with dreamwidth style.
I think I'm going to use this account for when I want to cross-post something to FB without any easy way to backtrack to my main blogging account.
smellsofbikes: (Default)
2010-08-21 11:10 pm

(no subject)

Maaaaaan I made the best bread today. I started the yeast beforehand, and by the time I got back to them they'd gone from a teaspoon of yeast in two teaspoons of water, to completely filling a one-cup bowl. RAAR. The bread went crazy, overfilled the bread machine, and when I did the second rise on the dough in the stove, it started to creep off the edge of the baking sheet.
So we went to a soiree -- walked, as it happens -- and I carried the bread. Put it down, and nobody touched it. Two hours passed.
Finally I cut off a piece and ate it, and it was fabulous.
And ten minutes later half the loaf was gone and everyone was saying "hey, this is the best bread EVER."

People are funny.
smellsofbikes: (Default)
2010-08-20 06:54 pm

(no subject)

It's happening, yo. We'll see if it continues to happen.