USB Indoor/Outdoor Thermometer (or, 'My first USB device')

USB Indoor/Outdoor Thermometer (or, \
This is a simple design that demonstrates the USB peripheral on the PIC 18Fs. There are a bunch of examples for the 18F4550 40 pin chips online, this design demonstrates the smaller 18F2550 28 pin version.

The PCB uses surface mount parts, but all components are available in through hole versions. I use surface mount parts because its faster to make the board without drilling holes.

The end result is a small USB peripheral that measures indoor/outdoor temperatures. Data is available to the PC through a virtual serial port. Temperature sensors are used in the example, but other analog sensors can be added.

P.S.
See a live graph of the data from my logger here:

http://www.syndicit.com/stream/ian/nieuwemarkt/indoor_temperature/?format=graph

 
Remove these adsRemove these ads by Signing Up
 

Step 1Design Overview

Design Overview
Required PIC components
This USB peripheral is based on the 28 pin PIC 18F2550. This chip has everything needed for a full speed USB interface.

A 0.1uf capacitor between power and ground decouples the PIC from the power supply.
A 20MHz crystal (used to generate a 48MHz internal clock) and two 27pf capacitors.
A 10K resistor from power to the MCLR pin. I added a 1n4148 equivalent diode between the resistor and power so that the 13+volts placed on MCLR during programming doesnt damage other components on the circuit board.
An ICSP header (5 pins) is used to program and debug the device.

Required USB stuff
A USB female B style socket.
220nf-440nf of capacitance is required for the internal USB voltage regulator. I use two 0.1uf capacitors (same as used for decoupling) without a problem.
A LED with 330ohm current limiting resistor is used to display USB connection status.

Required sensor stuff
I used the microchip TC1047A temperature sensor as the indoor temperature sensor. It is physically soldered to the board - this causes it to run a few degrees hotter than room temperature.
A header is used to connect an outdoor temperature probe (TO-92 version of TC1047a). An additional 0.1uf capacitor helps decouple a long wire run from the rest of the board.
USB voltage levels are not consistent enough to accurately measure and compute temperature from the analog sensors. An external voltage reference (MCP1525, 2.5volt) is used. The voltage reference requires a capacitor on the output of 1uf to 10uf. Without this capacitor the voltage reference will not work.
« Previous StepDownload PDFView All StepsNext Step »
41 comments
1-40 of 41next »
May 13, 2008. 3:02 AMthermoelectric says:
could you mod this to sence temp in a fridge/freezer and activate a relay at a certain temp while showing temp while a pc is off?
May 13, 2008. 10:30 PMthermoelectric says:
how would i make that with a usb and without (so i can use one or the other)
May 13, 2008. 11:10 PMthermoelectric says:
i know about all the components but i just don't know how to use microchips in circuits
Dec 17, 2007. 10:33 AMtradergordo says:
Any idea how I could do high temp monitoring for a woodstove. I assume I need a high temp capable thermocouple - but I'm not sure how I can interface that with a device like this?
Jul 12, 2007. 12:29 AMdavidgreenpea says:
Sweet work! Really inspiring, even if I'm in a bit over my head. I too, am wondering how difficult it is to get Mac support for the usb - would it require writing a driver, or are there any pic drivers out there? Or would it just work as a standard serial port???

As to making surface mount boards, the best I've seen is the skillet method. Here's a link to some great lead free solder paste that doesn't even need refrigeration - it's about 35 bucks a syringe and that's including shipping.

http://www.celeritous.com/estore/index.php?main_page=index&cPath=6_17
Feb 19, 2007. 3:30 PMzuixro says:
This is perfect for what I need. Great instructable, but one question; How crucial are the values of the caps for the crystal. Somewhere I saw that you should match the impedance of the crystal. You say 27pf somewhere on this page, but the eagle file says 30pf. I don't think that it really matters that much. Great instructable!
Feb 22, 2007. 5:02 PMzuixro says:
Or will a 3 terminal crystal resonator work?
Feb 22, 2007. 8:36 PMzuixro says:
Sorry, Ceramic Resonator.
Apr 26, 2007. 12:31 AMJames (pseudo-geek) says:
sure, it will work, just run the grounding wire through a rectifier matrix use .7 less volts. should work fine. (lol jk, if you know anything about electronics at all you'll figure out that theres no such thing as a "rectifier matrix" and .7 less volts wont do anything. I dont know if your idea will work but its sounds ok.)
Apr 26, 2007. 6:08 AMzuixro says:
Ok, I've looked into this a little, and it seems to me like a 20Mhz resonator would work, but it wouldn't be as stable/exact/accurate. I don't think that this needs to be overly stable/exact/accurate so I think it would work fine in this.
Jan 30, 2007. 10:00 AMfloehopper says:
Does anybody know if this will work with a Macintosh computer?
Aug 31, 2006. 1:08 AMrgbphil says:
I just finished re-laying out the microdot before writing this email. A little cross-eyed at the moment, I'll sleep dreaming of red and blue lines in my head. I couldn't fit any more than the LEDs and switches though for extra functionality as we've previously discussed...trying to keep it small. Was a little disappointed I had to add an extra 5mm to the dimensions...but it should still fit on a wrist. Currently 1.3x1.1inchs. I'll keep the icd in mind, though eventually I went and bought a meLabs USB programmer rather than fiddle around trying to make one. Nice little unit but no ICD as far as I can tell. Fortunately I've got a 18F2550 hanging around, so along with etching up a microdot and a couple of paying jobs, I'll etch up the thermometer, burn your code into it and see if I get a virtual comm port....that'll be the final test to see if it works with USB1.1
Dec 15, 2006. 6:34 AMbob_appax says:
please get me some examples of using the 18F4550...using usb incircuit progamming...please...it would be of great help
Nov 2, 2006. 1:45 PMzozodi says:
Great project. Would you please write down which software do you use for 3D design board in picture above.
Oct 19, 2006. 3:39 AMLarryDawson says:
Hello, Thank you for sharing your really great project and its assembly information. I have learned quite a lot from it. I've got one quick question. You stated "I use surface mount parts because its faster to make the board without drilling holes". Could you please explain how a hobbyist can mount surface mount parts, or point me to a good explanation website. Thanks again, Larry
Sep 8, 2006. 10:29 AMunknownserv says:
How would I go about doing this without a PCB?
Sep 9, 2006. 11:39 AMunknownserv says:
Thats what I was thinking, tho i'm new to electronics (well, making them ;) ) How do you join the various components up on a breadboard?
Oct 11, 2006. 9:09 AMsavvy9999 says:
Wires-- jumper wires made of solid 22 gauge wire. Google "proto breadboard" and you'll see kits on ebay.
Oct 2, 2006. 11:21 PMktulu1115 says:
This is great!! You're absolutely right - it's seriously the basics of a homegrown amateur weather station, and doesn't cost no $400 either. I've been wanting a DIY like this for some time now. How difficult would it be to modify to create a several channel version? Wired at first but I'm curious how difficult it would be to read in data from one of those wireless Oregon sensor things...
Aug 30, 2006. 10:41 PMrgbphil says:
Hi Ian, Nice to see another project from you. Been trying to get the CDC code into Sourceboost (my fav compiler).....but this might just encourage me to installed C18 again. A question though, does the CDC driver work with an older USB1.1 port? I've got an old IBM R31, as I said I'm porting CDC to Sourceboost, but don't know if the problems in establishing a virtual comm port are in my code, or the driver. I've got everything enumerating etc.....just no comm port. Phil PS: Received an instructables tee-shirt for the mini-dotclock, huzzah!....and now I've sorted out the problems doing ICSP for 16F88SOIP20 pin I can get back to work on the Microdot Pattern watch. FYI for anyone using the 20pin version of the 16F88 SOIP, this device has two seperate power pins for AVss/AVdd, for the A/D converter. These pins need to be connected for ICSP to work. That took a bit of figuring out and frustration.
Sep 9, 2006. 12:01 AMrgbphil says:
Speaking of the microdot.....ta-dah!!! I've got it to the equivalent functionality of the minidot clock...ie it's a boring old timepiece atm, looking for some cool ideas to code up before putting up the instructables. So far I have: - count up/count down timer. - detector/rejector...the LED bars act like a sort of VU meter. When this function is selected the bars sort of randomly increase to max or descrease to zeroin about 20seconds, zigging up or down like a VU meter on a stereo . With a bit of showmanship you could make an idiot detector and point to your chosen idiot at just the right time. - party mode....some sort of running animation ...any more ideas? Phil
100_0735.jpg
Sep 9, 2006. 4:13 AMrgbphil says:
Thanks, it's amazing how close it came to the original 3D from povray. Pattern upload might make it to the next layout of the board. I made a few mistakes like assuming you can use weak pullups on portb at the same time as running a charliegrid (ie wrong assumption)....so I need to add a few more parts. I might add IR for upload (or blinking dot on the computer screen maybe??). Learnt a few other interesting things which I'll have to write up properly. When I first built it I put my 15 channel PWM program in (RGBSPCHIP5 from www.rgbsunset.com plug plug :-) ), the grid responded very nicely to random PWM which I wasn't sure of until trying out a charlieplex grid. Highly recommended by the way those charliegrid thingies. The PWM should go well with the next gen charliegrid (pictured) which if I did it at the same rate as the microdot should be next year sometime!
microdot.gifmaxigrid.jpg
Sep 5, 2006. 5:42 PMBCHurricane89 says:
Where can you buy these parts? I would like to buy the parts, so I can do this little project. What is the approximate cost too?
Sep 5, 2006. 12:15 AMSarMANMANMANMAN says:
so where do i get the parts and equipment to make this kind of stuff because i just found this site and the stuff here looks really cool
Aug 30, 2006. 12:02 PMNeodudeman says:
Whoa! That's cool!
1-40 of 41next »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
125
Followers
30
Author:ian(DangerousPrototypes.com)