Compiling the kernel with DS1621 support

Posted by Doug on Sat 17 October 2009

After building the temperature sensing I2C circuit i posted about before i compiled a kernel for the mini2440 which supported the DS1621 temperature sensor. Thanks to the existing kernel support this was remarkably easy.

All i had to do was edit /mini2440_defconfig in .../kernel/mini2440/arch/arm/configs and change line 1039 to:

CONFIG_SENSORS_DS1621=y

I compiled the kernel using the script i posted here interrupting the process after the git clones to change the line above and then allowing it to continue. I then booted the mini2440 and the sensor module was immediately available under:

/sys/devices/platform/s3c2440-i2c/i2c-adapter/i2c-0/0-0048

In this directory you have the following:

root@mini2440:/sys/devices/platform/s3c2440-i2c/i2c-adapter/i2c-0/0-0048# ls
alarms name temp1_max uevent
driver power temp1_max_alarm
hwmon subsystem temp1_min
modalias temp1_input temp1_min_alarm

The output on the DS1621 is controlled by the temp1_min and temp1_max thresholds. By default it goes high when temp1_input < temp1_min. You can view the temperature by reading temp1_input and you can adjust temp1_min and temp1_max by echoing the required threshold to the file, for example:

root@mini2440:/sys/devices/platform/s3c2440-i2c/i2c-adapter/i2c-0/0-0048# cat temp1_input
26500
echo 27000 > temp1_min

In this configuration the DS1621 output is high and drives the base of my transistor which switches on an LED. As soon as i heat the sensor the temperature goes above temp1_min the LED turns off.

Although i have no purpose for this circuit it serves as a proof of concept for installing I2C devices on the mini2440.

Here's another pic with the power light on but the output off:

DSC_0052

SMD on veroboard was never meant to look nice!

tags: mini2440, OE