Jump to content

Temp controller


SpidersWeb

Recommended Posts

mwuahaha

I've gone crazy, and I don't really need to do this, but it looks like fun.

I've ordered a PICAXE 08M kit, temp sensor (apparently accurate to 1/10th of a degree celsius), and an 8x2 output display.

Why?

Well I notice tank temps relying on bi-metal thermostats isn't accurate, and there is no way the tank temp will be near as stable as wild conditions. I also hate it when heaters fail, so want something to audibly alert me to such conditions.

For those not familiar with the PIC chips, they're a programmable micro-controller. I'm going to program it to first display temperature, and then later control either a normal heater by 240V relay OR use a heating coil in the filter outlet, and use PWM to accurately control water temp.

I could also ad an EPROM chip later to record data logging of temp changes during the day. A piezo can be added so if temp is outside an acceptable range the unit can beep. It could also be set if tank temp is over 2C to flick a relay to completely cut power to the heating coil as an extra backup.

The 08M chip is the cheapest with suitable inputs and outputs. Has PWM output if I want to use it, serial in for the temp sensor, serial out for the display, and 4 other inputs and outputs for general use. It holds 80 lines of code which should be sufficent.

Thought I'd let you all know of my little idea, and hopefully I'll be updating this thread to let you know how I get on.

Link to comment
Share on other sites

  • Replies 50
  • Created
  • Last Reply

Top Posters In This Topic

Oh dear... a fish geek who's also an electronics geek. Where will the gadgetry stop?!

Yeah I swear there is something wrong with me, my car stereo is getting rediculous as well, moves my hair when its up loud :o

fun fun!

No suprise I work in IT as well.

Other applications for this could include fan controllers for native coldwater fish tanks, or as a thermostat for multiple fish tanks. I should be able to rebuild them for $30-40. Thanks for the luck, and I'll certainly enjoy it, been wanting to do something like this for years.

Link to comment
Share on other sites

I've been looking at the PICAXE controllers as well. I even downloaded some software and had a play writing some code, the simulaters are good so you don't need controller itself to try it out.

Have a look at this, it's basic temperature controller for fans.

http://www.masa.asn.au/phpBB2/viewtopic.php?t=188259

All of the stuff you get in the starter kits you can buy seperately, down load, or make for less than the kits cost.

Link to comment
Share on other sites

Yeah I got my starter kit from SurplusTronics, was like $40 which is cheap enough. Just realised I'm actually going to need the 18X and build a small EEPROM interface.

Means I can use 12bit temp sensing, and remember settings on power off.

Sure I can still have lots of fun with the 08M though :)

Can you copy and paste that info, I'm not a member (and don't really want to sign up).

Link to comment
Share on other sites

Gave it a go but it I couldn't copy the Pic which had the circiut diagram. but here is the code for it. Hope he doesn't mind me posting this, guess he'll send the boy's round if he does.

'For PICAXE-08M

'Reads Temp from DS18B20 and adjusts fan speed via MOSFET

SYMBOL MAXTEMP = 480 'temps are degrees x 16

SYMBOL MINONTEMP = 432

SYMBOL MINOFFTEMP = 424

SYMBOL CALIBRATETEMP = 3

SYMBOL MAXSPEED = 200 'must be <= 4 x pwm period (50)

SYMBOL MINSPEED = 50 'must be high enough to start fan

SYMBOL TEMP = w0

SYMBOL SPEED = w1

w2 = MAXTEMP - MINONTEMP 'temp range

w3 = MAXSPEED - MINSPEED 'speed range

w4 = w3 / w2 'integer part of ratio

w5 = w3 // w2 'remainder of ratio

for b12 = 1 to 4 'flash LED on power on

high 1

pause 20

low 1

pause 200

next

do

high 1 'flash LED on temp read

pause 20

low 1

readtemp12 4, TEMP 'read temp from DS18B20

TEMP = TEMP + CALIBRATETEMP

sertxd(#TEMP,13,10)

if TEMP = CALIBRATETEMP then

for b12 = 1 to 4 'flash LED if no temp data

high 1

pause 200

low 1

pause 100

next

high 1

pwmout 2, 0, 0

high 2 'fan on high if no temp data

else if TEMP > MAXTEMP then

pwmout 2, 0, 0

high 2

else if TEMP >= MINONTEMP then

SPEED = TEMP - MINONTEMP * w4 'convert integer part of temp to speed

SPEED = TEMP - MINONTEMP * w5 / w2 + SPEED 'convert remainder part and add interger part

SPEED = SPEED + MINSPEED

pwmout 2, 50, SPEED

else if TEMP < MINOFFTEMP then 'fan will stay on low between MINONTEMP and MINOFFTEMP

pwmout 2, 0, 0

low 2

end if

pause 5000

loop

Link to comment
Share on other sites

Ok so the kit turned up yesterday.

Screen (I got a 8x2 LCD display, cheap one, not the blue backlight style), was a lot smaller than I expected, but will still do the job just lovely. Unfortunately I made the mistake of assuming it just took serial data, but it doesn't have a controller, so I either need a big PICAXE chip to manually control the points, or (better option) use their LCD Firmware chip which is soooooooooooooo much easier to program with.

But anyway, built the kit, and hooked it to the computer, worked first time yey! I wrote a small program to slowly pulse pin 2, got the multimeter and it worked perfectly. Completely problem free project, already loving it.

I also need a pile of common resistors, diodes, and maybe a darlington array or three before I can do much interesting stuff. I didn't even have a spare LED at home to make a pretty flashy light.

So yeah, stoked, but also annnoyed the LCD didn't have a serial interface built in. Surplustronics threw in a second temp sensor free and optional the power filtering capacitor. Not expensive items but just that little bit extra can make the difference.

Link to comment
Share on other sites

Get the serial lcd backpack unit from mailtronics.

Are you a brightsparks member?

Cheers, I'll look in to that. Not a brightsparks member. I'll go hunt that down, did see that orcon website that talked about brightsparks.

Yes I considered relays, and at this moment it's the only thing I have to work with. Trouble is I don't want the heater running FULL ON full off, I want the controller to maintain tank temperature without creating sudden ups and downs in temp, so being able to lower the voltage or PWM the signal would be ideal. This is still a way off yet, hopefully I learn a lot more before I get a heater connected.

Tonight I want to get the thermostat running, and some form of display. Gonna go grab some supplies from gaycar/dse at lunch.

Thanks again :)

Link to comment
Share on other sites

You could have the ON off thing but have it so that if it strays by .1 degree from set value the heater starts then when it gets back to set value it turns off. That way it would be accurate to .1 degrees.

You could also use a really low powered element.

Where would you put the temp sensor?

Link to comment
Share on other sites

Well I've got bigger fish to fry before I deal with heaters aynwho.

I wanted to avoid moving parts, such as relays, but if I need to then I will, not a big deal. I was wanting crazy accuracy, and not because I need it, but because I'm tired of seeing my tank temp vary, particularly on fry tanks, and wanted a fun practical project to do.

Was wanting to put one sensor on the filter intake, and one sensor on the output past where the heating coils would be, so the unit, with logging, could learn how to control the temp. (e.g. if input is 26C and output needs to be 28C, the element should be on for x secs or get so much power (PWM/Amp), if it fails, records for next time. etc.

But anywho, getting ahead of myself!

What I've been looking at today is interfacing with the LCD.

Maltronics is for schools btw, they're not a retailer. Surplustronics has the serial to LCD for $27, but that's not viable if I ever wanted to make more of these. So went looking for solutions, found a serial in parallel out shift register chip that you can buy for $1.25. This combined with 3 of the controller pins, will run the display nicely.

Just had another brain wave, if I put an octal counter on my fake 'clock' line, I'd only need two pins. hmm I'll draw up what I have in mind...

Want to be able to build these for under $50 when finished, so $27 LCD interface doesn't cut it, I'll do it manually ;)

Link to comment
Share on other sites

hi guys read your posts with gusto.

but i all I see is

ydish gobble yuk yuk hehawah .1volt 96kw yad yady yadhah.

So can some one do an IT/electronics geek -english translation?

Or do i just need to nerd up....no offence intended

Navarre

Link to comment
Share on other sites

haha

I'm just learning how to do things here. If I get good success with this, I'll convert it in to plain english for the regular folk. Isn't really a simple version of the posts above. e.g. the terminology is there because that's what things are called, not because we're trying to be technical :)

Wouldn't recommend it without an electronics background of some sort.

Yell out if there is something specific you're not following though and I'll do my best to explain!

Link to comment
Share on other sites

hi guys read your posts with gusto.

but i all I see is

ydish gobble yuk yuk hehawah .1volt 96kw yad yady yadhah.

So can some one do an IT/electronics geek -english translation?

Or do i just need to nerd up....no offence intended

Navarre

hes making a doohicky that turns heaters and fans on or off depending on temprature

Link to comment
Share on other sites

I am using a serial interface, just using my own.

$2.25 worth of chips + my time vs $27 chip everytime I make one, not sure what the price is through brightsparks but still, this works :)

I'm using a 4017 decade counter combined with a serial to parallel shift register. The microcontroller will pulse the 4017, and outputs 0-9 from the 4017 will clock the shift register which will be receiving data from the microcontroller, bit by bit. On the 9th count the controller wont send data, but the 4017 will poke the register to send the data, we ignore cycle 10, and start all over again.

So far I've sorted the 4017 part of the circuit. I've got it setup (and it's working) so one LED flashes, and another flashes only on the 10th occurance. Easy as piss. Doesn't make my project more complete but it educates me on the 4017 and I got to see my idea working. A valuable lesson I picked up, was the output voltage of the 4017 when high (with 4.8V in) is only 3.8V out, so to keep the signal strong I should use transistors when relaying the signal. I have to investigate that more, but sounds easy enough, otherwise by the time the LCD display gets the signals the voltages will be poopy.

So tomorrow's mission is to connect the shift register, write a program, and just have an LED on each of its outputs. The idea being I send 01010010 or something, and the appropriate LEDs should light up correctly all at once on count 9. I've got a meeting until like 7PM so this might not happen, maybe Thursday.

Learning heaps, but still to scared to program in assembler, using the PIC Basic. Here is my goofy little loop for testing I've been using:

mainloop:

	high 2

	pause 700

	low 2

	pause 700

	gosub mainloop

Any questions about what I'm doing or have done just ask!

Chip numbers are MC14017B for the decade counter/divider, and MC7411C595A for the shift register. Both available at any dick smiths for around $1 each.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...