WiFi Help

Do you have a question on how to do something.
Ask in here.
Post Reply
divingdon
Posts: 57
Joined: Tue Mar 22, 2011 8:35 pm

WiFi Help

Post by divingdon »

Hello Group,

Before I get into the Issue that I'm experiencing please allow me to Thank the people who are responsible for an excellent reef controller with unlimited potential. My experience with the system has only been for a short time and by NO means can I write code but with the help of the RAGEN and Roberto it has been easier then I would have guessed.

The problem that I'm current having is twofold, 1st I cannot write any new codes because RAGEN will not run on the system dedicated to the REEF ANGEL in either the static mode or installed and I'm not really sure what happen to cause this problem but I can say the PC hasn't been modified or any new software added. But the Home network did get a new wireless router to allow me to secure the connection to the WiFi adapter. The WiFi adapter is seen when I use the setup codes.

This brings me to the 2nd part of the problem I cannot create a new code and I don’t know how to modify my current code that used the USB connection to log to the computer. If anyone can help with these issues I would be very grateful. I will post my current sketch for your review and comments please keep in mind this code is currently only controlling 6 meanwells and the main pump.

Thanks for your help

Don



// Autogenerated file by RAGen (v1.0.3.79), (03/19/2011 08:12)
// RA_031911_0812.pde
//
// This version designed for v0.8.5 Beta 12 or later
/* The following features are enabled for this PDE File:
#define WavemakerSetup
#define ATOSetup
#define MetalHalideSetup
#define wifi
#define StandardLightSetup
*/

#include <ReefAngel_Features.h>
#include <ReefAngel_Globals.h>
#include <ReefAngel_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <ReefAngel_EEPROM.h>
#include <ReefAngel_NokiaLCD.h>
#include <ReefAngel_ATO.h>
#include <ReefAngel_Joystick.h>
#include <ReefAngel_LED.h>
#include <ReefAngel_TempSensor.h>
#include <ReefAngel_Relay.h>
#include <ReefAngel_PWM.h>
#include <ReefAngel_Timer.h>
#include <ReefAngel_Memory.h>
#include <ReefAngel.h>

ReefAngel_TimerClass ParamTimer;

/*
----------------------------------------------------------------------------------------------------------------------------------------------------------
Give labels to your PWM channels
----------------------------------------------------------------------------------------------------------------------------------------------------------
*/
#define WhitePWM1 0
#define BluePWM1 1
#define WhitePWM2 2
#define BluePWM2 3
#define WhitePWM3 4
#define BluePWM3 5

byte PWMChannel[]={
0,0,0,0,0,0};

// Labels for the web banner
#include <avr/pgmspace.h>
prog_char id_label[] PROGMEM = "Reef Tank";
prog_char probe1_label[] PROGMEM = "Water";
prog_char probe2_label[] PROGMEM = "Room";
prog_char probe3_label[] PROGMEM = "light";
prog_char relay1_label[] PROGMEM = "Main%20pump";
prog_char relay2_label[] PROGMEM = "skimmer";
prog_char relay3_label[] PROGMEM = "Heater%201";
prog_char relay4_label[] PROGMEM = "Heater%202";
prog_char relay5_label[] PROGMEM = "Always%20on";
prog_char relay6_label[] PROGMEM = "Chiller";
prog_char relay7_label[] PROGMEM = "LED%20Royal%20Blue";
prog_char relay8_label[] PROGMEM = "LED%20Cool%20White";
PROGMEM const char *webbanner_items[] = {
id_label, probe1_label, probe2_label, probe3_label, relay1_label, relay2_label,
relay3_label, relay4_label, relay5_label, relay6_label, relay7_label, relay8_label};


void setup()
{
ReefAngel.Init(); //Initialize controller


ReefAngel.PHMin=368;
ReefAngel.PHMax=655 ;

ReefAngel.FeedingModePorts = B00001111;
ReefAngel.WaterChangePorts = B00001111;
ReefAngel.OverheatShutoffPorts = B11001100;
ReefAngel.LightsOnPorts = B11000000;

// Ports that are always on
ReefAngel.Relay.On(Port1);

// Initialize and start the Parameter timer
ParamTimer.SetInterval(15); // set interval to 15 seconds
ParamTimer.Start();
}

void loop()
{
ReefAngel.ShowInterface();


if ( ParamTimer.IsTriggered() )
{
ParamTimer.Start();
ReefAngel.PCLogging();
}

//This section calculates the slope
PWMChannel[WhitePWM1]=2.55*PWMSlope(12,15,21,00,0,30,60,PWMChannel[WhitePWM1]); // calculate slope for 0 to 50% starting at 12:30pm with duration of 60min, then from 50% to 0 from 17:00pm with duration of 60min
PWMChannel[BluePWM1]=2.55*PWMSlope(06,45,21,15,0,50,60,PWMChannel[BluePWM1]);
PWMChannel[WhitePWM2]=2.55*PWMSlope(12,16,21,00,0,30,60,PWMChannel[WhitePWM2]);
PWMChannel[BluePWM2]=2.55*PWMSlope(06,46,22,15,0,50,60,PWMChannel[BluePWM2]);
PWMChannel[WhitePWM3]=2.55*PWMSlope(12,17,21,00,0,30,60,PWMChannel[WhitePWM3]);
PWMChannel[BluePWM3]=2.55*PWMSlope(06,47,21,15,0,50,60, PWMChannel[BluePWM3]);

// this section sends the data to the PWM expansion module
PWMExpansion(WhitePWM1,PWMChannel[WhitePWM1]);
PWMExpansion(BluePWM1,PWMChannel[BluePWM1]);
PWMExpansion(WhitePWM2,PWMChannel[WhitePWM2]);
PWMExpansion(BluePWM2,PWMChannel[BluePWM2]);
PWMExpansion(WhitePWM3,PWMChannel[WhitePWM3]);
PWMExpansion(BluePWM3,PWMChannel[BluePWM3]);

}

void PWMExpansion(byte cmd, byte data)
{
Wire.beginTransmission(2); // transmit to device #2
Wire.send('$'); // sends $
Wire.send('$'); // sends $
Wire.send('$'); // sends $
Wire.send(cmd); // sends a value
Wire.send(data); // sends 255
Wire.endTransmission(); // stop transmitting
}
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: WiFi Help

Post by rimai »

May I ask which software you were using to collect the data coming from RA using the USB cable?
Was it Dave's client suite?
Roberto.
divingdon
Posts: 57
Joined: Tue Mar 22, 2011 8:35 pm

Re: WiFi Help

Post by divingdon »

I'm using the current version on Client suite 2.1 with lib version 8.5.14 on a XP system with a 1.6G processor and a 1gig ram
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: WiFi Help

Post by rimai »

Oh, so I can help you with 2nd problem:
http://forum.reefangel.com/viewtopic.php?f=8&t=18
Dave goes over the new updates and how to make it work.
Roberto.
divingdon
Posts: 57
Joined: Tue Mar 22, 2011 8:35 pm

Re: WiFi Help

Post by divingdon »

I removed and reinstalled the client software and enable Wifi in the ReefAngel_Features.h then tried to compile the sketch and was told is was too big so I disable the ReefAngel.ShowInterface(); and then compiled and still no luck connecting. I can ping the IP address and have it respond but no luck any other way. Maybe it will be easier to get the RAGEN working again and write a new sketch
divingdon
Posts: 57
Joined: Tue Mar 22, 2011 8:35 pm

Re: WiFi Help

Post by divingdon »

I final have gotten RAGEN to load and I believe that it is compiling correctly but I'm now getting this error

C:\Documents and Settings\My Documents\Arduino\libraries\ReefAngel_Wifi.cpp: In function 'void ProcessHTTP() ' :
C:\Documents and Settings\My Documents\Arduino\libraries\ReefAngel_Wifi.cpp:281: error: 'class ReefAngelClass' has no member named 'WM1port
C:\Documents and Settings\My Documents\Arduino\libraries\ReefAngel_Wifi.cpp: 285: error: 'class ReefAngelClass' has no member named 'WM2port
Clipboard does not contain a string

I have checked the library locations for Aurdino and RAGEN and they are the same. I'm not selecting any wavemakers, so I not understanding why the system is looking for them.

Please help

Don
YuppiWanna
Posts: 29
Joined: Sun Apr 17, 2011 6:46 pm

Re: WiFi Help

Post by YuppiWanna »

did you convert to the development libraries?

http://www.reefangel.com/update/
Image
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: WiFi Help

Post by binder »

divingdon wrote:I final have gotten RAGEN to load and I believe that it is compiling correctly but I'm now getting this error

C:\Documents and Settings\My Documents\Arduino\libraries\ReefAngel_Wifi.cpp: In function 'void ProcessHTTP() ' :
C:\Documents and Settings\My Documents\Arduino\libraries\ReefAngel_Wifi.cpp:281: error: 'class ReefAngelClass' has no member named 'WM1port
C:\Documents and Settings\My Documents\Arduino\libraries\ReefAngel_Wifi.cpp: 285: error: 'class ReefAngelClass' has no member named 'WM2port
Clipboard does not contain a string

I have checked the library locations for Aurdino and RAGEN and they are the same. I'm not selecting any wavemakers, so I not understanding why the system is looking for them.
That's my bad on the error. This problem has been corrected in a pending/future release. I know somebody else encountered the same problem, which lead me to fixing it.
Here is the fix:

The solution to the problem is quite simple and will be in the next
release of my libraries.
Open this file inside a text editor (notepad works fine)
My Documents\Arduino\libraries\ReefAngel_Wifi\ReefAngel_Wifi.cpp

Locate the following block of code (starts on line 265):

Code: Select all

                        case REQ_M_BYTE: 
                        case REQ_M_INT: 
                        { 
                                // webmemoryloc is location 
                                // weboption is value 
                                if ( bHasSecondValue && (webmemoryloc >= 0) ) 
                                { 
                                        // if we have a second value, we write the value to memory 
                                        if ( reqtype == REQ_M_BYTE ) 
                                                InternalMemory.write(webmemoryloc, weboption); 
                                        else 
                                                InternalMemory.write_int(webmemoryloc, weboption); 
#ifdef WavemakerSetup     // ADD THIS LINE 
                                        if ( (webmemoryloc == Mem_I_WM1Timer) || (webmemoryloc == Mem_I_WM2Timer) ) 
                                        { 
                                                // Restart wavemaker timers once they are set 
                                                byte i = 1; 
                                                byte p = ReefAngel.WM1Port; 
                                                if ( webmemoryloc == Mem_I_WM2Timer ) 
                                                { 
                                                        i = 2; 
                                                        p = ReefAngel.WM2Port; 
                                                } 
                                                ReefAngel.Timer[i].Trigger = 0; 
                                                ReefAngel.Timer[i].SetInterval(weboption); 
                                                ReefAngel.Timer[i].Start(); 
                                                ReefAngel.Relay.On(p); 
                                        } 
#endif  // WavemakerSetup   // ADD THIS LINE 
                                        Serial.print("<M>OK</M>"); 
                                } 
Add in the 2 lines that have // ADD THIS LINE in them. Those lines are

Code: Select all

#ifdef WavemakerSetup 
#endif  // WavemakerSetup 
Your code will look like the above block of code.
Now save the file.
Then you can go back to Arduino and compile and upload to your controller.

This will solve the problem. It is already fixed in the upcoming release, but I do not know when I'll have the next release out. The problem was a minor oversight on my end. It only occurs when you do not have the wavemaker code added in.
This fix will work for you. If it does not, let me know and we can get a solution for you.
divingdon
Posts: 57
Joined: Tue Mar 22, 2011 8:35 pm

Re: WiFi Help

Post by divingdon »

I made the changes and that error went away but a new one has arised.

C:\Documents and Settings\Administrator\My Documents\Ardunio\libraries\ReefAngel\ReefAngel.cpp: In member function ' void ReefAngelClass::ProcessButtonPressTimeouts() ' :
C:\Documents and Settings\Administrator\My Documents\Ardunio\libraries\ReefAngel\ReefAngel.cpp: 1800: error: no ,matching function for call to ' ReefAngelClass::Setupoption(int&, int&, int, int, int, const char [2], const char [15], constr char [1])'
C:\Documents and Settings\Administrator\My Documents\Ardunio\libraries\ReefAngel/ReefAngel.h: 164: note: candidates are: bool ReefAngelClass::Setupoption(int&, int&, int, int, byte, char*, char*,char*, char*)

Hope this helps you fix my issue.

thanks

Don
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: WiFi Help

Post by binder »

All of these errors you are finding have been corrected in a release that is not out yet.

This fix requires you to edit the ReefAngel.cpp file. Open up the file ReefAngel.cpp (inside the ReefAngel/ folder) and goto line 1800. You need to make sure it looks like this:

Code: Select all

if ( SetupOption(v, y, 0, 3600, 4, "s", "", "Screen Timeout", "", "") )
The last comma is what is missing. So make line 1800 match the line above. Then save the file.
You should be able to compile and be up and running.

I apologize for any inconveniences this is causing....you have just beat me to getting my next release out. :)

curt
divingdon
Posts: 57
Joined: Tue Mar 22, 2011 8:35 pm

Re: WiFi Help

Post by divingdon »

That seemed to work but now when i compile the new sketch i'm being told that its too big. I have selected the following features

display images, setup extras, date/time setup, direct temp sensors and wifi

and i normal add version menu, and overheat setup and display led pwm,

so i'm not sure what is happeing now.

How soon will the new library be released?
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: WiFi Help

Post by binder »

The new library won't make a difference. There is just a limited amount of space on the controller for the code. The more features that are added in, the more space it will take up.

I can say that you won't need the Setup Extras or the Overheat Setup. Those 2 just give you menu entries to adjust the values. Once the values are set, they rarely change which is why they are an option. Using the Internal Memory PDE will set those values initially for you.

Date/Time setup takes up a lot of space. You shouldn't have a problem with the date & time once it is configured and setup. So you can set the date on the controller with a minimal PDE file and then upload your main PDE file to handle everything.

Also, you may want to remove the Display Images to help with the size.
Wifi uses a lot of space to handle all that it does, but you need to have that included in order to use your wifi module.

You may just have to experiment with removing some extra features to get the compile size down. Sometimes this just takes a little testing to get it to work properly unfortunately.
You might want to look at this page: https://github.com/curtbinder/ReefAngel ... Features.h
It gives you a little bit of information about how much space each feature requires.

curt
divingdon
Posts: 57
Joined: Tue Mar 22, 2011 8:35 pm

Re: WiFi Help

Post by divingdon »

Thanks Curt,

The WiFi is working now with the new sketch hopefully tomorrow the LED's will work properly with the PWMSlope command.

I just noticed and maybe other already have noticed the same thing. That when I'm in the feeding mode the Wifi doesn't stay connected. Is this the way it is supposed to be or did i miscode something??

But again Thanks for all of your help!!

Don
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: WiFi Help

Post by binder »

Correct.

Currently when you enter Feeding Mode or Water Change Mode, the controller does it's own thing and the wifi does not work. An improvement is in the works where the wifi and other monitoring actions are performed during Feeding Mode and Water Change Mode. In fact, check out this thread to give your input:

http://forum.reefangel.com/viewtopic.php?f=7&t=31

curt
Post Reply