a friend of mine asked me to make a very simple device for him. He wants to measure temperatures, record it on a PC and do some very basic stuff with it (that's not the interesting part). I have already had him purchase an Arduino Pro Mini (I LOVE it for its size and versatility) and a DS18B20 temperature sensor but reading through the sensor datasheet I realized that this is in fact a rather smart IC and the Arduino would have next to no job at all. Since using a 16MHz AVR as a digital-to-USB converter is a tremendous overkill my question is: how can I connect the digital output from the sensor to the computer in such a way that it will be (relatively) easily used by a program (LabView or something I would write in C/C++).
I figure there must be a way and using some basic circuit with an IC or two wouldn't scare me, but I have literally no idea how to start.
Take a look at your PC. What options are there for connecting the IC to the PC? Serial? Parallel? VGA? SVGA? Firewire? USB? HDMI? None of those seem appropriate to me. At a minimum, you'd need something between the PC and the IC. Using the Arduino with its built-in USB to serial converter seems like a no-brainer to me.
Here is the datasheet for the sensor: http://datasheets.maximintegrated.com/en/ds/DS18B20.pdf
It uses one open-drain pin (and a common ground) to send a 12 bit digital signal. The ground and the 5V from the USB are in place. I just need to figure out a way to have the PC communicate with the sensor. I know the USB uses two data lines (TX and RX) so I definitely need some sort of conversion there. Thanks for the help.
bakadave:
Since using a 16MHz AVR as a digital-to-USB converter is a tremendous overkill ...
Indeed it can seem that way, but consider the cost and ease of implementation. For one-offs or small numbers, investing a couple bucks in a microcontroller hardly seems extravagant. A single ATmega328P from Mouser is currently $2.24, an ATtiny84A is $1.38. But implementing a custom solution with a factory MCU has its costs as well. The Pro Mini is nearly half the price it was a couple years back, seems like it could well represent the most expedient and cost-effective solution.
Honestly, I was expecting a rather low cost solution with some minimal tinkering required. Programming an ATtiny 85 is a bit more than what I had bargained for. And not to mention more expensive.
But at least I learned something today 8)
I suggest something like the Leonarduino, which you can find about half way down this page Cross Roads Electronics. You could leave off the parts that you don't need.
He needs a USB interface to the PC, which an ATtiny can't do by itself. That is why I suggested a reduced Leonardo clone. An ATtiny + FTDI cable would be another possibility.
dc42:
He needs a USB interface to the PC, which an ATtiny can't do by itself. That is why I suggested a reduced Leonardo clone. An ATtiny + FTDI cable would be another possibility.
Yep, a whole range of USB to TTY converters on ebay, you could use an attiny85 and softserial with 5v and the serial converter cable... or connect a bluetooth board to it and then interface via a virtual com port pc side.
After looking at the page, that is an attiny doing the job of conversion from usb (which are more like data packets) to tty, so it can be read over uart.
An Arduino is a sensible solution to this problem - it's ideal for fiddling with digital signals at low data rates which is exactly what is required here.
Given that bakadave already has an Arduino Pro Mini and a DS18B20 temperature sensor which will work fine with it, why are any other options being proposed? None of the other options are going to be easier or cheaper or better than using the bits that he already has.
PeterH:
Given that bakadave already has an Arduino Pro Mini and a DS18B20 temperature sensor which will work fine with it, why are any other options being proposed?
We are proposing a simpler (parts-wise) solution since OP asks this question "Do I need an Arduino at all?" ...
Zapro:
We are proposing a simpler (parts-wise) solution since OP asks this question "Do I need an Arduino at all?" ...
Understood, but given that the OP already has a suitable Arduino, proposing any other type means additional cost, time and effort. Nothing you propose can ever be cheaper, simpler or more convenient than the one he already sitting right there in front of him.