Reef Central Online Community

Go Back   Reef Central Online Community > General Interest Forums > Do It Yourself > The R3CA Project
Blogs FAQ Calendar Mark Forums Read

Notices

User Tag List

Reply
Thread Tools
Unread 12/06/2004, 08:08 AM   #1
j_c_a
Registered Member
 
Join Date: Jun 2003
Location: Tampa, FL
Posts: 38
My own controller project (and a couple requests)

So, I've been hesitant to post anything about my own controller project mainly because I don't want to feel pressure to "get it done" or anything like that. Now, however, I'm at a point where I may need a little assistance.

Here's a link to the latest schematic for the project (gif)(It's not neccessarily a big file, but the dimensions of the image are big so i'm posting a link rather than an image):

http://www.vbbyjc.com/personal/aq.gif

Everything in the schematic works and has been bread-boarded, although not neccessarily as a complete unit.

Here's where I may need help. Folks may recognize the schematic as being from EagleCAD. I'm not involved professionally in electronics in any way so I don't have access to any higher-end CAD software. Does anyone have a licensed version of EagleCAD or some other CAD software, and would be willing to board this schematic when I'm done? There's no way I can get it to fit under the free version of EagleCAD (board size restriction).

The second part where I need some assistance is in my ph interface. I really don't have any electronics background and I'm struggling to get a working interface. If anyone would care to lend a hand, I'd greatly appreciate it. Also, not to be picky, but if there's any way to get it to run from a single +12V or +5V supply it would be great.

Thanks and Regards,
jca


j_c_a is offline   Reply With Quote
Unread 12/10/2004, 04:51 AM   #2
karma
Registered Member
 
Join Date: Jun 2001
Location: Lawrenceville, Ga
Posts: 125
jca,

Try this link. http://www.emesystems.com//OL2ph.htm

It shows how to interface a pH probe to a Basic Stamp, so you should be able to adapt it to your setup. I believe most op amp require a negative voltage if they are going to be used to read a negative voltage (such as a pH probe can put out). You can generate the negative voltage from a positive voltage using the proper chip. The schematic at the link I provided shows how to do this.

Good luck,
Michael


karma is offline   Reply With Quote
Unread 12/10/2004, 07:40 AM   #3
j_c_a
Registered Member
 
Join Date: Jun 2003
Location: Tampa, FL
Posts: 38
Hey karma, thanks. I've actually seen that page and I think I'll have to try to follow it exactly. I've been trying to get this working w/ a single-supply opamp and just haven't had any luck. I've got several bi-polar opamps on hand that should be able to handle the high impedance, and I've ordered an IC that can create -5V from +5V (if I remember it's a maxim chip). So now, like always, I'm waiting on parts.

This is the last major piece to the puzzle, so once I get it working, I can start putting all the individual pieces into a single circuit and finish the software.

Regards,
jca


j_c_a is offline   Reply With Quote
Unread 12/25/2004, 03:28 PM   #4
banger
Registered Member
 
Join Date: Apr 2003
Posts: 57
Hi,

You can put a negative voltage into a single voltage op amp fairly easily. Just add a voltage divider to where you are feeding in the negative voltage, to make it positive. Also remember that opamps have an inverting and non inverting side. As an example, if you have a ph probe with an output from 0-100mv. Then feed in a voltage of 2.55 volts, and your opamp will output from 2.45 to 2.55 with the ph probe. You can also increase the gain on the opamp, to change your 100mv swing to 5v swing.


banger is offline   Reply With Quote
Unread 12/28/2004, 12:42 PM   #5
j_c_a
Registered Member
 
Join Date: Jun 2003
Location: Tampa, FL
Posts: 38
Thanks alot banger. That makes sense. I'll give it a shot.


j_c_a is offline   Reply With Quote
Unread 01/10/2005, 04:38 PM   #6
spipedong
Registered Member
 
spipedong's Avatar
 
Join Date: Jan 2005
Location: Casper, WY
Posts: 52
Hi j_c_a,

I've built a few DIY electronics items as well, and it's always sort of fun to figure out how to tie the different IC's together.

I was wondering (if you're still working on this) how the project works and what it's capable of. (LCD Display, PC Control, Timed outputs?) By looking at the schematic it seems to be a pretty well designed/laid out device that would accept modification or feature additions.

No pressure, I'm just very interested in hearing about your progress.


spipedong is offline   Reply With Quote
Unread 01/11/2005, 08:00 AM   #7
j_c_a
Registered Member
 
Join Date: Jun 2003
Location: Tampa, FL
Posts: 38
Hey spipedong, haven't done much since the holidays but it's still in the works. My last hurtling block is the ph interface. There's some good ideas above re: that, I just need to get back on it and apply them.

In terms of capabilities, here's a basic rundown of what it does (i've got code to do all this, but there is some tweaking needed to integrate all of it).

4x20 LCD display w/ backlight.

3-button ui (up/down/enter)

monitors 2 temp. probes (ie water and air/canopy/etc)

will monitor 2 ph sensors (ie tanks water and effluent)

controls dimmable on-demand red led nightlights

controls dimmable led moonlights according to lunar schedule

controls 3 banks of daylights according to user-defined solar schedule

monitors 4 float switches (turn on topoff, hi-water sump, low-water sump, low water makeup reservoir)

audible and visual alarms for out-of-range parameters

as configurated, capable of controlling 14 ac devices. So far:
heater, chiller, co2 soleniod, neilson stirrer, top-off pump, main pump shutdown(feeding), 3 banks of lights

^ w/ my current design, I could add control for additional ac devices, using 1-pin to drive each additional 7 devices (ie shift-register/uln2003 combination)

will also controll a DC canopy fan (haven't done code for this yet)

I've also thought about the ability to act as a wavemaker, but I reallly don't know how I'm going to work this in the new tank (ie. closed loop, powerheaders/etc) so I haven't really given it serious thought as to how to accomplish that.

I have basic one-way (out) communication w/ PC via serial port but I wouldn't mind adding some other type of communcation interface.

Eventually, I'd like to tackle some data-logging, but that's the last thing on my list.


j_c_a is offline   Reply With Quote
Unread 01/11/2005, 11:58 AM   #8
barebottoms
Registered Member
 
barebottoms's Avatar
 
Join Date: Aug 2002
Posts: 1,204
That might help with the ph probe. The MAX406 is a high impedance op-amp, it outputs a linear dc voltage.

If you want 2 way communications take a look at 1-wire. The WRRC (wireless recycled reef controller) I'm working on is using all 1-Wire for control and sensor network.




barebottoms is offline   Reply With Quote
Unread 01/11/2005, 12:06 PM   #9
j_c_a
Registered Member
 
Join Date: Jun 2003
Location: Tampa, FL
Posts: 38
Hey thanks barebottoms. I'm using 1-wire for my TEMP probes. I'm getting geared up to jump back on this project so hopefully I'll start making some more progress soon.


j_c_a is offline   Reply With Quote
Unread 01/11/2005, 12:25 PM   #10
barebottoms
Registered Member
 
barebottoms's Avatar
 
Join Date: Aug 2002
Posts: 1,204
Cool. Good luck with your project, I'll be sure to steal idea's from yours for mine

I'm not sure if you're at the dimming functions yet, if you are and need help, take a look at DS2890. It's a 1-Wire digital pot.

For the lunar scale, you can use a old BSD utility called POM (phase of moon). It calculates the current phase and a percentage, then you can easily convert that to an integer for dimming control.


__________________
--------------------------------------------
Point, Click, #FF0000 House = Free Reef Controller Project
barebottoms is offline   Reply With Quote
Unread 01/11/2005, 01:33 PM   #11
j_c_a
Registered Member
 
Join Date: Jun 2003
Location: Tampa, FL
Posts: 38
Hey barebottoms, maybe we can compare notes at some time.

I've got a MAXIM digital pot (don't have the part number handy) but I found I had a lot more flexability using an DAC and them amplifying the output using a simple LM324 op amp. It's a quad-amp w/o a lot of options so I can drive a lot of LED's if need be.

Also, for the moonlighting, I settled on a simple algorythm. Basically, I need the user to supply the date of any full moon within a given month. From that I can extrapolate the % of moonlight for any given day. I'm working on the assumption that the variance is pretty linear between moon cycles. I hope that's correct. I've yet to figure out a good way to do moon-rise and set because it doesn't work on a 24-hour period like solar rise/set. For now, I've settled on just turning on the moonlights when the last daylight goes off.


j_c_a is offline   Reply With Quote
Unread 01/11/2005, 03:01 PM   #12
spipedong
Registered Member
 
spipedong's Avatar
 
Join Date: Jan 2005
Location: Casper, WY
Posts: 52
Wow this is sounding really exciting. I haven't tackled any design project this complex before. I definitely commend your efforts. (Still no pressure! )


spipedong is offline   Reply With Quote
Unread 01/11/2005, 04:57 PM   #13
barebottoms
Registered Member
 
barebottoms's Avatar
 
Join Date: Aug 2002
Posts: 1,204
spipedong,

Its the chicken and the egg senario. Eveyone seems to want a controller, but get overwhelmed with the pieces involved so no one really wants to "help" until they see something working. Which I don't blame them.

Even with the way I'm going about it, not many people have stepped up to help. Even though I'm basically using off the shelf parts and software.

It is fun, and I think if a person just goes about it piece by piece it all makes sense.


__________________
--------------------------------------------
Point, Click, #FF0000 House = Free Reef Controller Project
barebottoms is offline   Reply With Quote
Unread 01/19/2005, 12:21 AM   #14
DJ88©
Premium Member
 
DJ88©'s Avatar
 
Join Date: Nov 2000
Location: BC. Canada.
Posts: 14,351
just curious as to your decision to run a BasicX microcontroller AND a PIC16F628.



__________________
Darren

Beauty fades....
Stupid is forever......

Current Tank Info: 34 Gal Solana with some lights.. and pumps that make water move. And fish...
DJ88© is offline   Reply With Quote
Unread 01/19/2005, 07:48 AM   #15
j_c_a
Registered Member
 
Join Date: Jun 2003
Location: Tampa, FL
Posts: 38
Quote:
Originally posted by DJ88
just curious as to your decision to run a BasicX microcontroller AND a PIC16F628.
As far as the BX MC it was simply a matter of expediency. For a mass production scenario, you'd obviously go w/ a much cheaper pic or avr, but for a one-off, the ease of basic programming w/o having to buy additional compilers, was just too attractive.

Re: mixing that w/ the pic .... the pic is actually a pre-programmed serial controller for an LCD. I'm not at home right now so I don't have the exact name, but there's a professor in Baltimore that sells very inexpensive pre-programmed packages on the web (he also sells BX chips at a decent price). Once again, for a one-off project it was a quick and easy way to get the desired functionality.


j_c_a is offline   Reply With Quote
Unread 01/19/2005, 12:35 PM   #16
DJ88©
Premium Member
 
DJ88©'s Avatar
 
Join Date: Nov 2000
Location: BC. Canada.
Posts: 14,351
ohh gotcha.. compilers and programmers were the reasons I asked.

Do you do much work with C? there is a C complier out there that is freeware for PICs. CCX-5 is what it is called I think. I use the CCS C compiler. Nice to work with. about $125(US) for the PIC12 and PIC16's.


__________________
Darren

Beauty fades....
Stupid is forever......

Current Tank Info: 34 Gal Solana with some lights.. and pumps that make water move. And fish...
DJ88© is offline   Reply With Quote
Unread 01/26/2005, 01:31 AM   #17
mupham
Registered Member
 
mupham's Avatar
 
Join Date: Nov 2004
Location: West Chicago
Posts: 31
Nice project so far... If you're still interested. Another example of a pH amplifier circuit is given in the National Semiconductor datasheet for the LMC6001 high Z op-amp. Unfortunately it too requires a dual power supply but may give you another example of how it works. http://www.national.com/ds.cgi/LM/LMC6001.pdf (page11)

I had a question about using the DAC for the moonlights. Have you given any thought to possibly using PWM and changing the duty cycle to control the LED intensity? It could save you a few ICs, resistor networks, and a couple of IO ports on your MCU. I can't speak for your MCU but some PICs have a PWM module that you can configure in hardware with 10 bits of resolution. Not that it has to be that good of course, but maybe you can simulate cloudy nights too


mupham is offline   Reply With Quote
Unread 01/26/2005, 09:05 AM   #18
j_c_a
Registered Member
 
Join Date: Jun 2003
Location: Tampa, FL
Posts: 38
I did experiement w/ using PMW but found a couple problems w/ that:

a) it really wasn't enough power to adequately drive my led's. Even w/ a rapid pulse, you still have a fraction of the max 5V from the PWM pin. I needed to run anywhere from 2+ led's. I won't know how many until I actually setup the tank and see what looks good.

b) At least for the chip I'm using, the PWM didn't really look good. There was a noticable flicker. It may just be for my chip, but it really wasn't acceptable.

I like the DAC/AMP combination better than a digital pot as well, because I'd rather just supply less power (ie DAC/amp) than always supply the max power and have to dissipate the excess using a resistor, ie adding heat. I'm really not that educated re: elctronics, so I may be all wet w/ my reasoning, but it seems to work for me.

As for the cloudy night scenario, that's very interesting. I'd actually given some thought as to how to similate clouds in the daylight environment, but that doesn't seem doable w/ MH lights.


j_c_a is offline   Reply With Quote
Unread 01/26/2005, 09:22 AM   #19
j_c_a
Registered Member
 
Join Date: Jun 2003
Location: Tampa, FL
Posts: 38
Just checked out the ph interface. That looks very interesting. THanks.


j_c_a is offline   Reply With Quote
Unread 01/26/2005, 10:41 AM   #20
DJ88©
Premium Member
 
DJ88©'s Avatar
 
Join Date: Nov 2000
Location: BC. Canada.
Posts: 14,351
I have run up to five LEDs using PWM from a PIC. Are you wiring them in series or parallel?

If you are really worried about it. send the output through an opamp(741 or 356) with it's rail voltages much higher. Say 0 and 10V. set it to a fairly high gain so the amplification of the input signal sends the output right to those rails. then wire the LEDs in parallel.

if you are seeing flickering it could be that you are running the frequency too low. What are you running it at?


__________________
Darren

Beauty fades....
Stupid is forever......

Current Tank Info: 34 Gal Solana with some lights.. and pumps that make water move. And fish...
DJ88© is offline   Reply With Quote
Unread 01/28/2005, 07:51 AM   #21
j_c_a
Registered Member
 
Join Date: Jun 2003
Location: Tampa, FL
Posts: 38
Hey DJ88, the unsatifsfactory PWM may be a limitation of the BX chip?? It's basically an AVR w/ a basic interpreter loaded in. Maybe the basic OS slows down the PWM? I don't know, but I do know that no matter which frequency I tried to use, the results we not satisfactory. I'm actually pretty satisfied w/ how the LED dimming is working now, but I'll certainly keep everyones suggestions in mind if I run into issues w/ the way I'm doing it.

Thanks all for the info. I'm getting phsyched up to dive back into this project


j_c_a is offline   Reply With Quote
Unread 01/28/2005, 10:10 AM   #22
DJ88©
Premium Member
 
DJ88©'s Avatar
 
Join Date: Nov 2000
Location: BC. Canada.
Posts: 14,351
well if ya had a programmer and C complier I'd send you the code for a PIC to do the PWM. that would make things really easy. I know it works as I can see it doing it's job right now.

you know there could be an issue with the pin not being able to source enough current for the LED/LEDs.

Take a look at that as a possibility.

I don't have the specs handy for the BX or I'd check it out myself.


__________________
Darren

Beauty fades....
Stupid is forever......

Current Tank Info: 34 Gal Solana with some lights.. and pumps that make water move. And fish...
DJ88© is offline   Reply With Quote
Unread 01/28/2005, 10:31 AM   #23
mupham
Registered Member
 
mupham's Avatar
 
Join Date: Nov 2004
Location: West Chicago
Posts: 31
If the PWM is implemented in hardware then the BASIC interpreter shouldn't be the bottleneck. Perhaps one of the timer prescalers is set too high and lowering the frequency of the PWM output. Either way, I think you guys are correct about having some kind of driver like a transistor to supply the current rather than your MCU. The only other thing is to not have the frequency too high or the switch on/off time of the LED may become a factor. I don't really know for sure though. Probably anything around 500 Hz would be unnoticable and slow enough for the LED. Darren, I have the CCS compiler (old version though) for the 16F series and ICD2 if you don't mind sending me the code. Should be pretty straight forward with the CCP port, I think.

-Mike


mupham is offline   Reply With Quote
Unread 01/28/2005, 06:17 PM   #24
DJ88©
Premium Member
 
DJ88©'s Avatar
 
Join Date: Nov 2000
Location: BC. Canada.
Posts: 14,351
Here's the code. For some reason I happened to have my USB key with me(not at home right now) Sorry about the formatting. guess the forum software doesn't like tabs.

I have attached the code as a txt file. Should work on any version of CCS. I didn't use any real fancy functions the newer ones have.

I am running a fairly recent version. I can't remember the ver. No off the top of my head. I do have it at home tho. (obviously)

I used a 16F818 as I had a bunch handy. tho I know it works on any CCP module. I was running this on an 877A for a while when I was writing some other code I threw it in for fun.

Quote:

#include <16F818.h>
#fuses HS,NOWDT,NOPUT,NOPROTECT,NOBROWNOUT
#fuses MCLR,CCPB2, NODEBUG,NOLVP,NOCPD,NOWRT
#use delay(clock = 4000000)

#define INTERRUPT_DELAY_TMR1 0x7FF9 //250ms prescale of 8
#define ON TRUE

int COUNTER, SECONDS, MINUTES, HOURS, DAYS;
int LED_intensity = 0;

BOOLEAN UP = TRUE;
BOOLEAN LED_cycle = TRUE;

void main(void){

setup_timer_1( T1_INTERNAL | T1_DIV_BY_8);
output_low(PIN_B2);
setup_ccp1(ccp_pwm);
set_pwm1_duty(1);
enable_interrupts(INT_TIMER1);
enable_interrupts(GLOBAL);

while(1);
}
/************************INTERRUPTS****************************/
#int_TIMER1
void TIMER1_isr(){

set_timer1( get_timer1() + INTERRUPT_DELAY_TMR1);

if (++counter >= 4){
counter = 0;
output_toggle(PIN_B0);
if(++seconds >= 60){
seconds = 0;
if (++minutes >= 60){
minutes = 0;
if(++hours >= 24){
hours = 0;
if(LED_cycle == UP){
LED_intensity = LED_intensity + 10;
set_pwm1_duty(LED_intensity);
}
else{
LED_intensity = LED_intensity - 10;
set_pwm1_duty(LED_intensity);
}
if(++days >= 14){
days = 0;
LED_cycle ^= 1;
}
}
}
}
}
}



__________________
Darren

Beauty fades....
Stupid is forever......

Current Tank Info: 34 Gal Solana with some lights.. and pumps that make water move. And fish...
DJ88© is offline   Reply With Quote
Unread 01/28/2005, 06:19 PM   #25
DJ88©
Premium Member
 
DJ88©'s Avatar
 
Join Date: Nov 2000
Location: BC. Canada.
Posts: 14,351
lets try that attachment again...


Attached Files
File Type: txt moonlight_sim.txt (1.2 KB, 106 views)
__________________
Darren

Beauty fades....
Stupid is forever......

Current Tank Info: 34 Gal Solana with some lights.. and pumps that make water move. And fish...
DJ88© is offline   Reply With Quote
Reply

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



All times are GMT -6. The time now is 05:05 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Powered by Searchlight © 2024 Axivo Inc.
Use of this web site is subject to the terms and conditions described in the user agreement.
Reef CentralTM Reef Central, LLC. Copyright ©1999-2022
User Alert System provided by Advanced User Tagging v3.3.0 (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.