Georgy aeishelSebinAnshul Shaji
Created July 29, 2018 © GPL3+

Intelligent Personal Robot

A personal Assistant robot with whom you can chit-chat, monitor your home when you are away ,easy user controls and lot more .

AdvancedShowcase (no instructions)Over 2 days147
Intelligent Personal Robot

Things used in this project

Story

Read more

Schematics

Components

Code

Arduino code

Arduino
for serial communication and reading sensor value
#include <SoftwareSerial.h>
void setup() {
 Serial.begin(9600);                                        
}
void loop() {

 int sensorValue = analogRead(A0);
 if(sensorValue>500)
 {
  Serial.println("1");
 }
 else
 {
  Serial.println("0");
 }
 Serial.println(sensorValue);
 delay(1000);
 }                    

Wiz 750 sr code

C/C++
for serial communication
#include "mbed.h"
#include "EthernetInterface.h"
#include "Adafruit_SSD1306.h"
#include "HTTPClient.h"


#if defined(TARGET_WIZWIKI_W7500)||defined(TARGET_WIZWIKI_W7500P)
    uint8_t mac_addr[6] = {0x00, 0x08, 0xDC, 0x53, 0xAE, 0x90};
#endif
Serial pc(USBTX, USBRX);
Serial device(D1,D0);
EthernetInterface eth;

// Declare TCP Connection Class
TCPSocketConnection sock;

int main() {
   int val;
   int i=0;
   char c;
   
char D[1000];
   
   int phy_link;
    printf("Wait a second...\r\n");

   eth.init(mac_addr);     //Use DHCP

printf("Check Ethernet Link\r\n");
    /*while(1) //Wait link up
    {
        if(eth.link() == true) 
            break;
    }*/
    printf("Link up\r\n");

    eth.connect();
    
      printf("IP Address is %s\r\n\r\n", eth.getIPAddress());
        printf("MASK Address is %s\r\n\r\n", eth.getNetworkMask());
        printf("GATEWAY Address is %s\r\n\r\n", eth.getGateway());
        printf("MAC Address is %s\r\n\r\n", eth.getMACAddress());
        while(1){
             while(device.readable())
        {   
        
            D[i]=device.getc();
           // char c= device.getc();
            pc.printf("%c",D[i]);
            c = D[i];
            i++;
            
            
        }
        val = int(c - 48);
        //printf("%d",val);
        // TCP socket connect to openweather server 
        //TCPSocketConnection sock;
        char send_data[1024];
        int CDS_data=val;
        sock.connect("api.thingspeak.com", 80);
        
         sprintf(send_data, "GET https://api.thingspeak.com/update?api_key=WO0QPMWOHQ7HTZMM&field1=%d HTTP/1.0\n\n",CDS_data);
        // GET method, to request weather forecast  
       // char http_cmd[] = "GET /update?api_key=0Q8S3KCULT7GUDVR&field1=2000 HTTP/1.0\n\n";
        
           
        sock.send_all(send_data, sizeof(send_data)-1);
        
        // get data into buffer
        char buffer[2048];
        int ret;
        while (true) {
            ret = sock.receive(buffer, sizeof(buffer)-1);
            if (ret <= 0)
                break;
            buffer[ret] = '\0';
            printf("Received %d chars from server: %s\n", ret, buffer);     
        }
        printf("\r\n\r\n");
      }
}

Raspberry Pi to Thingspeak

Python
For communication b/w raspberry pi and thingspeak
import urllib2
import json
import time


READ_API_KEY='   '
CHANNEL_ID= '    '


while True:
    TS = urllib2.urlopen("http://api.thingspeak.com/channels/%s/feeds/last.json?api_key=%s" \
                       % (CHANNEL_ID,READ_API_KEY))

    response = TS.read()
    data=json.loads(response)


    a = data['created_at']
    b = data['field1']
    c = data['field2']
    d = data['field3']
    print a + "    " + b + "    " + c + "    " + d
    time.sleep(5)   

    TS.close()

Credits

Georgy aeishel

Georgy aeishel

1 project • 0 followers
Sebin

Sebin

0 projects • 1 follower
Anshul Shaji

Anshul Shaji

0 projects • 1 follower
Thanks to richard.

Comments