Category Archives: Hardware

pfSense on Firebox X500

IMG_4881 Previously I had run pfSense as my firewall / router on a discarded Celeron 700mhz machine, with a lot of spare NICs in the PCI slots. Browsing around the local Goodwill and I stumbled upon this Watchguard Firebox X500 for $10. Finally, real rackmount gear for my 2×4 server rack!

I’m sure whatever software comes on this thing is great and wonderful, but I didn’t even try to use it. First step if you have one of these – hop on over to the pfSense Firebox wiki page and do some research. Popped open the case, swapped in a 2gb CF card with the pfSense no-VGA embedded image, and set to configuring it. The most difficult part of all this was getting a USB to Serial cable that worked… and then a Null Modem cable… and then having to do the configuration in a virtualized Windows XP machine because there are no OSX drivers for the WCH341 chip in my cheap eBay usb-serial converter.

Now that it’s all set up I can easily access via ssh or http, so serial access isn’t as important. The hardware in this is just a 1.2ghz Celeron, with 10/100 Ethernet ports and some 256mb RAM. Obsolete, yes, but that red paint job never goes out of style.

Wacom ArtPad II (KT-0405-R) to USB

1119141209 (1) Six or so years ago, I picked up a Wacom ArtPad II digitizer from Freecycle. It came with serial cable and power brick, but no pen. These devices aren’t like an iPad or whatever (which use a capacitative touchscreen) where you can use your finger or a cheap stylus. Wacom pens have built-in smarts to communicate with the tablet and relay pressure information, pen/eraser mode, button click, etc. Without the pen, it’s downright useless. A few eBay searches revealed that pens were crazy expensive to replace at the time. Into the spare bin it went.

Recently I had an interest in getting this working again. I did more research and found that Wacom pens are actually somewhat interchangeable – in this case I can use any “Penabled” pen on it, and it’ll probably work. The new Samsung Galaxy Note S tablet uses Wacom styluses and the replacements are cheap – $8 on eBay, so I ordered one. Holding the pen over the tablet causes the LED to switch from orange to green, which was good enough for me to figure it’s working.

New problem – I have no machines with a serial port any more, and even if I did, Wacom drivers don’t support serial tablets any more. The solution comes from the WaxBee project, which uses a Teensy 2.0 to sniff old-protocol tablet packets and re-encode them to emulate an Intuos2 (a modern USB tablet with driver support). Great! Ordered a Teensy and cracked open the tablet to set to work.

First, I knocked off the serial connector and voltage regulator (soldered across that instead), as the USB will provide the +5V needed to drive the tablet. Next step is removing the ADM202 TTL-to-RS232 chip, where things took a disastrous turn: my overeager Dremel application removed the chip as well as the pads it sat on, and gouged out some of the PCB to boot. Crud, now I have to follow traces to figure out where it was supposed to go. Took a couple high res photos and gave up for the night. (If you need more info – circuit board photos, etc – check out this series of posts: http://forum.bongofish.co.uk/index.php?topic=2088.msg20757#msg20757)

test The actual solution turned out not so bad: had to lift three pins on the Motorola chip and solder those to the Teensy. The hid_debug tool from pjrc (and associated WaxBee firmware) was invaluable in figuring out when I had the wires going the right way. Once that was done, superglue secured the wires and electrical tape held the Teensy. I cut a chunk off the side of the enclosure for the USB micro-port to fit, and drilled a hole for the Teensy button if I ever need to reprogram it. Covered with electrical tape, plugged it, and miraculously it all worked!

Teeny Tiny MIDI Controller

I’ve been working sporadically on this tiny MIDI controller.  It targets the smallest PIC microcontroller available with onboard A/D converter – the PIC10F220.

Currently it reads two potentiometers and a button input using three of the GPIO pins, and it bitbangs the remaining output pin to produce MIDI-Out at 31250hz using cycle-counted delays.  Since practically everything is already on-chip, this thing could just be epoxied straight to the enclosure.  There are only two or three more components – no PCB required!

schemThis microcontroller sports a whopping 256 instructions and 16 bytes of RAM.  Even so, the MIDI controller code consumes less than half the available resources after a modest amount of optimization for size.  One might see this as my response to using a certain 32k ROM / 2k RAM microcontroller to blink some lights, but I won’t admit to being that petty.

mplabWhat to do with the remaining space?  An easter egg isn’t a bad idea…  Hold the button down on boot, and the controller will dump “HTTP://WWW.HACKADAY.COM” as a series of MIDI note-on messages.

Unfortunately I haven’t built the thing yet, but I did simulate it.  Here’s the logic analyzer input, showing MIDI messages being sent (delays removed):

plot_editYou can listen to the result here: EasterEgg.mid

Code follows.

;
;
; Easter Egg: hold button on startup ;-)
    btfsc    GPIO,GP3    ; 2-3
    goto skip_egg

; "note on" running mode
    movlw    (0x90 | midi_channel)
    movwf output
    call serial_bitbang

; reset pointer
    clrf    egg_timer

; "HTTP://WWW.HACKADAY.COM" -> "48 54 54 50 3a 2f 2f 57 57 57 2e 48 41 43 4b 41 44 41 59 2e 43 4f 4d"
egg_loop:
; load ptr into w reg
    movfw egg_timer
; go get the next ascii value
    call egg_table

; done?
    iorlw    0x00
    btfsc STATUS,Z
    goto skip_egg

; send note (on)
    movwf output
    call serial_bitbang
; send note volume
    movlw 0x7F
    movwf output
    call serial_bitbang

; delay
    movlw 0x7F
    movwf output
egg_delay_outer:
    movlw 0x7F
    movwf temp
egg_delay_inner:
    nop
    nop
    nop
    nop
    decf    temp
    btfss    STATUS,Z
    goto egg_delay_inner
    decf    output
    btfss STATUS,Z
    goto egg_delay_outer

; send note (off) - again
    movlw egg_timer
    call egg_table
    movwf output
    call serial_bitbang
; send note volume 0x00 == off
    clrf output
    call serial_bitbang

; next ASCII char
    incf egg_timer,f

    goto egg_loop

skip_egg:
; Send the first MIDI CC message.
; ...

; ...
; rest of project code...
; ...

; lookup table for hackaday URL
egg_table:
    addwf    PCL,F    ;add offset to pc to
                    ;generate a computed goto
    retlw    0x48
    retlw    0x54
    retlw    0x54
    retlw    0x50
    retlw    0x3a
    retlw    0x2f
    retlw    0x2f
    retlw    0x57
    retlw    0x57
    retlw    0x57
    retlw    0x2e
    retlw    0x48
    retlw    0x41
    retlw    0x43
    retlw    0x4b
    retlw    0x41
    retlw    0x44
    retlw    0x41
    retlw    0x59
    retlw    0x2e
    retlw    0x43
    retlw    0x4f
    retlw    0x4d
    retlw    0x00
    END

Atari Flashback 2 Mod

The Atari Flashback 2 is a really neat plug-and-play TV game system. It looks like a tiny Atari 2600 and plays 20+ classics for the system. Most interesting to hackers, however, is that the board inside isn’t just a 2600 emulator or recreation – it’s actually a modern, miniaturized 2600-on-a-chip playing real ROM images. Additionally, there is a convenient silkscreened table on the board showing pinouts for adding a 2600 cartridge connector and playing real VCS game cartridges on the system.  Compatibility isn’t 100%, but it’s quite accurate, and the A/V cable is a nice way to hook up to a modern TV (no more fiddling with RF adapters).

Finding a NOS cart connector is tough, but there’s an alternative: source a floppy-to-IDE cable from an old PC – the board connector has the same pin spacing as a cart.  I stuffed cut-down popsicle sticks into the gaps on either side (the connector is wider than a real 2600 cart).

Soldering to the board can be a real pain in the butt, especially if (like me) you don’t have a solder station to do it and are using a blunted Rat Shack iron for the job.  Miraculously, it all worked when I screwed it back together.  Besides the cartridge slot itself I added a few details:

  • Power light
  • Difficulty lights
  • Switch on back to select between “cart” and “built-in games”
  • Removed hardwired A/V cable and replaced with A/V jacks

Cutting the slot posed a new challenge, which I didn’t do a very good job of.  I drilled holes through the cart connector and used long bolts to secure it to the back of the system – carefully spaced so that the would slide into the tabs on the Atari cartridges and release the dust cover.  Then came time to cut a rectangular hole in the top.  I did this… and found I’d put it at the wrong spot.  So I had to cut another hole, leaving a gap around the cartridge and screwing the aesthetic.  This time I got it right and was able to play Star Wars: Empire Strikes Back on my big-screen TV.

Definitely not the most impressive Flashback 2 hack out there, but I’m pleased with the outcome.  Like most of my projects, this one dragged on for a couple of years before reaching a finished state – I’d throw a couple hours at it every few months but never seemed to get it wrapped up.  Now if I could just finish the multicart I’ve also been designing, I could have something to play on it.

Mac Mini Processor Upgrade

Our Mac Mini (Intel, late 2006) is now the family computer.  That’s a big job for this little machine, which last saw an upgrade in 2008 to 2gb RAM.  However, it still poked along on the Core Solo 1.5ghz processor that it shipped with.  That was decent in 2006 but it’s slow in 2012: when your Flash games look like a slideshow, it’s time to upgrade.

Fortunately, the top end processor for this machine (Core2Duo 2.33ghz, the “T7600” model) has been out of production for some time and prices have finally fallen below $100 shipped on eBay.  I snagged one for $91 and went through with the install today.  It’s a little nerve-wracking working in such a tight space, especially since you must pry the case apart using a putty knife.  Also, I had no thermal compound… the nice guys at Luyet Computers donated the .1 gram or so that I needed at no charge (thanks!) and I was up and running shortly.  I also blew out a ton of dust and cleaned up some stickiness that appeared to be ancient Sprite spilled on the computer.

End result: well, it’s way way faster, as to be expected.  I didn’t measure temperatures before and after but (thanks to eliminating dust) it’s actually running quieter than when I took it apart.  For fun I did a before-after Geekbench scores comparison.  Click here to see the Google Docs spreadsheet.

If you have a Mac Mini, I highly highly recommend this upgrade, it’s great for the price (or you can probably do even better getting the T7200 or T7400 versions… but I was enticed by the turbo clock speed).  We should be good for the foreseeable future, until the HDD dies and I put in an SSD instead : )

New Server Problems

Well… the server began powering off after only a few minutes of activity, so I had to crack it open and fix several issues inside.  Self-hosting is great sometimes: the level of control is unmatched, and the costs are low.  On the downside, you must do your own tech support.  When hardware issues crop up, this can be quite an annoyance.  Here’s a shortlist of the issues I worked on.

  • Detached heatsink: Almost immediately after opening the case I found the cause of my force poweroffs: the heatsink mounting bracket (already damaged on one side) had broken completely and the heat sink was falling off the CPU. Overheating triggered a safety mechanism that shut down the PC to save the chip. I reattached this using a couple of plastic cable ties from Home Depot. According to BIOS measurements, it is running 5 degrees cooler now than when I originally brought it home.
  • Added PCI video card: My aging S3 Virge is now serving VGA duty in the machine. This allowed me to return the 16MB of shared video RAM back to the system. Definitely not much, but with only 384mb RAM total, every byte counts.
  • BIOS problems: Made a couple changes to BIOS. Unfortunately, the system remains a bit unstable after power-on… the second hard drive takes a while to report to BIOS after first power on. This generates an error that freezes the BIOS since boot devices had changed. I changed settings to simply ignore all errors and boot no matter what.
  • ACPI crash: ACPI support in FreeBSD must have broken at some point recently (or thenew gfx card is having troubles with it), but there are kernel panics on boot when trying to run with ACPI enabled. For now I have shut it off with an entry in /boot/loader.conf (hint.acpi.0.disable=”1″). Power management is not really necessary for an always-on server… I have the second hard drive set to spin down after 10mins inactivity, and do not have power to my floppy drive or CD drive at all.

With luck, this will keep me up and running for a good long while.

New Webserver

From FreecycleJust a quick post here before my latest projects all escape me.  I snagged a used PC off Freecycle a couple of weeks back and swapped out my web server – reformatting and installing the latest FreeBSD at the same time, then reinstalling all the ports from scratch.

In fact my needs have simplified considerably since standing up the old server, as I’m now using a TomatoUSB-flashed WRT54GS as my router / gateway instead of the webserver box – meaning I no longer needed dhcpd, natd, an elaborate pf.conf, dyndns client, a second NIC, etc.

Interesting specs: 2.0ghz Celeron (old machine 1.3ghz Pentium4), 384MB SDRAM (old: 128mb RDRAM).  Gigabit ethernet card.  Two SATA ports.  On-board GFX using 16mb shared ram (could put in a PCI card to get that back, if I really need it)  Most everything is up and running as before – a few side projects have dependencies I haven’t reinstalled yet.  In fact the biggest challenge was updating the BIOS, because all my floppy disks are dying… I managed to do it using two half-damaged disks, one for the flasher and one for the ROM, and even then command.com didn’t want to boot so I needed to use the flasher as the interpreter : )

The old machine is going to be fitted into the gutted Galaxian cabinet and run dedicated MAME – win98se stripped, off a CF card.

Joule Thief

So I had a few problems I needed to solve:

* My 4 year old daughter loves flashlights, but often forgets to turn them off, and all of our flashlights use D cells or multiple AAs.

* We have a large (20+) collection of “mostly dead” batteries that I feel kind of bad just tossing or recycling

Both these problems are nicely solved by the Joule Thief circuit (http://www.emanator.demon.co.uk/bigclive/joule.htm) – an LED driver that can drain the very last bit of power from a battery and still function for days on end.  It has an additional advantage of only using a few parts, and I happened to have them all on hand… a rarity for me!

I have no idea what the “ferrite” material is.  I stole this massive coil out of a broken car stereo, cracked open the plastic and found that it was actually some sort of tightly wound metal tape.  So I put the plastic back on since it was prone to damage otherwise and just ran a bunch of untwisted cat5e wires around it.  Works great.  The transistor is NPN… I assume the values of pretty much everything here really don’t matter much.  I did have problems getting the lights until I realized I had connected the wrong end of one transformer lead to the battery: the two coils must oppose one another, not run in the same direction.

Of course a bare circuit is fun but not all that useful.  So I stuffed it in a little elephant toy I got off Freecycle and gave him a shiny trunk.  For now the battery is soldered straight to the leads.  One day I’ll get a real AA battery holder and some velcro to finish this up.  In the meantime he’s a good nighttime buddy for my 4 year old daughter.

Time-Lapse Intervalometer

This was an interesting and mildly frustrating project.  I busted an old camera trying to get this to work, but in the end I was able to take some cool videos with it (and salvage the camera again for its single purpose).  The design is based largely on the instructable for the 555-timer based intervalometer, seen here:

http://www.instructables.com/id/Time-Lapse-Intervalometer-for-SLRs-with-555-timer-/

I had to make some changes to the circuit, replacing the transistor with a relay to fake push-button on the camera shutter.  It’s extremely fragile but works well and can produce some fascinating videos.  More info is available on my Photography News page:  http://greg-kennedy.com/2011/08/01/time-lapse-photography/