Git Product home page Git Product logo

tvduino's Introduction

TVduino

TVduino is a REST Server implemented on an Arduino. It is used for monitoring the state of a set-top box through its video output. The REST Server can be used as a library to create connected solutions with arduino.

To put in place this solution you will need:

  • 1 Arduino
  • 2 TinkerKit LDR Sensors (Can be substituted by a normal photoresistor)
  • 1 Ethernet Shield

You can then fix the sensors to a TV using a box and There are three main routes implemented on the arduino REST, they can be accessed through 10.0.2.160:80

page method parameters return
/video GET none Readings of both sensors
/getlivestatus POST {"dt" : ms} Transitions in the TV status
/status POST {"dt" : ms} Current TV status
/zap POST {"ip_box" : "STB_IP" , "channel":"NChannel", "threshold":"LOW_THRESHOLD"} Measures zapping time for a STB (dev)
/wakeup POST {"nplug" : "N_PLUG", "ip":"Ip_ePowerSwitch"} Measures electrical wakeup time for a STB

Example: /getlivestatus

Request (POST):

{"dt":5000}

Reply:

{
  "result": [
    {
      "plage": 1400,
      "status": "LIVE",
      "avgvalue": 399.93,
      "avgderiv": 0.35
    },
    {
      "plage": 1900,
      "status": "BLACK",
      "avgvalue": 23.45,
      "avgderiv": 0.2
    },
    {
      "plage": 1700,
      "status": "LIVE",
      "avgvalue": 300.19,
      "avgderiv": 17.05
    }
  ]
}

Showing us that there were three transitions on the TV signal and the time it stayed in each state.

TVduino can also be easily customized to add different routes to your rest server and be used for different needs. To create new routes it is really simple:

void callback(EthernetClient *client, char args[]){
  client->println("{\"hello\":\"world\"}"); 
}

void setup() {
  Serial.begin(9600);
  myServer = new restServer(mac, ip, gateway, subnet,80);
  delay(1000);
  //create routes on our rest server
  myServer->addRoute("/test", GET, &callback);
}

void run(){
  myServer->serve();
}

Requires Timer Library and Arduino IDE

tvduino's People

Contributors

fcaldas avatar jtbonhomme avatar

Watchers

James Cloos avatar

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.