WP40 on the Arduino UNO stand alone

Do you have a question on how to do something.
Ask in here.
Post Reply
jdoenumber2
Posts: 11
Joined: Wed Jul 13, 2011 8:14 am

WP40 on the Arduino UNO stand alone

Post by jdoenumber2 »

I hope that it is not out of place or offensive to ask this question. Reason why I don't own a reef angel is a financial reason. Nearly unemployed and wedding in less than 3 months. A couple of years ago i received another controller. Had it been my decision I would of started with a Reef Angel. I did buy the Jebao controller cable and have tinkered with that for a bit. Still not very exciting. I have an Arduino and very little knowledge of how to program it.

Trying to get my Arduino to work as a stand alone controller for my WP40 is my objective. From what i understand i would need to have a good code, a low pass filter and the ability to apply all together. I understand that there is a large community who fully understand how to program code to the Reefangel and files are obtainable. I just don't understand how to make them work on my Arduino. I have trying to figure out how to design a lowpass filter that would work between the PWM output of Arduino and the 5Vdc analog. Not sure how to do it correctly. After hours of my brain turning to mush Trying hard to get things to work i gave up for a couple of months.

1. Does anyone have a working sketch that would emulate Vortech modes in code designed for Arduino?
2. Does anyone have the ability to share what parts are needed to build a low pass filter would would work for said application?
3. Would anyone like to share their experiences with me if they have done the same project.

Any Information shared public or private is Gratefully Appreciated.

Thank you,

Jason
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: WP40 on the Arduino UNO stand alone

Post by rimai »

You can buy the Jebao cable from the RA webstore.
That's all you need :)
Download the RA installer from the website and upload RA code to your UNO. Just make sure to select "Reef Angel controller w/ optiboot" as board.
Then connect the cable on pin 9 (Actinic Channel) or pin10(Daylight Channel)
Roberto.
jdoenumber2
Posts: 11
Joined: Wed Jul 13, 2011 8:14 am

Re: WP40 on the Arduino UNO stand alone

Post by jdoenumber2 »

Thank you very much for the information you shared. I am trying to add the code. No luck yet. Am i to upload InitialInternalMemory First? I tried i am not too sure that it took all of the code. I could cut and past a screen shot of what i get? Or am i trying the wrong code to upload? I ordered the cable shortly after you came out with it. So i got that.

Code: Select all


The following features were automatically added:
Watchdog Timer
Version Menu

The following features were detected:
java.io.FileNotFoundException: /Users/jasonkramer/Documents/Arduino/update/feature.txt (No such file or directory)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(FileInputStream.java:120)
	at java.io.FileInputStream.<init>(FileInputStream.java:79)
	at java.io.FileReader.<init>(FileReader.java:41)
	at processing.app.Sketch.ProcessFeature(Sketch.java:1373)
	at processing.app.Sketch.build(Sketch.java:1766)
	at processing.app.Sketch.build(Sketch.java:1750)
	at processing.app.Editor$DefaultRunHandler.run(Editor.java:1867)
	at java.lang.Thread.run(Thread.java:680)
Simple Menu
java.io.IOException: No such file or directory
	at java.io.UnixFileSystem.createFileExclusively(Native Method)
	at java.io.File.checkAndCreate(File.java:1705)
	at java.io.File.createTempFile0(File.java:1726)
	at java.io.File.createTempFile(File.java:1803)
	at processing.app.Base.saveFile(Base.java:2189)
	at processing.app.Sketch.ProcessFeature(Sketch.java:1456)
	at processing.app.Sketch.build(Sketch.java:1766)
	at processing.app.Sketch.build(Sketch.java:1750)
	at processing.app.Editor$DefaultRunHandler.run(Editor.java:1867)
	at java.lang.Thread.run(Thread.java:680)
InitialInternalMemory:30: error: 'RA_NokiaLCD' does not name a type
InitialInternalMemory.cpp: In function 'void setup()':
InitialInternalMemory:34: error: 'e' was not declared in this scope
InitialInternalMemory:35: error: 'COLOR_WHITE' was not declared in this scope
InitialInternalMemory:38: error: 'InternalMemory' was not declared in this scope
InitialInternalMemory:72: error: 'Constant' was not declared in this scope
InitialInternalMemory:146: error: 'COLOR_BLACK' was not declared in this scope
InitialInternalMemory:146: error: 'MENU_START_COL' was not declared in this scope
InitialInternalMemory:146: error: 'MENU_START_ROW' was not declared in this scope
jdoenumber2
Posts: 11
Joined: Wed Jul 13, 2011 8:14 am

Re: WP40 on the Arduino UNO stand alone

Post by jdoenumber2 »

Just did a reboot on my computer. I think i am getting somewhere.............
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: WP40 on the Arduino UNO stand alone

Post by rimai »

You must use the Arduino version that comes with the RA installer.
Download it from the website.
Yes, you must upload the InitialInternalMemory first.
Roberto.
jdoenumber2
Posts: 11
Joined: Wed Jul 13, 2011 8:14 am

Re: WP40 on the Arduino UNO stand alone

Post by jdoenumber2 »

I am using Arduino version that came form this site. When i upload the InitialInternalMemory sketch am i supposed to add reefcrest sketch to it or load it as another sketch separately?

I found the code for reef crest that i want to add. I just dont think i am doing it correctly. This is what my sketch looks like. Please advise if possible.

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 <AI.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <Salinity.h>
#include <PH.h>
#include <WaterLevel.h>
#include <ReefAngel.h>


RA_NokiaLCD e;

void setup()
{
    e.Init();
    e.Clear(COLOR_WHITE,0,0,132,132);
    e.BacklightOn();

    InternalMemory.MHOnHour_write(15);
    InternalMemory.MHOnMinute_write(30);
    InternalMemory.MHOffHour_write(21);
    InternalMemory.MHOffMinute_write(0);
    InternalMemory.MHDelay_write(7);
    InternalMemory.StdLightsOnHour_write(14);
    InternalMemory.StdLightsOnMinute_write(0);
    InternalMemory.StdLightsOffHour_write(21);
    InternalMemory.StdLightsOffMinute_write(30);
    InternalMemory.DP1OnHour_write(20);
    InternalMemory.DP1OnMinute_write(0);
    InternalMemory.DP2OnHour_write(22);
    InternalMemory.DP2OnMinute_write(30);
    InternalMemory.DP1Timer_write(4);
    InternalMemory.DP2Timer_write(4);
    InternalMemory.DP1RepeatInterval_write(60);
    InternalMemory.DP2RepeatInterval_write(60);
    InternalMemory.ATOHourInterval_write(0);
    InternalMemory.FeedingTimer_write(900);
    InternalMemory.LCDTimer_write(600);
    InternalMemory.LEDPWMActinic_write(20);
    InternalMemory.LEDPWMDaylight_write(20);
    InternalMemory.WM1Timer_write(10);
    InternalMemory.WM2Timer_write(15);
    InternalMemory.HeaterTempOn_write(766);
    InternalMemory.HeaterTempOff_write(770);
    InternalMemory.ChillerTempOn_write(774);
    InternalMemory.ChillerTempOff_write(770);
    InternalMemory.OverheatTemp_write(1500);
    InternalMemory.PHMax_write(830);
    InternalMemory.PHMin_write(540);
    InternalMemory.SalMax_write(2550);
    InternalMemory.ORPMax_write(285);
    InternalMemory.ORPMin_write(1400);    
    InternalMemory.RFMode_write(Constant);
    InternalMemory.RFSpeed_write(50);
    InternalMemory.RFDuration_write(8);
    InternalMemory.RFDuration_write(8);
    InternalMemory.PWMSlopeStartD_write(15);
    InternalMemory.PWMSlopeEndD_write(100);
    InternalMemory.PWMSlopeDurationD_write(60);
    InternalMemory.PWMSlopeStartA_write(15);
    InternalMemory.PWMSlopeEndA_write(100);
    InternalMemory.PWMSlopeDurationA_write(60);
    InternalMemory.PWMSlopeStart0_write(15);
    InternalMemory.PWMSlopeEnd0_write(100);
    InternalMemory.PWMSlopeDuration0_write(60);
    InternalMemory.PWMSlopeStart1_write(15);
    InternalMemory.PWMSlopeEnd1_write(100);
    InternalMemory.PWMSlopeDuration1_write(60);
    InternalMemory.PWMSlopeStart2_write(15);
    InternalMemory.PWMSlopeEnd2_write(100);
    InternalMemory.PWMSlopeDuration2_write(60);
    InternalMemory.PWMSlopeStart3_write(15);
    InternalMemory.PWMSlopeEnd3_write(100);
    InternalMemory.PWMSlopeDuration3_write(60);
    InternalMemory.PWMSlopeStart4_write(15);
    InternalMemory.PWMSlopeEnd4_write(100);
    InternalMemory.PWMSlopeDuration4_write(60);
    InternalMemory.PWMSlopeStart5_write(15);
    InternalMemory.PWMSlopeEnd5_write(100);
    InternalMemory.PWMSlopeDuration5_write(60);
    InternalMemory.ATOExtendedTimeout_write(120);
    InternalMemory.ORPMin_write(2050);
    InternalMemory.ORPMax_write(450);
    InternalMemory.ActinicOffset_write(30);
    InternalMemory.CO2ControlOn_write(770);
    InternalMemory.CO2ControlOff_write(760);
    InternalMemory.PHControlOn_write(800);
    InternalMemory.PHControlOff_write(810);
    InternalMemory.AISlopeStartW_write(0);
    InternalMemory.AISlopeEndW_write(100);
    InternalMemory.AISlopeDurationW_write(60);
    InternalMemory.AISlopeStartB_write(0);
    InternalMemory.AISlopeEndB_write(100);
    InternalMemory.AISlopeDurationB_write(60);
    InternalMemory.AISlopeStartRB_write(0);
    InternalMemory.AISlopeEndRB_write(100);
    InternalMemory.AISlopeDurationRB_write(60);
    InternalMemory.RadionSlopeStartW_write(0);
    InternalMemory.RadionSlopeEndW_write(100);
    InternalMemory.RadionSlopeDurationW_write(60);
    InternalMemory.RadionSlopeStartRB_write(0);
    InternalMemory.RadionSlopeEndRB_write(100);
    InternalMemory.RadionSlopeDurationRB_write(60);
    InternalMemory.RadionSlopeStartR_write(0);
    InternalMemory.RadionSlopeEndR_write(100);
    InternalMemory.RadionSlopeDurationR_write(60);
    InternalMemory.RadionSlopeStartG_write(0);
    InternalMemory.RadionSlopeEndG_write(100);
    InternalMemory.RadionSlopeDurationG_write(60);
    InternalMemory.RadionSlopeStartB_write(0);
    InternalMemory.RadionSlopeEndB_write(100);
    InternalMemory.RadionSlopeDurationB_write(60);
    InternalMemory.RadionSlopeStartI_write(0);
    InternalMemory.RadionSlopeEndI_write(100);
    InternalMemory.RadionSlopeDurationI_write(60);
    InternalMemory.DelayedStart_write(7);
    InternalMemory.PHExpMax_write(2500);
    InternalMemory.PHExpMin_write(500);
    InternalMemory.WaterLevelMax_write(3575);
    InternalMemory.WaterLevelMin_write(2875);
    InternalMemory.SalTempComp_write(750);
    InternalMemory.WaterLevelLow_write(60);
    InternalMemory.WaterLevelHigh_write(65);
    InternalMemory.DP3Timer_write(4);
    InternalMemory.DP3RepeatInterval_write(60);
    InternalMemory.IMCheck_write(0xCF06A31E);
    e.DrawText(COLOR_BLACK, COLOR_WHITE, MENU_START_COL+20, MENU_START_ROW*3, "Memory Updated");
    e.DrawText(COLOR_BLACK, COLOR_WHITE, MENU_START_COL+25, MENU_START_ROW*6, "You can now");
    e.DrawText(COLOR_BLACK, COLOR_WHITE, MENU_START_COL+25, MENU_START_ROW*7, "upload your");
    e.DrawText(COLOR_BLACK, COLOR_WHITE, MENU_START_COL+33, MENU_START_ROW*8, "INO code");
}

void loop()
{
  
      ////// Place your custom code below here
    
    

    
    ReefAngel.PWM.SetDaylight( ReefCrestMode(60,20,true) );
   
   byte ReefCrestMode(byte WaveSpeed, byte WaveOffset, boolean PulseSync)
{
  static unsigned long lastwavemillis=millis();
  static int newspeed=WaveSpeed;
  if ((millis()-lastwavemillis) > 5000)
  {
    if (random(100)<50) newspeed--; else newspeed++;
    newspeed=constrain(newspeed,WaveSpeed-WaveOffset,WaveSpeed+WaveOffset);
    newspeed=constrain(newspeed,0,100);
    lastwavemillis=millis();
  }  
  if (PulseSync)
    return newspeed;
  else
    return WaveSpeed-(newspeed-WaveSpeed);
}


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

rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: WP40 on the Arduino UNO stand alone

Post by rimai »

You only need the code InitialInternalMemory once and never again.
The code can be found on menu File->Sketchbook->Example Codes
Then, you can use a code like this:

Code: Select all

#include <Salinity.h>
#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <rtc_clock.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 <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <Humidity.h>
#include <DCPump.h>
#include <ReefAngel.h>

void setup()
{
  ReefAngel.Init();  
}

void loop()
{
  ReefAngel.PWM.SetDaylight( ReefCrestMode(60,20,true) );
  ReefAngel.ShowInterface();

}
Roberto.
jdoenumber2
Posts: 11
Joined: Wed Jul 13, 2011 8:14 am

Re: WP40 on the Arduino UNO stand alone

Post by jdoenumber2 »

I wanna thank you for all the help you are giving me. However i think i just don't understand how to add the second piece of code correctly. I will post a video of what i am doing and if at all possible you could advise what i am doing wrong.

Thank you for extending so much help to me,

Jason
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: WP40 on the Arduino UNO stand alone

Post by rimai »

No need to add anything.
Use the code I posted as is.
Roberto.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: WP40 on the Arduino UNO stand alone

Post by rimai »

Oh, I just realized you also need to mod the Jebao cable, since your signal is 0-5V instead of 0-10V:
http://forum.reefangel.com/viewtopic.php?p=24152#p24152
Roberto.
jdoenumber2
Posts: 11
Joined: Wed Jul 13, 2011 8:14 am

Re: WP40 on the Arduino UNO stand alone

Post by jdoenumber2 »

Well......... I removed R2 and while desoldering it i melted surface of board of jebao cable. After that i used a jumper wire to jump the two points that were desoldered and my Arduino board went pop. Now my board started getting really hot and would not respond to anything. gonna let it cool down and doubtfully get it to restart. Just my luck.........
Post Reply