I’ve been thinking about making a temperature logger for my room and my computer, I set on using DS18S20 sensors from Maxim because they’re common, cheap and overally pretty ideal. My computer is so new that it does not have a serial port (not 100% sure, I think there might be a pinheader on the motherboard with serial port connections) so I have to use USB for interfacing. Next thing I had to do was to make an USB to 1-wire adapter so I could attach the sensors to my computer.

I browsed around for a while and set on using the DS2490 USB-to-1-wire adapter chip because the circuit for it looked pretty simple. I modded the component values a bit from the ones on the original schematic from Maxim to ones I had in hand. I used 0805 sized SMD components because I have those in store.

USB-to-1-wire adapter schematic

USB-to-1-wire adapter schematic

There isn’t any special components except the actual chip (DS2490). The 5V->3.3V regulator chip (MAX8881EUT33) is not crucial and it could be replaced with whatever 3.3V regulator you have in hand. The chokes after the mini-USB connector are just for EMI so they’re not that critical, any low value (under 1µH) choke or just a ferrite bead with the wire going through should work fine. Too much inductance might hamper the USB communication.

USB-to-1-wire adapter finished board

USB-to-1-wire adapter finished board

Getting the board to work in linux (Gentoo) was fairly straightforward. In a nutshell I just have to plug in the adapter, check that the chip is working and gets recognized, mount the owfs filesystem and I’m done. I checked the outputs of commands “lsusb” and “dmesg” to make sure the chip is working and gets recognized.

After I had the adapter working, I made sure the kernel modules “wire” or “ds2490” are not loaded. I don’t want to use those so I unloaded them and added them to /etc/modprobe.d/blacklist to make sure they do not get loaded. Then I installed owfs. I added the USE flags “fuse” and “usb” for owfs. After that I could basically just mount the owfs filesystem with “sudo owfs -u –mountpoint=/path/to/mountpoint/” (you can mount the owfs filesystem to where ever you want, I put it in /var/1-wire/).

But in practice it’s not that simple. The first problem for me was that I could not read the owfs filesystem with my regular user. To get the permissions just right, I added my own user to the group “owfs” and added the group owfs to the group “usb”. Then I had to make a .rules file for udev to make it mount the adapter with its group as “owfs”. I made the file “/etc/udev/rules.d/46-ds2490.rules” which contains (all in one line):

SUBSYSTEMS=="usb", ATTRS{idVendor}=="04fa", ATTRS{idProduct}=="2490", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="owfs", MODE="0664"

Next thing I had to do was to add the line “user_allow_other” to /etc/fuse.conf so we can use the option “–allow_other” with owfs which makes the filesystem available to other users. Now I could just mount the owfs filesystem with the command “sudo owfs -u –allow_other –mountpoint=/path/to/mountpoint/” Now I can print the temperature of one DS1820 sensor with the command (the “10.CDCEFB000800” is the sensors invidual ID): “cat /var/1-wire/10.CDCEFB000800/temperature”

I also built a humidity sensor to my 1-wire network from a DS2438 chip and a HIH4000 humidity sensor. OWFS supports this combination natively and can display humidity values straight up without any conversions.

Humidity sensor for 1-wire network

Humidity sensor for 1-wire network


6 Responses so far.


  1. Johan Arens says:

    Hi there

    Would you mind sharing the circuits and pin-out of your 1-wire humidity sensor ?

    I have been looking for building a humidity sensor.

    As far I understand, the HIH4000 chip is analog and need a DS2438 chip to interface with the 1-Wire bus.

    Thanks !

    J.

  2. Alexey says:

    Hi! Very interesting circuit you have. I’d like to ask you about L1 and L2 elements and Q1 — what is this and which parameters they have?

    Thanks in forward, Alexey.

    • L1 and L2 are ferrite beads (to suppress any noise in the USB power rails), they are not very critical (pretty much any ferrite bead will work. You can also leave them out, it will most likely not make a difference. Q1 is a regular 12MHz quartz crystal.

  3. Ants says:

    Hi. Can you send picture from pcb 1:1 ?

Leave a Reply