Documentation

Joe Armstrong, father of Erlang and programmer extraordinaire, came up with this highly accurate diagnosis of the phases in project documentation on [erlang-questions] a couple of days ago:

I think it works like this:

1) first you don’t understand how the X works (X=Beam, JVM, X11,
… you name it)
2) You struggle – and think – google and have a hot bath
3) Eureka – bath flows over
4) Now you can understand it – and you can also remember why you
could not understand it
5) Now it’s easy you understand it
6) You see no reason to document it since it’s obvious

Round about 4) there is a small window of opportunity to explain to
other people how it works.

Once you get to 6) it’s very difficult to remember what it felt like
at point 2) and consequently difficult to write decent documentation.
/Joe

So true!

Posted in Posts | Tagged , | 1 Comment

Introducing Ponte: Arduino – Raspberry Pi Bridge

(This is a collaboration between myself and my friend and purveyor of fine electronic bits, S.K. Pang)

How would you connect an Arduino to a Raspberry Pi? Just plug it in via USB as you would normally do with an ordinary computer, right? That takes up one of the precious USB ports and while you can use a hub, that takes up more space than the beautifully minimal ‘Pi and just looks ugly. Not a deal breaker per se, but still, unpleasant.

Why would you connect an Arduino to a Raspberry Pi? You probably want to use a shield or two to add extra functionality to your ‘Pi, and really, in this scenario the Arduino is just acting as a proxy between the shield and the ‘Pi. I find this a bit superfluous as the ‘Pi itself has pins and peripherals that can act as their Arduino counterparts.

What makes Arduino great is the ecosystem around it — the countless number of people working on projects, answering questions, writing code and developing shields for it. These all take time and I am sure the ‘Pi community will be as vibrant as the Arduino one as more people receive their units but can we somehow link these two together for extra awesomeness?

Introducing Ponte, our (currently experimental) design that aims to be the “bridge” between the Arduino and Raspberry Pi hardware. It serves two purposes: You can either plug it into an Arduino to link it to your ‘Pi or you can use it to connect Arduino shields to your ‘Pi.

The first case is useful for times when you want to use Arduino to simulate certain things, say for instance creating a behavioural model of another part of the system you are developing and the second case is simply for when you want to extend the functionality of the ‘Pi with add-on Arduino shields. (If you haven’t seen it already, check out Shield List and prepare to be amazed as you browse through nearly 300 existing shields!)

The idea is simple, consequently the circuit itself is not very complicated. With some clever software hackery, we should even be able to use existing Arduino sketches on the Raspberry Pi.  There is promising start for that here. (I was actually going to implement this myself but there is no need to reinvent the wheel I suppose)

For those of you interested, here is the current version of the design:

Schematic:

Layout:

(click thumbnail, receive larger image )

The design files will be released as open source hardware once we are happy with our prototypes but in the meantime we are looking forward to your comments and suggestions. It is 2012, so this is pretty much an RFC in the form of a blog post ;)

Spot any embarrassingly fundamental errors? Should we have picked a better ADC? Do you think the clever power selection/prioritisation bit is actually not that clever? Let us know before we send the gerbers off to the fab next week!

(Probably unnecessary but sort of a ‘just-in-case’ legal bit: Arduino and Raspberry Pi are registered trademarks and this site is not associated with them, so yeah.)

Posted in Posts | Tagged , , , , , , | 34 Comments

Setting up Wifi under Debian on Raspberry Pi

(These instructions are for the debian6-13-04-2012 image but they should be applicable to later versions as well. YMMV)

Step 1 – Edit your APT Sources

Before we start, you should edit /etc/apt/sources.list and include the ‘non-free’ section of the repositories since firmware blobs for wireless adapters are usually ‘non-free’:

$ sudo nano /etc/apt/sources.list

Change:

deb http://ftp.uk.debian.org/debian/ squeeze main

to

deb http://ftp.uk.debian.org/debian/ squeeze main non-free

and issue:

$ sudo apt-get update

to refresh the package database.

 

Step 2 – Figure out which chipset you have

Now, plug your USB wifi adapter to one of the ports and issue: lsusb. You should see something along the lines of:

$ lsusb

...
Bus 001 Device 004: ID 0ace:1215 ZyDAS ZD1211B 802.11g
...

Okay, it looks like the chipset we have here is ‘zd1211′ (Have a look at http://wiki.debian.org/WiFi for a list of supported chipsets)

Let’s see if there are any firmware packages we can install to get this up and running:

$ apt-cache search zd1211

zd1211-firmware - Firmware images for the zd1211rw wireless driver

Sweet, let’s install that:

$ sudo apt-get install zd1211-firmware

We should be good to go now. Unplug the adapter, plug it back in again and have a look at the output of lsmod:

$ lsmod

Module   Size   Used by
arc      4764   2
zd1211rw 40444  0
mac80211 171628 1 zd1211rw
cfg80211 123084 2 zd1211rw,mac80211
fuse     49036  1

You should see mention of zd1211.

dmesg should also give you an indication whether things are loaded or not:

$ dmesg

...
usb 1-1.2: new high speed USB device number 4 using dwc_otg
usb 1-1.2: New USB device found, idVendor=0ace, idProduct=1215
usb 1-1.2: New USB device strings: Mfr=16, Product=32, SerialNumber=0
usb 1-1.2: Product: USB2.0 WLAN
usb 1-1.2: Manufacturer: ZyDAS
cfg80211: Calling CRDA to update world regulatory domain
usb 1-1.2: reset high speed USB device number 4 using dwc_otg
ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
zd1211rw 1-1.2:1.0: phy0
usbcore: registered new interface driver zd1211rw
zd1211rw 1-1.2:1.0: firmware version 4725
zd1211rw 1-1.2:1.0: zd1211b chip 0ace:1215 v4810 high 00-1a-ee UW2453_RF pa0 -7---
...

Awesome, looks like the adapter is up and running! To see which networks are available, do:

$ iwlist wlan0 scan

…which should give you a list of wireless networks around you.

 

Step 3 – Configure adapter and WPA settings

One final bit left to do now: configuring our adapter. Before that though, we should make sure that you have wpasupplicant package installed since you’ll probably want to connect to a WPA secured network:

$ sudo apt-get install wpasupplicant

After that’s done, create a configuration file for it:

$ sudo nano /etc/wpa.conf

network={
ssid="YOUR-SSID"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk="WPA-PASSWORD"
}

And reference this in /etc/network/interfaces:

$ sudo nano /etc/network/interfaces

# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.

auto lo

iface lo inet loopback
iface eth0 inet dhcp

auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa.conf

 

Step 4 – Conclusion

Restart your networking subsystem with:

$ sudo /etc/init.d/networking restart

If you have DHCP enabled on your network, you should see something along the lines of:

Reconfiguring network interfaces...Internet Systems Consortium DHCP Client 4.1.1-P1
Copyright 2004-2010 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlan0/00:1a:ee:00:b4:12
Sending on LPF/wlan0/00:1a:ee:00:b4:12
Sending on Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7
DHCPOFFER from 192.168.0.1
DHCPREQUEST on wlan0 to 255.255.255.255 port 67
DHCPACK from 192.168.0.1
bound to 192.168.0.103 -- renewal in 40349 seconds.
done.

(If not, you will have to edit /etc/network/interfaces and manually specify your IP address/gateway etc.)

You can also issue dmesg again to see what’s happening under the hood:

$ dmesg

...
wlan0: authenticate with 00:26:f2:3f:XX:XX (try 1)
wlan0: authenticated
wlan0: associate with 00:26:f2:3f:XX:XX (try 1)
wlan0: RX AssocResp from 00:26:f2:3f:XX:XX (capab=0x431 status=0 aid=3)
wlan0: associated

Which means you should now be connected!

If it doesn’t work, well, have you tried turning it off and on again? :)

Posted in Posts | Tagged , , | 32 Comments

“Not dead, just writing up.”

That’s a phrase I’ve used far too many times in the past few months.

Here’s what I’ve been up to, other than staring at my computer screen for ridiculously long periods of time:

Next month should be fun, I feel festive already! (I think this might have something to do with it)

Posted in Posts | Tagged , , , | Leave a comment

SolderPad is here!

This is a quick post to spread the news on the arrival of SolderPad, a hosting/collaboration site for open source hardware projects, from the good folks behind OSHUG.

The official blurb from the website is:

SolderPad is a place to share, discover and collaborate on electronics projects. It offers free git hosting for Open Source Hardware projects.

Our aim is to simplify the process of publishing electronic projects and to improve the state of the art in collaboration in electronics by raising the visibility of designs.

The site lets you create git repositories for open source hardware projects and there is a useful schematic/board viewer as well as a (JSON based) BOM list embedded on the project pages.

Have a look here for the project page of arguably the most famous OSHW project, the Arduino Uno, as an example.

I guess it wouldn’t be far fetched to call SolderPad the hardware centric cousin of GitHub, which is a very welcome addition to the OSHW ecosystem.

Andrew and Paul did an amazing job with the site and from what I hear, they are not done yet! Keep an eye out for updates on the site and the SolderPad twitter account.

If you have an open source hardware project, do join in the party and upload it to SolderPad!

Posted in Posts | Tagged | Leave a comment