diy aquarium controller

ok guys here i go. going to try and program this to actualy do somthing for the first time
since what im doing is almost the same as the blink program that is pre programed on my pic im just going to work off of that slowly changing parts to make it do what i want while making sure it still works :)
heres a snip from my lil notepad
60 hz = state change every 0.0083- seconds or 8300 instructions
30 hz = 0.016- seconds or 16000

decfz

not going to care about randomizing right now... or even switching for that matter...
 
Ok,

I looked over the spec sheet.

How are you communicating with it to load code, acsess a shell, etc? I am not as familiar with the PIC. Can you access the internal I/O from a serial shell, or only via loaded code.

Are you just trying to turn on & off a discrete Output to drive an external circuit or are you trying to use the PWM?




Stu
 
here we go so far

and yes. i know.. i work backwords..
i know what i want to do. make it do it.. then make the way it does it happen :P


#include <p16F690.inc>
__config (_INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _BOR_OFF & _IESO_OFF & _FCMEN_OFF)

cblock 0x20
Delay1 ; Define two file registers for the
Delay2 ; delay loop
Delay3
Delay4
Ram1
Ram2
Outbit2
Outbit1
Foutbit
HZdelay1
Hzdelay2
Toc1
Toc2

endc

org 0
Start:
bsf STATUS,RP0 ; select Register Page 1
clrf TRISC
bcf STATUS,RP0 ; back to Register Page 0

movlw b'00001111'
movwf Ram1
MainLoop:
;outputchanger
movf Outbit1
xorwf Outbit2,0
movwf Foutbit
movf Foutbit
movwf PORTC


end
 
dont know what hte pwm is really so im not using that..

actualy wait i kinda know alil about it and from what it does it dosnt look like waht i want to do
 
dont know what hte pwm is really so im not using that..

actualy wait i kinda know alil about it and from what it does it dosnt look like waht i want to do

fyi and yes i know im a sloppy programer
and i ahve no clue what you just asked.
 
#include <p16F690.inc>
__config (_INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _BOR_OFF & _IESO_OFF & _FCMEN_OFF)

cblock 0x20
Delay1 ; Define two file registers for the
Delay2 ; delay loop
Delay3
Delay4
Ram1
Ram2
Outbit2 ; bit 1
Outbit1 ; bit 0
Foutbit
HZdelay1
Hzdelay2
Toc1
Toc2

endc

org 0
Start:
bsf STATUS,RP0 ; select Register Page 1
clrf TRISC
bcf STATUS,RP0 ; back to Register Page 0

movlw b'00001111'
movwf Ram1
MainLoop:

;outputchanger
movf Outbit1
xorwf Outbit2,0
movwf Foutbit
movf Foutbit
movwf PORTC
;done with the output
goto MainLoop

; start bit switcherfor port 1
*****anger1
comf Outbit1,1
bcf Outbit1,1
bcf Outbit1,2
bcf Outbit1,3
return

goto MainLoop
end


:) its coming along nicly almost done with the easy parts!!!!
 
#include <p16F690.inc>
__config (_INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _BOR_OFF & _IESO_OFF & _FCMEN_OFF)

cblock 0x20
Delay1 ; Define two file registers for the
Delay2 ; delay loop
Delay3
Delay4
Ram1
Ram2
Outbit2 ; bit 1
Outbit1 ; bit 0
Foutbit
HZdelay1
Hzdelay2
Toc1
Toc2

endc

org 0
Start:
bsf STATUS,RP0 ; select Register Page 1
clrf TRISC
bcf STATUS,RP0 ; back to Register Page 0

movlw b'00001111'
movwf Ram1
MainLoop:

;outputchanger
movf Outbit1
xorwf Outbit2,0
movwf Foutbit
movf Foutbit
movwf PORTC
;done with the output
;hzchanger
decfsz HZdelay1,1
goto HZS1 ;skip*****anger
call *****anger1
HZS1:
decfsz HZdelay2,1
goto HZS2
call *****anger2
HZS2:

goto MainLoop

; start bit switcherfor port 1
*****anger1
comf Outbit1,1
bcf Outbit1,1
bcf Outbit1,2
bcf Outbit1,3
return
; start bit switcherfor port 2
*****anger2
comf Outbit2,1
bcf Outbit2,0
bcf Outbit2,2
bcf Outbit2,3
return
goto MainLoop
end
 
#include <p16F690.inc>
__config (_INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _BOR_OFF & _IESO_OFF & _FCMEN_OFF)

cblock 0x20
Delay1 ; Define two file registers for the
Delay2 ; delay loop
Delay3
Delay4
Ram1
Ram2
Outbit2 ; bit 1
Outbit1 ; bit 0
Foutbit
HZdelay1
Hzdelay2
Hz1
Hz2
Toc1
Toc2

endc

org 0
Start:
bsf STATUS,RP0 ; select Register Page 1
clrf TRISC
bcf STATUS,RP0 ; back to Register Page 0

movlw b'00001111'
movwf Ram1
Mainreset1: ;reset hzdelays

goto MainLoop
Mainreset2:

MainLoop:

;outputchanger
movf Outbit1
xorwf Outbit2,0
movwf Foutbit
movf Foutbit
movwf PORTC
;done with the output
;hzchanger
decfsz HZdelay1,1
goto HZS1 ;skip*****anger
call *****anger1
goto Mainreset1
HZS1:
decfsz HZdelay2,1
goto HZS2
call *****anger2
goto Mainreset2
HZS2:
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop

goto MainLoop

; start bit switcherfor port 1
*****anger1
comf Outbit1,1
bcf Outbit1,1
bcf Outbit1,2
bcf Outbit1,3
return
; start bit switcherfor port 2
*****anger2
comf Outbit2,1
bcf Outbit2,0
bcf Outbit2,2
bcf Outbit2,3
return
goto MainLoop
end


this should work. for doing absolutly nothing except running pumps at a slightly lower hz then they are rated for. ( but it should work out close because of the few slight varyations every few cycles
 
ok using this new code ( added a delay so i could check that the on off is happening since otherwise it is too fast to see
i get a wierd problom


then all lights solid for about 40 seconds
then a quick flash of only light number two ( on and off about every 1/4 second) for 40 seconds while all others are on and it keeps doing this over and over

help i bet its somthing really dumb

#include <p16F690.inc>
__config (_INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _BOR_OFF & _IESO_OFF & _FCMEN_OFF)

cblock 0x20
Delay1 ; Define two file registers for the
Delay2 ; delay loop
Delay3
Delay4
Ram1
Ram2
Outbit2 ; bit 1
Outbit1 ; bit 0
Foutbit
HZdelay1
HZdelay2
Hz1
Hz2
Toc1
Toc2

endc

org 0
Start:
bsf STATUS,RP0 ; select Register Page 1
clrf TRISC
bcf STATUS,RP0 ; back to Register Page 0

movlw b'00001111'
movwf Ram1
Mainreset1: ;reset hzdelays

goto MainLoop
Mainreset2:

MainLoop:
decfsz Delay1,f
goto MainLoop
decfsz Delay2,f
goto MainLoop
;outputchanger
movf Outbit1
xorwf Outbit2,0
movwf Foutbit
movf Foutbit
movwf PORTC
;done with the output
;hzchanger
decfsz HZdelay1,1
goto HZS1 ;skip*****anger
call *****anger1

HZS1:
decfsz HZdelay2,1
goto HZS2
call *****anger2
HZS2:
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
goto MainLoop

; start bit switcherfor port 1
*****anger1:
comf Outbit1,1
bcf Outbit1,1
bcf Outbit1,2
bcf Outbit1,3
return
; start bit switcherfor port 2
*****anger2:
comf Outbit2,1
bcf Outbit2,0
bcf Outbit2,2
bcf Outbit2,3
return
goto MainLoop
end
 
i am now walking throu the program manualy and doing everything on paper... lets see if i find the probloms
 
ok found them

#include <p16F690.inc>
__config (_INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _BOR_OFF & _IESO_OFF & _FCMEN_OFF)

cblock 0x20
Delay1 ; Define two file registers for the
Delay2 ; delay loop
Delay3
Delay4
Ram1
Ram2
Outbit2 ; bit 1
Outbit1 ; bit 0
Foutbit
HZdelay1
HZdelay2
Hz1
Hz2
Toc1
Toc2

endc

org 0
Start:
bsf STATUS,RP0 ; select Register Page 1
clrf TRISC
bcf STATUS,RP0 ; back to Register Page 0

movlw b'00001111'
movwf Ram1
Mainreset1: ;reset hzdelays

goto MainLoop
Mainreset2:

MainLoop:
decfsz Delay1,f
goto MainLoop

;outputchanger
movf Outbit1,0
xorwf Outbit2,0
movwf Foutbit
movf Foutbit,0
movwf PORTC
;done with the output
;hzchanger
decfsz HZdelay1,f
goto HZS1 ;skip*****anger
call *****anger1

HZS1:
decfsz HZdelay2,f
goto HZS2
call *****anger2
HZS2:
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
goto MainLoop

; start bit switcherfor port 1
*****anger1:
comf Outbit1,f
bcf Outbit1,1
bcf Outbit1,2
bcf Outbit1,3
return
; start bit switcherfor port 2
*****anger2:
comf Outbit2,f
bcf Outbit2,0
bcf Outbit2,2
bcf Outbit2,3
return
goto MainLoop
end

new code lol
 
can someone run over this for me and make sure that both bits 0 and 1 are ona nd off for about the same amount of time
 
I was thinking about doing something simmilar to this using an Atmel AVR controller and programing it using BASCOM- AVR since I already know Basic.

I've played withthe Microchip controllers in the past but the programmers and compilers (for Basic) were a bit out of my budget, so I went with the Atmel.

What do you plan to use to switch the outlets on and off with, Relays, Opto relays, etc?

Good Luck!
 
programmers are free for microchip. atleast what im using.

i was going to use solidstate relays. no clue what an opto relay is
 
no no controller can do what im looking for wihtout special pumps and a huge ticket price

and diy isnt about easy its about doing it your self and being able to say " yeah. i saved 20 bucks and build it my self. it only took me 26 hours and i was tired at work the next day"
 
so far program works fine EXCEPT the random

for the ramdom i added (ramdomly thouout hte progrom

decf Ram2,f inthe program and then when the program calls for the ram2 variable to reprogram a different function it should be psudo random
 
From what I gathered, correct me if Im wrong, the cost of of everything isnt much cheaper then buying one, and then calculate all the man hours that goes into it and the stress level and how many times you have to rebuy parts after you have thrown them across the room, haha. Dont get me wrong, I am all about building things myself, you have a better appreciation for it.

Why not look into greenhouse automation equipment? Thats where 90% of aquarium trade advancements come from anyways and not to mention a heck of a lot cheaper for the exact same thing with a different name. Tek Lights is made by Sunlight Supply, who is Sunlight supply? a green house lighting company! Its funny when you see people spending hundreds of dollars for things like MH lights when you can buy the exact same thing for less then $100 usually, but it says greenhouse on the box instead of aquarium. Both are high humid enviroments, so you cant say thats the difference, only difference is color temperture in bulbs.
 
Back
Top