Showing posts with label 1-wire temperature. Show all posts
Showing posts with label 1-wire temperature. Show all posts

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.

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.





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.