Giter Site home page Giter Site logo

smartuni / smartfarm Goto Github PK

View Code? Open in Web Editor NEW
10.0 8.0 10.0 26.62 MB

SS 2017 - RIOT im Internet of Things - Bachelor Project of Computer Science and Electrical Engineering

TypeScript 9.95% JavaScript 16.54% HTML 3.51% CSS 0.52% C 51.55% Makefile 1.11% Python 9.44% PHP 7.37%
iot student-project riot-os

smartfarm's Introduction

SmartFarm Project

Overiew

RFID-Part

  • send RFID of Tag
  • send status of checksum

Voltage-Control

  • send if fence is broken or if sth. lies on it
  • send if animal-gate is open or closed

LoRA

  • send and receive data

IEEE 802.15.4

  • send upd pakages between client and server

Server

  • receive data from LoRa-Module via UART
  • send data to CoAP-Server

To flash tap

$ BOARD=nucleo-f411 make all flash term

Used Boards

  • Selfmade RFID-Board
  • Nucleo-F441
  • mbed SX1276MB1xAS LoRa Shield

Send packages via LoRa

Necessary lib:

#include "lora.h"

The nodeID and the frameID enums are filled with

typedef enum lora_nodeID
{
    NODEID_NODEone 				= 0x01,
	NODEID_NODEtwo				= 0x02
} lora_nodeID;

typedef enum lora_frameID
{
    FRAMEID_HEARTBEAT 			= 0x01,
	FRAMEID_RFID_TAGID			= 0x02,
	FRAMEID_FENCE				= 0x10
	
} lora_frameID;

feel free to extend them

Make a Frame

lora_frame frame;

The Frame has the form

typedef struct lora_frame {
    uint8_t	nodeID;
	uint8_t frameID;
    char data[6];
} lora_frame ;

So let's fill the struct with a NodeID

frame.nodeID = 0x03;

and with a FrameID

frame.frameID = FRAMEID_RFID_TAGID;

Fill the struct with some payload:

char payload[6] = {0}; 
            .
            .
            .
frame.data[0] = payload[0];
frame.data[1] = payload[1];
frame.data[2] = payload[2];
frame.data[3] = payload[3];
frame.data[4] = payload[4]; 
frame.data[5] = payload[5]; 

Now we send our frame via LoRa:

lora_send_frame(frame);

RFID

To begin convince that u include the librarys for the mlx90109

#include "mlx90109.h"
#include "mlx90109_params.h"
#include "checksum/ucrc16.h"

Define Clock and Data Pin fit to the used hardware

#define MLX90109_PARAM_CLOCK
#define MLX90109_PARAM_DATA  

Create device descriptor

mlx90109_t mlx90109_dev;

The device descripter has the form

typedef struct {
    mlx90109_params_t p; 		/**< device configuation parameter */
	uint8_t counter;	  		/**< counter for data bits*/
	uint8_t counter_header;		/**< counter for Header bits "10000000000"*/
	uint8_t data[128];			/**< raw data*/
} mlx90109_t;

Then we create a Tag Object

tagdata newTag;  

Then make an interrupt for detecting new tags in the near field

void interrupt_hand(void *args)
{
    if (args){}
    int16_t temp = mlx90109_read(&mlx90109_dev);
    if (temp == MLX90109_DATA_OK)
    {
        printf("data ok\n");
    }
return;
}

Use the format-function to make raw-data(just a bitstring) to tagData (formated in TagID and countrycode). In this function also a checksum test is running in the background.

mlx90109_format(&mlx90109_dev, &neuerTag);

Fence

Necessary lib:

#include "fence.h"

Measure the voltage at fence

double measure (int numberOfMeasurement, double calculateParameter)

detecting the Gate state:

recognise_gate_funk (int port, int pin);
Value Fence
0 open
1 closed
2 error at initialisation of the port

calculate transfer value

calculate_transfer_value(double voltageFence, int recogniseGate)
Value Fence Gate
1 broke closed
2 broke open
3 intact closed
4 intact open

To-Do:

- bidirectorial communication (LoRa)  
  - Testing under real conditions
- Error-handling  

smartfarm's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

smartfarm's Issues

do you have any demo?

I would like to introduce your smart farm project to my hometown's farms, and we can share the profit. Could you provide demo link or video? So I can figure out whether it's suitable for our farm or not.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.