Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Sunday, May 5, 2013

Arch Linux Iomega IConnect

I got an iConnect a few years ago. 1 Ghz processor, 256 MB RAM, Gigabit Ethernet, Wireless Card, 4 USB Ports (3 Usable).

Quite a good machine to run embedded Linux on. I had it running various services such as OWFS 1-Wire, XRF Wireless from Ciseco and other testing projects.

Anyway, one day I was tinkering and I broke it. It had to do with the bloody Arch Linux updates and Kernel modules. It was in a heap and was useless. I was busy being distracted by other projects, so the iConnect was put offline and joined the grave yard of stalled/unfinished projects.

One day, recently, I talked to Dr Google about hacking the iConnect.

I came across a couple of interesting links dealing with installing Debian on the iConnect.

http://scriptkiller.de/en/a54/computer_electronics/hacking_the_iomega_iconnect/

http://www.kroonen.eu/wiki/Debian%20iConnect

Really excellent links. You should have a read if you are interested in this type of stuff.

The link that was really the money shot was

http://pawelwozniak.info/index.php/embedded-linux/iconnect/126-install-archarm-linux-on-iconnect

It contains all the information required to install Arch Linux on the iConnect.

I used the Sarkfun FTDI Basic Breakout - 5V which I got from Cool Components to gain console access. I modified it to use 3.3V rather then the hotter 5V. Perfect.

The final update is to set the arcNumber from 1682 to 2870. This gives you access to the specific hardware in the iConnect, such as LEDS and the button.

They are located in:

/sys/class/leds

This is what you get:


iconnect:blue:otb -> ../../devices/platform/leds-gpio/leds/iconnect:blue:otb
iconnect:blue:power -> ../../devices/platform/leds-gpio/leds/iconnect:blue:power
iconnect:blue:usb1 -> ../../devices/platform/leds-gpio/leds/iconnect:blue:usb1
iconnect:blue:usb2 -> ../../devices/platform/leds-gpio/leds/iconnect:blue:usb2
iconnect:blue:usb3 -> ../../devices/platform/leds-gpio/leds/iconnect:blue:usb3
iconnect:blue:usb4 -> ../../devices/platform/leds-gpio/leds/iconnect:blue:usb4
iconnect:led_level -> ../../devices/platform/leds-gpio/leds/iconnect:led_level
iconnect:red:power -> ../../devices/platform/leds-gpio/leds/iconnect:red:power
rt2800pci-phy0::assoc -> ../../devices/pci0000:00/0000:00:01.0/leds/rt2800pci-phy0::assoc
rt2800pci-phy0::quality -> ../../devices/pci0000:00/0000:00:01.0/leds/rt2800pci-phy0::quality
rt2800pci-phy0::radio -> ../../devices/pci0000:00/0000:00:01.0/leds/rt2800pci-phy0::radio



http://archlinuxarm.org/forum/viewtopic.php?f=27&t=2612

Great work. Costs no money, so Woo Hoo!!

I plan to use to use it for Project Janus. It will use an iButton key fob or an RFID card to control some devices. There will also be other sensors in the loop for status updates, PIR and perhaps some audio component. Cool....

Sunday, October 14, 2012

Arch Linux Kernel Upgrade Broke Modules

I ran a full upgrade using 'pacman -Syu' which included a kernel upgrade.

It started fine but then went into the toilet, as follows:

(1/1) upgrading linux                                                       [###########################################] 100%
>>> Updating module dependencies. Please wait ...
ERROR: could not open directory /lib/modules/3.5.6-1-ARCH: No such file or directory
FATAL: could not search modules: No such file or directory
>>> Generating initial ramdisk, using mkinitcpio.  Please wait...
==> Building image from preset: 'default'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
==> Starting build: 3.5.6-1-ARCH
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [autodetect]
  -> Running build hook: [pata]
  -> Running build hook: [scsi]
  -> Running build hook: [sata]
  -> Running build hook: [filesystems]
  -> Running build hook: [usbinput]
==> ERROR: module not found: `hid_apple'
==> ERROR: module not found: `hid_logitech_dj'
==> ERROR: module not found: `hid_hyperv'
==> ERROR: module not found: `hid_saitek'
==> ERROR: module not found: `hid_generic'
==> ERROR: module not found: `hid_axff'
==> ERROR: module not found: `hid_dr'
==> ERROR: module not found: `hid_cypress'
.
.
.
.
.==> ERROR: module not found: `hid_gaff'
==> ERROR: module not found: `hid_picolcd'
==> ERROR: module not found: `hid_twinhan'
  -> Running build hook: [fsck]
==> WARNING: No modules were added to the image. This is probably not what you want.
==> Creating gzip initcpio image: /boot/initramfs-linux.img
==> WARNING: errors were encountered during the build. The image may not be complete.
==> Building image from preset: 'fallback'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-fallback.img -S autodetect
==> Starting build: 3.5.6-1-ARCH
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [pata]
==> ERROR: module not found: `pata_cmd640'
==> ERROR: module not found: `pata_ns87410'
==> ERROR: module not found: `pata_via'
==> ERROR: module not found: `pata_cs5535'

Arseburger was shouted loudly.

Dr. Google did not help.

It seems that the kernel modules have moved to /usr/lib/modules from /lib/modules

I put a symlink in /lib to the new location. ln -s /usr/lib/modules /lib/modules

I then ran the install of the kernel again and all was good.

WooHoo! Simple really

Friday, August 10, 2012

USB Temperature Sensor and Linux (Part 2)

I wrote on this a quite a while ago and it seems very popular, so I thought I would write an update

I decided to include some of the files, to make it easier to use.

The first file is temper-1.0.tgz. I got this from the good looking guys over at www.relavak.com.

Here it is here temper-1.0.tgz

I downloaded it, and extracted it with 'tar zxvf temper-1.0.tgz'

Then I downloaded temper.c, which is my modified code.

I copied the temper.c file into the temper-1.0 directory.

Then I ran 'make'.

It produced and executable called 'temper'

Here is the compiled 32 bit version temper_32bit

And the compiled 64 bit version temper

Have fun.

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.

Monday, April 2, 2012

Arch Linux Stora Error - Fixed

I kept getting the following error repeated every gew seconds, filling up the log files like crazy.

unable to receive ctrl connection: Function not implemented

I found this after a bit of research

 ##in /etc/rc.local add
kill $(pidof udevd)
sleep3
udevd &



A reboot later and no problem.


It seems there was some problem between between different versions of udevd

Tuesday, November 9, 2010

The Most Measured Fridge in the World

What would you measure about your fridge?

I wanted to measure Temperature and Energy Usage.

A few months ago, I used two 1-Wire DS18S20 Temperature sensors and OWFS to measure the temperature in the main fridge and the freezer compartment. It is a fairly standard and straightforward set-up which I am not going to cover here. I stick the readings in a MySQL database and produce graphs using gnuplot. Interesting in a very geeky way.

You can see the way behaviour such as leaving the door open for a minute or more can drastically effect the temperature. It can take over an hour go get to a stable temperature.



This is an average day. Not much activity. Quick opens and closes. There is a temperature spike in the freezer about 10 am. This happens about every 30 hours or so and I think this represents the automatic defrost function. This removes the requirement to have to defrost the fridge from time to time. Cool in my book.


The main reason for this article is to outline the process involved in installing a new Currentcost IAM (Individual Appliance Module) and how to extract the readings and process them.


I have using Currentcost sensors and display/receiver for a number of years to measure electricity consumption in my house.

I have a CC128 Display/Receiver Unit connected to a Linux computer which reads the XML output, parses it and stores it in a RRD database and a MySQL database.

I then use a few scripts to gather the data and product graphs which I display on a web page. Excellent stuff.

The set-up is based on the excellent write up on http://www.jibble.org/currentcost/.



So, after waiting for yonkity bonks for the Currentcost IAM to be released, I saw that they were available recently. They measure the energy usage of an particular appliance and send it to your receiver, in my case the CC128.



They are available on Amazon.co.uk for about £30. I am based in Dublin, so the postage was about £20. Feck I thought. My brother, who is also a Currentcost fan, bought 2 and posted it to me. Postage about £10, still to high. They need to do something about that.

Anyway, the time came to install one of the IAMs and set-up the logging and graphing processes. I had a look around but could not find much useful information about how to handle the extra sensors.

I found some information on the Currentcost site here http://www.currentcost.com/cc128/xml.htm. Not really much help though.

What I did at the end of the day, was just configure the new sensor and plugged in the fridge.

I watched the output from the CC128 and noticed, that there were two lines output. One was for the main energy sensor and the other one was from the new sensor.

Here is an example:

<msg><src>CC128-v0.11</src><dsb>00621</dsb><time>13:46:40</time><tmpr>21.9</tmpr><sensor>0</sensor><id>01223</id><type>1</type><ch1><watts>00601</watts></ch1></msg>

<msg><src>CC128-v0.11</src><dsb>00621</dsb><time>13:46:42</time><tmpr>21.9</tmpr><sensor>1</sensor><id>01181</id><type>1</type><ch1><watts>00001</watts></ch1></msg>

As you can see the lines are fairly similar. The first point of note is the sensor number 0 and 1. This was enough to discriminate between the sensors.

I then modified the data collection script as follows:
Original line
m!<ch1><watts>0*(\d+)</watts></ch1>.*<tmpr> *([\-\d.]+)</tmpr>!

had to be changed to
m!<tmpr>\s*(-*[\d.]+)</tmpr><sensor>0</sensor>.*<ch1><watts>0*(\d+)</watts></ch1>!

as in e.g.

#Sensor 0
if ($line =~ m!<tmpr>\s*(-*[\d.]+)</tmpr><sensor>0</sensor>.*<ch1><watts>0*(\d+)</watts></ch1>!)
{
my $watts = $2;
my $temp = $1;
system("rrdtool update /var/www/html/currentcost/data/powertemp.rrd N:$watts:$temp");
system("./mysql_bit.sh $watts $temp");
}

#Sensor 1
if ($line =~ m!<tmpr>\s*(-*[\d.]+)</tmpr><sensor>1</sensor>.*<ch1><watts>0*(\d+)</watts></ch1>!)
{
my $watts1 = $2;
my $temp1 = $1;
system("rrdtool update /var/www/html/currentcost/data/powertemp_mod1.rrd N:$watts1:$temp1");
system("./mysql_module_bit.sh 1 $watts1 $temp1");
}

That was it basically. Everything worked.



Here is an average 4 Hour Graph and Usage of the fridge at the weekend. Some activity, not much.

Bloody hungry machines. It makes up a significant part of our electricity bill. Not much you could do except increase the general minimum temperature. Some research required, I think.

I think I will produce a daily Fridge Electricity Bill. I have done this for the house, based on Dale Lanes idea

If you need more information, leave a comment.

Saturday, April 3, 2010

In Praise of Linux

The house server, which runs Fedora Linux and does the 1-wire, currentcost etc activities plus many other things was becoming a bit unstable and was crashing every day or two.

The cry went up and 'Feck' was heard throughout the land.


It took me most of the day to sort it.

It was all caused by disk errors. Luckily they were only soft errors. File allocation errors etc.

It took a long time to find out what the problem was and then to repair it.

Anyway, all good now.

I also had an aborted upgrade issue, that left things in a bit of a limbo situation. I was able to force it through, I think.

The truth is that I really enjoyed it. Plenty of problem solving and I didn't know if I could solve it. Well, I knew I could.

If it was Windows, I think the outcome would = Bollixed.

Linux will never catch on, as it is complex under the hood.

But you can get under the hood and twiddle away and fix really obscure issues.

The new word on the street is 'Coolziod'.

I Love Fedora..............

Wednesday, November 18, 2009

USB Temperature Sensor and Linux

I picked up an USB Temperature Sensor on eBay a few weeks ago. Total cost just over 4 Euros. It would have been rude not to get one. It is a HIP TEMPer model from http://www.pcsensor.com/. They have a few mad products such as a three foot switch. I like it.



I took quite a while to actually arrive.

It arrived today, so I plugged it into a Windows XP machine and installed the software. Yep, worked fine. The software that comes with it is basically crap. The colour scheme is way ugly.

This is not a problem at all as I planned to use it on Linux. I wanted to be able to poll the device and pull a temperature reading off it, stick it in a mySql database and present the data via a PHP web page. Bob's your aunty.

After consulting Dr. Google for a while, I came across this site, that had what I was looking for. http://relavak.wordpress.com/2009/10/17/temper-temperature-sensor-linux-driver/

I downloaded the driver and ran it. Perfect, almost.

It ran in a loop with lots of other data being shown. The default executed in a debug mode.

So, I had a look at the source code. I am not a C programmer but it was easy to follow.

I changed a few settings, commented out a few lines, compiled and tested it. Wash, rinse and repeat.

After a very short period of time, I had what I wanted.

The program just reads once and outputs the temperature in centigrade.

Done.

Just the thing to use in a script and automate.

I think I will get a few more. Very cheap and useful. Brilliant piece of kit.

I use 1-wire sensors for a lot of my temperature measurements. This is another tool for the toolbox. This is all due to the Linux drivers provided by http://relavak.wordpress.com/2009/10/17/temper-temperature-sensor-linux-driver/.

He is the hero.

I have added an update to this blog   - USB Temperature Sensor and Linux (Part 2)  on 10/08/2012. Included come compiled code.

Saturday, November 14, 2009

Linux Media Player Part 2

This time I tried one of the most popular ones, MythTV.

I tried this first a few years ago and failed dismally to get it to work properly.

This time around I did not fair much better. It is overly complicated and poorly documented. Sure, there is loads of docs but I found it difficult to follow. After two days of install and set-up, what I ended up with was a poorly operating system. It was slow and sluggish.

Too many things. I just wanted to play a few cds and watch a few videos.

A single application device.

So, I basically abandoned Myth TV.

Hello again Freevo.

It installed fairly easily on Fedora 11. There is just 1 configuration file. Excellent.

It all works. No issues.

There are many new features added since I first set-up Freevo.

The Question: "Which is a good and lightweight Home Theatre / Media Player to install on an old or low spec PC?"

The Answer: Freevo

It is really an answer and not the answer. There are other other ones.

Another one I played around with last year was GeeXboX. It was fairly good. The best thing was that it came on a bootable cd, so it was easy to test out.

I think I shall just do that.

In the mean time, I am a Freevo sort of guy.

Monday, November 9, 2009

Linux Media Player

I have been a fan of Freevo for a few years now, but decided to review what the current state is with other application.

The reason I chose Freevo, was because it was relatively easy to set-up and did not require a powerful computer to run on.

The PC I choose to run the tests on is a 1.? Ghz machine with 512Mb of RAM.

The first candidate was XBMC. It looked good. Downloaded and installed it, no problems. When I started to use it, there were some serious issues. It played fine but the user interface was very, very slow. Dragging the mouse accross the screen produced a large number of jumps.

This product was quickly dismissed, as it would fail the UAT (User Acceptance Test) straight away.


The next fella was LinuxMCE. This requires a specific version of Kubuntu to install. It is all contained on the DVD image which is handy.

The install took many hours, about 5, to complete. There were a few hangs and reboots. It didn't fail but just picked up from where it left off.

When I got it installed, I had some trouble setting preferences, such as IP address. The changes were not retained. This gets very frustrating, after 5 or 5 attempts to set something.

I noticed that it failed to pick up various media available.

The main issue was the customisation. It wouldn't take the changes.

After a number of hours, there was only one decision and that was /bin.

The end.

The next system is MythTV. I have it installed on Fedora Core 11 and need to configure it.

More next time.

Friday, November 6, 2009

Sinead's 1-Wire Alarm Clock


My daughter Sinead has a problem getting up for college in the morning.

She finds standard alarm clocks do not work for her. Too easy to turn off and go snoozing again.

We investigated a number of solutions, such as louder alarm clocks etc, but nothing really provided a complete solution.

I have been involved, some people would say obsessed, with Home Automation for a while now. One of the technologies that I use is called '1-Wire'.

1-Wire is basically a 2 wire network, that can be used with a number of components supplied by Dallas Semiconductor Co (now Maxim) to perform a number of functions, controlled by a computer for example.

They are probably best known, in geekdom, for their DS18S20 temperature sensor. I use these throughout the house to measure the temperature in different rooms.

They product other chips that do different things. The one I used in this case was a DS2405 addressable switch. It is an oldish device that has been superseded by the DS2406 and DS2408.

Anyway, it can be used as a switch and as a sensor to detect voltage. Pretty useful.

When the alarm goes off, the patron will need to get out of the scratcher, go to where the computer is, bring up a web page and click 'OFF'. She has an iPaq which is connected to the network. There will be a block on using an iPaq to turn off the alarm. Hehe! Evil, evil, evil.

My design is as follows:

1. Use my existing 1-Wire network to control the DS2405.
2. Use the DS2405 to control a relay.
3. Use the relay to switch on and off a sound source.
4. Use a PHP web page to interface with the set-up, i.e. turn on/off, set-up schedules, etc.
5. Use bash scripts to manage the schedule automatically.
6. Cost me nothing, except time.

List of materials:

DS2405 (or DS2406 or DS2408)

Some relay. I used a Opto-Isolator, which I already had. I used Opto-isolator,ISD74 5300Vac/50mA DIP8 which I got from Radionics.ie

A door /window alarm I got from Lidl a number of years ago. There is a small siren, that is loud enough for this application. I shouldn't wake people in other rooms.

5V Transformer. I used one from an old Sony walkman.

Various cabling, cat-5 and phone cable.

Some heat shrink sleeving (to make it all neat-o)


Construction:

Prepare the alarm. Strip out the button batteries, remove the battery contacts. You are left with a red and black wire. I also removed the reed relay sensor.

Connect the 1-Wire cable to the GND and 5V of the DS2405.

Connect the PIO and GND of the DS2405 to the appropriate pins. See spec sheet for this chip.

Connect the output pins to the 5V+. One to the walkman and the other to the 5V on the alarm siren (red wire).

Connect the black wire from the alarm to the gnd on the transformer.


I was able to fit all the components in to the alarm, after removing the batteries and cutting a plastic separator.


Wired it up to the 1-Wire controller and tested it. Worked perfectly.

Patched it through from where the main computer is to Sinead's bedroom.


Next Step:

Write the PHP script to provide an interface to turn it off, when the patron has arisin.

Put together a bash script to automate the switch on and off of the alarm. I think 30 mins on would be sufficient. I you can't get up in that time, you are not there or there is a serious problem.

This will be the easy part.

Power failure - Restart not successful - No Email

There was a power failure here yesterday and knocked out the computers that were running.

One of these was my Internet server. It provides my web sites 'www.thegiblins.com' and 'shankillweather.com' and acts as my email server.

It is based on Linux, so, I thought that it should recover fairly easily.

This was not 100% true. The web site came up fine but email was working well.

I use sendmail as my MTA, which can be very difficult to configure and maintain.

I noticed that I hadn't received any emails since the afternoon. There are always emails being sent, either externally or internally from the various scheduled jobs that are always running. Something was wrong.


On further inspection of the /var/log/maillog, I say many messages like:

Milter: data, reject=451 4.3.2 Please try again later

and

to=, delay=00:00:04, pri=31034, stat=Please try again later

and even

to=root, ctladdr=root (0/0), delay=00:00:02, xdelay=00:00:02, mailer=relay, pri=30341, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: 451 4.3.2 Please try again later

I said to myself, "What the Feck!".

I did the usual quick fix, i.e. "Did you try turning it off and on again?". No change.

I run Spamassassin and Clamav (Virus Protection), which can be troublesome boys, so, they were the next suspects.

The main clue from the maillog, was the word 'Milter'. This is basically a mail filter. There is one for Spamassassin and Clamav.

If you have ever set these up on Linux, you will know how tricky it can be. The documentation is not clear enough. It becomes clear after you have completed the job, which is not very helpful. Clamav has many components and it is not clear what are required.

Spamassassin seemed to be fine. It was identifying spam and non spam correctly.

Next was Clamav. I checked the configs, all OK. Ran an update on the data ans s/w. No change.

Checked my old notes. No help there. Talked to DR Google. Same.

I had a look through the bash history and noticed something.

I could see that 'clamav-milter' was running bit 'clamd' was not.

I started 'clamd' and restarted 'clamav-milter'. All good.

Done.

Mail logs looked good. Emails were coming through. Happy days.


What did I learn?

Make better notes (probably never happen).

Fully automate for a restart. I remember when I recently rebuilt the Internet server, there were issues with these email components. I obviously did not fully complete the install and left things not starting on boot.

Wednesday, October 7, 2009

Sheeva PlugComputer

It seems I have bought a Sheeva PlugComputer. Not really sure what I will use it for.

Probably some Home Automation solution or monitoring activity.

Options are 1-Wire, CurrentCost or HomeEasy applications.

Linux = anything

Monday, September 28, 2009

DNS Problems Not Resolved

Finally, I can access this blog from home. I had an issue with my DNS that I have been able to overcome. Simple really, as it often is.