|Tech Projects Notes|
This is my "cheat sheet" for my tech projects. My bookmarks and side notes were getting out of control so I made up this page. It is obviously very volatile.
My current development configuration: Arduino: WiShield 2.0 on an Arduino Mega Duemilanove, Nano, YellowJacket WiShield 1.0, USB Host Shield Gumstix: Fire COM on a Tobi board Pinto-TH board Gumstix OE builds: Ubuntu 9.10 (32-bit) on Parallels 5.0 on a 13" MacBook Pro Devices: Canon XSi and 20D, Logitech Quickcam Orbit AF, a Raymarine SeaTalk network
Arduino: arduino.cc, forum, interfacing
|[19 Feb 2010] My first project involves serving up
4 pages for a
Camera Controller/Intervalometer. The Duemilanove was getting a little tight on both Flash and
RAM space. I could probably fit *most* of the app in the 30K of the Duemilanove but the 126K of the Mega is sooo much nicer. Also I
was having odd problems (with strings) that seemed to disappear when I moved up to the Mega. AsyncLabs is offering
V2 of the WiShield
on their website with 16 Mbit of storage for web pages.|
[20 Feb 2010] I'm getting reasonable performance on the camera controller app by using AJAX programming techniques (ie. minimize the interaction with the server by using javscript in the browser to manage the GUI and then just exchange small asynchronous messages with the server. Keeping the message size within a single packet - about 300 bytes in the current configuration - helps). And hopefully I will also have the manifest-based browser page caching (when I get the outbound links to work from cached pages). The power usage should be a lot less using the Arduino vs the Gumstix. For one thing, the WiFi module on the WiShield is a lot cooler (probably sacrificing performance). The size and performance also seem acceptible.
|Programming: Lang Ref, Hello World, timers 1&3, timer 2, flash, AT45DB161D dataflash library, Spi Library, EEPROM|
|[19 Feb 2010] Programming the Arduino is very easy using the IDE.|
|USB Host Shield: the developer's blog, forum|
|[19 Feb 2010] I got the USB Host Shield in order to access the device I'm controlling using USB. For example, the camera and webcam have USB ports. I haven't tried it yet.|
|WiFi: WiShield 1.0 and 2.0, forums, WiShield 1.0 on a Mega Board including Pin 2, setup|
|[19 Feb 2010] I am using the WiShield 1.0 on the Arduino Mega.
I followed the instructions
(links above) to bend and jumper pins 2 and 10-13; and changed spi.h.
The suggestion about leaving the pins unbent and using "pinMode(n, INPUT)" didn't
seem to work for me.|
[21 Feb 2010] Ordered a WiShield 2.0. It should arrive on Wednesday. I should be able to fit my Camera Controller app on it with the Duemilanove, reducing the size a little and getting rid of the 5 extra jumper wires.
[25 Feb 2010] The WiShield 2.0 arrived. The WiFi worked fine serving up a HelloWorld webpage to my iPod. For the new dataflash chip, I tried this AT45DB161D dataflash library and it seemed to work OK when using Pin 10 (ie. switching the jumper on the WiShield to Pin 10 and leaving the
"#define SLAVESELECT 10" as it was in at45db161d.h). But the Asynclabs docs say that you can't use the WiFi together with the dataflash when using Pin 10. You have to use Pin 7 for Slave Select. This resulted in the code spinning in the spi_transfer() routine at the "while(!(SPSR & (1 << SPIF)));". Then I downloaded the the Spi Library and tried reading the status register over SPI from the dataflash chip. Low and behold, it worked with both pins 10 and 7. I then simply converted the original at45db161d.h and at45db161d.cpp to use the Spi Library. It was just a matter of including Spi.h in the files and doing a change-all of "spi_transfer" to "Spi.transfer". The author's test program now works without problems on both Pin 7 and Pin 10.
Gumstix: gumstix.net, forum, Setup & Programming
|Programming: Hello World|
|GPIO: GPIO Event Driver, User GPIO Driver, from user space / more, 1.8v to ...|
|[19 Feb 2010] I have a Fire COM with a Tobi board. The following will
toggle the red LED on the Tobi board:|
From the serial console window: echo 21 > /sys/class/gpio/export echo out > /sys/class/gpio/gpio21/direction echo 1 > /sys/class/gpio/gpio21/value echo 0 > /sys/class/gpio/gpio21/value
|Webserver (Boa): boa.org, error about gethostbyname|
|[19 Feb 2010] After building OE (per
these excellent instructions),
I found Boa in the build system's sources folder but it seemingly hadn't been built. To build it:
On the build system: cd ~overo-oe (or where ever your build lives) bitbake boa copy the boa .ipk to the gumstix Then on the gumstix: opkg install <the boa .ipk> edit /etc/boa/boa.conf to uncomment the ServerName line mkdir /var/www and copy your web content to it /etc/init.d/boa startPresently, I can serve up pages to my MacBook without problems. The Boa webserver seems to be very fast. But it is not yet working with the iPod.
|WiFi: Starting & stopping WiFi, Ad-hoc, reported problem on Air, the ad-hoc problem|
|[19 Feb 2010] Ad-hoc works for me on Fire with 201002051458 build
(but only the console build image, not desktop):
Set the wlan0 config in /etc/network/interfaces to auto wlan0 iface wlan0 inet static address 192.168.1.3 netmask 255.255.255.0 wireless-mode ad-hoc wireless-essid gumstixI think you can fry a (really small) egg on the surface of the WiFi module - it gets that hot. I plan to put a heat sink on it.
iPhone Explorer, File sharing
|[19 Feb 2010] I haven't gotten caching using a manifest file to work yet.
The pages cache. Ie. after clearing my browser's cache and then accessing my Camera Controller app,
I see the manifest file and the app's pages being loaded from the server on the first reference to the app's initial index.html page.
From that point on, the pages are not reloaded and the response time is nearly instantaneous as if it was a native iPod app
as I flip from page to page. But my links to the server
don't work. It's as if the browser is blocking fetches to the web from cached pages.
Removing caching (by simply removing the manifest file from the <html> tag) allows the links to work again.
This happens on both the iPod Safari browser and Firefox on my MacBook. This is pretty basic so I must be missing something.
Both relative (href="/tp/i/r.html" or href="./r.html") and absolute
(href="html://192.168.1.3/tp/i/r.html") links behave the same.
[21 Feb 2010] I had been using a 1g iPod Touch up until now. I just got a 3g, hoping to see a performance improvement and whether there might be a difference in the problem noted above. I see some improvement in performance (I'll show in my video). But no change with regard to the problem. One thing I note is that using Safari from the Home Screen (ie. clicking on the Safari icon in the Home Screen, then entering the URL in it's address bar) doesn't cache the pages at all. I see the page and the manifest file fetched from the server, but not the pages listed in the manifet file. So the links to the server work, but the hoped-for caching doesn't. Again, I'm probably missing something that will become obvious later. The overall speed of the 3g iPod is quite a bit faster and makes the purchase worth it IMO. Plus it is nicer to hold and the colors (especially blue) are much nicer. Easy to justify a new toy :-). It also induced me to download an iTunes U course - Stanford's iPhone Application Development (Winter 2010). Wow!
Java: 1.6.0 javadoc
|[19 Feb 2010] I used Java to write a utiity that strips out the white space (tabs, spaces, line feeds, and comments) from my app's html in order to shrink it down as much as possible to save on space and improve the transfer speed. This was pretty quick and painless. Only complaint is that Apple has apparently removed support for Java from the latest release of Xcode. Bummer.|
Mac OS X (as my development environment): Man Pages, Ref Library, Handy tutorial on sockets
|Serial terminal: Use 'screen' as a serial terminal emulator, Serial Communication in OSX Terminal|
|[19 Feb 2010] For the Gumstix,
open a Terminal window (Applications > Utilities > Terminal.app) ls /dev/tty.* (shows tty.usbserial-A700aBHw added when I plug in the Mega) screen /dev/tty.usbserial-A700aBHw 115200
OpenEmbedded: openembedded.org, building on various platforms, building OE for the Gumstix
|[19 Feb 2010] Maybe it's because I am on a slow network connection.. it took nearly a day to build OE on my MacBook.|
Ubuntu: download, Ubuntu on Macbook Pro
|[19 Feb 2010] This seems to be working OK. The only problem I had was in downloading the install image. I first tried a peer-to-peer download (I think they recommend it for speed and reliabiity). The file appeared to download OK (no errors seen), but trying to install it failed consistently midway through - something about an I/O error. I then downloaded the install image from Ubuntu's download page (clicking on the big green button) and it installed without problems.|
Virtual stuff: Parallels, virtualbox.org (Ubuntu on Mac using virtualbox), VMware
|[19 Feb 2010] I'm using Parallels. It seems to be working well. My only complaint is that the MacBook Pro's builtin SD card reader does not appear to be mounted as a device on Ubuntu (at least I couldn't find it). It is mounted under /media/psf/. So, instead of using the builtin SD card reader to format the microSD card, I got one of the USB-based microSD card readers - $10 for the Sandisk microSD reader from Staples. It mounts as /dev/sdb on Ubuntu and the partitions are then named /dev/sdb1 and /dev/sdb2 after formatting the card.|
Regarding the devices & circuits:
Arduino Intervalometer Basics|
AI-1 ("All-in-one") Remote
Digital Camera Hack
|Logitech Quickcam Orbit AF:|
|the Logitech Mac download page|
UVC Camera Control for Mac OS X
uvc_mac (UVC driver not based on Quicktime
How to control pan/tilt/zoom on Logitech cameras
UVC code specific to the Orbit webcam
"How to get 30 Frames Per Second with your Logitech Webcam"
USB in a Nutshell
To use the Logitech Quickcam Orbit AF (and get pan/tilt) on Ubuntu:
Follow: How to install the Webcam Tools (libwebcam, uvcdynctrl) on Ubuntu
then: Orbit AF: Pan/tilt Reset is missing from uvcdynctrl -c to install that xml file
then: sudo apt-get install luvcview
USB sniffing on linux (although the mounting & modprobe seem unnecessary)
then, for example to trace the Command Out records:
sudo cat /sys/kernel/debug/usb/usbmon/1u | grep Co
|[26 Feb 2010] UVC Camera Control for Mac OS X looks like a good starting point. His project builds and runs without too much fuss. Disabling the iSight camera on my MacBook appears to help - it prevents these simple sample programs from finding the iSight camera first and attempting to use it.|
Looks like a nice description of the interface|
|Sensors & circuits:|
Looks like a good introduction|
12v plus temperature sensor to Arduino
A voltage divider calculator, another
Resistor Color Code Table And Calculator
Op-amp as voltage follower
Parallax 555-28027 PIR Sensor (Datasheet)
Octopart - "a search engine for electronic parts"