Sunday, 30 December 2012


For the isNight() function of the Arduino intervalometer and datalogger an approximate sunset and sunrise is taken for each month  - stored as ints in two arrays sunrise[12] and sunset[12].

Estimates will be based on the NAOO spreadsheet available from;

the rest of the program is heavily influenced by the adafruit temp/light 'fridgelogger'

I've added a function for taking photos - but it isn't much more involved than blinking two LEDs. Ultimately one of these pins will turn on the  GoPro (pull pin 30 low) and the other will drive the IR LED. Obviously I've also added the onewire and ds2348 libraries instead of using the analog pins.

Monday, 24 December 2012

Arduino 1-wire Datalogger

Playing with bits of wire.

SD card and RTC tested.

probably will use Lady Ada's fridge logger and SD/RTC test sketches as a template;

combining the RTC and SD examples to test the board have got me pretty close to it already;

That all works. Need some data.

One wire example picks up the DS1820 easily enough, need to look at humidity.

This looks promising;

Some notes on it here, (may not be relevant),49368.0.html

This looks like Arduino 1 code,  replace #include "WConstants.h" with #include "Arduino.h". That's just something I read here;

This does something too...

yet another link... sht15 more accurate than HIH4013?

Friday, 14 December 2012

go pro notes

bus pinouts

pin 12 for time lapse

thanks to this site I got the name of the DD1P030MA1 connector;|Telephone_and_Telecom-_-DD1P030MA1

IR board lens

another arduino link

Wednesday, 5 December 2012

some Arduino links


SD cards

1 Wire


Time Lapse


Tuesday, 4 December 2012

bufo duplo


I've been using these in tests so far;

Infrared T-1 LED 880nm 130° SFH487P

RS 654-8334

Note Anode (+ve) is the SHORT LEG!
Vf = 1.5V
If= 100mA

six of them light the test tunnel area quite well, at 100mA they are taking almost as much power as my camera - but sensible options all seem to be coming in around this value.

Infra-Red 850nm LED Star 950mW "Golden Dragon"

RS 736-2358

The Golden Dragon LED may be too powerful for lighting a 50cm tunnel, and even present a possible hazard... As 'IR illumination for cameras' is second on the list of applications to 'surveillance systems' I assume the H&S warnings pertain to 5A burst mode - I'll need to check this before I deploy one, but I'm picking up one to test.

Vishay LED IrLED 940nm PLCC  

RS 710-4944

another wide beam IR LED with a reasonable output. Wavelength higher than the 880nm LED above, but SMT package less friendly

Vf = 1.35V
If = 100mA

Looking at current draw v performance, i'm going to stick with  RS 654-8334. (All my notes are still in the loft where I tested them.)

For a rainy day;
I'm thinking I could try and knock the voltage down for the dragon with a switch mode regulator and not have to burn so much power off, but if the LED's i have are good enough it might not be worth it. 

notes on time lapse method

Fig 1 - Bufocam 001 - The camera input is currently taking a video feed from my media player.

I'm drawing a line under ARM processors for now as the funding is here and moving forward with the working Vivotek device and independent temp/humidity loggers. The massive tuffbox full of lead acid batteries is unattractive, so now Plan A is in the bag with off the shelf parts and a correspondingly short lead time. I'm looking at another option that as been on the back burner.

Time lapse recording in the trail cameras I've looked at (bushnell / reconyx) is limited to 1 frame a minute. Looking at work in Canada and mean amphibian velocities (Hels 2001) it is know that this frequency is too slow, certainly for Rana temporaria! The Bushnell I have would also be a really shit choice of camera to put in a tunnel.

A system that can capture images every 10/20/30 seconds is going to need a bit more work;

I like the image of time lapse with PIC, (for battery consumption), but as it's already been done with Arduino it would seem sensible to go with what's out there. Either way it just seems like a matter of physically switching the shutter button;

Stripping the IR cut filter is another well trodden path;

 Getting the images out of the camera while leaving it in situ relies on it behaving like a USB storage device - and no settings would need to be adjusted - ie 'PC mode'. maybe the intervalometer needs to be disabled during this task.

Then tie all this in with an SD card and 1-wire libraries... see earlier post.

Camera requirements that I can think of...

silent(ish) and no focussing lights
wakes up ready to take photos with last settings.
takes a 32gb SD card
IR moddable
behaves as USB storage device
wide angle lens - or will take adaptor
decent sensor - low noise in low light

Reviewing the time-lapse images doesn't seem so bad once they are compiled as a movie. I've had some success running a time-lapse movie through motion detection too, (which is why the prototype bufocam is plugged into my media player). The smart solution will be something like a simplecv script I guess - for now watching it through seems ok.

All i need now is an Arduino and a compact camera to hack apart. Any donors out there please get in touch....

Thursday, 22 November 2012

Vivotek 8102

Having a look at the Vivotek video server with local SD storage. Pictures are ok... need to set up my test tunnel before testing the sensitivity.

Sunday, 18 November 2012

Ardiuno data logger?

Random thoughts..

As I run out of time, I'm thinking of dropping the USB capture devices - but I won't have time to develop a solution without one. (I believe something like run ridge SDK on the leopard board and a video capture module is going to take me too long.) For this year a video server is looking more feasible - but it leaves the 1-wire data logging high and dry.

So a Vivotek 8102 is on it's way for testing - "just in case".

Running an addition arm board for the 1wire is overkill and battery intensive.

At a glance standalone dataloggers are a +£50ea
good ones, (Tiny tag),  +£100ea

Thinking about alternative remote 1-wire for less power consumption than an ARM board...

Ardiuno plus data logger shield (SD card + real time clock + 1 wire interface)

Given that there is already a datalogger sketch written for this, it's really tempting... but if we only need one logger per tunnel, and one exterior logger; is it worth it? Probably not... but at £30 for the base unit and £12 a sensor it might be worth a look at.

See also the SDcard libraries in this arduino weather station;

Sunday, 11 November 2012

OLinuxino IMX233 Maxi

Looking around for help building the IMX233 kernel with em28xx/easycap/w1 et al....

Found some stuff...

git clone --depth=1 git:// linux-2.6-imx

Olinuxino patches:
git clone --depth=1 git:// alarm

Also you will need to build the boot code (imx-bootlets), the build script at top will does it for you.

Here is the offical alarm kernel build "script": 

what about 3.6 kernel?

Read some friendly manuals

Finally I ended up here;

I think at some point a prebuilt 3.x image will turn up for idiots like me, meanwhile...

(take note that the readme begins with 'don't use these instructions...')

git clone git://
cd archlinuxarm-olinuxino/olinuxino/kernel26-olinuxino/
nano PKGBUILD <- uncomment 'make menuconfig'

get any missing dependencies...
pacman -S docbook-xsl xmlto
makepkg --asroot

later, next day...
some error about building ds2751 stuff.

  CC [M]  drivers/w1/slaves/w1_ds2751.o
drivers/w1/slaves/w1_ds2751.c: In function ‘w1_f51_read_bin’:
drivers/w1/slaves/w1_ds2751.c:112:2: error: expected ‘;’ before ‘if’
drivers/w1/slaves/w1_ds2751.c: At top level:
drivers/w1/slaves/w1_ds2751.c:258:2: warning: initialization from incompatible pointer type [enabled by default]
drivers/w1/slaves/w1_ds2751.c:258:2: warning: (near initialization for ‘’) [enabled by default]
drivers/w1/slaves/w1_ds2751.c:259:2: warning: initialization from incompatible pointer type [enabled by default]
drivers/w1/slaves/w1_ds2751.c:259:2: warning: (near initialization for ‘w1_f51_bin_attr.write’) [enabled by default]
make[3]: *** [drivers/w1/slaves/w1_ds2751.o] Error 1
make[2]: *** [drivers/w1/slaves] Error 2
make[1]: *** [drivers/w1] Error 2
make: *** [drivers] Error 2
==> ERROR: A failure occurred in build().

Trying again without ds2751 stuff... I don't think my humidity sensor is using that one anyway.
(2438 and temp and the em28xx)

Try and do the em28xx patch...


put patch and md5sum in the PKGBUILD
do not pass GO, do not collect £200.

 makepkg --asroot

Failed again - got as far as depmod...
DEPMOD  2.6.35-4-OLinuXino-ARCH+
ERROR: could not open directory /home/archlinuxarm-olinuxino/olinuxino/kernel26-olinuxino/pkg/kernel26-olinuxino/usr/lib/modules/2.6.35-4-OLinuXino-ARCH+: No such file or directory
FATAL: could not search modules: No such file or directory
make: *** [_modinst_post] Error 1

as per the warning; 'Warning: you may need to install module-init-tools'

pacman -S module-init-tools

just for fun...

 makepkg --asroot

==> Finished making: kernel26 (Tue Nov 13 06:24:02 CST 2012)


need to install bootlets and elf

cd ../imx-bootlets-olinuxino
makepkg --asroot
pacman -U imx-bootlets-olinuxino-10.12.01-1-arm.pkg.tar.xz

cd ../elftosb
makepkg --asroot
pacman -U elftosb-10.12.01-1-arm.pkg.tar.xz

now back to the kernel

cd ../kernel26-olinuxino
pacman -U kernel26-olinuxino-

answer the scary questions


low and behold - pictures!
my kworld USB2800 (em28xx) is showing pictures with intermittent green/pink flashing.

I'll have a look at 3.6 kernels and try the stk1160 next.

Saturday, 10 November 2012

Not Fixing em28xx on Beaglebone

fixing em28xx on Beaglebone

ATTENTION - Method below almost worked, but didn't.

Horizontal pink and green bars across the image... but at least there was an image. That's better than a green screen, isn't it?

I really liked the Beaglebone. I really wanted it to work. The easycap driver sort of worked, but wasn't stable enough to leave in a field. (although it seems ok at 320x240). The stk1160 driver experiences similar break up to the images I've seen of it running on the raspberry pi. (if you are reading this - I know you're working on the latter!).

It looks like the full Beagleboard xM might be the next contender. More money than I'd hoped to spend, and more power, but 1-wire and rtc and already on the board.

Having another go...

from my ubuntu 12.04 beaglebone;

using as a guide

did this

export DIST=oneiric  (options are lucid/maverick/natty/oneiric/precise/squeeze/wheezy)
export ARCH=armel (options are armel/armhf (armhf only for precise))

export BOARD=omap

export BOARD=omap-psp

wget $(cat ./LATEST-${BOARD} | grep STABLE | awk '{print $3}')


naturally it blew away my 1307rtc, (remember so...

got the headers from


installed the headers

dpkg -i linux*2.6.38-7.37*.deb

cd /usr/src/linux-headers-3.2.32-psp25/

Get source

cd /home/stuff



tar xjf linux-3.2.tar.bz2 
cd linux-3.2
zcat /home/stuff/patch-3.2.32-psp25.diff.gz | patch -p1

cp /home/stuff/defconfig .config

change build symlink!

restore the 1307

nano arch/arm/mach-omap2/board-am335xevm.c

Add to the existing static struct i2c_board_info __initdata cape_i2c_boardinfo
                I2C_BOARD_INFO("ds1307", 0x68),

Config changes/checks; (looks ok as it is?)
remove support for the OMAP RTC driver
I2C RTC drivers

try patching em28xx while we're here...

make a new kernel

Thursday, 25 October 2012

em28xx - RPi - archlinux-hf-2012-09-18

N.B. This doesn't work

Second attempt with a em28xx on Raspberry Pi... I'm so fucking bored of this not working I decided to do it again.

This is largely based on the first attempt...


build SD card (on a mac) and, probably, make it work

diskutil list

sudo diskutil unmountDisk /dev/disk1

dd if=/Users/michael/Desktop/RaspberryPi/Images/archlinux-hf-2012-09-18.img of=/dev/disk1 bs=1m

muck about with partitions - i expand the arch linux partition to 4Gb and call the remainder of the drive fat32.

fiddle with boot partition memory elves - rename original start elf and copy the 240 start elf as start.elf

then insert card, boot RPi and watch the LEDs dance about while you find it on the network.

mine was 85...

ssh -l root (password root)

if this isn't your first time round the loop you might get a load of key verification errors, so do

ssh-keygen -R

and try again.

it is plugged in, right?

set up stuffs


mkdir -p /var/cache/swap/

dd if=/dev/zero of=/var/cache/swap/swapfile bs=1M count=1024

chmod 0600 /var/cache/swap/swapfile 
mkswap /var/cache/swap/swapfile
swapon /var/cache/swap/swapfile
put it in fstab, if you want to...
echo "/var/cache/swap/swapfile    none    swap    sw    0   0" >> /etc/fstab

...otherwise just remember to check it's on before you make the kernel.


// if you like progress bars, this will give you the horn.

pacman -Syuand open a bottle of red wine.

install stuff

// because you want stuff

pacman -S ffmpeg motion git base-devel python2

Shall we reboot? Wouldn't be a bad idea. It will be nice to see it boot in a working state one more time...

do a kernel

get the kernel source

// are you doing this for fun? - because it isn't.

cd /home

git clone --depth 1

cd linux

zcat /proc/config.gz > .config

make menuconfig
( it appears i2c and em28xx stuff is all there now, but you can have a look for yourself)

muck about with the kernel

This is where you patch em28xx...

diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c
index de2cb20..bed07a6 100644
--- a/drivers/media/video/em28xx/em28xx-core.c
+++ b/drivers/media/video/em28xx/em28xx-core.c
@@ -785,12 +785,8 @@ int em28xx_resolution_set(struct em28xx *dev)
         dev->vbi_height = 18;

-    if (!dev->progressive)
-        height >>= norm_maxh(dev);

     em28xx_accumulator_set(dev, 1, (width - 4) >> 2, 1, (height - 4) >> 2);

     /* If we don't set the start position to 2 in VBI mode, we end up

make the kernel

// I know we've been here before, just try and think positively


cd ..

git clone

python2 /home/linux/arch/arm/boot/Image

mv /boot/kernel.img /boot/kernel.old

cp kernel.img /boot/kernel.img

cd /home/linux

make modules_install



motion grumbles with;

[1] Unable to query input 1 VIDIOC_ENUMINPUT: Invalid argument
[1] ioctl (VIDIOCGCAP): Inappropriate ioctl for device
[1] Could not fetch initial image from camera

I suspect this is something to do with the wrong card id...

[    4.504130] em28xx #0: Your board has no unique USB ID and thus need a hint to be detected.

Here are the choices;

[    4.504215] em28xx #0: Here is a list of valid choices for the card=<n> insmod option:
[    4.504232] em28xx #0:     card=0 -> Unknown EM2800 video grabber
[    4.504248] em28xx #0:     card=1 -> Unknown EM2750/28xx video grabber
[    4.504264] em28xx #0:     card=2 -> Terratec Cinergy 250 USB
[    4.504279] em28xx #0:     card=3 -> Pinnacle PCTV USB 2
[    4.504293] em28xx #0:     card=4 -> Hauppauge WinTV USB 2
[    4.504307] em28xx #0:     card=5 -> MSI VOX USB 2.0
[    4.504321] em28xx #0:     card=6 -> Terratec Cinergy 200 USB
[    4.504335] em28xx #0:     card=7 -> Leadtek Winfast USB II
[    4.504350] em28xx #0:     card=8 -> Kworld USB2800
[    4.504365] em28xx #0:     card=9 -> Pinnacle Dazzle DVC 90/100/101/107 / Kaiser Baas Video to DVD maker / Kworld DVD Maker 2
[    4.504386] em28xx #0:     card=10 -> Hauppauge WinTV HVR 900
[    4.504401] em28xx #0:     card=11 -> Terratec Hybrid XS
[    4.504415] em28xx #0:     card=12 -> Kworld PVR TV 2800 RF
[    4.504429] em28xx #0:     card=13 -> Terratec Prodigy XS
[    4.504445] em28xx #0:     card=14 -> SIIG AVTuner-PVR / Pixelview Prolink PlayTV USB 2.0
[    4.504462] em28xx #0:     card=15 -> V-Gear PocketTV
[    4.504476] em28xx #0:     card=16 -> Hauppauge WinTV HVR 950
[    4.504490] em28xx #0:     card=17 -> Pinnacle PCTV HD Pro Stick
[    4.504506] em28xx #0:     card=18 -> Hauppauge WinTV HVR 900 (R2)
[    4.504521] em28xx #0:     card=19 -> EM2860/SAA711X Reference Design
[    4.504537] em28xx #0:     card=20 -> AMD ATI TV Wonder HD 600
[    4.504552] em28xx #0:     card=21 -> eMPIA Technology, Inc. GrabBeeX+ Video Encoder
[    4.504569] em28xx #0:     card=22 -> EM2710/EM2750/EM2751 webcam grabber
[    4.504585] em28xx #0:     card=23 -> Huaqi DLCW-130
[    4.504599] em28xx #0:     card=24 -> D-Link DUB-T210 TV Tuner
[    4.504613] em28xx #0:     card=25 -> Gadmei UTV310
[    4.504628] em28xx #0:     card=26 -> Hercules Smart TV USB 2.0
[    4.504643] em28xx #0:     card=27 -> Pinnacle PCTV USB 2 (Philips FM1216ME)
[    4.504659] em28xx #0:     card=28 -> Leadtek Winfast USB II Deluxe
[    4.504675] em28xx #0:     card=29 -> EM2860/TVP5150 Reference Design
[    4.504690] em28xx #0:     card=30 -> Videology 20K14XUSB USB2.0
[    4.504705] em28xx #0:     card=31 -> Usbgear VD204v9
[    4.504719] em28xx #0:     card=32 -> Supercomp USB 2.0 TV
[    4.504733] em28xx #0:     card=33 -> Elgato Video Capture
[    4.504748] em28xx #0:     card=34 -> Terratec Cinergy A Hybrid XS
[    4.504763] em28xx #0:     card=35 -> Typhoon DVD Maker
[    4.504777] em28xx #0:     card=36 -> NetGMBH Cam
[    4.504790] em28xx #0:     card=37 -> Gadmei UTV330
[    4.504804] em28xx #0:     card=38 -> Yakumo MovieMixer
[    4.504817] em28xx #0:     card=39 -> KWorld PVRTV 300U
[    4.504832] em28xx #0:     card=40 -> Plextor ConvertX PX-TV100U
[    4.504846] em28xx #0:     card=41 -> Kworld 350 U DVB-T
[    4.504860] em28xx #0:     card=42 -> Kworld 355 U DVB-T
[    4.504875] em28xx #0:     card=43 -> Terratec Cinergy T XS
[    4.504890] em28xx #0:     card=44 -> Terratec Cinergy T XS (MT2060)
[    4.504905] em28xx #0:     card=45 -> Pinnacle PCTV DVB-T
[    4.504919] em28xx #0:     card=46 -> Compro, VideoMate U3
[    4.504934] em28xx #0:     card=47 -> KWorld DVB-T 305U
[    4.504948] em28xx #0:     card=48 -> KWorld DVB-T 310U
[    4.504962] em28xx #0:     card=49 -> MSI DigiVox A/D
[    4.504976] em28xx #0:     card=50 -> MSI DigiVox A/D II
[    4.504990] em28xx #0:     card=51 -> Terratec Hybrid XS Secam
[    4.505005] em28xx #0:     card=52 -> DNT DA2 Hybrid
[    4.505019] em28xx #0:     card=53 -> Pinnacle Hybrid Pro
[    4.505033] em28xx #0:     card=54 -> Kworld VS-DVB-T 323UR
[    4.505048] em28xx #0:     card=55 -> Terratec Cinnergy Hybrid T USB XS (em2882)
[    4.505064] em28xx #0:     card=56 -> Pinnacle Hybrid Pro (330e)
[    4.505079] em28xx #0:     card=57 -> Kworld PlusTV HD Hybrid 330
[    4.505094] em28xx #0:     card=58 -> Compro VideoMate ForYou/Stereo
[    4.505109] em28xx #0:     card=59 -> (null)
[    4.505123] em28xx #0:     card=60 -> Hauppauge WinTV HVR 850
[    4.505138] em28xx #0:     card=61 -> Pixelview PlayTV Box 4 USB 2.0
[    4.505153] em28xx #0:     card=62 -> Gadmei TVR200
[    4.505167] em28xx #0:     card=63 -> Kaiomy TVnPC U2
[    4.505181] em28xx #0:     card=64 -> Easy Cap Capture DC-60
[    4.505196] em28xx #0:     card=65 -> IO-DATA GV-MVP/SZ
[    4.505210] em28xx #0:     card=66 -> Empire dual TV
[    4.505223] em28xx #0:     card=67 -> Terratec Grabby
[    4.505237] em28xx #0:     card=68 -> Terratec AV350
[    4.505252] em28xx #0:     card=69 -> KWorld ATSC 315U HDTV TV Box
[    4.505267] em28xx #0:     card=70 -> Evga inDtube
[    4.505281] em28xx #0:     card=71 -> Silvercrest Webcam 1.3mpix
[    4.505296] em28xx #0:     card=72 -> Gadmei UTV330+
[    4.505310] em28xx #0:     card=73 -> Reddo DVB-C USB TV Box
[    4.505325] em28xx #0:     card=74 -> Actionmaster/LinXcel/Digitus VC211A
[    4.505340] em28xx #0:     card=75 -> Dikom DK300
[    4.505354] em28xx #0:     card=76 -> KWorld PlusTV 340U or UB435-Q (ATSC)
[    4.505371] em28xx #0:     card=77 -> EM2874 Leadership ISDBT
[    4.505386] em28xx #0:     card=78 -> PCTV nanoStick T2 290e
[    4.505400] em28xx #0:     card=79 -> Terratec Cinergy H5
[    4.505415] em28xx #0:     card=80 -> PCTV DVB-S2 Stick (460e)

It's supposedly a kworld 2800USB, so i'll try 8

modprobe -r em28xx
modprobe em28xx card=8

doesn't work, hangs on Resizing pre_capture buffer to 1 items - which i think is an improvement. card=19 doesn't work either, same error - although i have a feeling that's how it has turned up in the past.

New drivers?

cd /home

mkdir stuff



makepkg --asroot -s

pacman -U perl-proc-processtable-0.45-3-any.pkg.tar.xz

pacman -S patchutils

cd /home

git clone git://

cd media_build


the build failed on smiapp-core.c
at this point I  make menuconfig and start removing stuff
then try to make it again.

make install 

 this seemed to work now


but the driver still doesn't. I'm giving up on this board for a while.

Monday, 22 October 2012

Cue light repeater

A cue light repeater

a photo transistor;

a red led

some circuit diagrams;

When the male XLR shell housing the photo transistor is mounted over a cue light, and the cue light comes on, then the LED comes on.

Monday, 3 September 2012

enabling the gpio on the beaglebone

Currently in the process of building the hardware for the first beaglebone bufocam. The 1-wire and RTC clock have been mounted on some prototyping board (ebay). Cheapest supplier I found for board headers was rapid electronics - buy the larger ones and cut them down.

I want to add a couple of LED's to the inside of the box to give some user feedback that something is really happening. There are lots of guides already for this;

Monday, 6 August 2012

stk1160 driver on beaglebone

Had another look at this

There's a branch of STK1160 for the raspberry pi, and that works for the beaglebone

(think all the AC97 has been commented out)

it's here -

(some history of it - )

It still exhibits the same picture breakup as seen on the RPi - but I've checked my DMA fix ... and it hasn't been, so that's my first step; (Disable USB DMA at drivers->USB support->Inventra-> select [*] Disable DMA)

Disable DMS makes it worse; the picture is a horrible mess now!


Attempt to build the updated easycap driver stk1160 from Ezequiel Garcia.

need kernel sources to build it on beaglebone - trying to create them using this method;

git clone git://
cd linux-dev
git checkout origin/am33x-v3.2 -b am33x-v3.2


exciting highlights;

arch/arm/configs/omap2plus_defconfig:244:warning: unexpected data # # configuration written to .config # `.config' -> `/home/michael/beaglebone/linux-dev/patches/ref_omap2plus_defconfig' `/home/michael/beaglebone/linux-dev/patches/defconfig' -> `.config' HOSTCC scripts/kconfig/lxdialog/checklist.o HOSTCC scripts/kconfig/lxdialog/inputbox.o HOSTCC scripts/kconfig/lxdialog/menubox.o HOSTCC scripts/kconfig/lxdialog/textbox.o HOSTCC scripts/kconfig/lxdialog/util.o HOSTCC scripts/kconfig/lxdialog/yesno.o HOSTCC scripts/kconfig/mconf.o HOSTLD scripts/kconfig/mconf scripts/kconfig/mconf Kconfig *** End of the configuration. *** Execute 'make' to start the build or try 'make help'. `.config' -> `/home/michael/beaglebone/linux-dev/patches/defconfig' make -j2 ARCH=arm LOCALVERSION=-psp20 CROSS_COMPILE="ccache arm-linux-gnueabihf-" zImage modules scripts/kconfig/conf --silentoldconfig Kconfig

I'm using the machine in my loft to build all this, because (being an ubuntu 12.04 server) it was easier to install the cross compiler toolchain. Seemed to be as easy as sudo apt-get install gcc-arm-linux-gnueabihf

found some files that look like source in /KERNEL and some headers and a zImage in /deploy... looks like the kernel i've made isn't the one i'm using on the beaglebone (not very surprising). I've made a uImage from the new zImage and will see what happens.

Found the command below at

mkimage -A arm -O linux -T kernel -C none -a 0x80008000 -e 0x80008000 -n "Linux" -d ./linux-dev/deploy/3.2.21-psp16.zImage ./uImage

Wednesday, 1 August 2012

1-wire and blinking LEDs

Not much progress tonight. I got distracted looking at opencv/simplecv - which is something that interests me for the future - and I think I may have broken motion/ffmpeg in the process of trying to install opencv with ffmpeg and python support. I've built a new image and have disabled creating ffmpeg videos to be on the safe side. (I'm not really interested in video footage, but I'm quite interested in stability). I hasn't crashed yet since. (still running at 720x576).

I have been looking at 1wire for humidity and temperature monitors. I don't think I'm feeling bold enough to attempt anything like
ultimately this, or something like it (I2C?) is going to make the device £20 cheaper.... but in terms of simplicity I want to see it working first with something like the DS9094


Currently the SWE3 module from looks favorite, with a DS18S20 sensor ( wired directly into the 3way terminal block on the board to create a dual temp/humidity unit. The IR led lighting can live on this module too and take power from the cat5.

Afterwards, I made LED 3 turn on and off

echo 0 > /sys/class/leds/beaglebone\:\:usr3/brightness 
echo 1 > /sys/class/leds/beaglebone\:\:usr3/brightness 

RTC on i2c

Instructions for the DS1307 below, step one is build the thing;

Then buy this (should have used the

(set EN high)
connect them all together;

(The 1-wire thermometer can just be seen at the bottom of the breadboard)

L@@K! something (hopefully the DS1307) is at address 0x68.

root@omap:/home# i2cdetect -r -y 3    

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- UU UU UU UU -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                      

The DS1307 didn't seem to burst into life until you set it... I would probably know that if I read the friendly manual. I seem to be able to set the seconds byte to 00x0 with

i2cset -y 3 0x68 0x00 0x00

and a couple of seconds later 0x00 is 02... so I think it's working. Note to self - need to refine this to actually set/read the time.

i2cdump -y 3 0x68

No size specified (using byte-data access)
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: 02 00 00 01 01 01 00 03 07 01 40 30 40 0d 26 70    ?..???.???@0@?&p
10: 98 03 10 50 83 89 18 1d 1c 01 0c 08 0c 12 00 20    ???P??????????. 
20: 1e 6a 10 f0 60 52 82 61 47 81 63 10 80 30 04 39    ?j??`R?aG?c??0?9
30: 2e 38 8a 04 ec 88 c0 20 01 20 20 56 40 d0 24 95    .8????? ?  V@?$?
40: 02 00 00 01 01 01 00 03 07 01 40 30 40 0d 26 70    ?..???.???@0@?&p
50: 98 03 10 50 83 89 18 1d 1c 01 0c 08 0c 12 00 20    ???P??????????. 
60: 1e 6a 10 f0 60 52 82 61 47 81 63 10 80 30 04 39    ?j??`R?aG?c??0?9
70: 2e 38 8a 04 ec 88 c0 20 01 20 20 56 40 d0 24 95    .8????? ?  V@?$?
80: 02 00 00 01 01 01 00 03 07 01 40 30 40 0d 26 70    ?..???.???@0@?&p
90: 98 03 10 50 83 89 18 1d 1c 01 0c 08 0c 12 00 20    ???P??????????. 
a0: 1e 6a 10 f0 60 52 82 61 47 81 63 10 80 30 04 39    ?j??`R?aG?c??0?9
b0: 2e 38 8a 04 ec 88 c0 20 01 20 20 56 40 d0 24 95    .8????? ?  V@?$?
c0: 02 00 00 01 01 01 00 03 07 01 40 30 40 0d 26 70    ?..???.???@0@?&p
d0: 98 03 10 50 83 89 18 1d 1c 01 0c 08 0c 12 00 20    ???P??????????. 
e0: 1e 6a 10 f0 60 52 82 61 47 81 63 10 80 30 04 39    ?j??`R?aG?c??0?9
f0: 2e 38 8a 04 ec 88 c0 20 01 20 20 56 40 d0 24 95    .8????? ?  V@?$?

lots of numbers....

getting the time out of the ds1307 looks like it's going to be easier than i thought

echo ds1307 0x68 >/sys/bus/i2c/devices/i2c-3/new_device


echo ds1307 0x68>/sys/devices/platform/omap/omap_i2c.3/i2c-3/

both these seem to work, and it also seems this information can be found at  /sys/class/i2c-adapter/i2c-3/

There's a driver in the kernel for the ds1307, so getting the time is seemingly as straight forward as; 

hwclock -f /dev/rtc1 --set --date="8/11/2012 21:31"

I had some problems with the hours last night - either it was me, or whatever time zone i'm in (haven't set any locale data yet) or the bits for 24h/12h on the ds1307 (see datasheet).

so look there for a fuller explaination - but here are the useful commands I need for my own reference;
Read time from hwclock;
hwclock -f /dev/rtc1 -r
Set system time from hwclock;
hwclock -f /dev/rtc1 -s
Write system time to the hwclock
hwclock -f /dev/rtc1 -w

Looking into getting this to work on startup next...

got some advice here;!topic/beagleboard/DegreEdtI-Q%5B1-25%5D

Which seems to work.
I think this should set the right time and write it to the hwclock

dpkg-reconfigure tzdata
hwclock -f /dev/rtc0 -w

1 wire

Datasheet for DS9094; 

pinout for DS9094;

pinout for RJ45;

The humidity module SWE3 from sheepwalk ( has two rj45 sockets - I'm going to use one of these at the host end to build a RJ12 - RJ45 adapter. Pins 4 and 5 will come from the 1wire host RJ12 socket but this adapter doesn't provide enough power to drive the IR leds so my RJ45 adapter is going to inject 5v from the regulator.

Image of the SWE3 from - the terminal block is where the temperature sensor will be mounted.

Having built my RJ12 -> RJ45 adaptor I dmesg, and have just spied;

[ 1.827064] BeagleBone cape: initializing w1-gpio
[ 1.832094] w1-gpio connected to P8_6

This implies to me that the ubuntu 12.04 already has the 1wire patch and I don't need my USB host!? Looking at the comments at leads me to believe I probably should have expected than...

last comment regarding the 4k7 pull up seems pertinent too.

...Found two approx. 10k resistors in the loft! Hooking up to P8_6 does indeed work.

root@omap:~# cat /sys/bus/w1/devices/10-000802307b83/w1_slave 
31 00 4b 46 ff ff 01 10 27 : crc=27 YES
31 00 4b 46 ff ff 01 10 27 t=24687

cat /sys/bus/w1/devices/10-000802307b83/w1_slave | tail -n1 | awk -F= '{print $2/1000 " degrees Celsius"}'
24.625 degrees Celsius

A comfortable 24.635 C°.

I need to do some homework before I hook up the humidity sensor as 3.3v is outside the voltage range of the 4031. Looks like I might be able to replace it with the 5031;

I've have to do some homework/ read the datasheet.

Voltage supply 2.7 - 5.5 Vdc

Current supply 200 - 500 uA

Voltage output (1st order curve fit) VOUT=(VSUPPLY)(0.00636(sensor RH) + 0.1515), typical at 25 C

Temperature compensation True RH = (Sensor RH)/(1.0546  0.00216T), T in  C

NB The ADC may lose accuracy at 3.3v... so maybe some more bidirectional level conversion is better?

This looks a bit like the SWE3 circuit to me;
note the True RH calculation above for the 5031 differs from the information in the sidebar for the other chip.

Further reading

Application notes on 1-wire

References/ Acknowledgements

Invaluable 1-wire info;

Great i2c beaglebone tutorial;

another RTC resource

Monday, 30 July 2012


  1. Raspberry Pi
  2. BeagleBone
  3. syntek/'easycap' capture device
  4. em28xx capture devices
  5. 5v regulator
  6. SD card reader
  7. Multimeter

The bullet camera is mostly obscured by an elephant.

Friday, 27 July 2012


Advantech MIO2260


Monday, 23 July 2012

BeagleBone - ubuntu precise 12.04 armhf

Beaglebone with ubuntu precise

On debian laptop 

(, 2012)


sudo ./ --mmc /dev/sdX --uboot "board"

ssh into BeagleBone

 (R.Nelson, 2012)

apt-get update

apt-get upgrade

apt-get install libncurses5-dev lzma make gcc patchutils libproc-processtable-perl

create a swapfile

mkdir -p /var/cache/swap/ sudo dd if=/dev/zero of=/var/cache/swap/swapfile bs=1M count=1024 sudo 

chmod 0600 /var/cache/swap/swapfile 
mkswap /var/cache/swap/swapfile
swapon /var/cache/swap/swapfile

get sources and BeagleBone patches

mkdir /home/stuff

cd /home/stuff



mkdir /home/linux

cd /home/linux


tar xjf linux-3.2.tar.bz2 

cd linux-3.2

zcat /home/stuff/patch-3.2-psp16.diff.gz | patch -p1

cp /dir/downloaded/defconfig .config

edit the em28xx driver (Makarov, 2011)

cd drivers/media/video/em28xx/

sed -i 's/height >>= norm_maxh(dev)/height = norm_maxh(dev) >> 1/' em28xx-core.c

cd /home/linux/linux-3.2

make menuconfig

Device drivers > USB support > disable DMA (always use PIO)


make modules_install

apt-get install motion

Getting a decent picture out of the lifecam, but timeouts from the em28xx.


Answer = use a syntek device!

thanks to :!topic/beagleboard/NZGU2gt-U2Y

Amazon uk link;

This card is currently producing a 720x576 image in motion on the BeagleBone running ubuntu 12.04 - and no mucking about with the kernel.

References, July 2012, BeagleBoardUbuntu, available from accessed 23rd July 2012

Robert C Nelson, (2012) in reply to ubuntu make error No such file or directory available from!topic/beagleboard/5xMAyFxQbdE accessed 23rd July 2012

Vitaly Makarov (2011) Non-portable code in em28XX driver, available from , accessed 21st July 2012
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported License