Sponsor Our Community
Go Back   The Reef Tank > Equipment / Methodology related Forums > DIY Forum

DIY Forum Share those Do-It-Yourself projects and money saving tips with us here.


Registered Members don't see these ads. Register now it's free!

Reply
 
Thread Tools
Old 11-13-2004, 11:54 PM   #1
Jimbo
Klingon
 
Jimbo's Avatar
 
Join Date: Feb 2002
Location: Forest Grove, OR
Posts: 1,808
Images: 8

Down and Dirty DIY Wavemaker


My other wavemaker is turning into a full controller, but wanted a wavemaker now. So been working on it the last couple of days. Just got it working today.

It uses a dontronics dt106 processor board and a dt205 relay board. No LCD or realtime clock, just works. Uses a 16f867 processor, but you could use just about any pic processor that will fit the dt106 board, I just have a couple of them laying around.

It use two channels for the powerheads
one channel for main pump

It runs 3 cycles each lasting about an hour each
1. This cycle runs both powerheads for 15 minutes with 2 minutes off
2. This cycle runs one powerhead for 8 minutes then the other for 8 minutes
3. This cycle runs both powerheads for 3 minutes 15 off

-Port b0 switch for feeding (not implemented yet) shut off 15 minutes and main pump
-Port b4 powerhead one Relay 1
-Port b5 Powerhead two Relay 2
-Port b6 main pump Relay 3
-Port b7 relay 4 not used on my setup relay 4

You can buy dontronic's boards just about anywhere

I use pic simulator IDE basic to program the chip.
You can download it from
http://www.oshonsoft.com/pic.html
30 usage trial
If you email me I can compile the code for you if you let me know what timings you would like for the powerheads. Then email you the code file but you will need a programmer.

You'll need a pic flash programmer
search the web for usb serial programmer, they run about $35

Here's the simple basic program

Code:
'Down and Dirty Wavemaker
' James Luttrell
'Uses DT106 board
' Uses Relay board
' Uses 16f876x processor 20mhz
Symbol powerhead1 = PORTB.4
Symbol powerhead2 = PORTB.5
Symbol pump = PORTB.6
Symbol button1 = PORTB.0
Const one_minute = 60000
'On / Off duration pulse one
' all powerhead on/off at the same time
Const pulse_one_on = 15
Const pulse_one_off = 2
' Alternating
Const pulse_two_on = 8
Const pulse_two_off = 8
' all on/off same time with longer off period
Const pulse_three_on = 3
Const pulse_three_off = 15
 
'init
TRISB = 0xf0
High pump
Dim i As Byte
Dim y As Byte
Dim x As Byte
'start main program here
Dim wait_time As Word
loop:
For i = 1 To 4
High powerhead1
High powerhead2
y = pulse_one_on
Gosub timer
Low powerhead1
Low powerhead2
y = pulse_one_off
Gosub timer
Next i
For i = 1 To 4
High powerhead1
Low powerhead2
y = pulse_two_on
Gosub timer
Low powerhead1
High powerhead2
y = pulse_two_off
Gosub timer
Next i
For i = 1 To 4
High powerhead1
High powerhead2
y = pulse_three_on
Gosub timer
Low powerhead1
Low powerhead2
y = pulse_three_off
Gosub timer
Next i
Goto loop
End											 
 
 
' wait y minutes 
timer:
For x = 1 To y
WaitMs one_minute
Next x
Return
If you have any questions or would like programmed chips let me know.

Registered Members don't see these ads. Register now it's free!
Attached Images
File Type: jpg downanddirty.jpg (81.8 KB, 56 views)
__________________
40g 3' BB tank * 2 Seio 820's * 250w 14kk light * 190w actinic/10kk * DIY recirc skimmer.
~If I could only remember half of what I've learned~
~Jimbo~
Jimbo is offline   Reply With Quote
Old 11-14-2004, 01:10 AM   #2
drw94
dahh ok swevn
 
drw94's Avatar
 
Join Date: Aug 2004
Location: Santa Maria, CA
Posts: 267
I can barly turn on a computer can't imagine make one and then programming. Sound very cool!!
drw94 is offline   Reply With Quote
Old 11-14-2004, 10:29 PM   #3
Jimbo
Klingon
 
Jimbo's Avatar
 
Join Date: Feb 2002
Location: Forest Grove, OR
Posts: 1,808
Images: 8
I was able to get the feed button to work today

The button port needs to pulled down with a 10k resister and the switch is hooked to +5v. Turns off for 10 minutes including main pump. If your setup will overflow if you turn off main pump don't hook it up. Hopefully that would not be the case if so you might want to rethink your design.

Here's the final code
Code:
'Down and Dirty Wavemaker
' James Luttrell
'Uses DT106 board
' Uses Relay board
' Uses 16f876x processor 20mhz
 
Symbol powerhead1 = PORTB.4
Symbol powerhead2 = PORTB.5
Symbol pump = PORTB.6
Symbol button1 = PORTB.0
Const one_minute = 60000
 
'On / Off duration pulse one
' all powerhead on/off at the same time
Const pulse_one_on = 15
Const pulse_one_off = 2
 
' Alternating
Const pulse_two_on = 8
Const pulse_two_off = 8
' all on/off same time with longer off period
Const pulse_three_on = 3
Const pulse_three_off = 15
 
 'init
TRISB = 0x80
INTCON.INTE = 1 ' enable interrupt routine
 
Dim i As Byte
Dim y As Byte
Dim x As Byte
Dim sp1 As Bit
Dim sp2 As Bit
 
'start main program here
High pump
Enable
Dim wait_time As Word
loop:
 
For i = 1 To 4
High powerhead1
High powerhead2
y = pulse_one_on
Gosub timer
Low powerhead1
Low powerhead2
y = pulse_one_off
Gosub timer
Next i
 
For i = 1 To 4
High powerhead1
Low powerhead2
y = pulse_two_on
Gosub timer
Low powerhead1
High powerhead2
y = pulse_two_off
Gosub timer
Next i
 
For i = 1 To 4
High powerhead1
High powerhead2
y = pulse_three_on
Gosub timer
Low powerhead1
Low powerhead2
y = pulse_three_off
Gosub timer
Next i
 
Goto loop
End
 
' wait y minutes 
timer:
For x = 1 To y
WaitMs one_minute
Next x
Return 
 
On Interrupt
Save System
sp1 = powerhead1
sp2 = powerhead2
' turn off pumps
powerhead1 = 0
powerhead2 = 0
pump = 0
y = 10 '10 minutes
Gosub timer
'restore state before interrupt
pump = 1
powerhead1 = sp1
powerhead2 = sp2
'clear interrupt float
INTCON.INTF = 0
Resume
Here's the final pics of the unit.
Attached Images
File Type: jpg downanddirty1.jpg (91.2 KB, 27 views)
File Type: jpg downanddirty2.jpg (108.8 KB, 28 views)
__________________
40g 3' BB tank * 2 Seio 820's * 250w 14kk light * 190w actinic/10kk * DIY recirc skimmer.
~If I could only remember half of what I've learned~
~Jimbo~
Jimbo is offline   Reply With Quote
Old 11-17-2004, 03:43 AM   #4
Jimbo
Klingon
 
Jimbo's Avatar
 
Join Date: Feb 2002
Location: Forest Grove, OR
Posts: 1,808
Images: 8
I found a bug, need to save the y variable during interrupt. I was having a problem with the unit locking up but it turned out that the processor was too close to the relays. The magnetic pulse generated by them turning on caused interference with the processor. So I moved the processor board to it's own case.
__________________
40g 3' BB tank * 2 Seio 820's * 250w 14kk light * 190w actinic/10kk * DIY recirc skimmer.
~If I could only remember half of what I've learned~
~Jimbo~
Jimbo is offline   Reply With Quote
Old 11-17-2004, 12:18 PM   #5
davidc
Little Fishy
 
davidc's Avatar
 
Join Date: Jul 2004
Location: Buford, GA
Posts: 362
for your button input, you can also use the internal pull-ups and tie the switch to ground. this could reduce your board complexity.

only thing is to be sure the pull ups are configured before the port is enabled so you don't short it. alternatively, you could connect the switch to ground through a 5K resistor or so and still use the internal pull ups without any risk.
davidc is offline   Reply With Quote
Old 11-17-2004, 12:43 PM   #6
Jimbo
Klingon
 
Jimbo's Avatar
 
Join Date: Feb 2002
Location: Forest Grove, OR
Posts: 1,808
Images: 8
I tried using the internal pullups, but the processor I'm using seemed to lock up when I set option_reg.7 to 0, I did set the tris register first, this drove me nuts for a day . I did not try another fresh processor yet. You would also need to change the trigger level for the interrupt, trigger on falling edge not rising, not a big deal. It was just easier to put in the pull down resistor at the time
__________________
40g 3' BB tank * 2 Seio 820's * 250w 14kk light * 190w actinic/10kk * DIY recirc skimmer.
~If I could only remember half of what I've learned~
~Jimbo~
Jimbo is offline   Reply With Quote
Old 11-25-2004, 03:42 PM   #7
RipTide
Plankton
 
RipTide's Avatar
 
Join Date: Nov 2004
Location: Alabama
Posts: 26
Great Doc! Glad to see your back from the future! Flux Capacitors and Time Machines should be easy after this
RipTide is offline   Reply With Quote
Reply

Bookmarks



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Sitemap:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
Sponsor Our Community

All times are GMT -5. The time now is 04:28 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Our lawyer tells us that, by pressing the "New Thread" or "New Reply" button, you acknowledge that the opinions and information expressed in your article are yours alone and not those of thereeftank.com, dba The Reef Tank. Further, you agree to indemnify The Reef Tank, its moderators, administrators and agents from any and all liability which may arise as a result of your article. (C)opyright 2006 TheReefTank.com