Posted by Jim Morris
on Sat Oct 24 14:50:02 -0700 2009
In playing with my new Rovio I decided that my Old MS Sidewinder 3D
Pro Joystick would be an excellent way to control it, as it has the
twist which can rotate the Rovio, and the joystick up/left/down/right
can move the Rovio in those directions while still facing forward.
The problem is that the joystick has a game port connector, and my
Linux workstation does not have a game-port. After doing the obligatory
Googling I found
this Exactly what I
needed, except this was for Windows not Linux. Thinking I would have
to modify the code I contacted Grendel who graciously sent me the
source code for the project, however it turns out the code he wrote
was so good it works as is on Linux, I just needed to modprobe
sidewinder and it worked.
The project is based on a great little hackers device called a
Teensy a relatively cheap
general purpose programmable USB dev board. It has lots of
sample code showing it being a keyboard or mouse or serial port
etc. It is programmed in C using the avr-gcc toolchain. This is like a
Basic Stamp with USB, something I needed years ago but couldn't
find. Now I have one I forgot what I needed it for many years ago, but
it is in my arsenal now.
The only thing I needed to do, as I was on Ubuntu Hardy (8.04 LTS) and
not 8.10 or newer, was to build the avr-gcc toolchain myself. The one
included with Hardy did not recognize the atmel mmcu atmega32u4 type,
which is relatively new. This process is made much easier with a
script you can get from this
thread,
Note you need to register with the forum to see the download
links. The file you want is
build-avr-gcc-4.3.3-libc-1.6.7-insight6.8-arch25-fix.zip. Make sure you
read the first post of the thread and make sure you have all the
dependencies installed first according to the pre-reqs.txt file in the
download. (Especially the libmpfr-dev which I missed initially).
Anyway I prototyped the circuit using the photos provided in Grendels
post, and plugged it into a Windows XP system and it worked, then I
plugged it into my Linux box and dmesg told me it recognized the
joystick device..
[926661.299475] input,hidraw8: USB HID v1.11 Joystick [Detlef <Grendel> Mueller Microsoft SideWinder 3D Pro (USB)] on usb-0000:00:1d.7-4.3
I then downloaded jstest which is a simple joystick test program, and
all the degrees of freedom were recognized.
I wanted to make the proto more robust so I designed a PCB layout
using
ExpressPCB's
free PCB design and schematic tool (Windows based but runs fine under
Wine on Linux). These guys will make 3 off 3.8" x 2.5" PCBs
MiniBoard for
around $50, which is a get price if you can't make your own. However I
decided that for this one off project I'd just do a PCB prototype
instead, so I sent the PCB layout to Grendel as thanks for all his
hard work, in case he ever wants to go into production for this great
little project.
I got a
Schmartboard
board (around $5 from Fry's) and a Rt Angle female pcb mount 15 pin
DSub connector (.99c), and soldered the components and jumper
wires. The DSUB needed coaxing onto the board as I guess the pin
spacing is not the standard 0.01", however Shmartboard does have a
board
especially for dsub connectors, Fry's did not stock it though. I like
these Schmartboards, they are cheap and well built, through hole, and
you can even do surface mount if you have to. They are a lot better
quality than what you can get from Radio shack!

As a side note, as I am getting older and it has been 10 years since I
did any pcb soldering I found that my eyesight has deteriorated to the
point that I needed a magnifying lamp to do this work, and that my hand
is no longer as steady as it was, and that my old trusty Weller 35W
pro soldering iron was too hot and unwieldy, and I was making solder
bridges everywhere and melting the wire and connectors. (That did not
used to happen when I was younger ;) So I splashed out and got a nice
new
Hakko 936 soldering station,
with the 907 iron and a very fine soldering
tip and some
very fine solder. This made this go a lot smoother, although finding
the right temperature to use was hit and miss.
The last component was putting the finished product into a box. None
of the Radioshack boxes I had lying around would fit, so remembering
that I had great fun building an Acrylic box for my PC (which I
eventually ditched for a Silenced case), I made a little acrylic box
for the converter. A trip to Tap Plastics to get the adhesive was all
that was needed as I still had some Acrylic scraps laying around.
Anyway that was my project for this week. Next up writing the code to
control the Rovio with my Sidewinder 3D Pro. What Language to use??
Ruby, C++/Qt, Java, maybe learn a new one like Groovy? Hmmm what a
Dilemma.
Posted in
Linux,Embedded,Robotics
|
Tags
joystick,usb,soldering
|
no comments
Show
Posted by Jim Morris
on Wed Oct 21 01:32:16 -0700 2009
Around 10 years ago I was playing with some home robotics, built a
simple robot, with some sensors and an on-board Linux-based PC. The
purpose was to experiment with Robot AI, a continuation of my PhD
thesis I started on some 30 years ago, but did not complete.
The robot had a camera, a digital compass, a sonar scanner and a short
range IR range detector, plus some bump detectors. I could control
it over a wifi connection, that was a Orinoco PCMCIA board plugged
into the PC104, 586 based Linux PC that was on-board. All powered by
several batteries.
I ran out of time and interest and energy and shelved the project. 10
Years later I stumbled upon a relatively cheap camera, wifi based
robot called a
Rovio
made by Wowwee, its basically a toy, but a cool one. The Rovio has
much better manouverability than my feeble attempt, and it has a
camera and is controlled over Wifi by some well documented HTTP
calls.
I bought one of these gizmos to play with, and to "use" as a remote
security camera to check on the dogs when I am not home. It fired up
my Robot hobby enthusiasm, and as I have a lot of time on my hands
these days I dug out all my old stuff, which I had mostly forgotten,
and dusted off the old PC104 embedded system and tried to get it up
and running again. I'm not sure what I'll use it for but it was
pretty expensive back in the day, so I'll find some use for
it. Maybe I'll stick it on the Rovio to give it some more computing
power.
Anyway things have changed a lot since then, a PC104 is ISA based, and
this board had no USB ports, but I did have a PCMCIA slot, which was
5v 16 bit only. This posed a problem as all PCMCIA cards today are
Cardbus 3.3v and usually 32 bit. The only wifi card I had that was
5v was the old Lucent Orinoco 802.11b card. But my AP these days is
a WPA/WPA2 based 802.11b/g.
The first fun thing was to get wpa_supplicant running on this old
thing, if possible. I mentioned no USB because one workaround was to
use a newer wifi card, I also wanted to use some flash drives. But
this turns out to be impossible as no ISA/PC104 USB cards were ever
built (according to an extensive Google search).
The board has 32Mb of RAM, and that was fully loaded, it also ran
WhiteDwarf Linux out of a
32Mb disk-on-a-chip board that plugs into the IDE socket. The old
version of WDLINUX I had definitely would not run the newer Hermes
Linux drivers and wpa_supplicant. I found that Whitedwarf is still
in business and have a newer version of wdlinux2.2. This is a
Slackware based Dist, that fits in under 32Mb of Ram and Disk. But I
want to run Ruby on this thing, and probably Java, so I needed some
more room which meant swap space, and swap and flash drives don't go
well together, so I dug out a 4Gb Seagate Microdrive I bought at
Frys a few years back, which would do really nicely. However getting
it to work reliably turned out to be tricky. I grabbed the latest
version of wdlinux, and did some digging to find it seems to be
based on Slackware 8.1, which is important as you need more packages
to make it useful than wdlinux has, so installing from Slackware
makes things easier. They have an ISO so I installed the ISO in a
Vmware Workstation, so I could compile a new kernel and compile any
application on my workstation, and then tried to install it also on
the 4Gb microdrive. This worked eventually but it turns out the
microdrive likes to go to sleep every few seconds, (I guess to save
power when it is plugged into a camera or whatnot). This caused
Linux to get upset (the kernel version is 2.4.29). I saw a lot of
errors saying "no drq after write", this was caused by it going to
sleep, as I found if I did
> dd if=/dev/hda of=/dev/null`
in a separate terminal, it kept it awake. The long term workaround
was to execute
> hdparm -B255 /dev/hda
as soon as possible after boot, this turns off the power saving
mode. I put it in /etc/rc.d/rc.S which is the first thing to get
executed on startup. This error is more than annoying it corrupted
the disk more than once.
I ordered a compact flash to ide44 adapter and short 44pin f-f cable
so I could plug the microdrive into the ide connector on the board.
So now I had wdlinux 2.2 installed on a 4Gb microdrive on the PC104
board. Luckily 2.2 came with PCMCIA and associated tools already
built into the kernel, unfortunately the module for my particular
PCMCIA adapter board was not built, so I built a new kernel with
the relevant driver built as a module, and was able to get the
PCMCIA system up, plugging in the Orinoco card loaded the
orinoco_cs driver which would work fine if I was still using
WEP. After much Googling I found that the Orinoco which is a
Hermes-I based card, would apparently work with wpa_supplicant if
you upgraded the firmware and used a Linux driver released by Agere
(who have since been acquired and their web site dismantled)
Luckily I found the source online somewhere (Google for
wl_lkm_718_release.tar.gz), and built it. The driver is called
wlags49 and comes in a Hermes-I and Hermes-II flavors and for
pccarc and pci, also the firmware is downloaded and can be either
station or ap modes. After browsing through the source code they
provided (which BTW only works on 2.4.x kernels) I figured out how
to build it properly and also build the version of wpa_supplicant
and Hermes driver that came with it. (I saw that some people have
provided patches to make the code compile under 2.6.x kernels, but
that didn't help me too much).
Initially the driver didn't seem to work too well, iwlist eth1
scanning did not seem to return anything, and wpa_supplicant also
barfed when it tried to scan for AP's. A bit more digging and reading
the sparse docs, looked like I needed to do some configuration of the
module when it was loaded, rather than allow wpa_supplicant to do all
the configuration. They provide a way to configure the Agere based
chips with a /etc/agere/iwconfig-eth1 file. I set the SSID, the
download_firmware and the debugging flags, and it seemed to fix
everything. The wpa_supplicant.conf file was pretty sparse as it was
a really old version of wpa_supplicant they were using, but it was
enough to finally get a connection via WPA to my AP. Note WPA2 is not
supported.
Along the way I was looking for alternatives, like using a newer
PCMCIA card, I had a 3.3v newer card, but that wouldn't plug in to
the 5v adapter, and I couldn't find a 5v to 3.3 v adapter on the
market, which is odd as it is one chip to do it. I also couldn't
find many 5v wireless cards, although it looked like I could still
buy a Linksys WPC11 card so long as it was v1, v2 or v3, the new
ones are v4 and appear to be 3.3v only.
So things learned...
- There are no USB boards for ISA (or PC104) based PCs
- New PCMCIA cards are 3.3v and won't work on older PCMCIA adapters
(or Laptops)
- There are no converters that allow you to run a newer 3.3v PCMCIA
card in a 5v slot
- Orinoco cards can be made to work with WPA, but require newer
firmware and the Agere drivers.
- working with old H/W is a pain, but embedded boards such as PC104
are still using old technology, although PC104+ does have a PCI bus
which allows newer boards to be used
- Using a compact card microdrive to run Linux off of is possible but
you need to disable the power management in the drive
Now I finally have my old PC104 board running again with its wireless
card and talking WPA, I have to figure out what to do with it :)
My next project is to build a USB adapter for my old Microsoft
Sidewinder 3D Pro joystick, so I can use it on Linux to control my
Rovio. This has already been mostly
done but for
Windows. I am going to modify it to talk a serial protocol so I can
plug it into my Linux workstation.
Posted in
Linux,Embedded
|
Tags
linux,pc104,wpa_supplicant,microdrive
|
no comments
Show
Posted by Jim Morris
on Tue Jul 22 13:20:08 -0700 2008
Well I have had this thing for a few weeks now, and I have burned a lot
of hours playing with it :) (Wish I could bill someone for those
hours it would have paid for the phone 4 times over!)
I started with 2007.2 the built in image, and upgraded it initially
with dfu-util, then with opkg update && opkg upgrade.
I installed a bunch of things and tweaked it to death (literally).
I got Jalimo
java installed and working, and wrote the simple SWT app which worked nicely.
The only change to the instructions are you need to add
-force-depends to the opkg command.
As reported in my
other blog article
I got WIFI/WPA2 working, and finally got GPRS working.
I have not tried to pair with a bluetooth headset yet, although got
far enough to see that the device could be seen using the scan
command.
I played with all the varieties of on screen keyboards available, but
really couldn't use any of them as they are so small, and my eyes are
not that good anymore. I have seen some promising mentions of works in
progress for keyboards, but the ones in the Qtopia distribution are
the best, plus they have handwriting recognition which is a little
fussy but looks like it can be trained.
The GPS problems were fixed by an amazing community and OpenMoko
effort, which I have never seen before. There is a S/W fix, and a H/W
fix which I suspect most people will not be able to do, soldering
surface mount components is not for the faint of heart!
I spent several hours trying to build the OpenEmbedded and
the MokoMakefile development environments, so I could start to
contribute, but have still not been able to get them to finish
building the native toolchain needed to build any of the apps.
I get several errors, some of which I found workarounds to by googling
but eventually hit dead ends in both cases which I could not solve and
have not been reported or solved by the community. I am using a stock
KUbuntu 8.08 Hardy Heron desktop, which should be pretty mainstream,
so I don't know what is wrong. The pre built toolchain OpenMoko
provides for building apps does work however, but you can't build
soft keyboards, or system components that route (at least I couldn't
find a way to do it). I'll continue to hammer away at MokoMakefile and
see if I can eventually get it going, of course I'll post my findings
to the Wiki or dev mailing list if I succeed.
If someone could provide a VMPlayer image of a working OE or
Mokomakefile environment that would help a lot of us.
(Trolltech/Qtopia do provide exactly that for their development
tools).
So after several opkg upgrades and tweaks, I finally killed my highly
customized rootfs, X would no longer boot, sound was dead etc etc.
I tried to backup the image using
these instructions,
but always got an error halfway through, I suspect my flash image of
rootfs may have been corrupted. Anyway I lost all that work :(
I tried flashing ASU, but it seems too much a work in progress more so
than 2007.8.
Then I tried
Qtopia
now this is much more to my liking. The interface is clean, intuitive
and seems to work pretty well. There are still a few rough edges which
Trolltech seem to be taking care of, but it mostly works pretty well. The
on screen input methods (which there are several of) are very good,
even the keyboard has a nice touch where it zooms into the keys you
are touching. It also has the tiny tiny QWERTY keyboard if you prefer
that style and your eyes still work.
The downside is of course you lose access to all the applications
currently under development for the GTK based 2007.2, but Qtopia does
have a growing number of applications, and of course you can write
your own.
I am going to experiment a little with trying to run GTK based apps
under Qtopia, I know I can do that on my KDE (aka QT) desktop, so why
not under Qtopia? I'll update this if I get it to work.
UPDATE Oh ok the reason you can't do that is that Qtopia is not
running X Windows, so running GTK is not an option, bummer. I suppose you
could render GTK into a QT canvas or something but that is more work
than I am prepared to do at the moment.
The current show stoppers for me, which stops me being able to use
this a phone are...
- Nasty buzzing noise on both ends of the call
- Bluetooth pairing with a headset not easily available.
I'm sure people are working on these issues, and I wait patiently for
them to get fixed so I can dump my aging Motorola V600. I'd actually
try to pitch in myself but I can't get the development environment to
work!
Oh well guess I better get back to my paying job :)
Posted in
Openmoko,Linux
|
Tags
openmoko,freerunner
|
5 comments
Show
Posted by Jim Morris
on Sun Jul 13 04:32:03 -0700 2008
I did my duty and upgraded from Gutsy to Hardy, after letting Hardy settle for a while.
For the most part it was painless (unlike the last upgrade to Gutsy!).
Unfortunately the sound was now broken I have a HDA-Intel AD198x Analog chip set.
Then I discovered (just when I needed it of course) that my Samsung
ML-2010 USB printer didn't print anymore.
I would get this weird error...
Unable to open device hal:///org/freedesktop/Hal/devices/...
After Googling I found this, he was
half right, I don't know why but it works, except that I needed to do...
sudo chmod 700 /usr/lib/cups/backend/usb
sudo chmod 700 /usr/lib/cups/backend/hal
sudo killall -HUP cupsd
sudo /etc/init.d/cupsys restart
ie both usb and hal.
That fixed it... Amazing!
Now why won't my audio work???
Ok now it does work, go figure. The only things I changed were added this to /etc/modprobe.d/alsa-base
options snd-hda-intel model=3stack-dig
and made sure that Front was checked in the mixer and turned up.
Not sure which of those fixed it though.
Posted in
Linux
|
Tags
ubuntu,hardy,cups
|
5 comments
Show