Tuesday, July 31, 2012

Raspberry PI Arduino Shield - Cheap Option

I have a project on the go which I call Project Doorman aka Carlton. It will involve a Raspberry PI, I2C connections controlling a 1-Wire controller which will be connected to a DS2408 switch. I will use an iButton ID keyfob and sensor i got from http://www.homechip.com a few years ago. So, keybob, open the door and Bob's your auntie.

I wanted to have as much of the electronics mounted on the RPI. I have a Slice of PI by ciseco.co.uk but the prototyping space is too small.

I was also looking at the Adafruit Prototyping Pi Plate Kit for Raspberry Pi but that would cost €20 landed. I was going use it, so all the fancy connectors etc., would end up not being used. Feck that, I said. I know the bits would be used on other projects. A penny saved is a penny to squander.

I read about a fella who was talking about using an Arduino Prototyping Shield on the RPI. That sparked an idea.

In my previous researching/playing with Arduinos, I got Budget Proto Shield (x3) from Oomlaut.com. I had one I hadn't used.

So I desoldered the headers, and soldered one on the other way.

Presto Chango, I had a Cheapo Raspberry PI Prototyping Shield/Plate


Here is the Protoshield attached.

it only uses a single line header, which provides access to the I2C pins (3 & 5). I also get 3.3V on pin 1. I will also need access to the 5V pin (2) and Ground pin (6). I probably will put a small header piece to accomodate this and solder some pieces of wire and connect it to the Shield. I don't care really, whatever works.

It is a nice size and definately has the real estate I need.

From the side. I used the space to have it fit on top of the other bits of hardware, in this case, the composite video connector. Everything has to be nice, after all.


Kist the header from different angles.



Here we have the major components that will be used for this project. The red guy is a Logic Level Converter I got from CoolComponents.co.uk. Very cheap and useful. It ensures that I only have 3.3V connecting to the RPI.

The next girl is the Dallas DS2482-800 the I2C 8 Channel 1-Wire Master Controller. I used the Tirna SMT SMD DIL adaptor SOIC 16 PIN NARROW  to mount the DS2482-800. Very Handy and fairly cheap.

The final good buddy is a Dallas  DS2408 a 8 Channel 1-Wire Adressable Switch. Very handy. Again I used the Tirna adapter.

That is about it. I will probably reorganise the layout to facilitate adding extra components. I might add a couple of light sensors, while I am at it.

So, what are the benefits? Cheap and Useful. I don't really need a prototyping board. It is going strainght into production.

Sunday, July 29, 2012

Arch Linux Raspberry PI Wirelss USB Edimax EW-7811Um

I got an Edimax EW-7811Um a few days ago on eBay from Peats, actually. Nice, really small. Just what I wanted for a wireless project I have for the Raspberry PI (RPI) running Arch Linux.

I had a wrestle with it for a few hours, trying to get it working.

I was able to get it working using a number of different sources.

Here all the sources are combined into one Recipe, that works.

I have two RPIs and used this method to configure the card on the second RPI, after the first one was working. so I know it works

I started with a fully upto date OS, e.g. pacman -Syu will do this.


The life saver link was Edimax EW-7811Un USB-Wifi adapter.

Here is what I did:

Download and compile the drivers
 
1. wget http://myplugbox.com/rtl8188C_8192C_usb_linux_v3.4.3_4369.20120622.tar.gz

Get the driver

2. tar xzf rtl8188C_8192C_usb_linux_v3.4.3_4369.20120622.tar.gz

Extract the doings

3. cd rtl8188C_8192C_usb_linux_v3.4.3_4369.20120622

Change to the directory

4. nano Makefile

Change KVER to what the current version is. It's currently set to: KVER := 3.1.9-31-ARCH+

I changed mine to 3.1.9-33-ARCH+

If in doubt use 'uname -a' to get the current kernel version.

5. make

This compiles the driver and takes about 10+ minutes

6. cp 8192cu.ko /usr/lib/modules/extramodules-3.1.9--raspberrypi/

Copy the new driver to a place that will be used to load it.

7. depmod -a

This wil find the new modules and write them to a file called something. I don't care.

8. sync ; reboot

9. Log back in and run lsmod

You should see the '8192cu' listed

So far, so good.

Now to configure for automatic loading of the driver and settings.

10. nano /etc/rc.conf and modify the line

MODULES=(8192cu !rtl8192cu)

This stops the rtl8192cu module that does not work for the USB Device and loads the 8192cu

11. nano /etc/rc.local

This makes sure that the required  programs are run at boot time.

#!/bin/bash
#
# /etc/rc.local: Local multi-user startup script.
#
wpa_supplicant -B -c /etc/wpa_supplicant/wpa_supplicant_special.conf -i wlan0
ifconfig wlan0 192.168.22.132 255.255.255.0
route add default gw 192.168.22.1

12. nano /etc/wpa_supplicant/wpa_supplicant_special.conf

This is all that is needed for wpa_supplicant. The other default settings are OK, I think.

# WPA-Personal(PSK) with TKIP and enforcement for frequent PTK rekeying
network={
        ssid="ESSIDtoUse"
        proto=WPA
        key_mgmt=WPA-PSK
        pairwise=TKIP
        group=TKIP
        psk="secret agent password in clear text or Hex"
        wpa_ptk_rekey=600
}

So far so good again.

13. sync ; reboot

14. Log back in

It might take a few minutes longer to login, as there are two network connection and the RPI may be getting confused.

If you run 'ifconfig', you should see the wlan0 card listed.

15. nano /etc/rc.conf

Comment out the Ethernet settings, so that the wire connection is no longer used.

#interface=eth0
#address=192.168.22.130
#netmask=255.255.255.0
#broadcast=192.168.22.255
#gateway=192.168.22.1

16. sync ; reboot

17. Log back in using the new Wireless IP Address.

Job done. Time for a beer and a quiet smirk.

Wednesday, July 25, 2012

PogoPlug Cheap Deal and Hack

I recently signed up for a PogoPlug Family Backup Offer . It cost €24 in total.

The best thing is that you get a free PogoPlug Pro.

Being a big embedded Linux fan, I was eager to find out if this was one of the hackable devices. It was a cheap price to pay, to find out if it was useful.

It arrived on Friday. The first thing I dis was to crack it open. That was even before I powered it up. I am that sort of guy.





It turns out that it is Model: PogoPlug Pro FCC ID: VUIPOGOPLUG. The one with the Grey/White Symbol on the front. It turns out that it is a hackable device, see Link.

I wanted the smallest USB drive I could get. I went to Power City and got an 8GB drive by someone or other. Picture here:



So, I horsed over to http://archlinuxarm.org/platforms/armv6/pogoplug-provideov3 and followed the recipe to install Arch Linux on the device. It worked like a charm.

Another Arch Linux box joins the Empire.



It has some wireless card and a SATA port and of course a Gigibit Ethernet port. Ultra cool to build some sort of data/file server or anything really.

I think I will investigate the possibility of connecting an SATA drive to it and use for centralized MyDocuments and Photographs.

Only the Windows client can take advantage of independent storage on the PogoPlug cloud. I may incorporate that into a general offloading plan. We will see.

The best thing is 'Cheap PlugComputer' and benefits that could be used.

Win. Win. Win.

Thursday, July 5, 2012

Raspberry PI 1-Wire I2C OWFS

I wrote this a few weeks ago and forgot to post it.

I received a Raspberry PI recently. It looks great, nice and small.

I have been playing with PlugComputers, such as the SheevaPlug and the Seagate Goflex series for a few years. They form the basis of my low power computer systems that are on 24x7. The Raspberry PI is just like one of them but with a few extra facilities.

Getting up and running was a breeze. I simply downloaded the image, by bittorrent, if I remember correctly. It only took a few minutes.

I blew it onto an SD card and powered it up. Hey Presto! it worked. I was able to determine it's IP address and ssh in to have a look around. Perfect.

I didn't have a HDMI cable to hand, so I used a composite cable to connect it to the TV. It worked but the quality was not the best. Moved on.

I was wondering what to use the PI for. I still don't know.

I came across an article talking about using the PI with OWFS. http://raspberrypi.homelabs.org.uk/


OWFS stands for One Wire File System. 1-Wire is a technology developed by Dallas Semiconductor (Maxim-IC), that actually uses 2 wires to communicate with devices such as temperature sensors, switches, voltage detectors, a/d converters and so on. I use it extensively throughout the house to measure temperature and control things. One of the great things about the 1-Wire devices is that they are pretty cheap.

On the Raspberry PI, there are a number of input/output pins. The ones of interest in relation to 1-Wire stuff are the I2C pins. I2C is basically a serial protocol. It is the building blocks that USB and SATA are built on.

The good thing is that Maxim-IC make a number of I2C to 1-Wire controllers. These are the DS2482 and DS2483. There are probably others also.

So, the possibility to connect the chips directly to the PI was real.

I was able to acquire a couple of DS2482s from a friend of mine. I had to mount them on a 16 way SOIC to DIP converter.

The OWFS system was easily compiled from source on the Raspberry PI and installed.

I then began the search for the I2C drivers.

This was a hard one. I found many forums that resulted in a dead end. Many kernels were compiled and failed. I couldn't get/build a kernel that would work with the drivers installed.

I found a fella that had a pre-built kernel built for Debian. I use Arch, which is pretty different in it's config, even though it is Linux.Here is the link I used http://www.bootc.net/projects/raspberry-pi-kernel/ I also installed the latest firmware.

Anyhoo, I was able to install the new kernel and modules and boot a workable system. Cool.

All the quick checks were good.

I then wired up the chips, DS2482, and started  the main program owserver. Hey presto, it worked.

I wired a couple of DS18B20's and could see them and read temperatures. Success.

I love this embedded Linux crap.

Raspberry PI Stuff and Building a Case

My Raspberry PI arrived a few weeks ago.

I tried both the Debian and Arch Linux boot images.

I don't have a convenient HDMI TV to play with, so I settled on the Arch version.

It suites me better, as I really wanted to use it as another Plug Computer, to do something with.

What to do with it? I am not sure yet. There will probably be something Home Automation related.

I am a big fan of the 1-Wire technology, for temperature sensors and control, so I compiled the latest version of OWFS on it. It worked fine with the USB 1-Wire controller.

The RPi has an I2C interface, so I decided to get my hands on a couple of  DS2482-100s and DS2482-800s. These are I2C to 1-Wire controllers. After a bit of messing about, I was able to address the conrolllers using OWFS.

That will be a furure post, hopefully.

I was looking for a suitable plastic case fir the new toy. There are quite a few about and rather pricy for what they are. I liked the one on SKPANG. Including postage and VAT, it would come in at about €20.  As my friend Ber would say 'Balzac' to that.

I came accross a post by Pecker Dunne on raspberrypi.org http://www.raspberrypi.org/phpBB3/viewtopic.php?f=40&t=9165&e=0

I was able to get a small sheet of perspex. Using youtube, I was able to determine that the 'score and snap' method was the best and cleanest way to get the pieces I wanted.

I made a few attempts. Two sheets of perspex and some No4 screws and nuts. I got some plastic washers to hold the board. It was just the job.






Attempt 2. In the presious version, I had put the screws too close to the IO header.



I also decided to make a breadboard version of it, to add breadboards and a USB hub.

I found that 3 screws would hold the RPi quite tightly and was easier to position the top piece.




Add a 10 port powered USB Hub


Some Breadboards
 

A Nanode and Xino Basic Arduinos for completeness.


I plan to use the slim breadboard for connections from the RPi headers and the larger one for the various components.

I sized the main plate, based on a plastic box with cover I have. Everything fits in and can be safely stored between project activity.

The next investigation will involve the Ciseco Slice of PI and the XRF radio module.