User:JanosA

From ArmadeusWiki
Revision as of 19:53, 15 May 2013 by JanosA (Talk | contribs) (RS-485 moved to main Wiki Tree)

Jump to: navigation, search

About Me

I am IP Network and Datacenter engineer, currently I'm working for an Internet Service Provider in Hungary.

My hobby is programming embedded systems and creating my own small electronic boards.

Skills

  • Assembly programming: PIC 8bit family
  • C programming: PIC 8bit / PIC32MX family, Linux
  • Perl, PHP, Javascript, Html programming with MySQL
  • Linux system administration
  • RS-232/485 serial communications: Ascii, Modbus, Saia Sbus, etc.
  • IP networking

My ArmadeuS plans (APF28 based)

  • Creating an universal home automation hardware for my friends, with easy programming in perl or PHP. :)
  • Datacenter temperature monitoring, with RS-485 and OneWire communications.
  • Data logger for Saia Sbus based intelligent power meters.


RS-485

Informations and mini HOWTOs for my APF28/iMX28 mxs-auart and busybox stty patches moved to the main Wiki tree: RS-485


OneWire

Informations and mini HOWTOs for my APF28DEV OneWire patch.


Software installation

  • Recompile your Linux kernel with OneWire GPIO bus master (and some slave device) support.
$ make linux-menuconfig
Device Drivers  --->
    <*> Dallas's 1-wire support  --->
        1-wire Bus Masters  --->
            <*> GPIO 1-wire busmaster
        1-wire Slaves  --->
            <*> Thermal family implementation
$ make
  • Reflash your Linux kernel


Hardware Notes

  • Connect the OneWire slave directly to the APF28_DEV board J9 connector:
 * Vcc 3.3V is pin 1 on J9 connector
 * DQ is pin 31 on J9 (LCD_D18 / GPIO 1_18)
 * GND is pin 39 on J9
  • Add an 1.2k pullup resistor between Vcc and DQ


How it works

The OneWire bus master driver every 10 seconds scan the bus for new slave devices.

Each detected OneWire slave device have a sub-directory with it's unique ID in "/sys/devices/w1 bus master".

The sub-directory format is <2 digit family ID>-<12 digit unique ID>.

# ls -la /sys/devices/w1\ bus\ master/
total 0
drwxr-xr-x    4 root     root             0 Jan  1 01:06 .
drwxr-xr-x    6 root     root             0 Jan  1 01:05 ..
drwxr-xr-x    3 root     root             0 Jan  1 01:06 28-000001e68904
lrwxrwxrwx    1 root     root             0 Jan  1 01:07 driver -> ../../bus/w1/drivers/w1_master_driver
drwxr-xr-x    2 root     root             0 Jan  1 01:07 power
lrwxrwxrwx    1 root     root             0 Jan  1 01:07 subsystem -> ../../bus/w1
-rw-r--r--    1 root     root          4096 Jan  1 01:07 uevent
-rw-rw-rw-    1 root     root          4096 Jan  1 01:07 w1_master_add
-r--r--r--    1 root     root          4096 Jan  1 01:07 w1_master_attempts
-r--r--r--    1 root     root          4096 Jan  1 01:07 w1_master_max_slave_count
-r--r--r--    1 root     root          4096 Jan  1 01:07 w1_master_name
-r--r--r--    1 root     root          4096 Jan  1 01:07 w1_master_pointer
-rw-rw-rw-    1 root     root          4096 Jan  1 01:07 w1_master_pullup
-rw-rw-rw-    1 root     root          4096 Jan  1 01:07 w1_master_remove
-rw-rw-rw-    1 root     root          4096 Jan  1 01:07 w1_master_search
-r--r--r--    1 root     root          4096 Jan  1 01:07 w1_master_slave_count
-r--r--r--    1 root     root          4096 Jan  1 01:07 w1_master_slaves
-r--r--r--    1 root     root          4096 Jan  1 01:07 w1_master_timeout

You can list the detected slaves from this files:

# cat /sys/devices/w1\ bus\ master/w1_master_slave_count
1
# cat /sys/devices/w1\ bus\ master/w1_master_slaves
28-000001e68904

Let's read the temperature: (The 28-xxx family is a DS18B20 temperature sensor in this example.)

# cat /sys/devices/w1\ bus\ master/28-000001e68904/w1_slave
dd 01 4b 46 7f ff 03 10 1e : crc=1e YES
dd 01 4b 46 7f ff 03 10 1e t=29812

The t=29812 means, the temperature is: 29.812°C