PDA

View Full Version : DIY Controller (Atmel based)


kwirky
02-13-2008, 10:18 PM
http://www.futurlec.com/Pictures/ATMega_Controller_C.jpg

I've ordered some ATMEL128 boards from futurlec.com along with some opto-relays and a serial interface. Each board is aprox $29 and each opto-relay board is $14. the optorelay boards have 4 relays per board. (relays let you turn 110AC high voltage wall-socket power on and off using low-voltage electronics)

I'm learning atmel programming and electronics interfacing for both my fine arts practice and my aquarium hobby. I'm pretty excited about the potential of these guys :). I've been going through tutorials using the emulator built into AVR Studio. kinda neat.

I could use it to control water pumps for elaborate wavemaking, auto top off, all sorts of stuff. An ambitious idea would be to emulate the Tunze controllers and control the AC frequency the same way the controllers do (like what the profilux does). you get 48 inputs and outputs along with analog inputs and outputs (for probes and temp sensors n such).

i'm sourcing out a pH probe interface or schematics to make one. pH probes don't work with normal 5V resistance. You need to work the pH probe with an interface. kinda hard to find these things but I'm getting close.

I also ordered a 16x4 character LCD screen with backlight and a 128x64 pixel screen (b&w, no greyscale).

I'll be getting the stuff probably about 3 weeks from now. it's 3-6 days shipping USPS express but it'll probably be held up at the border.

I'll let u all know how it goes :). Any work I do will be open source and I'll post code examples of working stuff as I go.

information on the ATMEL chip:
ATMEL assembly programming for beginners: http://www.avr-asm-download.de/beginner_en.pdf

ATMEL boards and other tidbits of electronics: http://www.futurlec.com

the ATMEGA board i'm using: http://www.futurlec.com/ATMEGA_Controller.shtml

ATMEL forums and projects: http://www.avrfreaks.net

AVR studio IDE for programming ATMEL chips: http://www.atmel.com/dyn/products/tools_card.asp?tool_id=2725

Robw
02-13-2008, 11:33 PM
This sounds like an interesting project. I remember seeing a schematic for a ph probe interface somewhere on the web. I will try and find it and post a link to it. Being an electronics tech I should be able to help with making pc boards for the ph probe interface etc. Any web or pc interface for these boards? Would be nice to log temps and ph etc to a pc for review. My biggest problem is finding time to do all the research.

Rob

kwirky
02-13-2008, 11:43 PM
This sounds like an interesting project. I remember seeing a schematic for a ph probe interface somewhere on the web. I will try and find it and post a link to it. Being an electronics tech I should be able to help with making pc boards for the ph probe interface etc. Any web or pc interface for these boards? Would be nice to log temps and ph etc to a pc for review. My biggest problem is finding time to do all the research.

Rob

there are PC and Web interfaces. the ATmega control module interfaces with serial out of the box. You can get a USB interface for about $25. Would have to write a driver for it and then write assembly code in the Atmel chip to support it.

A web interface is difficult. There are network interfaces but then you'd have to code a web server entirely in assembly. It might be easier to instead set up a client-server relationship where software's run on the PC and the controller sends data to the software.

I thought about ordering a USB and network interface but I'll be so busy just learning the Atmel assembly that I wouldn't use them right away.

Robw
02-13-2008, 11:50 PM
I did find one schematic so far for a ph probe. The output from the circuit is 0-140mv which corresponds to the ph value. No link to the probe used though.
http://damien.douxchamps.net/elec/ph_meter/

Assembly language! I haven't used that in more than 20 years. I do remember it was fun once I figured out the codes etc. That was for the 8085 microprocessor. Time to start reading!

mark
02-14-2008, 12:57 AM
Kwirky, once you get them running, sounds like a cheap little controller you could market to fellow reefers.

Robw, I was looking for the output for figuring the slope/intercept for a pH probe awhile back (was hooking to a datalogger) and got this e-mail from American Marine (AMI):
"After proper calibration the probe will generate 59 mV per each unit of positive pH and the opposite will be negative mV. Example pH 7.0= 0 mV; a ph of 8.0=59mV a pH of 6.5= -30mV Good Luck...Lou Dell/AMI"

midgetwaiter
02-14-2008, 01:22 AM
"After proper calibration the probe will generate 59 mV per each unit of positive pH and the opposite will be negative mV. Example pH 7.0= 0 mV; a ph of 8.0=59mV a pH of 6.5= -30mV Good Luck...Lou Dell/AMI"

Did he by any chance explain how to correct for temperature with this? The closest I've ever found to a bona fide reference is the table on the back of pinpoint's calibration packets and I bet that doesn't necessarily correspond with SW.

kwirky
02-14-2008, 01:54 AM
Did he by any chance explain how to correct for temperature with this? The closest I've ever found to a bona fide reference is the table on the back of pinpoint's calibration packets and I bet that doesn't necessarily correspond with SW.

with the temperature we run our aquariums at temperature callibration is almost negligable. I saw a chart somewhere once and it's like a 2% difference. (ph 8.302 instead of 8.297)

KrazyKuch
02-15-2008, 04:11 AM
Here is a schematic I just did up for an Orp interface

http://i27.photobucket.com/albums/c184/KrazyKuch/Orp.jpg

kwirky
02-18-2008, 01:45 AM
does the orp interface work the same with a pH probe too? only the calibration points would be separate?

KrazyKuch
02-18-2008, 03:15 AM
Yeah thats basically how all probes work.....All you have to do is amplifi the signal to a stat that is easily readable from your controller then it's a matter of figuring out how the signal gets converted into the proper reading.....for PH after it's amplified 1 millivolt will stand for a ph of 1 a 10 millivolt signal stands for a ph of 10....If you want I can get the calculations for the orp!

kwirky
02-18-2008, 03:08 PM
what's that on the far lefthand side that was cut off in the schematic labeled "X1"?

What about having software callibration? Which pots would be cut out for software callibration? (for example, put probe in ph 7 solution, press button. put ph probe in ph 10 solution, press button)

KrazyKuch
02-18-2008, 04:02 PM
The X1 in that schematic is the BNC connector.....basically that schematic is for orp...I have another for PH if you want it, well basically you can remove the 2 variable resistors and thats all the one that is on the orp is a set it once and never again kinda dealy...

Robw
02-18-2008, 11:09 PM
With the schematic link I posted you calibrate the amp with a volt meter and your calibration solutions so you get appropriate readings. This output would be sent to an A/D converter for the atmega board and the value read by one of the input ports. Does the board have any built in A/D converters?

Rob

KrazyKuch
02-18-2008, 11:55 PM
It's th3 ATmega 128 if I remember correctly it has 8 10bit A/D ports!

kwirky
02-19-2008, 05:06 AM
yeah I understand the two schematics now. I'm probably going to go with the controller schematics here: http://emesystems.com/OL2ph.htm

I've been reading up on the LCD controllers i ordered and I've been toying with AVR tools to figure out efficient ways to interface with LCD controllers.

My goal is to use the 128x64 screen for graphing of logs (temperature, ph, orp, etc). The 128x64 uses dual KS0108's. I also have a 16x4 character LCD ordered that uses the HD44780 controller. I wonder if it'd also have dual controllers because most of the info I've found on the HD44780 pertains to a 2 line screen. we'll see.

I'm waiting on the parts to arrive. they haven't even shipped them yet and I paid extra for express shipping. *grumble grumble*

KrazyKuch
02-19-2008, 10:52 PM
I have found the best way to deal with LCD and Micro controllers is building the LCD with another chip and comunicate between the 2 serialy(i.e make a serial LCD)....saves on I/O pins on your controller!!!

Bryan
02-20-2008, 06:29 AM
I have one of the MIkroe EP4 development bioards. Quite nice and are a good deal. For some some schematics on ORP and PH.

http://home.zonnet.nl/rsetteur/aquarium/karel/ph/index_ph.htm

and how is your Russian

http://www.montan-a.hotmail.ru/samodel/Aqua_1.htm

Bryan
02-20-2008, 06:39 AM
and if your Russian is no good.

http://members.optusnet.com.au/markdem/

kwirky
02-20-2008, 09:50 PM
I ordered a sample pack from intersil, including few pH interfaces. They're only $1.40 a piece if I need any more :)

kwirky
02-27-2008, 04:48 PM
ok my atmel mega controller units have been processed. I'm still waiting for them to ship them though.

it's taking longer than expected to recieve them. :(

kwirky
03-17-2008, 05:32 AM
they finally arrived on saturday haha. I need to get myself a 12V power supply or two and I have to find the mating ends for the 14 pin busses. I asked for "male" parts but they sent me the same ones soldered to the bords. I must have gotten male and female mixed up. I'm going to try to find somewhere local that has them, maybe alberta computer cable.

Here are my priorities:


get the power supplies and cable ends
figure out how to get my pc talking to the boards (relatively simple)
get the units talking with the screens (fair bit of work, i'll be writing my own framework for this as a learning experience)
get the units talking with the opto-interrupted relays
start designing the user interface (switches, etc) and how the unit will function


my first real use will be a wavemaker using maxijet pumps. My goal is to EVENTUALLY develop it into a product. I have a guinea pi*ahem* BETA TESTER lined up already ;). I'll post my progress of the build on the thread here. I'm pretty busy with class for the next few days so I can't run around town gathering the stuff I need to start playing with my parts until later this week.

oh does anyone know how I'd run 120VAC through the relays? They're SPDT. Would I switch the hot on and off and leave the ground connected to the wall supply? I've never worked with AC power and I have to make sure I get things right before I start using it. I don't want to burn anything or even worse get a nasty shock.

oh and here's a serious iodological personal debate of mine: open source. I REALLY want to make all the code open source and I don't really think it would interfere with me selling them down the road. If people want to mess with their units then so be it. If they want to make their own and sell them oh well. I just like the idea of introducing a well featured aquarium controller at a price many more hobbyists can afford (shake up the market). That's WAY down the road but I think the "open source" decision should be made early. Any suggestions?

oh please don't ask me "make me one!" because I just barely understand all this myself yet. Talk about a "product" is just my overambition :)
here are some pictures:
http://www.kwirky88.com/images/aquarium/controller/controllers.jpg
http://www.kwirky88.com/images/aquarium/controller/electronics.jpg

Delphinus
03-17-2008, 05:59 AM
Count me as a vote for open source..

Pan
03-17-2008, 06:00 AM
Make me Two! :twised:
Open Source is a good idea i think as well.

midgetwaiter
03-17-2008, 05:05 PM
oh does anyone know how I'd run 120VAC through the relays? They're SPDT. Would I switch the hot on and off and leave the ground connected to the wall supply? I've never worked with AC power and I have to make sure I get things right before I start using it. I don't want to burn anything or even worse get a nasty shock.


Switch hot and wire the neutral straight through. Neutral and ground are different though, makes life easier to keep them separate in your mind.

kwirky
03-17-2008, 05:40 PM
on a 2 pronged AC plug, which is the hot and which is the neutral? Is the wider prong the hot?

digital-audiophile
03-17-2008, 08:02 PM
http://www.petsworld.co.uk/images/guinea-pig.jpg

KrazyKuch
03-18-2008, 12:07 AM
The wider prong is the neutral!

KrazyKuch
03-18-2008, 12:09 AM
Hey Kwirky if you have any problems with the code let me know....What language are you gonna program in???

I can program with C of coarse and I'm not bad with assembly!

kwirky
03-18-2008, 03:52 AM
The wider prong is the neutral!

hence why I asked ;)

Hey Kwirky if you have any problems with the code let me know....What language are you gonna program in???

I can program with C of coarse and I'm not bad with assembly!

I'll be using C through the gcc/atmel compiler. Assembly would be required for something of extreme performance but it's not like I'm doing frequency generation or the likes. I shouldn't have problems with C. It'll more or less be problems with the poorly documented atmel library for C that I forsee. But like I said i'm not doing anything real complex.

One thing I don't know is how to make a serializing circuit. I understand the programming but how the transistors would go together to "unserialize" the data later is a bit beyond me. It's the electronics that I'm learning as I go.

kwirky
03-19-2008, 07:52 AM
I got me some "8 bit parallel serial shift registers"

They're so I can use like 3 pins for 8 pins worth of traffit. mainly for the LCD screen/s.

I got all the 10 pin wire and ends too and a cheap little 500ma power supply. I'll be getting the serial cable tomorrow hopefully then start playing with them on friday.

banditpowdercoat
03-19-2008, 12:57 PM
The wider prong is the neutral!

Yup. As an electrician myself, I am very interested in your outcome. Ive been thinking of trying a old PLC5 from work to controll stuff, but the physical size of the chassis are just to huge. Now if only I could get a little SLC processor..... HAHAHA

Midknight
05-13-2008, 02:08 PM
So how is this progressing? Are you ready to mass produce yet? :wink:

BC564
05-13-2008, 04:50 PM
you could alway use a micrologix PLC......

Robw
08-02-2008, 03:47 PM
How is this project going? There hasn't been any updates in several months? Do you have any source code for perusal?

spreerider
08-02-2008, 08:33 PM
I have access to a bunch of melsec A1S PLCs and have started building a controller out of one, the chassis size is a bit large but compared to all the recepticles and contactors that will be in the case the PLC isnt that bad.

kwirky
08-08-2008, 08:39 PM
haha I've been SO busy with other stuff the hardware's sat on the shelf. My real nice workspace in the basement was taken down. Also I've been busy helping my fiance with the business (along with my job at golds) therefore I haven't been able to continue with it lately.

I have to say I'm spoiled developing on something high level with tons of framework like c# and dot.net. The learning curve of programming in the Atmel's version of C is VERY steep compared to what I'm used to.

Also the text screen I picked up has ZERO documentation. It's a 20x4 screen and you have to overflow it's registers to use the extra characters (standard is 16x2). That's all I figured out so far.

I got the controller switching the opto-relays on and off but as for the screen it reached a stand still.

But it's indefinate when I'll be able to continue with the project. :(