Page 2 of 2

Re: Need custom code for custom expansion

Posted: Thu Oct 25, 2012 8:42 am
by rimai
I'm also interested on seeing how you are powering the motors. Did you use a mosfet transistor?

Need custom code for custom expansion

Posted: Thu Oct 25, 2012 11:54 am
by AquaO
rimai wrote:I'm also interested on seeing how you are powering the motors. Did you use a mosfet transistor?
No I use a NPN transistor TIP-122

Here is the wiring I did

Image

Image

Image

Image

Image

Thank you very much for your comment

Need custom code for custom expansion

Posted: Thu Oct 25, 2012 12:14 pm
by AquaO
For control motor speed with PWM you need:

1x NPN transistor TIP-122
1x Capacitor 1uf
1x Diode
1x Resistor 1k ohm

And the diagram

Image

Image

Image

Image

Image

For make your own USB cable for communication RA/Uno
You need:

1x Regular USB cable and strip it
2x Resistor 1.5k ohm

And the diagram

Image

Need custom code for custom expansion

Posted: Thu Oct 25, 2012 4:49 pm
by AquaO
Hi guys, I did some experiment for you. And the good news, you can use the dimming ports of Reef Angel to control the motor speed. You do not need an Arduino Uno. The Reef Angel and pwm expansion module is ready for this use.

Here the diagram

Image

Image

Image

Image

Image

And the video
http://youtu.be/Zo3RXFuEGlI

I think if would be great for an update of RA dosing pump ;)

Need custom code for custom expansion

Posted: Thu Oct 25, 2012 4:59 pm
by lnevo
There you go roberto! Wire that into the circuit for of the ra dosing pump add a switch for controlled or independent mode and done deal!!!

Re: Need custom code for custom expansion

Posted: Thu Oct 25, 2012 8:25 pm
by AquaO
I need your help, I'm not very good with the RA code.

I would like to know if it's possible to add to the menu PWM port and change the name in the menu?
Ex: instead of Ch 0, Ch 1, Ch 2 and Ch 3
I would like Alk, Ca, Mg and Carb and to modify the duration and %
Ex: Alk 15sec at 100% or Ca 20sec at 60%

Thank you in advance
Eric

This is my RA code

Code: Select all

#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_NokiaLCD.h>
#include <RA_ATO.h>
#include <RA_Joystick.h>
#include <LED.h>
#include <RA_TempSensor.h>
#include <Relay.h>
#include <RA_PWM.h>
#include <Timer.h>
#include <Memory.h>
#include <InternalEEPROM.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
#include <Salinity.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <ReefAngel.h>

////// Place global variable code below here


////// Place global variable code above here


void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    ReefAngel.AddStandardMenu();  // Add Standard Menu

    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port5Bit | Port6Bit | Port7Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = 0;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = 0;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 869 );


    // Ports that are always on
    ReefAngel.Relay.On( Port1 );
    ReefAngel.Relay.On( Port2 );
    ReefAngel.Relay.On( Port3 );
    ReefAngel.Relay.On( Port4 );
    ReefAngel.Relay.On( Port5 );
    ReefAngel.Relay.On( Port6 );
    ReefAngel.Relay.On( Port7 );

    ////// Place additional initialization code below here
    

    ////// Place additional initialization code above here
}

void loop()
{
    ReefAngel.DosingPumpRepeat( Port8,0,60,60 );
    ReefAngel.PWM.SetChannel( 0, now()%3600<15?80:0);
    ReefAngel.PWM.SetChannel( 1, now()%3600<25?50:0);
    ReefAngel.PWM.SetChannel( 2, now()%3600<35?95:0);
    ReefAngel.PWM.SetChannel( 3, now()%3600<10?100:0);

    ////// Place your custom code below here
    

    ////// Place your custom code above here

    // This should always be the last line
    ReefAngel.ShowInterface();
}

void DrawCustomMain()
{
    int x,y;
    char text[10];
    // Dimming Expansion
    x = 15;
    y = 2;
    for ( int a=0;a<6;a++ )
    {
      if ( a>2 ) x = 75;
      if ( a==3 ) y = 2;
      ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x,y,"Ch :" );
      ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x+12,y,a );
      ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x+24,y,ReefAngel.PWM.GetChannelValue(a) );
      y += 10;
    }
    pingSerial();

    // Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
    ReefAngel.LCD.DrawMonitor( 15, 43, ReefAngel.Params,
    ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
    ReefAngel.LCD.DrawMonitor( 15, 43, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
    pingSerial();

    // Main Relay Box
    byte TempRelay = ReefAngel.Relay.RelayData;
    TempRelay &= ReefAngel.Relay.RelayMaskOff;
    TempRelay |= ReefAngel.Relay.RelayMaskOn;
    ReefAngel.LCD.DrawOutletBox( 12, 84, TempRelay );
    pingSerial();

    // Date and Time
    ReefAngel.LCD.DrawDate( 6, 122 );
    pingSerial();
}

void DrawCustomGraph()
{
}

Re: Need custom code for custom expansion

Posted: Fri Oct 26, 2012 9:32 am
by rimai
I'm assuming you are talking about changing the main screen, right?
http://forum.reefangel.com/viewtopic.php?f=14&t=109

Need custom code for custom expansion

Posted: Fri Oct 26, 2012 11:22 am
by AquaO
Yeah and change the value of PWM expansion, on ch0, ch1, ch2, ch3 directly on PDE.

Need custom code for custom expansion

Posted: Sat Oct 27, 2012 6:13 am
by AquaO
rimai wrote:I'm assuming you are talking about changing the main screen, right?
http://forum.reefangel.com/viewtopic.php?f=14&t=109
thank you I'll try to make my own main screen and menu.