Comments: Pushing Data to Data.SparkFun.com

Pages

Looking for answers to technical questions?

We welcome your comments and suggestions below. However, if you are looking for solutions to technical questions please see our Technical Assistance page.

  • Member #398338 / about 8 years ago * / 1

    I was trying to follow this tutorial to post data from an Android phone to data.sparkfun.com but it didn't work. The error in Android Studio said:

    https error: javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x5f342930: Failure in SSL library, usually a protocol error
    error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure (external/openssl/ssl/s23_clnt.c:741 0x5ad6fb86:0x00000000)
    

    My phone is a Samsung S3 running Android 4.3.

    After doing some looking around with Google, I think the problem is because Android 4.3 cannot do TLS 1.2, and based on this report it appears that the data.sparkfun.com server requires TLS 1.2. I am totally new to all of this (Android programming and Phant), but can anyone confirm for me that this might be the problem? If it is, can I make this work somehow? Maybe by installing Phant on my own computer and somehow configuring it do TLS 1.1?

  • TyTower / about 8 years ago * / 1

    Clicking on https://data.sparkfun.com/ give me an access error and I can't get to see any data unless I use a tor browser so whats happening? Tried it with mozilla and Opera browsers .

    You have changed something recently and its stuffed it up Perhaps you are just censuring Australia or individuals out ? Hope not

  • Member #140677 / about 8 years ago / 1

    Hi, Just wondering whether anyone has a suggestion on how to deal with a bad data row in data.sparkfun.com. My hardware logged an incorrect entry and it's causing problems with my graphing in analog.io so I'd like to remove it, but can't find a way. There doesn't seem to be a delete option for a single row. I looked at downloading everything, clearing the stream and uploading, but that would create new timestamps (including &timestamp= in the upload doesn't cause an error, but doesn't alter the timestamp).

    Any ideas?

    Thanks,

    ...rob

    • TyTower / about 8 years ago / 1

      You could send them a request perhaps to go in and delete a row . Maybe there is a PHANT command that will delete a row .Have you looked into that at all ?

  • Member #389991 / about 8 years ago / 1

    Hi, I am looking for help with a 400 Bad Request error.

    I used phant-raspi.py example to develop my code. I get zero errors reported until "400 Bad Request" at the very end. And yes, I double checked my Public and Private keys which were copy/paste into my python code.

    Here's the terminal output:

    pi@raspberrypi:~/python $ sudo python wifi_ISP_phant.py

    ---Press CTRL+Z or CTRL+C to stop.---

    Testing Wifi Signal

    link quality = 96 signal_level = 54

    Be patient - testing Internet Speed can take several minutes .

    Download_Mbps = 11.76 Upload_Mbps = 2.21

    Testing completed.

    Here we go! Press CTRL+C to exit Sending an update! 2016-02-16 16:23 location - data[fields[0]]= Living_Room connection - data[fields[1]]= Edimax_EW-7811Un link_quality - data[fields[2]]= 96 signal_level - data[fields[3]] = 54 download_Mbps - data[fields[4]] = 11.76 upload_Mbps - data[fields[5]]= 2.21 params = link_quality=96&signal_level=54&connection=Edimax_EW-7811Un&location=Living_Room&upload_Mbps=2.21+&download_Mbps=11.76 400 Bad Request

    I added the printout of "params" to help detect a fault - but I don't see anything. All the code after the params statement is copied from phant-raspi.py as are the "header" statements.

    I have the better part of a day wasted, I mean invested, in debugging without success. I'm a beginning python coder.

    The URL I intend to upload data to is:

    http://data.sparkfun.com/output/3Jb4WjKLvlh9l1pvqJ2Z

    BTW, this is my 2nd phant project, the first one worked fine - https://data.sparkfun.com/streams/yA6ryDZa4as5O0QdOW7N.

    Any thoughts on what is should do next?

    Thanks

    Paul

  • Member #769875 / about 8 years ago / 1

    Hello every one!! I had an error when uploading the code from Arduino & Ethernet Shield, which was Progmem.h: No such file or directory. Please I need help

    • M-Short / about 8 years ago / 1

      It sounds like there might be an issue with the libraries being installed correctly. Double check your libraries and if you are still having problems email techsupport@sparkfun.com with a copy of your code and a screenshot of the error and they should be able to help you.

  • Member #692109 / about 9 years ago / 1

    Hi,

    Can I use an Arduino wifi Shield instead of the Ethernet Sheild? I suppose the code will be slightly different?

    Thanks in advance.

  • Member #375102 / about 9 years ago / 1

    I love the push data side of Phant, but has anyone used it the other way, to pull data into an embedded device? Any examples out there?

    Seems like it would make a great way to do some semi real time displays.

  • RuralGuru / about 9 years ago / 1

    can we get an example with the xbee style wifly(RN171)?

  • Member #616581 / about 9 years ago / 1

    i commented out progmem.h and was able to get a compile. anyway, the code seems to be hanging up at the post phase. This is the same point in time that the m2x example is hanging. Im so close, and yet so far!

  • LSV / about 9 years ago * / 1

    Arduino + WiFi shield - I get this compiler error: Phant_CC3000_Redux.ino:56:22: fatal error: Progmem.h: No such file or directory compilation terminated.

    I tried adding: #include <avr/pgmspace.h> but it still doesn't work.
    Also tried moving the files up one level as member 471086 recommended - but still get the same error. Where is Progmem.h anyway???

    Any ideas on what to try?

    • Member #616581 / about 9 years ago / 1

      commenting out the progmem.h allows it to compile, but i still can't get a connection to Sparks (see other comment)

  • Member #623109 / about 9 years ago * / 1

    I'm trying to run this on a Mega with a CC3000 shield. I've run the buildtest on the shield and all is working well. BUT, this sketch hangs as soon as

    // Initialize the CC3000 objects (shield and client): SFE_CC3000 wifi = SFE_CC3000(CC3000_INT, CC3000_EN, CC3000_CS); SFE_CC3000_Client client = SFE_CC3000_Client(wifi);

    Firmware is V1.26

    I've installed the SFE library.

    If I run the Connection test example from the SFE library, it hangs after


    SparkFun CC3000 - Connection Test

    Ideas?

  • TyTower / about 9 years ago / 1

    It would be very helpful if you could give us a data gathering example using the DHT library for the Ethernet shield. You sell them both and I have spent 2 days trying to amalgamate the data collecting bit to the to your present example . 5 minutes for you could save weeks for us minions.

    • TyTower / about 9 years ago / 1

      I finally got a stream up and working . It took a bit but its for the first Ethernet shield here using the DHT library which covers 3 or 4 different types of sensors (see inside the library). Mine is the white plastic housed one RHT03 and it seems to be getting it right . Ill attach the code here too which is a bit messy and needs refining but works out of the box on that sensor.

      include <SPI.h> // Required to use Ethernet

      include <Ethernet.h> // The Ethernet library includes the client

      include <Progmem.h> // Allows us to sacrifice flash for DRAM

      include <DHT.h>

      include <stdio.h>

      define DHT_PIN 2

      DHT dht(DHT_PIN,DHT22);//DHT22 for my sensorRHT03-others in library

      define TIMEOUT 3000 //10 second timout

      define SPARKFUN_UPDATE_TIME 60000 //Update SparkFun data server every 60000 ms (1 minute).

      unsigned long timer1 = 0; unsigned long timer2 = 0;

      byte mac[] = {0x00, 0x1D, 0x09, 0x22, 0x75, 0x69}; char server[] = "data.sparkfun.com"; // name address for data.sparkFun (using DNS) // Set the static IP address to use if the DHCP fails to assign IPAddress ip(192,168,0,177); EthernetClient client;

      const String publicKey = "RMzp9ANyqzfjw4drzNnZ"; const String privateKey = "lzrnDbjBprioBgD6Mlvd"; const byte NUM_FIELDS = 2; const String fieldNames[NUM_FIELDS] = {"humidity", "temp"}; String fieldData[NUM_FIELDS]; const int triggerPin = 3; const int lightPin = A0; const int switchPin = 5; String name = "Ether-anon"; boolean newName = true;

      //Character array to hold results char s[4]; //const int requestInterval = 20000; long lastAttemptTime = 0; float humidity; float temp;

      void setup() { Serial.begin(115200);

      setupEthernet();

      // Setup Input Pins: pinMode(triggerPin, INPUT_PULLUP); pinMode(switchPin, INPUT_PULLUP); pinMode(lightPin, INPUT_PULLUP);

      Serial.println(F("=========== Ready to Stream ===========")); Serial.println(F("Press the button (D3) to send an update")); Serial.println(F("Type your name (no spaces!), followed by '!' to update name")); }

      void loop() {//Update sparkfun data server every 60 seconds. // Convert each value to a string for our request to App Engine humidity = dht.readHumidity();

      temp = dht.readTemperature(); //temp = (temp9/5) + 32 - 1; //To Farenheight calibrate here String temp_string = dtostrf(temp100, 4, 0, s); String humidity_string = dtostrf(humidity*100, 4, 0, s); delay(200); if(millis() > timer1 + SPARKFUN_UPDATE_TIME) { timer1 = millis(); //Update timer1 with the current time in miliseconds since startup. // Gather data: fieldData[0] = String(humidity); delay(100); fieldData[1] = String(temp); //fieldData[2] = name; delay(100); Serial.println("Posting by timer !"); postData(); //Send data to sparkfun data server. Serial.println("Just after timer1\n"); delay(200); }

      // If the trigger pin (3) goes low, send the data.
      

      if (!digitalRead(triggerPin)) { // Gather data: fieldData[0] = String(humidity); fieldData[1] = String(temp); //fieldData[2] = name;

      Serial.println("Posting by Trigger pin!");
      postData(); // the postData() function does all the work, 
                  // check it out below.
      Serial.println("Just after trigger\n");
      delay(200);
      

      }

      // Check for a new name input: if (Serial.available()) { char c = Serial.read(); if (c == '!') { newName = true; Serial.print("Your name is "); Serial.println(name); } else if (newName) { newName = false; name = ""; name += c; } else { name += c; } } }

      void postData() { // Make a TCP connection to remote host if (client.connect(server, 80)) { // Post the data! Request should look a little something like: // GET /input/publicKey?private_key=privateKey&light=1024&switch=0&name=Jim HTTP/1.1\n // Host: data.sparkfun.com\n // Connection: close\n // \n client.print("GET /input/"); client.print(publicKey); client.print("?private_key="); client.print(privateKey); for (int i=0; i<NUM_FIELDS; i++) { client.print("&"); client.print(fieldNames[i]); client.print("="); client.print(fieldData[i]); } client.println(" HTTP/1.1"); client.print("Host: "); client.println(server); client.println("Connection: close"); client.println(); //Serial.println( fieldNames[],fieldData[]);

              }
      

      else { Serial.println(F("Connection failed")); }

      // Check for a response from the server, and route it // out the serial port. /* delay(2000); timer2 = millis();// while((client.available() == 0)&&(millis() < timer2 + TIMEOUT)); //Wait here until server respond or timer2 expires.

        // if there are incoming bytes available
        // from the server, read them and print them:
        while(client.available() > 0)
        {
          char inData = client.read();
      
          Serial.print(inData);
        }      
        Serial.print("\n");
        Serial.println("Response should be above");
        Serial.println("Disconnected now");
        client.stop(); //Disconnect the client from server.  
      

      */

      while (client.connected()) { if ( client.available() ) { char c = client.read(); Serial.print(c); }
      } Serial.println(); client.stop(); }

      void setupEthernet() { Serial.println("Setting up Ethernet..."); // start the Ethernet connection: if (Ethernet.begin(mac) == 0) { Serial.println(F("Failed to configure Ethernet using DHCP")); // no point in carrying on, so do nothing forevermore: // try to congifure using IP address instead of DHCP: Ethernet.begin(mac, ip); } Serial.print("My IP address: "); Serial.println(Ethernet.localIP()); // give the Ethernet shield a second to initialize: delay(1000); }

      • TyTower / about 9 years ago * / 1

        Hm I don't like the look of that but maybe you can copy it to an editor and make sense of it . I think its all there in one form or another?

        Thanks for the try though

  • Member #471086 / about 10 years ago / 1

    Hi Todd,

    Im using an Arduino Uno with the CC3000 wifi shield on top. I ran through the hookup guide and now i wanted to begin pushing information to data.sparkfun. I get a compiling error when running the code provided in this tutorial that looks like this:

    sketch_jul24a.ino:50:21: fatal error: Progmem.h: No such file or directory compilation terminated.

    I do have the SFE_CC3000 library installed. I'm not sure what the problem is. Any ideas?

    I'm on a mac OS X 10.9.4

    thanks, Brett

    • Member #471086 / about 10 years ago / 1

      Ok so clearly it was a library problem.

      What i did was take all the libraries in the Utility folder and move them into the top folder. After doing this i got a bunch more library errors and moved the libraries back into the utility folder if they were mentioned in the error.

      Problem was progmem.h wasn't the title of any libraries in the SFE_CC3000 master file so it made it hard to trouble shoot for me.

      Ultimately i moved the following out of the utility folder into one folder above it: cc3000_common.cpp cc3000_common.h host_driver_version.h security.c security.h

      That worked for me, but i can't tell you why. Also can't tell you if that will have negative implications moving forward.

      Todd could you pick up the pieces on these library moves

      • Member #471086 / about 10 years ago / 1

        Still troubleshooting - although the code compiles I do still get an error making a TCP Connection

        Error: 4 - Could not make a TCP connection

  • Member #218858 / about 10 years ago / 1

    Thanks Todd! I'm going to use this from a Arduino Yun so presumably can configure the curl command to connect to the ports I choose.

  • Member #218858 / about 10 years ago / 1

    I'm interested in running phant on my own machine in order to have more history on my data. But I need to change the ports it listens on from 8080/8081. I can't find a way to do that. Is there a command line option? Is there a way to set the clients to use non-default ports when talking to phant?

  • Any chance we can get a section on using this with processing running on a pc connected to an arduino over USB? I have a working connection to the arduino but am having trouble creating a connection to data.sparkfun.com.


If you've found an issue with this tutorial content, please send us your feedback!