First program I've writen - any sugestions?

leds4u

New Member
This is the first Program I've written without copping anything, it's for a greenhouse - open and close the vent according to temperature, and water when soil gets to dry. I know it's probably a real mess, but is there any parts that could do with a tidy up, or rearrange? because it's a bit unreliable, like it will suddenly trigger and open the vent for no apparent reason, and some times it all freezes and needs a reset. I have diodes on all relays and a cap in the regulated power supply.

Any hints or tips greatly appreciated!

'Aaron's Green House Controller 18x


symbol Menu = pin0 'Bottom Left
symbol switch1 = pin7 'Top Right
symbol switch2 = pin6 'Bottom Right
symbol Water = 0
symbol ventup = 6
symbol ventdown = 5
symbol psu = 4
symbol green = 2
symbol red = 1
symbol temp = b2
symbol opentemp = b3
symbol wateron = b0
symbol wetness = b1
symbol ask = b4
symbol waterdisp = b5
symbol waterontime = b10
symbol ask1 = b7
symbol watercount = w4


Init:
high 7
pause 500
wateron = 50
opentemp = 30
waterontime = 90
low 0,1,2,3,4,5,6
serout 7,T2400,(254,1)
pause 30
serout 7,T2400,(254,128,"Initializing")
pause 1000

Systemrunning:
serout 7,T2400,(254,1)
pause 30
serout 7,T2400,(254,128,"System Running ")
b6 = 0
low red
high green
pause 1000
Charlie:
serout 7,T2400,(254,192,"Menu ",#temp,"C ")
button 0,1,100,100,b6,1,showoffdemo
gosub checkinputs
pause 1182 'calibrated so loop repeats every 2000ms
goto Charlie

Showoffdemo:
b6 = 0
low green
high red
serout 7,T2400,(254,1) 'clear lcd
pause 30
serout 7,T2400,(254,128,"Show Off Demo!")
serout 7,T2400,(254,192,"Menu Start")
pause 1000
cont:
button 0,1,4,5,b6,1,tempadjust
button 6,1,100,100,b6,1,Demorunning
pause 50
Goto Cont

Tempadjust:
b6 = 0
serout 7,T2400,(254,1) 'clear lcd
pause 30
serout 7,T2400,(254,128,"Temp Adjust ",#temp,"C") ' with actual temp on same line
serout 7,T2400,(254,192,"Menu Change")
pause 1000
cont2:
button 0,1,100,100,b6,1,wateradjust
button 6,1,100,100,b6,1,Openingtemp
pause 50
Goto Cont2

Openingtemp:
serout 7,T2400,(254,1) 'clear lcd
pause 30
serout 7,T2400,(254,128,"Opening Temp +")
serout 7,T2400,(254,192,"Save -")
serout 7,T2400,(254,198,#temp,"C ",#opentemp,"C ")
pause 1000
cont3:
pause 50
button 0,1,100,100,b6,1,tempadjust
button 7,1,4,5,b6,1,hotter
button 6,1,4,5,b6,1,cooler
goto cont3

Wateradjust:
serout 7,T2400,(254,1) 'clear lcd
pause 30
serout 7,T2400,(254,128,"Water Adjust")
serout 7,T2400,(254,192,"Menu Change")
pause 1000
cont4:
pause 50
button 0,1,100,100,b6,1,wateringontime
button 6,1,100,100,b6,1,wetness1
goto cont4

Wetness1:
serout 7,T2400,(254,1) 'clear lcd
pause 30
serout 7,T2400,(254,128,"Water On +")
serout 7,T2400,(254,192,"Save -") 'b0
serout 7,T2400,(254,199,#wetness,"~",#wateron)
pause 1000
cont5:
pause 50
button 0,1,100,100,b6,1,wateradjust
button 7,1,4,5,b6,1,wetter
button 6,1,4,5,b6,1,drier
goto cont5

WateringonTime:
serout 7,T2400,(254,1) 'clear lcd
pause 30
serout 7,T2400,(254,128,"Water On Time")
serout 7,T2400,(254,192,"Menu Change")
pause 1000
cont6:
pause 50
button 0,1,100,100,b6,1,systemrunning
button 6,1,100,100,b6,1,wateringontime1
goto cont6

WateringonTime1:
serout 7,T2400,(254,1) 'clear lcd
pause 30
serout 7,T2400,(254,128,"Water Duration +")
serout 7,T2400,(254,192,"Save -") 'b0
serout 7,T2400,(254,198,#Waterontime,"Mins ")
pause 1000
cont7:
pause 50
button 7,1,5,3,b6,1,watercountup
button 6,1,5,5,b6,1,watercountdown
button 0,1,100,100,b6,1,wateringontime
Goto cont7

Checkinputs:
readadc 2,wetness 'b1
if wateron => wetness then gosub waterons
if ask1 = 1 then gosub timer1
readtemp 1,temp 'b2
if temp => opentemp then goto open
if temp < opentemp then goto close
pause 100
return

Timer1:
watercount = watercount + 2
w6 = waterontime * 60
if watercount => w6 then
ask1 = 0
watercount = 0
pwmout 3,0,0
endif
return

Waterons:
if wetness =< wateron and ask1 = 0 then
pwmout 3,99,400
ask1 = 1
endif
return

Watercountup:
waterontime = waterontime + 1
serout 7,T2400,(254,198,#waterontime,"Mins ")
goto cont7

watercountdown:
waterontime = waterontime - 1
serout 7,T2400,(254,198,#Waterontime,"Mins ")
goto cont7

Hotter:
opentemp = opentemp + 1
serout 7,T2400,(254,198,#temp,"C ",#opentemp,"C ")
goto cont3

Cooler:
opentemp = opentemp - 1
serout 7,T2400,(254,198,#temp,"C ",#opentemp,"C ")
goto cont3

Drier:
wateron = wateron - 2
serout 7,T2400,(254,199,#wetness,"~",#wateron," ")
goto cont5
Wetter:
wateron = wateron + 2
serout 7,T2400,(254,199,#wetness,"~",#wateron," ")
goto cont5

Open:
if ask = 2 then return
endif
high psu
pause 1000
high ventup
serout 7,T2400,(254,128,"Opening Vent... ")
serout 7,T2400,(254,192,"Temp Over ",#opentemp,"C ")
pause 10000 ' what ever it takes
low ventup
pause 300
low psu
ask = 2
serout 7,T2400,(254,1)
serout 7,T2400,(254,128,"System Running ")
return

Close:
if ask = 1 then return
endif
high psu
pause 1000
high ventdown
serout 7,T2400,(254,128,"Closing Vent... ")
serout 7,T2400,(254,192,"Temp Under ",#opentemp,"C ")
pause 10000 ' what ever it takes
low ventdown
pause 300
low psu
ask = 1
serout 7,T2400,(254,1)
serout 7,T2400,(254,128,"System Running ")
return

Demorunning:
serout 7,T2400,(254,1) 'clear lcd
pause 30
serout 7,T2400,(254,1)
serout 7,T2400,(254,128,"Demo Running...")
high psu
pause 1000
high ventup
serout 7,T2400,(254,192,"Opening Vent... ")
pause 10000 ' plus abit more
low ventup
pause 1000
high ventdown
serout 7,T2400,(254,192,"Closing Vent... ")
pause 10000
low ventdown
pause 1000
low psu
pause 1000
pwmout 3,99,400
serout 7,T2400,(254,192,"Start Watering..")
pause 5000
pwmout 3,0,0
serout 7,T2400,(254,192,"Stop Watering...")
pause 1000
goto showoffdemo
 

Attachments

westaust55

Moderator
Hi Aaron,

Hopefully you will find these comments as constructive:

1. Add a header with some details and lots of comments on the end of the program lines so others and later even you know what the program is doing.

2. Use white space and tabulation to show the program structure.
By way of example:
Code:
SYMBOL An_Alias = b0
SYMBOL counter = b1

Init:
    An_Alias = 55

Main:
    FOR counter 1 TO 255
        SEROUT 7, N2400, (#counter)
        
        IF counter = 25 OR counter = 155 THEN
            SEROUT 7, N2400, ("Magic numbers!")
        ELSEIF counter = 55 OR counter = 225 THEN
            SEROUT 7, N2400 ("Other numbers")
        ENDIF
    NEXT counter
See how each level is indented further so it is clearer what part of the program falls under the control of a looping or testing function, etc
 

SAborn

Senior Member
What picaxe are you using, as i guessed the 20m but the syntax dont make sense if using a 20x2.

Be nice if you used the tab key and put your program into a standard layout to make it easier to read.

Can you list the areas that are having problems so we can isolate the areas.

Nice attempt but its doing my head in trying to make sense of it all.
 

inglewoodpete

Senior Member
This is the first Program I've written without copping anything, it's for a greenhouse - open and close the vent according to temperature, and water when soil gets to dry. I know it's probably a real mess, but is there any parts that could do with a tidy up, or rearrange? because it's a bit unreliable, like it will suddenly trigger and open the vent for no apparent reason, and some times it all freezes and needs a reset. I have diodes on all relays and a cap in the regulated power supply.

Any hints or tips greatly appreciated!
That's quite a program! Your use of descriptive names for variables and goto/gosub names is good. I always encourage that, as well as lots of comments. It helps the reader to understand how execution leaves a loop as well as reaching it.

The challange for me is to try to understand the flow of execution: you may have heard people refer to "spaghetti" code. For someone not familiar with your program, it takes quite a while to get to know what is happening and where.

A couple of points that should help when designing a program.
- Break your code up into small blocks or subroutines.
- Put all of your button or 'inputs' code in one block (or in one loop if you can do it) and jump (preferrably gosub) to the action code, returning to the main loop/block once the action has been completed.

Finally, you are very brave using the button command, something I have not tried after several years of programming PICAXEs:rolleyes:. Could this command inadvertantly be causing your lockups?

SAB: 18x, at the top of the code
 

MartinM57

Moderator
What picaxe are you using
Says 18x at the top and the circuit diagram shows 18 pins...

Nice attempt but its doing my head in trying to make sense of it all.
Agreed.

leds4u - you have written what's called "spaghetti code". It's like trying to follow a single piece of spaghetti in a bowl full - it goes everywhere ;)

Spaghetti code can work perfectly, but it's usually difficult to prove that it will (the problem here) and it's very hard to write to make it work (you've probably found that).

You do use GOSUBs which is good, but you use too many GOTOs - there will definitely be a more elegant GOTO-less (i.e. none) piece of code that will do exactly what you want. I suspect others might pitch in with some ideas how to do it.

All I can suggest to do with the current code is to get out a printout of it, get your pencil out and pretend you are the PICAXE - follow the code, line by line, choose an easy steady state set of values that makes the code do the same paths all the time and then slightly change them so that different code is executed. You might find the problem...

EDIT:agree about the BUTTON command. I don't think many people use it. For your need of simple button detection, just read the button pin and use an IF statement
 
Last edited:

leds4u

New Member
Hey thanks guys for all your comments, I'll have another go at it tomorrow and see if I can get rid of some of the spaghetti. Thanks heaps!
 

MartinM57

Moderator
...it might also be a hardware problem:
- is it really a 9v battery or is it some sort of power supply
- you have no capacitors in your circuit at all - a non-trivial circuit with no capacitors is probably a wrong circuit - search for the many threads here about decoupling and reservoir capacitors (they only come up about once every 18 hours ;))
- less than perfect construction - can you post a picture to see what we're dealing with?
 

SAborn

Senior Member
Ya i missed the 18x and cant count either by looking at the schematic.

Just wondering if ....
:SAB 18x, at the top of the code
was short for me.

Or .... Son of A Bit-h?
 

Technical

Technical Support
Staff member
Finally, you are very brave using the button command, something I have not tried after several years of programming PICAXEs:rolleyes:.
We've updated the button command description in the latest manual (7.0) to try to make it's (complex) operation a bit clearer. Give it a go!
 

leds4u

New Member
Yeah - the schematic was just a quick throw together. The power supply is a transformer with a 7805 for the circuit, and 7812 for the relays. I see I put a cap before the 78xx's but not after, so I'll add one to the board as well. I've got a few photos, but it would be a little hard to trace anything. the photo of the track side of my board looks real messy, but some of that is how the light caught it, and the other half is that I left it too long in the etchant. :eek:
 

Attachments

leds4u

New Member
My next attempt is looking like this - any better?

Main:
readadc 2,Wetness
if Wetness <> WaterOn then gosub ReadWater

readtemp 1,Temp 'b2
if Temp <> Temperature then gosub ReadTemperature

if Menu = 1 then gosub Menus
if Switch1 = 1 then gosub CheckSwitch1
if Switch2 = 1 then gosub CheckSwitch2
pause 100

goto main

Menus:
if b5 > 4then
b5 = 0
endif

Branch b5, (Menu0,menu1,menu2,menu3,menu4)
return

Menu0:
serout 7,T2400,(254,1)
pause 30
serout 7,T2400,(254,128,"System Running ")
serout 7,T2400,(254,192,"Menu ",#temp,"C ")
low red
high green
b5=1
return


Menu1:
serout 7,T2400,(254,1) 'clear lcd
pause 30
serout 7,T2400,(254,128,"Show Off Demo!")
serout 7,T2400,(254,192,"Menu Start")
low green
high red
b5=2
return


Menu2:
serout 7,T2400,(254,1) 'clear lcd
pause 30
serout 7,T2400,(254,128,"Temp Adjust ",#temp,"C")
serout 7,T2400,(254,192,"Menu Change")
b5=3
return

Menu3:
serout 7,T2400,(254,1) 'clear lcd
pause 30
serout 7,T2400,(254,128,"Water Adjust")
serout 7,T2400,(254,192,"Menu Change")
b5=4
return

Menu4:
serout 7,T2400,(254,1) 'clear lcd
pause 30
serout 7,T2400,(254,128,"Water On Time")
serout 7,T2400,(254,192,"Menu Change")
b5=0
 

Attachments

Last edited:

Dippy

Moderator
LEDS4U. That's quite a drop of code. Very brave :)
I haven't looked at it as there is too much pasta in it and I'm not a 'button' fan.:)

Get a pen and paper, make a flow chart and then see how you can put it into a routine format i.e. GoSubs and dump Goto as much as possible. Ah -crossed post...

PLEASE remember, it will take someone quite some time to check your code and your schematic, so it would be appreciated if your schematic was accurate rather than just "a quick throw together".
Seriously, what is the point of numerous people spending quite some time checking a circuit which isn't precisely what you are using? :confused:
Sorry if I sound harsh. Not intended , but do you get what I am saying?

And it would be nice if you told us if you understand comments made - esp. the ones about capacitors by Martin a few posts back. Decoupling etc. is SO important and should be standard practice when you have motors, relays, long wiring and/or mains PSUs kicking around.
 

MartinM57

Moderator
Well it looks more structured (and obviously you haven't posted most of it) but it's still not very easy for the casual reader to understand :(

Take the first few lines...

readadc 2,Wetness
if Wetness <> WaterOn then gosub ReadWater
...reading Wetness sounds good (how wet is something?), but comparing it with WaterOn sounds weird (sounds like WaterOn is an on/off flag about the state of the water) . Also, reading an ADC value is highly unlikely to match some previous value so a <> logical test will almost always be true.

readtemp 1,Temp 'b2
if Temp <> Temperature then gosub ReadTemperature
...likewise for the <> test. Is Temp a temperature, or a temporary value? If it's a temperature, you seem to have just read it, so why gosub to something that apparently reads a temperature?

if Switch1 = 1 then gosub CheckSwitch1
...ditto - you've just checked Switch1, but you gosub to check it again?

if Switch2 = 1 then gosub CheckSwitch2
...ditto

So the next exercise is to make all the variable names and targeted gosubs have really obvious to understand names ;)

Anyway, looking at your pictures, I think your random behaviour is due to electrical interference problems. Unspecified wall-wart power blocks, no capacitors, long leads everywhere, running all those bunched leads together, and running them right underneath the processor etc are all bad news for a reliable system. A few inductors and/or ferrite beads will probably not go amiss in due course. A PCB design that leaves as much ground plane copper on the board (i.e the etching removes the absolute minimum of copper) would also be something to consider if you ever made a Mk2 version.

All this sounds really bad but hopefully you'll take it as constructive criticism (you seem to be so far, which is definitely a well done on your side). You'll get there - it's a fairly ambitious project to get all this hardware and software working together with complete reliability, but approaching the electrical and software side methodically should work out. IMHO, you will be needing to spend quite a lot more time on it though....
 

leds4u

New Member
Thanks alot MartinM57, I see the problems now. I'm sure the decoupling will fix the unreliability issues.

I will spend some hours and have a good rethink and rewrite, and will come back when I have done so.

Thanks every one for your comments, I really do appreciate you taking your time to help me! :)
 

inglewoodpete

Senior Member
Ya i missed the 18x and cant count either by looking at the schematic.

Just wondering if .... was short for me.

Or .... Son of A Bit-h?
Sorry mate, didn't think of that one. I get "IP". My wife thinks that makes her Mississippi:p

PS She's SA born too.
 

leds4u

New Member
After adding the caps and ferrite beads, it's totally stable. I have rewritten my code, and as time goes on I'll keep improving it, as I get a better understanding for it.

Code:
'Green House Controller using an 18x
'simply controlls soil moisture, and inside temperature
'It should normally display "System Running" 
'with the current temperature on the second line.
'there are 4 menus from there, each with a selectable 
'sub menu for adjusting the preset temp/moisture etc

symbol Menu = pin0	'Bottom Left
symbol switch1 = pin7 	'Top Right
symbol switch2 = pin6 	'Bottom Right
symbol ventup = 6
symbol ventdown = 5
symbol psu = 4
symbol green = 2
symbol red = 1
symbol temp = b0'
symbol opentemp = b1'
symbol wateron = b2'
symbol wetness = b3'
symbol waterdisp = b4
symbol check = b5
symbol waterontime = b6
symbol check1 = b7'
symbol watercount = w6



Init:
high 7
pause 500
gosub clearlcd
low 0,1,2,3,4,5,6
opentemp=30
wateron=200
waterontime=60
serout 7,T2400,(254,128,"Initializing") 
pause 1000
gosub menu0

Main:
	readadc 2,wetness 
	if wetness < wateron and check1=0 then 
		pwmout 3,99,400 
		check1 = 1
		endif
	if check1=1 then gosub timer1          'Main takes just over 1000ms to loop so I use 
						'it as the clock for timing the duration the  
	readtemp 1,temp 			'water is on for
		if temp => opentemp and check=1 then gosub open
		if temp < opentemp and check=0 then gosub close
	
	if Menu = 1 and b8=0 then gosub Menu0 	'depending which menu was last seen 
	if Menu = 1 and b8=1 then gosub Menu1	'changes b8 so that next time it's
	if Menu = 1 and b8=2 then gosub Menu2	'pressed it goes to the next menu
	if Menu = 1 and b8=3 then gosub Menu3	
	if Menu = 1 and b8=4 then gosub Menu4
			
	if Switch2=1 and b8=2 then gosub SubMenu1	'When veiwing a menu the program still
	if Switch2=1 and b8=3 then gosub SubMenu2	'loops in Main: so switch2 will select
	if Switch2=1 and b8=4 then gosub SubMenu3	'the submenu
	if Switch2=1 and b8=0 then gosub SubMenu4
	
	b10=b10+1				'all this to make LCD update every 10 sec
	if b10=10 then			'rather than every sec
	b10=0					'I don't know why but it just seems kinder
	endif					'to the LCD
	if b10=5 then gosub menu0
	
	debug
	goto main 

Menu0:
	low red
	high green
	serout 7,T2400,(254,128,"System Running  ") '‘ move to start of first line
	serout 7,T2400,(254,192,"Menu    ",#temp,"C     ")
	b8=1 'sets it up so that next time 'menu' is pressed it will goto the next menu
	pause 500
	return

Menu1:
	low green
	high red
	serout 7,T2400,(254,128,"Show Off Demo!  ")
	serout 7,T2400,(254,192,"Menu       Start")
	b8=2
	pause 500
	return
	
	SubMenu1:
		gosub clearLCD
		serout 7,T2400,(254,128,"Demo Running...")
		gosub open
		gosub close
		gosub clearlcd
		pwmout 3,99,400
		serout 7,T2400,(254,192,"Start Watering..")
		pause 5000
		pwmout 3,0,0
		serout 7,T2400,(254,192,"Stop ")
		pause 1000
		goto menu1
	

Menu2:				
	serout 7,T2400,(254,128,"Temp Adjust  ",#temp,"C ") ' with actual temp on same line
	serout 7,T2400,(254,192,"Menu      Change")
	b8=3
	pause 500
	return
	
	SubMenu2:
		serout 7,T2400,(254,128,"Opening Temp   +")
		serout 7,T2400,(254,192,"Save           -")
		do	
		serout 7,T2400,(254,198,#temp,"C ",#opentemp,"C  ")
		pause 200
		if switch1=1 then
			opentemp = opentemp + 1  'Increase Opening temperature
			endif
		
		if switch2=1 then
			opentemp = opentemp - 1  'Decrease Opening temperature
			endif
		
		if Menu=1 then exit  'Return to Main Menu
		loop
		return
	
Menu3:
	serout 7,T2400,(254,128,"Water Adjust    ")
	serout 7,T2400,(254,192,"Menu      Change")
	b8=4
	pause 500
	Return
	
	SubMenu3:
		serout 7,T2400,(254,128,"Water On       +")
		serout 7,T2400,(254,192,"Save           -")  
		do	
		serout 7,T2400,(254,199,#wetness,"~",#wateron)
		
		if switch1=1 then
			wateron = wateron + 2  'Increase Soil dryness
			endif
		
		if switch2=1 then
			wateron = wateron - 2  'Decrease soil dryness
			endif
		
		if Menu=1 then exit  'Return to main Menu
		loop
		return

Menu4:
	serout 7,T2400,(254,128,"Water On Time   ")
	serout 7,T2400,(254,192,"Menu      Change")
	b8=0
	Return
	
	SubMenu4:
		serout 7,T2400,(254,128,"Water Duration +")
		serout 7,T2400,(254,192,"Save           -")   
		do
		serout 7,T2400,(254,198,#Waterontime,"Mins  ")
		
		if switch1=1 then
			waterontime = waterontime + 1  'Increase watering time
			endif
		
		if switch2=1 then
			waterontime = waterontime - 1  'Decrease watering time
			endif
		
		if Menu=1 then exit  'Return to preivious Menu
		loop
		return
		
Timer1:
	watercount = watercount + 1 	'once triggered it counts aproxamatly at
	b9 = watercount / 60		'1022ms wich is close enough, so divide 
	if b9 => waterontime then	'by 60 and you have minuits which is then 
	check1 = 0				'compaired to the predetermaned time
	watercount = 0			'when it's finished it resets
	pwmout 3,0,0
	endif
	return
	
Open: 
	serout 7,T2400,(254,128,"Opening Vent... ")
	serout 7,T2400,(254,192,"Temp Over ",#opentemp,"C    ")
	high psu
	pause 1000
	high ventup
	pause 10000 ' how ever long it takes
	low ventup
	pause 300
	low psu
	check=0
	gosub menu0
	return
	
Close: 
	serout 7,T2400,(254,128,"Closing Vent... ")
	serout 7,T2400,(254,192,"Temp Under ",#opentemp,"C   ")
	high psu
	pause 1000
	high ventdown
	pause 10000 ' how ever long it takes
	low ventdown
	pause 300
	low psu
	check=1
	gosub menu0
	return

ClearLCD:
	serout 7,T2400,(254,1)
	pause 30
	Return
Thanks all for your help :)
 

techElder

Well-known member
Looking better. You probably can see that yourself now, though. ;)


b10=b10+1 'all this to make LCD update every 10 sec
if b10=10 then 'rather than every sec
b10=0 'I don't know why but it just seems kinder
endif 'to the LCD
PS. I just had a good chuckle "kinder to the LCD", because I've done this myself! :rolleyes:
 

InvaderZim

Senior Member
Glad to hear about adding the caps and ferrites. The regulator is quite far from the things that need power; you might do well to shorten the regulated power wires. All those long wires can do is pick up noise and drop voltage (defeating the purpose of the regulator, possibly to the point to making it unstable).
 

leds4u

New Member
When I put the circuit into an enclosure, I will shorten the wires significantly, so they are only as long as they have to be.

To measure soil moisture, I put two copper strips (of the same shape and size) in the soil about 100mm apart. one is connected to gnd, the other to + through a 10-20k resistor, and a 5-10k resistor to the picaxe. though I think that if the soil acidity changes, it may need to be recalibrated.

Excuse my ascii

Code:
                        |--/\/\/\--- to ADC
                        |
   Gnd --- |  ........  |---/\/\/\----- +
           |  ..Soil..  |
           |  ........  |
           |  ........  |
 
Last edited:

papaof2

Senior Member
Be aware that any metal in contact with soil and having a DC current through it will change characteristics farily quickly, whether by corrosion, oxidation or some other process. Stainless steel is a much better choice than copper.

There are sensors that use non-metallic elements but they still require replacement on some more or less regular basis. Sensors that use AC current typically do not experience as much degradation as those using DC. There are also capacitive sensors which can last several years.

The good commercial sensors start about $95US http://www.vernier.com/probes/sms-bta.html - which is why my raised bed vegetable garden never had sensors. I'll do a lot of "finger in the dirt" testing before spending $95 each for several such sensors ;-)

Do a Google search on
moisture sensor
or
moisture probe

John
 

leds4u

New Member
I never even thought of searching on how to do it! :eek: I will go through the archives and google, and try for one that uses ac... Thanks
 
Top