DIY Dosing Pump Controller Atmega128

<a href=showthread.php?s=&postid=13711804#post13711804 target=_blank>Originally posted</a> by hellssephiroth
wow that is so kewl, wish i could do stuff like that, started going to school for electronics but had to drop out due to financial issues and bad roomates....... keep up the good work man!

I have no formal training, other than a BS (very useless) electronics class in junior high school. This is all self taught with the help of asking questions on some electronics forums.

There is nothing very complex here, just building blocks of basic systems.

The Atemga128 needs very little external circuitry. A 5V power supply rail and some filter caps, along with a clock crystal (it can also run without the crystal using its own internal Phased Locked Loop).

The relays are tied to the Atemaga PINS via a simple transistor. This prevents the relay coils from drawing current THROUGH the I/O pins and allows them to pull current directly from the 5V rail. Basic transistor as a switch :)

The diodes on the board are all simple flyback or protection diodes to prevent the relay coils from damaging the sensitive components due to spikes.

The RS232 transceiver simply changes the low level signals from the Atmegas built in UART to a voltage and current usable with a PCs serial port. It only needs a few external filter caps and is hooked directly to the Atemags UART pins.

The Real Time Clock uses its own crystal oscillator and a few filter caps. It ties directly to the I2C pins of the Atmeaga. Standard pull-up resistors for SDA and SDL (the standard I2C lines).

The power supplies are right out of the datasheets (I did add some extra filtration in the form of a choke coil).

The WIZNET is the most complex piece in the system. The Bascom compiler has some built in commands to make working with TCP/IP over SPI easier.

The BASCOM compiler also has some built in features to deal with rotary (quadrature) encoders.

So all in all, this looks complex but is fairly simple compared to many other projects.
 
Bean,

VERY nice work. It all looks very professional ( you want a job?? ;-).

If you need any help, let me know ( although it appears you dont ).

Your design is very similar to my own rabbit micro, although mine uses C ;-).

Keep up the good work and keep posting.

What are you going to use for dosing pumps?

Stu
 
<a href=showthread.php?s=&postid=13712027#post13712027 target=_blank>Originally posted</a> by stugray
Bean,

VERY nice work. It all looks very professional ( you want a job?? ;-).
I would love to do this for a living... Though I think my depth of electronics knowledge may be a tad shy compared to the geeks at JPL and NASA. Then again you could put me in an office with a soldering iron and I could smile and act like I was working!

If you need any help, let me know ( although it apears you dont.
I have the logic worked out and am hammering away at the code. I don't need help yet, but may need some if I get stuck thinking in a loop. A fresh perspective can mean wonders when you code yourself into a corner!

Yor design is very similar to my own rabbit micro, although mine uses C ;-).
That is why I am not using the Rabbit or FireBoard, etc.. they are all C or Assembly based. I like programming in basic so it was pretty much between this and the PIC.

What are you going to use for dosing pumps?

I have a small 3 channel Ismatic (24VDC) and a few larger Cole-Palmer masterflex pumps. I am not sure yet. The software will handle any size (or combination of size) pumps. The ml/min calibration setting is per channel.

At one point I was going to use Hall Effect sensors to count revs instead of using TIME, but decided against it due to added complexity and the need to retrofit the hall effects/magnets to the pumps. In reality, counting the revs is a much more elegant solution though :)

Thanks for the kind words.
 
BeanAnimal,

I also have a masterflex pump & I want to see how it works.

Does anyone know if they use a feedback loop to control RPM? ( Is there a tachometer output )

Or is it a Constant current device that will vary speed with load?

Bean, your setup looks like it will just turn on/off the AC to the pumps right? The Masterflex turns on/off very nicely with a slow start pump.


Oh.. and if the pumps have a clear cover, then YFs suggestion could work with a retro-reflector IR detector. As the arms of the pump pass under the detector, you could count the pulses.

Stu
 
I just have the masterflex heads (#35 i think). A guy on ebay had loads of them, they are no longer around though. I bid on a few full pumps but never got one. The ismatec is just a head and 24VDC motor as well.

Yes my setup will just Switch devices on and off 15A relays. I borught out the NO, NC and C contacts so that AC/DC can be used as needed.

I played with a few IR detectors but did not want to fiddle with the myriad of small issues in getting them to work right. The hall sensors were MUCH easier to get consistent results from.

Remember, this is not being designed for a particular pump, it is to work woth any pump :)

Another note: The hall sensors I chose are flip flops, they produce no bounce. I do not need to tie them to an interrupt. The IR sensors need to be polled or tied to an interrupt, or attached to the micro via a flip-flop and buffer... making things MUCH more complex.

I just decided not to use them (the sensors) in favor of timed operation. Pump output may drift based on slight voltage changes, but even with precise revolution count the output will still drift due to wear in the tubing (in the case of a peristaltic pump).
 
If you want to read more about the Hall Effect latches I am playing with:

http://www.allegromicro.com/en/Products/Categories/Sensors/latches.asp

I have unipolars, bipolars and omnipolars as well... however the latch is the way to go for a projet like this. You don't need to poll for it, debounce it or tie it to an interrupt.

For example if you glue a south magnet on one edge of the disc and a north magnet 180 degrees around the perimeter of the disc, then each change of state is 1/2 turn. You simply read the pin state as high or low on each pass of the "game loop" even a High RPM peristaltic pump will rotate thousands of times slower than the programs internal game loop, so you will never miss a pin change.

Put 4 magnets on the disc and you have 1/4 turn accuracy... 6 magnets 1/6 turn.. etc.
 
Bean, fist i have to say you have done some realy nice work. Just one question: since you have the plates made by someone else by your drawings, wouldn't it be much cheaper to buy an arduino board?
 
<a href=showthread.php?s=&postid=13719784#post13719784 target=_blank>Originally posted</a> by tarzan
Bean, fist i have to say you have done some realy nice work. Just one question: since you have the plates made by someone else by your drawings, wouldn't it be much cheaper to buy an arduino board?

I built a custom hardware solution and am writing purpose built software tailored to exactly perform a task. Not only that, but the platform will be further developed to perform my lighting and monitoring tasks. The hardware and software are designed to directly meet those goals. I choose to program in the BASIC language. My compiler/IDE of choice is BASCOM-AVR.

Arduino is simply a different IDE and compiler that is more akin to C. I don't like C and have no need to follow somebody else's hardware design.

I still need to have custom PCBs made for the bulk of the project, even if I used the "arduino" hardware layout. So why not just build what I want instead of trying to leverage somebody else's layout?

The cost difference? I had to buy BASCOM-AVR for $100 instead of depending on an open source compiler and language. I have more than a single uC project, so the compiler is an investment in a tool, just like any other tool. Secondly, I prefer not to rely on "open source" tools because you get no real world support when and if you need it. Just because "arduino" is free does not mean that it is a better solution. There are many free development platforms for PICs and ARs out there. I chose BASCOM-AVR for many reasons and could care less about free.
 
<a href=showthread.php?s=&postid=13721265#post13721265 target=_blank>Originally posted</a> by skunkmere
BeanAnimal. you should put it on hackaday.

hahah someone else who know about hack-a-day!!!
I had a really simple project featured by them.
It was featured there back in 05
http://hackaday.com/2005/02/27/xbox-landing-lights-mod/

I have since made a custom board, and added rumble feature to make the lights go crazy when a controller rumbles.

My skills have improved tons since then..
It was nothing more than a basic stamp with NPN transistors driving the LEDs


Keep it up Bean, I love this stuff and your project is right at my current skill level!!!
I LOVE basic too!!!
 
I see lots of C hating going on here :(

But I'm not here to criticize languages and abstractions.

Cool project! Are you planning on releasing it as an open source hardware+software design?
 
Yup.. you caught me... I am a C hater! Fortran too! C++, not as bad as C, but close... and JAVA? Well JAVA THIS!

Funny though, I loved COBOL and did like VAX assembly. Though I am an assembly hater now too! I love VB6 (but not so much VB.net) and am right at home in BASCOM-AVR. Is BASIC as powefull as C or Assembly... nah I am not delusional. I just like to code in a language that flows easily and can be leveraged to do what I need it to do :)

I am not sure how or what form I am going to release it in. I doubt there is much real world interest no matter how it is released anyway.

Updates? Been kind of busy, but the menu structure is all done. The timer routines are working (8 outputs) and the user settings are being stored in EEPROM. I will start on the TCP/IP code this weekend. I can not get the board to communicate via RS-232. I either have a bad MAX-3222 or am missing something obvios like a subtle clock error problem. I have to get the RX and TX pins on the AVR on the scope and see what they look like.

I had an ISR problem with the rotary encoders switch. I could not stop the random ISR calls no matter how I tried to debounce the switch. Lesson learned. The fix, I hit the ISR on both the falling and rising edge before I set the interrupt flag for the button press. That way no matter how long the button is pressed, the code only sees it as one interrupt. Yup... I am new to uC based interrupts :)
 
I either have a bad MAX-3222 or am missing something obvios like a subtle clock error problem. I have to get the RX and TX pins on the AVR on the scope and see what they look like.

Reverse TX and RX. It always works for me ;)


I had an ISR problem with the rotary encoders switch. I could not stop the random ISR calls no matter how I tried to debounce the switch. Lesson learned. The fix, I hit the ISR on both the falling and rising edge before I set the interrupt flag for the button press. That way no matter how long the button is pressed, the code only sees it as one interrupt. Yup... I am new to uC based interrupts :)

Mechanical rotary encoders suck. I've tried using them before as a digital pot volume control. When I realized my rotary encoder library was larger than my main application code, I went ahead and spent the big bucks on an optical encoder. Fixed most of the problems and let me throw most of my careful debouncing work out. Plus it had a very silky feel which was miles ahead of the mechanical part.
 
The encoder itself is optical and I am having no problems with the rotary portion... The mechanical momentary shaft switch is what was killing me.

I will try reversing Rx and Tx and see what happens... I have a second HW UART on the AVR that I did not tie to anything. I am also going to try and configure it and see what happens.

maybe I should breadboard the ENTIRE design nextime before having PCBs made.... Nah :)
 
Too bad they don't readily make optical switches :)

Another trick you can try with debugging serial is to loopback various portions of the circuit. If the micro or computer can see its own transmissions, that portion of the circuit is good. If not, something is either backwards or not working. I say flip it backwards as I often goof up TX/RX connections, especially when I haven't quadruple checked the datasheets (is that TX in? or TX out? ). This problem may not apply to you.

Breadboarding sucks. Its easier for me to get PCBs fabbed, spend 30 minutes building the circuit using SMT (small tweezers, syringe with paste, toaster oven). Then jumper wire or cut traces as needed to fix layout and schematic mistakes. While I'm waiting on new PCBs I go design a few more things which may or may not see the light of day, or write software for what I'm building.

What PCB layout software are you using?
 
I have double checked the datsheets and my traces and schematic... I got it right. I have not been home today to toubleshoot though. I may have a bad chip.. or I could have killed it with the iron (but I have not overheated anything in years).

I have not done any reflow yet but keep thinking I will build one of the temp controlled toater oven projects. I did this all through hole to avoid SMT... the board is 28x larger than it needs to be :)

I have tried several layout packages. I purchased eagle and don't like it. Even after purchase it goes bonkers and scramples files once in a while (anti piracy feature). I am partial to Altium Protel, even though it is overkill for my use and no hobbyist could ever afford to buy it.

I have evening access to PROTEL but will lose that soon, as my friend is moving jobs. So back to eagle I go... I guess.
 
I'm on.

I like the idea of diy, will you have pre-programmed uC's for those like me, that can solder, draw schematics, make sheet metal enclosures but can't program a lick?

Will you have more boards made up and if you will, please post that you'll be ording and I'll send my $$ for one .

Are you getting your parts from DigiKey (they suck for their minimum)

Hopefully this will pan out
 
Back
Top