PDA

View Full Version : Can I pick someon's brains please?



lew247
- 21st May 2008, 23:23
Hi guys, I've been reading here for a long time now and know about checking data sheets and searching on google and so on.
However I'm pretty new to Pic programming and I'd like some pointers please (if you dont mind me asking)
I'm trying to make a double thermostat i.e. measure the temperature indoors and outdoors, and if the temperature falls inbetween a certain range then my lcd would do nothing but display both temperatures.
However I'd like 2 switching outputs, so if the temperature was below a certain figure a heater would come on, if it was above a certain figure then a cooler would activate.
Hope I'm making sense so far, and apologies for making this long winded but I figure it best you know as much as possible to give the best answer.

I've decided to use DS18B20's as the sensors.
What i'd like is some pointers on how to get the pic (probably a 16f877 as thats what I have here at the moment) to read the temperatures display both on the lcd and monitor the range of both sensors so it switches only between 2 ranges
for example if the temp is above 20ºC and 25ºC only the temp is displayed on the LCD, but if it goes above 25ºC then an output goes high activating the cooler, similary is the temp goes below 20ºC then another pin goes high activating a cooler.

I'm not asking for finished code, as although it would be totally handy I like experimenting.
What Id like if possible is some help, maybe some kind of flow chart showing the steps I need to take bujt mainly how to get the pic measuring the range of both temp sensors continually and acting on it,
FORGOT to say above, each sensor is in a different room so they both need to be monitored and acted upon independentaly of each other,
hope that all made sense. (using PBP 2.5)
Lew

victorf57
- 21st May 2008, 23:41
Perhaps you can start here.
http://www.rentron.com/PICX4.htm

Victor

lew247
- 21st May 2008, 23:46
Perhaps you can start here.
http://www.rentron.com/PICX4.htm

Victor

Thanks, thats a great help although I had actually seen it when I was doing some research for this, what I dont get is how you use it as a thermostat though, monitoring a certain range of temperatures.
I'm using the 16f877 and the DS18B20 because thats what I have handy at the moment.

mister_e
- 21st May 2008, 23:49
So maybe that?
http://www.rentron.com/PicBasic/one-wire3.htm

lew247
- 22nd May 2008, 00:00
So maybe that?
http://www.rentron.com/PicBasic/one-wire3.htm

I was actually just reading that at the same time you typed that.
it looks extremely promising, although not having used the serout command or serial at all yet it "seems" a bit complex but I'm assuming I can just change the serout commands to lcdout and pick the line i want it displayed.
It's late at the moment and I'll look again tomorrow when I'm fresher, but at a glance I cant see past of that code that compares the range of temperatures and acts on it,(thermostat range) although as I said its late and Im tired so I'm probably missing it.
Thanks for the help so far guys, it's nice being able to pick people's brains and sorry if I seem to be making mistakes and missing things at the moment.

Archangel
- 22nd May 2008, 00:10
Thanks, thats a great help although I had actually seen it when I was doing some research for this, what I dont get is how you use it as a thermostat though, monitoring a certain range of temperatures.
I'm using the 16f877 and the DS18B20 because thats what I have handy at the moment.
Are you asking how to use the information gathered from the DS18B20 ?
something like:


loop:
IF MYVAR1 >= 75 THEN
PortB.1 = 1
IF MYVAR2 <= 65 THEN
PortB.0 = 1
else
portb.1 = 0
portB.0 = 0
serout PortB.6,N9600,[254,128,"Inside temp is,"#myvar1]
serout PortB.6,N9600,[254,192,"Outside temp is,"#myvar2]
endif
endif
goto loop