Getting the Sparkfun EL Escudo to work

I’m really disappointed in Sparkfun. I recently purchased the EL Escudo shield for driving EL wire with a microcontroller, and woe be upon anybody who doesn’t do hours and hours of Internet research before plugging the thing in. There were 3 years of questions from poor customers with only a few answers, and the few answers that were there were often contradictory. Here are my conclusions from my Internet research, and the amazing Will Byrd helped me finally get it to work. Long story short, Sparkfun sets you up to fail and hasn’t fixed things in 3 years.


Continue reading Getting the Sparkfun EL Escudo to work

Venturer HPS9308 GPS navigation system

If you ever want to modify or upgrade your Venturer HPS9308 GPS navigation system, you can easily do so by modifying or replacing the software on the SD Card. However, there are some settings that aren’t obvious and aren’t directly modifiable, so you have to follow a couple things.

It seems like the default Venturer shell, when you choose “Navigation”, looks for SDCard\MobileNavigator\MobileNavigator.exe and runs it. Thus, if you want to replace the software that gets run, you should place the executable at that path. In addition, the GPS device is on port 1 with a baud rate of 4800, at least according to a working config file I found. For reference, that was in SDCard\MobileNavigator\sys.txt with the section
[gps]
port="1"
baud="4800"

Life-saving ability of major mobile devices

We’ve all known that Apple iDevices are superior to their competitors, but until now, we haven’t looked into a critical factor—their ability to save your life.

To compile the following charts, a Google search was conducted for “X saved my life” where X is a value from the left side of the chart. The number of results are reported by Google was then recorded as the data point.

“_____ saved my life”

Continue reading Life-saving ability of major mobile devices

“usbscale”: read USB scales

I’ve just finished writing the big parts of usbscale, a command-line program written in C that reads and interprets data from USB scales. It was meant as a little hack for the Stamps.com scale, so currently it’s only set up to recognize the Stamps.com 10-lb scale (manufactured by Elane). It should be trivial to add support for more scales, though.

If you have a USB scale, please let me know!

You can find the software at usbscale on Github: https://github.com/erjiang/usbscale

Reading a USB Stamps.com scale

Update: I now have an improved C version of this program: usbscale.

I got suckered into one of those hard-to-cancel Stamps.com trials. The upside is that they give you a $10 USB 5 lb. scale to use with their software. The downside is that they want you to only use it with their software, and the company that makes the scale has since taken down their free USB-scale program.

The good news, as Nicholas Piasecki and some Linux users figured out, is that the USB scale conforms to the USB HID specifications, which helpfully standardize how USB scales should work (no joke).

So, this little Perl hack reads from the Stamps.com scale by accessing the hidraw# interface that Linux provides. In my case, I have hidraw4 hard-coded into the script itself. Basically, it loops until it reads a good value from the scale, at which point it prints out the weight and exits.

Edit: This code is now a Gist on GitHub.

Continue reading Reading a USB Stamps.com scale

Linux support for Genius WizardPen, Mousepen, UGEE, UC-Logic, DigiPro tablets

I noticed that today’s Woot was a DigiPro UC-Logic drawing tablet.  I happen to own a UC-Logic tablet: a “WP4158U 快速龙” made by Taiwanese company UGEE.  UC-Logic makes tablet technology for many different companies, and their USB interface is relatively standard and straightforward. (I naively tried reverse-engineering the USB communication for my tablet a couple years ago, and then didn’t know what to do with the results.)  All of the UC-Logic tablets, as well as Genius Wizardpens and even Aiptek tablets can be used in Linux with the “wizardpen” driver.

The basic instructions for setting up the wizardpen driver in Ubuntu can be found on the Ubuntu wiki. If you use Ubuntu, use the instructions on there to install the driver; otherwise, do what your distribution needs.  However, the instructions on there for configuring udev and X.org are a bit overcomplicated and unnecessary.  You don’t need to create udev rules.  Instead, in your xorg.conf, add something like

Section "InputDevice"
Identifier      "MyGenericTablet"
Option          "SendCoreEvents"        "true"
Driver          "wizardpen"
Option          "Name"        "Tablet WP5540U"
Option          "TopX"          "2199"    #Replace these numbers with
Option          "TopY"          "3598"    #numbers correct for your
Option          "BottomX"       "30325"   #own unique tablet by using
Option          "BottomY"       "29278"   #wizardpen-calibrate
Option          "MaxX"          "30325"
Option          "MaxY"          "29278"
EndSection 

Where the “Name” option is the name of your tablet.  You can find out the proper name of your tablet by running

$ cat /sys/bus/usb/devices/*/product

and looking for the line that would be your tablet.  Mine was simply called “TABLET DEVICE”, so that’s what I put in my config.  That way, X will now to use the wizardpen driver for the device that has that name, saving you the trouble of creating udev rules.

Next, don’t forget to add

InputDevice "MyGenericTablet" "AlwaysCore"

to your ServerLayout section.  Forgetting this little step will leave the configuration incomplete, and your tablet broken. After you restart X, start the GIMP, Inkscape, Krita, or whatever paint program you use.  Go into the configuration, into Extended Input Devices, and you should see a new entry that bears the name “MyGenericTablet” or whatever you called it.  You should be able to draw with pressure sensitivity with your fully-functional tablet.  However, one problem that might occur is that you get two separate cursors—your paint cursor and a regular mouse cursor—whose positions are not matched. This is because your tablet is being reported twice: once in /dev/input/mice, and once with the tablet driver.

To fix this, you need to replace “/dev/input/mice” with “/dev/input/mouse#” where “mouse#” is the entry for your mouse.  The way I found out which one was the right one was by running “$ sudo cat /dev/mouse1″, moving my mouse, and seeing if any gibberish appeared on the screen.  I did the same for mouse2, etc. until I found the right one.  However, if you do this, be aware that you may need to change this entry when you change to a new mouse, because X.org is not longer set up to use aggregated mouses.

Working Wi-Fi on Macbooks with Ubuntu Linux

To use a MacBook’s Atheros wireless chipset on Linux, you need to use Ndiswrapper with the provided Boot Camp drivers.

  1. Get the wi-fi driver at makel.org. The one you’re looking for is drivers/Atheros/AtherosXPInstaller.exe.
  2. Install ndiswrapper from apt.
  3. Install unrar from apt.
  4. Extract the drivers with “$ unrar x AtherosXPInstaller.exe
  5. Install the drivers with “$ ndiswrapper -i net5416.inf
  6. $ sudo modprobe ndiswrapper
  7. $ sudo echo >> /etc/modules “ndiswrapper”
  8. Delete the temporary files
  9. The wireless should start working immediately.

Dual-booting Windows and Leopard with Kalyway

(not for public use)

Here’s my plan:

  1. Windows partition (NTFS), about 40 GB or more
  2. Mac partition (HFS+), about 20 GB or more
  3. Data partition (preferably FAT32), the rest of the drive

The data partition is for all the documents and music and stuff, so it can be shared by both operating systems. The reason for using FAT32 is that Mac can read, but not write to NTFS partitions (unless you install MacFUSE with the NTFS-3G driver, remount your drives, and remember to always dismount your drives before you shutdown).

Alternatively, if you don’t want three partitions:

  1. Windows partition (NTFS) the rest of the drive
  2. Mac partition, about 20 GB or more

This is for one drive. If you have another hard drive that you can wipe and dedicate to Mac, you can completely skip partitioning and save some work.

  1. First, boot to the Ubuntu disc. When it starts, go to System → Administration → Disk Partition tool (or run gparted from a console).
  2. Decide on your plan of action. What the computer probably has right now is one large NTFS partition. Choose one of the plans listed above, or create your own if you want to boot more operating systems. Remember that you can only create four “primary” partitions. If you need more, you would have to create a “logical” partition (which counts as one primary partition) that can be further divided into smaller partitions. It is recommended that you always put operating systems on primary partitions.
  3. Partition the drive.
    1. Shrink the NTFS partition to make room for the other partitions. You must have plenty of free space on your hard drive for this.
    2. Depending on your plan, create one or more new partitions to take up the freed space. However, GParted cannot create HFS+ partitions that Mac uses. So, for the Mac partition, just create a partition that’s the right size and format it as FAT32 or anything else. Don’t try creating an HFS partition.
    3. Commit your changes.
    4. Exit GParted.
    5. (Optional. I think you can do without, but this is how I did it.) Start cfdisk. Go to Programs → Accessories → Terminal and run “cfdisk.” If cfdisk is not installed, run “sudo apt-get install cfdisk.”
    6. Cfdisk is a text-based program. The left and right arrow keys choose the actions at the bottom, and the up and down keys choose the listed partitions. What you want to do is manually set the identifier for the partition you made for Mac to “AF.”
  4. Reboot into the Mac DVD.
  5. This is Kalyway’s Leopard install DVD for great justice.
  6. Before you follow the wizard, start Disk Utility. Reformat the partition you made for Mac into an HFS+ partition. Don’t touch anything else.
  7. Now you can follow the wizard. Make sure that on the last screen, you click the “Customize…” button. Choose only the drivers that you need. The most important one is NVInject for your video card, and the standard one should work. Only choose other drivers if they match your motherboard’s stuff. In the KOOLSTUFF list, I recommend downloading Adium and things like that after you install Leopard.
  8. Install.
  9. Enjoy???
  10. When you boot your computer, it should now boot into the Darwin bootloader, which should let you choose which OS to boot to. Don’t ever use the partitioner in Windows again. It will change your boot so that it only boots to Windows. Making a backup of your MBR is not a bad idea.
  11. Download important things like Adium, VLC, and Firefox.
  12. In iTunes, if you’re sharing music, it might be a good idea to tell iTunes not to copy everything to your Music folder. Alternatively, you can get Songbird.
  13. If your video resolution is still bad (1024×768 or worse) and you can’t set it higher, that probably means you don’t have the right video drivers. This can be confirmed by looking in the System Profiler. Get the latest NVInject and install it.
  14. If you have no sound (e.g. music won’t play in iTunes), you might need the AppleHDA patcher and the corresponding Linux codec dump (there is a link to some on the AppleHDA patcher page).
  15. When stuck, look on the OSXProject Wiki’s Hardware Compatibility List for your motherboard.

Alternative instructions.

  1. Buy a Mac.
  2. Enjoy???