Code for DC return pump

Do you have a question on how to do something.
Ask in here.
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Code for DC return pump

Post by Ismaclst »

Thanks for the help. I guess eventually I will buy another one that you can control with the RA.
Image
jegillis
Posts: 86
Joined: Sat Jan 04, 2014 10:26 am

Re: Code for DC return pump

Post by jegillis »

I haven't seen this pump but I am gathering that the controller sends 24v PWM to the DC motor to control speed why not just use an appropriately powered LED driver directly to the motor to control the speed?

Looks like a Meanwell ELN-60-27P could do it.

*EDIT

oops this is a three phase motor, needs a motor controller
Image
jegillis
Posts: 86
Joined: Sat Jan 04, 2014 10:26 am

Re: Code for DC return pump

Post by jegillis »

Alright you could use a programmable ESC like this one http://www.hobbyking.com/hobbyking/stor ... oCXUjw_wcB

You would control the ESC like a servo from the reef angel

There are more expensive but prebuilt I2C ESC's are available the difficulty is in finding any that can handle 24v.

Or you could just build one...

http://www.atmel.com/images/doc8012.pdf

Basically everything you need to know to control one of these motors can be found from people using arduino to control hobby RC.

Note that because the motor allegedly does not have hall sensors you should look for an esc that will work with sensor-less motors...
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Code for DC return pump

Post by rimai »

That motor controller can handle 6S which is 24V :)
Roberto.
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Code for DC return pump

Post by Ismaclst »

Image
jegillis
Posts: 86
Joined: Sat Jan 04, 2014 10:26 am

Re: Code for DC return pump

Post by jegillis »

Can't say for sure it would work without documentation for the motor or esc but the specs are ok.

the ESC would need to be programmed so make sure that the ESC has appropriate documentation on programming.

Roberto can we get a PWM port (ato port/ports) to do PMM? or would a servo shield need to be made to handle that?
Image
jegillis
Posts: 86
Joined: Sat Jan 04, 2014 10:26 am

Re: Code for DC return pump

Post by jegillis »

Ismaclst wrote:Sent.
Do you mind sending a pic to me of the board? jegillis@yahoo.com


It needs to have an ESC in it just the same, It should have a micro controller in it and some way to tell that controller what you want it to do.
Image
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Code for DC return pump

Post by Ismaclst »

Ok, sent them to you.
Image
jegillis
Posts: 86
Joined: Sat Jan 04, 2014 10:26 am

Re: Code for DC return pump

Post by jegillis »

Is there any writing at all on the U3 Chip on that board?
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Code for DC return pump

Post by rimai »

0-5PWM is available on both ATO ports or any channel on the dimming expansion module.
0-10PWM is available in the relay box dimming port.
Roberto.
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Code for DC return pump

Post by Ismaclst »

jegillis wrote:Is there any writing at all on the U3 Chip on that board?
Nope.
Image
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Code for DC return pump

Post by Ismaclst »

Since it doesn't sound like this is possible, what would I put into my code to shut the return off if it gets too high? I would use the water level sensor to decide what the max height is and if it gets that high it will shut off port 1. I'm using a gate valve on the drain to create a full siphon so I want the water level sensor to act like a failsafe.
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Code for DC return pump

Post by rimai »

Try something like this:

Code: Select all

if (ReefAngel.WaterLevel.GetLevel(1)>50)
  ReefAngel.Relay.Off(Port1);
else
  ReefAngel.Relay.On(Port1);

Roberto.
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Code for DC return pump

Post by Ismaclst »

Thanks, Roberto.
Image
jegillis
Posts: 86
Joined: Sat Jan 04, 2014 10:26 am

Re: Code for DC return pump

Post by jegillis »

Ismaclst wrote:Since it doesn't sound like this is possible, what would I put into my code to shut the return off if it gets too high? I would use the water level sensor to decide what the max height is and if it gets that high it will shut off port 1. I'm using a gate valve on the drain to create a full siphon so I want the water level sensor to act like a failsafe.

Don't give up so easily....I have been getting a little confused with the PPM (Pulse Position Modulation (servo.write) and PWM.

You should be able to use the ESC you posted (Look for RC Airplane ESC as they are all sensorless) with a 0-5v PWM from the reef angel. Programing will need to be done but it is possible. (The controller has to learn the range of the reef angel PWM signal)
Image
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Code for DC return pump

Post by Ismaclst »

How sure are you that this will work? I'm only asking because I don't want to throw anymore money at something that might work. What kind of programming is involved for the RA?
Image
jegillis
Posts: 86
Joined: Sat Jan 04, 2014 10:26 am

Re: Code for DC return pump

Post by jegillis »

Ismaclst wrote:How sure are you that this will work? I'm only asking because I don't want to throw anymore money at something that might work. What kind of programming is involved for the RA?
without having done it myself I cannot say for sure it will work, in principle it will. If you don't want to throw more money at it hold off and I will get myself one of these pumps soon and try it out.


The programming for the RA is to make a calibration program for the PWM output corresponding to the ESC... For example the ESC may want 100%, 0%, and 50% to learn the range...

ESC programming may entail setting voltage, locking out reverse, and locking out brake, and/or shutting off the battery eliminating circuit (BEC) depending on the ESC.


The ESC is designed for the same type of motor the only other quirk of using an airplane ESC would be that on startup of the ESC the PWM signal must be at 0 to "arm" the esc (this is a safety feature on planes so you don't chop off a finger).

And it will only work with 0-5v PWM, 0-10v PWM or analog will not work.
Image
jegillis
Posts: 86
Joined: Sat Jan 04, 2014 10:26 am

Re: Code for DC return pump

Post by jegillis »

Has anyone seen a DCT4000 from a US seller? I can only seem to find it in the UK at a cost of $160 bucks. The DCT6000 is on amazon for 100.
Image
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Code for DC return pump

Post by Ismaclst »

I appreciate you looking into this. They have them for 65 plus shipping, but I think they either come from China or the UK.

http://www.fish-street.com/jebaojecod_d ... eturn_pump
Image
jegillis
Posts: 86
Joined: Sat Jan 04, 2014 10:26 am

Re: Code for DC return pump

Post by jegillis »

I will just get the 6000 from amazon, easy return if it doesn't work out and no duties or brokerage charges. Last time I got a $25 car part from the UK UPS charged me $130 in brokerage charges for the inconvenience of prepaying $2.50 in duty charges. I will order the stuff this week and see how it goes.
Image
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Code for DC return pump

Post by Ismaclst »

jegillis wrote:I will just get the 6000 from amazon, easy return if it doesn't work out and no duties or brokerage charges. Last time I got a $25 car part from the UK UPS charged me $130 in brokerage charges for the inconvenience of prepaying $2.50 in duty charges. I will order the stuff this week and see how it goes.
Any updates?
Image
OceanWolf
Posts: 54
Joined: Sun Sep 22, 2013 4:59 pm
Location: Morgan Hill, CA

Re: Code for DC return pump

Post by OceanWolf »

Not on the DCT, but my DC6000 works perfect with the code that was in this thread.
An interesting note, when I used the DC6000 controller, 4 light out of 6 was getting my overflow to 98%. I thought it will be equal to 66% in the reef angle code. After playing a bit 77% gets me to 67% in the overflow. I am fine with it, since the waterfall sound is not very bad. I learned that you need to play with the control to find the best for each case.

http://forum.reefangel.com/status/banne ... nWolf&t=-8
Thanks
Onur

Image
jegillis
Posts: 86
Joined: Sat Jan 04, 2014 10:26 am

Re: Code for DC return pump

Post by jegillis »

Ismaclst wrote:
jegillis wrote:I will just get the 6000 from amazon, easy return if it doesn't work out and no duties or brokerage charges. Last time I got a $25 car part from the UK UPS charged me $130 in brokerage charges for the inconvenience of prepaying $2.50 in duty charges. I will order the stuff this week and see how it goes.
Any updates?
Sorry been busy the last few days with girl scout camping...I have the DCT pump waiting on a speed controller the cheap one I got was junk. Should have the new one on Monday.
Image
jegillis
Posts: 86
Joined: Sat Jan 04, 2014 10:26 am

Re: Code for DC return pump

Post by jegillis »

Got the new speed controller today, worked on figuring out how to use servo.write all day hopefully all will work out tomorrow :)

here is the code I am going to try out it compiled if anyone who knows better sees a problem with this let me know

First you need the servo libraries added to the ReefAngel libraries

Code: Select all

 #include <Servo.h> 
This gives our servo a name (placed after the last #include)

Code: Select all

Servo returnpump; // return pump control
placed this in setup to attach return pump to the low ato pin

Code: Select all

returnpump.attach(lowATOPin); //Attaches return pump to low ato
Placed this in loop

Code: Select all

pinMode(lowATOPin,OUTPUT);
returnpump.write(90); //value between 90 and 180
Image
jegillis
Posts: 86
Joined: Sat Jan 04, 2014 10:26 am

Re: Code for DC return pump

Post by jegillis »

So the code works to output the correct signal from the low ato port

Running into another problem in that I need to run through my loop as close as possible to every 20ms for this to work which is not happening.

otherwise all I get is random jitters from the motor

code examples I have found have sketches that control only the motor and add a 20ms delay in the loop. Is their a way to determine how long it takes to run through the loop?
Any other ideas?
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Code for DC return pump

Post by rimai »

What does the servo class do?
Isn't is just a simple PWM signal?
Roberto.
jegillis
Posts: 86
Joined: Sat Jan 04, 2014 10:26 am

Re: Code for DC return pump

Post by jegillis »

rimai wrote:What does the servo class do?
Isn't is just a simple PWM signal?

It is a PWM signal that is sent at a 50hz instead of 490hz of a standard PWM signal


I'm using the code servo.writeMicroseconds with a value of between 1000 and 2000 now instead of just .write (value in degrees) as its easier to understand the changes.. Basically the microsecond value is the length of time on high pulse and the low pulse needs to be about 20ms consistently which is where I am getting confused as I was under the impression that the low pulse length was determined by the frequency


Looking at the Servo.h comments it looks like I can use refresh() throughout the loop to ensure that the signal is refreshed every 20ms so I may have answered my own question.

I also just found a servo library someone wrote specifically to control these esc's so I may give that a try if this doesn't work.
Image
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Code for DC return pump

Post by Ismaclst »

Ok, so I found a design flaw in the DCT pumps. It doesn't retain the speed you had when you lose power to the pump. When it starts back up it is on max speed. This is a problem for me because I restrict my drain so I can create a full siphon. Thankfully, I used the code Roberto gave me to shut off my pump when my overflow reaches a certain height. But this just creates a cycle of off and on on my pump since it is running at max speed. Has anybody heard if Jebao fixed this in a new controller? I don't want to have this happen when I'm away for an extended period of time.
Image
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Code for DC return pump

Post by lnevo »

Thats horrible. That would be a deal breaker for most people.
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Code for DC return pump

Post by Ismaclst »

I know. I wish I had researched these before I bought mine.
Image
Post Reply