Azure / connectthedots

Connect tiny devices to Microsoft Azure services to build IoT solutions
http://connectthedots.io
MIT License
399 stars 274 forks source link

azurewebsites.net #128

Closed RubenvWyk closed 9 years ago

RubenvWyk commented 9 years ago

Hi All :)

So currently I am running EHconsole, and seeing my wonderfull data stream.

If I log into the name.azurewebsites.net I just see a blank page... do I need some java or whatever to see the graphs?

azurewebsites

ghost commented 9 years ago

If you see your data stream in EHConsole, then the Pi is set up correctly and sending data to EH. If you see the website below and it shows “connected” in the bottom left corner, you have the website set up correctly. That seems to indicate that you have incorrectly set up the data strings from your sensors. If you are using the Arduino and weather shield, I would look at the INO file and make sure it is correct.

Can you copy 6-10 lines of the data you see in EHConsole into here? We could see immediately if that is the issue.

RubenvWyk commented 9 years ago

Hmmmm currently having issues with programming my Arduino, will get back to you asap

olivierbloch commented 9 years ago

Hi Ruben. Curious to know if you were able to fix your Arduino setup?

RubenvWyk commented 9 years ago

Hi all,

I've sort have had a shift in working responsibilities hehe but as far as I know:

After the Pi started to communicate with the azure website, there came a problem with reading the string from the Arduino. It might only be a coincidence (I have not been able to pinpoint the start of the problem), but for some reason, the JSON string read complete gibberish...

import serial ser = serial.Serial('/dev/ttyACM0', 9600) while 1: textln = ser.readline() print(textln)

This being my python script (running on my Pi) just to view the info being sent from the Arduino.

My .ino file looks like this:

include "dht.h"

define dht_dpin A0

define ldr_dpin A1

dht DHT;

// Constants used for the ConnectTheDots project // Disp value will be the label for the curve on the chart // GUID ensures all the data from this sensor appears on the same chart // You can use Visual Studio to create DeviceGUID and copy it here. In VS, On the Tools menu, click Create GUID. The Create GUID // tool appears with a GUID in the Result box. Click Copy, and paste below. // char GUID1[] = "019d2910-d224-11e4-8830-0800200c9a66 "; //generated by wwww.famkruitfoh.net/uuid/uuidgen - universally unique identifier - according to www.ietf.org/rfc/rfc4122.txt char GUID2[] = "7f354d10-d2e9-11e4-8830-0800200c9a66 "; char GUID3[] = "8bbb7a50-d2e9-11e4-8830-0800200c9a66 "; char Org[] = "Company "; char Disp[] = "Current conditions: "; char Locn[] = "The Loft "; char Measure1[] = "Temperature: "; char Units1[] = "C "; char Measure2[] = "Humidity: "; char Units2[] = "% "; char Measure3[] = "Light: "; char Units3[] = "% "; char buffer[300]; char dtostrfbuffer[15];

void setup() { Serial.begin(9600); delay(700); }

void loop() {

DHT.read11(dht_dpin); //call library function - temperature and humidity delay(1000); //stability float light_level = analogRead(ldr_dpin); //read ldr level light_level = (light_level-20)*100/180; //conversion to percentage light (an estimation of light required)

// print string for temperature, separated by line for ease of reading // sent as one Serial.Print to reduce risk of serial errors

memset(buffer,'\0',sizeof(buffer)); strcat(buffer,"{"); strcat(buffer,"\"guid\":\""); strcat(buffer,GUID1); strcat(buffer,"\",\"organization\":\""); strcat(buffer,Org); strcat(buffer,"\",\"displayname\":\""); strcat(buffer,Disp); strcat(buffer,"\",\"location\":\""); strcat(buffer,Locn);
strcat(buffer,"\",\"measurename\":\""); strcat(buffer,Measure1); strcat(buffer,"\",\"unitofmeasure\":\""); strcat(buffer,Units1); strcat(buffer,"\",\"value\":"); strcat(buffer,dtostrf(DHT.temperature,8,2,dtostrfbuffer)); strcat(buffer,"}"); Serial.println(buffer);

/* delay(1000); //stability

// print string for humidity, separated by line for ease of reading memset(buffer,'\0',sizeof(buffer)); strcat(buffer,"{"); strcat(buffer,"\"guid\":\""); strcat(buffer,GUID2); strcat(buffer,"\",\"organization\":\""); strcat(buffer,Org); strcat(buffer,"\",\"displayname\":\""); strcat(buffer,Disp); strcat(buffer,"\",\"location\":\""); strcat(buffer,Locn);
strcat(buffer,"\",\"measurename\":\""); strcat(buffer,Measure2); strcat(buffer,"\",\"unitofmeasure\":\""); strcat(buffer,Units2); strcat(buffer,"\",\"value\":"); strcat(buffer,dtostrf(DHT.humidity,6,2,dtostrfbuffer)); strcat(buffer,"}"); Serial.println(buffer);

delay(1000); //stability

// print string for light, separated by line for ease of reading memset(buffer,'\0',sizeof(buffer)); strcat(buffer,"{"); strcat(buffer,"\"guid\":\""); strcat(buffer,GUID3); strcat(buffer,"\",\"organization\":\""); strcat(buffer,Org); strcat(buffer,"\",\"displayname\":\""); strcat(buffer,Disp); strcat(buffer,"\",\"location\":\""); strcat(buffer,Locn);
strcat(buffer,"\",\"measurename\":\""); strcat(buffer,Measure3); strcat(buffer,"\",\"unitofmeasure\":\""); strcat(buffer,Units3); strcat(buffer,"\",\"value\":"); strcat(buffer,dtostrf(light_level,6,2,dtostrfbuffer)); strcat(buffer,"}"); Serial.println(buffer);*/

delay(1000); //stability }// end loop()

At first I thought the error might be because I am sending 3 Serial.println so I commented out the last two, but the problem persists.

Is there a way that you know of to check for interrupts on the Arduino maybe? Or some reason the serial communication protocol might be clashing with the ethernet communication? The reason I am asking, is because if I connect the Arduino directly to my laptop, I can program it fine (now that I think about it, I didnt check the serial data being sent back)...

Blegh. Anyway, I am sure this not really in your scope of work to test arduino's :P so don't worry about this. At the moment I need to learn app programming, so my Arduino is going back into the box for a while...

Thank you so much for your support in everything.

Oh, and regarding that deploy.cmd... I just added sudo in front of every command, and that sorted it out. And I specified the direct file path of my project. (not just ../../)