Understanding Networks: IOT Device Design

Posted on
understanding_networks iot
Understanding Networks: IOT Device Design /img/itp/03_semester/networks/digital-pet.gif

I’m working with Jackie Liu for an IOT assignment.

Our first assignment was to design and build a web api and a physical interface for the app.

Our idea is for a digital pet.

App

The application simulates a pet. The pet has a state with several attributes.

  • Hunger satisfaction: how satisfied is the pet’s hunger?
  • Love satisfaction: How much love does the pet have?
  • Cleanliness: How clean is the pet?

All attribute values start at 0 and max out at 10. The attributes deteriorate after a predetermined time interval, eg every hour.

There is also an “overall happiness” metric. It is the sum of the hunger, love, and cleanliness levels, out of the total number of 30 points. For example if we have hunger = 410, love = 210, cleanliness = 910, overall happiness will be 1530.

Web API endpoints

/pet

A GET endpoint that returns a JSON object describing the state of the pet.

{ 
    "hunger": 1,
    "love": 0.5, 
    "cleanliness": 10,
    "happiness": 0.383
}

Trigger endpoints

  • /hunger
  • /love
  • /cleanliness

Requests to these endpoints should trigger a modification of the state mapping to that end point. e.g. calling /hunger should decrease hunger by some amount.

Physical Avatar

A physical avatar communicating the state of the simulation. It is a 3D printed body for an Arduino compatible board with an OLED screen.

The avatar is connected to WiFi and uses the API to get the state of the pet.

Web client

A web client provides users with an easy way to trigger API calls.

A simple web page with three buttons, one for each trigger endpoint.