WeatherPiArduino RasPiConnect Control Panel

WeatherPiArduino RasPiConnect
WeatherPiArduino RasPiConnect Control Panel

WeatherPiArduino RasPiConnect Control Panel

Below is the RasPiConnect control panel for the WeatherPiArduino.  The software for the WeatherPiArduino was released last week.  The control panel is built on the milocreek.com iPhone/iPad app ArduinoConnect.  Either RasPiConnect or ArduinoConnect can talk to both Raspberry Pis or to Arduinos.  I chose to use ArduinoConnect so I get a second icon on my iPad.  ArduinoConnect and RasPiConnect are used interchangably in this posting.

The full WeatherPiArduino article will be published in Raspberry Pi Geek magazine in September.

 

WeatherArduino RasPiConnect
WeatherArduino RasPiConnect Control Panel
Arduino Adafruit SparkFun
Fully Populated WeatherArduino Board

I asked MiloCreek.com (makers of RasPiConnect /ArduinoConnect) if they would implement a compass rose control and they said they would!  Note:  A compass rose is a subset of a polar coordinate plot so that is what they will implement.

All of the WeatherRack Sensor instruments are implemented in this version. The vibration sensor has not yet been implemented and the FRAM code has not been connected to the control panel yet.  The DS3231 Real Time Clock code for the Arduino can be found on the Adafruit site and for the Raspberry Pi here.

The Local.h File for ArduinoConnect / RasPiConnect

Building all these controls are straight forward in the app and then implementing the code on the Arduino for talking to the controls was simple. There is good documentation and examples on the milocreek.com website and also some examples by me on the www.switchdoc.com website (including a tutorial article I published in MagPi Magazine).

There are over 13 controls in the WeatherPiArduino configuration file for the ArduinoConnect app.

RasPiConnect WeatherArduino
RasPiConnect Panel Setup Screen for WeatherArduino

In the Panel Setup screen we set up a Simple Line Graph control and connect it to the control ID SLGL-1 as seen below. Pretty easy.

Next you go to the Arduino and set up webserver in the Arduino as shown in the setup section of the MiloCreek. The you download and set up the webserver and then test it as shown in the “getting started” part of the documentation. Once this is done, we add custom code to the Local.h file (this is equivalent to the Local.py file for RasPiConnect).

Code for the Simple Line Graph RasPiConnect Control

The code for SLGL-1 looks like this:

void ExecuteLocalSIMPLE_LINE_GRAPH_LIVE_UITYPE(char returnJSON[], char *buffer, currentObjectStructure *parsedObject)
{

  
    // SLGL-1 returns the current wind speed graph
  if (strcmp(parsedObject->ObjectServerID, "SLGL-1") == 0)  
  {
    if (strcmp(parsedObject->Validate, "YES") == 0)
    {
      // send validated response
      returnJSONValidateResponse(returnJSON, returnJSON, parsedObject);
    
      strcpy(returnJSON, buffer);
      return;
    }

    char responseData[200];
 
    sprintf(responseData, "%s", windSpeedBuffer);   
    
    
     
   
    returnJSONResponse(returnJSON, returnJSON, parsedObject, responseData );
       
    strcpy(returnJSON, buffer);
    return;
  }

}

Very simple. This routine is executed when ArduinoConnect asks the Arduino for a refresh of the control. The important statement in this routine is:

sprintf(responseData, "%s", windSpeedBuffer);

What is “windSpeedBuffer”? It is a string containing the values needed to set the graph. From the ArduinoConnect documentation it should be a string formatted as:

Response for Simple Graph LIVE
Returns string values of data and labels to generate the graph
Returns A^^....||N^^.....
Where:
A... is floating point data
N... are labels for the X Axis
example return:
68672.000000^^17457.000000^^16954.000000^^723.000000^^10874.000000^^10367.000000^^59561.000000^^56276.000000^^6379.000000^^40763.000000||1^^2^^3^^4^^5^^6^^7^^8^^9^^10

The example return is all one line with no embedded new lines.

I have written a class to easily generate a RasPiConnect moving graph string with the results formatted like this. I will be releasing this library on github next week and also posting the full WeatherArduino Local.h file for ArduinoConnect.