PC Logging

Related to the development libraries, released by Curt Binder
Post Reply
Bryan
Posts: 147
Joined: Wed Jul 06, 2011 1:49 am
Location: Vancouver, B.C.

PC Logging

Post by Bryan »

Hello:

I have the Client Suite 2.1 installed and attempting to have it connect to the RA. I note in the instructions for the Reef Client it refers to the following.

"If you are communicating with the USB Cable, you must enable PC Logging inside RAGen to work properly. "

yet I can find no mention of a PC Logging option in RAGen.

Thanks
-=Bryan=-
Bryan
Posts: 147
Joined: Wed Jul 06, 2011 1:49 am
Location: Vancouver, B.C.

Re: PC Logging

Post by Bryan »

Oops, okay i see PC logging is no longer supported. Have pin 5 (Tx) and pin 4 (Rx) hooked up to a scope and not seeing any activity, so not sure if it's the sketch that's the problem.

ReefAngel_features.h

Code: Select all

/*
If you have the wifi module for your controller and wish to use it, you must uncomment this next line
to utilize the built-in webserver for the controller.
*/
#define wifi

The Sketch

Code: Select all

// Autogenerated file by RAGen (v1.0.4.93), (07/18/2011 23:01)
// RA_071811_2301.pde
//
// This version designed for v0.8.5 Beta 12 or later

/* The following features are enabled for this PDE File: 
#define DisplayImages
#define SetupExtras
#define WavemakerSetup
#define DateTimeSetup
#define VersionMenu
#define ATOSetup
#define MetalHalideSetup
#define DirectTempSensor
#define DisplayLEDPWM
#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>


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

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

void loop()
{
    ReefAngel.ShowInterface();

    // Specific functions
    ReefAngel.StandardATO(Port1);
    ReefAngel.StandardLights(Port2);
    ReefAngel.MHLights(Port3);
    ReefAngel.Wavemaker1(Port4);
    ReefAngel.Wavemaker2(Port5);
    ReefAngel.StandardFan(Port6);
    ReefAngel.StandardHeater(Port7);
}

-=Bryan=-
dmolton
Posts: 182
Joined: Tue Mar 22, 2011 11:08 am

Re: PC Logging

Post by dmolton »

You're right, the PCLogging feature is now obsolete. For WiFi or USB, all you need is the wifi line in your features file and uploaded to the controller

Code: Select all

#define wifi
After that, all you need to do is configure and start the Listener service. Are you connecting over WiFi or USB?

If wifi, make sure you are seeing a response from the built in web server by browsing to the ip address of your wifi adapter inside of a browser. Something like http://192.168.1.110:2000. If the browser displays "ReefAngel Web Server" you know you're good. Just plug in the ip address and port # in the configuration screen.

If you're connecting over USB, make sure the Listener is configured for it, and you have the correct COM and Baud rate chosen. It will be the same com/baud that you have configured in arduinio for uploading new sketches. The important thing to remember over USB is that only one process can communicate to the controller over usb at a time. So if you're running the listener, you will not be able to upload a new sketch until you stop it. If you have usb configured correctly, make sure you close the arduino IDE, and try stopping/restarting the Listener service.
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: PC Logging

Post by binder »

the controller no longer pushes the data to the client suite...it is all pull requests. this just means that the listener requests the data at a specified interval. the only thing that is a push from the controller is if you are having it update a web banner at reefangel.com. if you are doing this then you will not be able to run the client suite. the client suite does have the ability to send data to reefangel.com for a web banner.

curt
Bryan
Posts: 147
Joined: Wed Jul 06, 2011 1:49 am
Location: Vancouver, B.C.

Re: PC Logging

Post by Bryan »

binder wrote:the controller no longer pushes the data to the client suite...it is all pull requests. this just means that the listener requests the data at a specified interval. the only thing that is a push from the controller is if you are having it update a web banner at reefangel.com. if you are doing this then you will not be able to run the client suite. the client suite does have the ability to send data to reefangel.com for a web banner.

curt

Thanks for the help folks. I don't have a USB TTL cable so was just trying a test. Can I not hook tx and rx to a MAX232 and then on to the serial port of the PC. The client suite listener should send a request to the controller as long as the correct com port is identified in the client suite?

Should not the pc be able to capture data in this fashion as well for the "Dump log to PC"
-=Bryan=-
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: PC Logging

Post by binder »

Bryan wrote: Thanks for the help folks. I don't have a USB TTL cable so was just trying a test. Can I not hook tx and rx to a MAX232 and then on to the serial port of the PC. The client suite listener should send a request to the controller as long as the correct com port is identified in the client suite?
I'm not positive on this one. That would be more of a roberto question. I would think this would work but cannot say with 100% confidence.
I'm curious as to how you do not have a USB TTL cable. I didn't think you could buy a controller now without getting the cable. Anyways, not the point.
Should not the pc be able to capture data in this fashion as well for the "Dump log to PC"
This sounds like you have been running the Simple/Demo Software that ships with the controller. If you plan on running the Client Suite you will need to upgrade to my development libraries in order for it to work. It sounds like you know this but I wanted to make sure.
I do not know the "Dump log to PC" option so I cannot comment on it.

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

Re: PC Logging

Post by rimai »

The max232 works just the same, if your computer has a serial port.
Most computers nowadays only offer USB though.
If you open a serial monitor app, such as Tera Term or Putty, you can see exchange serial data with the controller.
If you plan on developing your own PC application, you can basically dump any kind of data that you want to the PC.
"Dump log to PC" was created only for the demo code and it was meant only for demonstration purposes.
I would also highly recommend upgrading the libraries to "Development". You will get much more from it.
Here is an easy way to upgrade:
http://forum.reefangel.com/viewtopic.php?f=8&t=2
Roberto.
Bryan
Posts: 147
Joined: Wed Jul 06, 2011 1:49 am
Location: Vancouver, B.C.

Re: PC Logging

Post by Bryan »

rimai wrote:The max232 works just the same, if your computer has a serial port.
Most computers nowadays only offer USB though.
If you open a serial monitor app, such as Tera Term or Putty, you can see exchange serial data with the controller.
If you plan on developing your own PC application, you can basically dump any kind of data that you want to the PC.
"Dump log to PC" was created only for the demo code and it was meant only for demonstration purposes.
I would also highly recommend upgrading the libraries to "Development". You will get much more from it.
Here is an easy way to upgrade:
http://forum.reefangel.com/viewtopic.php?f=8&t=2

Well, gettting there, problem was a miswired cap on the max232. With the preloaded code using the "Dump to PC", "dump Parameters to PC" I can transmit a bunch of garbage characters to the pc using Putty with 57600, 8,1,N,. Seems to follow a pattern so think the baud rate may be mismatched.

Using the development libraries and the RAgen I can not get anything on Putty or with ReefClient 2.1. Could see not getting anything with Putty because it needs to pull from the controller, although nothing on Putty when I click keys on the computer.

Getting close anyways.
-=Bryan=-
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: PC Logging

Post by rimai »

"Dump to PC" uses 115200 baud
When sending requests to controller, use "GET /r99"
Roberto.
Bryan
Posts: 147
Joined: Wed Jul 06, 2011 1:49 am
Location: Vancouver, B.C.

Re: PC Logging

Post by Bryan »

rimai wrote:"Dump to PC" uses 115200 baud
When sending requests to controller, use "GET /r99"

Thanks, tried 115200, but still garbage, could be the wiring etc. Is the Reef Client 56700?. I don't think the com port is being opened up by the Reef Client as I can still open the same port with Putty. The reef client should have locked the port??. I do receive some garbage characters on Putty about every minute or so, which doesn't make sense unless the controller is sending it out?
-=Bryan=-
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: PC Logging

Post by rimai »

Yes, the wifi will work on 57600 and since the Client uses the same wifi coding, it would use 57600 too.
On wifi mode, the Client will open tcp and immediatelly closes it. On serial mode, it keeps it open.
Make sure the listener service is running on the client dashboard and it is configured to use serial mode.
Roberto.
Bryan
Posts: 147
Joined: Wed Jul 06, 2011 1:49 am
Location: Vancouver, B.C.

Re: PC Logging

Post by Bryan »

Hi Roberto:

When you refer to configure serial, do you mean from ReefClient Service Dashboard Wifi NOT selected. I have Port 16 open at 56700, as well as "Listener" and "Logger" service running.. As you can see from thr pic I can open up Putty at anytime on Port 16 56700,8,N,1, and some data comes through every minute or so. Seems the listener is not "listening" otherwise the port would not be available for Putty?

Capture.PNG
Capture.PNG (64.92 KiB) Viewed 8347 times
-=Bryan=-
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: PC Logging

Post by rimai »

What do you have on "COM Port" under menu "Settings->Modify" and tab "General"?
Roberto.
Bryan
Posts: 147
Joined: Wed Jul 06, 2011 1:49 am
Location: Vancouver, B.C.

Re: PC Logging

Post by Bryan »

Com 16...
Capture.PNG
Capture.PNG (55.56 KiB) Viewed 8346 times
-=Bryan=-
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: PC Logging

Post by rimai »

Hahah.. I know now.
It's 57600 not 56700 :)
Roberto.
Bryan
Posts: 147
Joined: Wed Jul 06, 2011 1:49 am
Location: Vancouver, B.C.

Re: PC Logging

Post by Bryan »

No go, I have changed around with it so many times I must have typed it in wrong on the last go, changed to 57600, but still not working. Still can't explain why putty will open up when reef Client is open, the port should be locked. Strange. Wonder if it is my max232 setup is part of the problem. Think I best try a pic USART project to see if it can communicate correctly with putty at 57600. Perhaps the data is garbled and the controller doesn't recognize the sequence.
-=Bryan=-
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: PC Logging

Post by rimai »

Load this to the controller and open putty at 57600. Can you see anything?

Code: Select all

void setup()
{
  Serial.begin(57600);
}
void loop()
{
  Serial.println("I'm here");
  delay(1000);
} 
Roberto.
dmolton
Posts: 182
Joined: Tue Mar 22, 2011 11:08 am

Re: PC Logging

Post by dmolton »

Bryan, it might be a timing issue.

If the Listener cannot open the serial port COM16 on 57600 right away, an internal timer will start for 30 seconds and then it will try again. It will repeat that process until it can lock the serial port and begin communicating.

In addition to that, when you make core changes to the listener settings, it will restart the service in order to actually apply them. It takes a bit to do that and you should probably see some red text at the bottom status bar of the Client saying "Unable to connect. Retrying in 2:00". After two minutes the Client will reconnect and begin displaying data.

I'm attaching a copy of the newest version of the "ReefAngel Serial Reader" application that comes bundled with the client suite installation. The older version that you have still relies on the controller to send out updates every 15 seconds which it no longer does. This new version uses the same Serial Port logic that the RA Listener uses to connect and send/receive data. So if this works for you, the Listener should also be doing its thing correctly.

To start with, just update your com port and baud rate and press the Open Serial Port button. It should say "Opened... Now Listening". If it does, just press the send button and see if you get a response similar to the one below. Make sure teraterm or putty is closed first and also stop the Listener Service from the dashboard.

Image
Attachments
ReefAngelSerialReader.zip
(27.57 KiB) Downloaded 559 times
Bryan
Posts: 147
Joined: Wed Jul 06, 2011 1:49 am
Location: Vancouver, B.C.

Re: PC Logging

Post by Bryan »

Success!!!.

Problem was twofold. I was getting the red text at the bottom, but while the listener was waiting to connect and turn green I would open Putty. This obviously locked the port for Reef Client so it could not receive anything from the listener. The garbage data on Putty was due to a cap on the MAX232 circuit not being fully seated. The SerialReader app worked like a charm, very helpful.

Picture speaks a thousand words. Thanks everyone, much appreciated.
Capture.PNG
Capture.PNG (102.79 KiB) Viewed 8342 times
-=Bryan=-
dmolton
Posts: 182
Joined: Tue Mar 22, 2011 11:08 am

Re: PC Logging

Post by dmolton »

Glad you got it working, Bryan.

Hate to do it to ya, but it might be a good time now to uninstall that version and have a go at my latest version that I just committed a few minutes ago. Looks like you're using celsius so the latest version might be a bit better for you. Have a look over here http://forum.reefangel.com/viewtopic.php?f=8&t=175
Bryan
Posts: 147
Joined: Wed Jul 06, 2011 1:49 am
Location: Vancouver, B.C.

Re: PC Logging

Post by Bryan »

Haha, yes just saw that. Keep them coming...
-=Bryan=-
Post Reply