Jump to content









Photo

DATA STREAM LIST


  • Please log in to reply
12 replies to this topic

#1 PSMPROJEK2014

PSMPROJEK2014

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 26 March 2014 - 04:51 PM

do we have to press previous key everytime we want to see new data? or i miss others step to make the data always show new data even without press the key.. thanks for any sugestion



#2 alvaro

alvaro

    Carriots CTO

  • Administrators
  • 72 posts

Posted 26 March 2014 - 07:12 PM

Hi.

 

At this moment there is no autorefresh on Carriot's control panel data stream list page. You have to manually refresh the page.

 

Enjoy Carriots!


Alvaro Everlet

Carriots CTO


#3 PSMPROJEK2014

PSMPROJEK2014

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 28 March 2014 - 03:54 AM

sory again, if i create a listener like send sms. even without refresh the data in carriot, the sms will be trigger or not.



#4 alvaro

alvaro

    Carriots CTO

  • Administrators
  • 72 posts

Posted 28 March 2014 - 08:47 AM

Hi.

 

Listeners are event-oriented, so to fire their execution the associated event must occur. For example, if you have a listener "listening" for "Data received" on "test@carriots", the listener will be executed each time a data stream is sent to "test@carriots". No need to refresh the stream list.

 

Enjoy Carriots!


Alvaro Everlet

Carriots CTO


#5 jpastor

jpastor

    Development leader

  • Administrators
  • 159 posts

Posted 28 March 2014 - 08:49 AM

Yes, all listeners are triggered.

No need to refresh the data display to make this happen.

 

Enjoy Carriots!



#6 PSMPROJEK2014

PSMPROJEK2014

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 14 April 2014 - 11:28 AM

thanks for answer but now i counter with new problem, why my streaming data just send max 20 data then stop, i need to reset after 20 data to send it again, it is my device or i need to setup something, thanks for any help.



#7 jpastor

jpastor

    Development leader

  • Administrators
  • 159 posts

Posted 14 April 2014 - 11:49 AM

Hi.

 

In Carriots, the limit for free account is ->  500 streams/second.

You can view all limits in the following URL: https://www.carriots.com/pricing

If you can only send 20 streams, it is possible that problem is in the device. Can you give us more information (device type, code, etc)?

 

 

Enjoy Carriots!



#8 PSMPROJEK2014

PSMPROJEK2014

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 14 April 2014 - 03:34 PM

.using arduino mega 2560 and cc300 wifi breakout adafruit.

code : im beginner so sory if my code little bit scramble

..................

/***************************************************
 TEST 4
 ****************************************************/

// Libraries
#include <Adafruit_CC3000.h>
#include <ccspi.h>
#include <SPI.h>
#include <string.h>
#include "utility/debug.h"
#include<stdlib.h>


// Define CC3000 chip pins
#define ADAFRUIT_CC3000_IRQ   3
#define ADAFRUIT_CC3000_VBAT  5
#define ADAFRUIT_CC3000_CS    10

// sensor pins
int sensor1 =  14;
int ledPin1 =  15;
int sensor2 =  16;
int ledPin2 =  17;
int sensor3 =  18;
int ledPin3 =  19;

// first state sensor
int sensorState1 = 0;
int sensorState2 = 0;
int sensorState3 = 0;

const int ON = 1;    
const int OFF = 2;  

// bacaan sensor
const int BACAAN0 = 0;
const int BACAAN1 = 1;
const int BACAAN2 = 2;
const int BACAAN3 = 3;
//char OFF = 0;

// point ke bacaan
int point1 = OFF;
int point2 = OFF;
int point3 = OFF;

int point1New = OFF;
int point2New = OFF;
int point3New = OFF;
int pointSend = 0;

// Create CC3000 instances
Adafruit_CC3000 cc3000 = Adafruit_CC3000(ADAFRUIT_CC3000_CS, ADAFRUIT_CC3000_IRQ, ADAFRUIT_CC3000_VBAT,
                                         SPI_CLOCK_DIV2); // you can change this clock speed
                                
// WLAN parameters
#define WLAN_SSID       "xxx"
#define WLAN_PASS       "11111111"
// Security can be WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or WLAN_SEC_WPA2
#define WLAN_SECURITY   WLAN_SEC_WPA2

// Carriots parameters
#define WEBSITE  "api.carriots.com"
#define API_KEY "8c2b289ecdf6f78824b532ee5290e4b3f14d1531d8ff2254eee6841ddbd4fb20"
#define DEVICE  "FWSM@PSMPROJEK2014.PSMPROJEK2014"

uint32_t ip;

void setup(void)
{
  pinMode (sensor1,INPUT);
  pinMode (ledPin1,OUTPUT);
  pinMode (sensor2,INPUT);
  pinMode (ledPin2,OUTPUT);
  pinMode (sensor3,INPUT);
  pinMode (ledPin3,OUTPUT);
 
  // Initialize
  Serial.begin(115200);
 
  Serial.println(F("\nInitializing..."));
  if (!cc3000.begin())
  {
    Serial.println(F("Couldn't begin()! Check your wiring?"));
    while(1);
  }
 
}


void loop(void)
{
  // Connect to WiFi network
  cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY);
  Serial.println(F("Connected!"));
 
  /* Wait for DHCP to complete */
  Serial.println(F("Request DHCP"));
  while (!cc3000.checkDHCP())
  {
    delay(100);
  }  
 
  // Get the website IP & print it
  ip = 0;
  Serial.print(WEBSITE); Serial.print(F(" -> "));
  while (ip == 0) {
    if (! cc3000.getHostByName(WEBSITE, &ip)) {
      Serial.println(F("Couldn't resolve!"));
    }
 delay(500);
  }
 
  cc3000.printIPdotsRev(ip);

  //..............CHECK SENSOR
 
  checkSensor();
 
 
   // Prepare JSON for Carriots & get length
  int length = 0;

  String data = "{\"protocol\":\"v2\",\"device\":\""+String(DEVICE)+
                 "\",\"at\":\"now\",\"data\":{\"LEVEL\":"
                 +String(pointSend)+"}}";
                 //",\"ALARM\":"+String(point2)+
                  //",\"GATE\":"+String(point3)+"}}";
                  
  length = data.length();
  Serial.print("Data length");
  Serial.println(length);
  Serial.println();
 
  // Print request for debug purposes
  Serial.println("POST /streams HTTP/1.1");
  Serial.println("Host: api.carriots.com");
  Serial.println("Accept: application/json");
  Serial.println("User-Agent: Arduino-Carriots");
  Serial.println("Content-Type: application/json");
  Serial.println("carriots.apikey: " + String(API_KEY));
  Serial.println("Content-Length: " + String(length));
  Serial.print("Connection: close");
  Serial.println();
  Serial.println(data);
 
  // Send request
  Adafruit_CC3000_Client client = cc3000.connectTCP(ip, 80);
  if (client.connected()) {
    Serial.println("Connected!");
    client.println("POST /streams HTTP/1.1");
    client.println("Host: api.carriots.com");
    client.println("Accept: application/json");
    client.println("User-Agent: Arduino-Carriots");
    client.println("Content-Type: application/json");
    client.println("carriots.apikey: " + String(API_KEY));
    client.println("Content-Length: " + String(length));
    client.println("Connection: close");
    client.println();
    
    client.println(data);
    
  } else {
    Serial.println(F("Connection failed"));    
    return;
  }
 
  Serial.println(F("-------------------------------------"));
  while (client.connected()) {
    while (client.available()) {
      char c = client.read();
      Serial.print©;
    }
  }
  client.close();
  Serial.println(F("-------------------------------------"));
 
  Serial.println(F("\n\nDisconnecting"));
  cc3000.disconnect();
 
  // Wait 10 seconds until next update
  delay(10000);
 
}

// end of main loop

//..........others

void checkSensor(){
 
   sensorState1 = digitalRead(sensor1);
   sensorState2 = digitalRead(sensor2);
   sensorState3 = digitalRead(sensor3);
 
 //case 1
 if(sensorState1 == HIGH){   //water level 1 off
   digitalWrite(ledPin1,LOW); //indicator 1 off
   Serial.println(F("sensor1 OFF"));
   point1 = OFF;
   
 }
 else{ //water level 1 on
   digitalWrite(ledPin1,HIGH); //indicator 1 on
   Serial.println(F("sensor1 ON"));
   point1 = ON;
 }
 
 if (point1 != point1New){
   pointSend = BACAAN1;
 
 }
   
 //case 2
  if(sensorState2 == HIGH){    //water level2 off
    digitalWrite(ledPin2,LOW);//indicator 2 off
    Serial.println(F("sensor2 OFF"));
    point2 = OFF;
 }
  else{ //water level2 on
   digitalWrite(ledPin2,HIGH); //indicator 2 on
   Serial.println(F("sensor2 ON"));
   point2 = ON;
 }
  if (point2 != point2New){
    pointSend = BACAAN2;
 
 }
 //case 3
  if(sensorState3 == HIGH){   //water level 3 off
    digitalWrite(ledPin3,LOW); //indicator 3 off
    Serial.println(F("sensor3 OFF"));
    point3 = OFF;    
 }
  else{ //water level 3 on
    digitalWrite(ledPin3,HIGH); //indicator 3 on
    Serial.println(F("sensor3 ON"));
    point3 = ON;
}
 if (point3 != point3New){
   pointSend = BACAAN3;

 }
}


 



#9 jpastor

jpastor

    Development leader

  • Administrators
  • 159 posts

Posted 14 April 2014 - 04:18 PM

Hi.


We don't have an adafruit cc300 wifi to test, but we see that the Wifi is reconnected at each loop iteration:

/ Connect to WiFi network
  cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY);
  Serial.println(F("Connected!"));
 
  /* Wait for DHCP to complete */
  Serial.println(F("Request DHCP"));
  while (!cc3000.checkDHCP())
  {
    delay(100);
  }  
.......


In our opinion, this should be done once in your "setup" function. You can see an example in the following URL:

https://github.com/a...t/WebClient.ino

 

Try this and tell us your progress.

 

 

Enjoy Carriots!



#10 sofiyaradzi

sofiyaradzi

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 13 May 2015 - 02:53 AM

hi,

im using wido (it's a wifi module that is compatible with arduino leonardo)

so i want to send stream to carriots using this wifi module.

i uploaded the example code from https://www.carriots...ibrary#checking

but i dont receied any data stream from the device. :( 

and i did replace the mac address, ip address, api key and deice developer in the code

please help



#11 jpastor

jpastor

    Development leader

  • Administrators
  • 159 posts

Posted 13 May 2015 - 10:42 AM

Hi sofiyaradzi.

 

The first thing is to limit the problem. With that information, the problem could be in several places:


 - The Arduino code
 - The Arduino connectivity with the outside
 - Data sent to Carriots

 Could you give us more information?

 

Best regards!



#12 sofiyaradzi

sofiyaradzi

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 13 May 2015 - 02:22 PM

thanks for your reply,

here's the info you're asking for:

 

 

 - The Arduino code 

i copied the codes from the tutorial given
 - The Arduino connectivity with the outside

the Arduino does not connected to any other devices. i'm only using the WiDo board
 - Data sent to Carriots- 

 i need to send strings to carriots



#13 jpastor

jpastor

    Development leader

  • Administrators
  • 159 posts

Posted 13 May 2015 - 03:52 PM

Hi sofiyaradzi.

 

In our example, we are using libraries for ethernet connection, so if you are using WIFI modules you must adapt this code.

 

Best regards!






2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users