{
  "$type": "site.standard.document",
  "canonicalUrl": "https://rickymoorhouse.uk/blog/2016/pizero-desklight",
  "path": "/blog/2016/pizero-desklight",
  "publishedAt": "2016-12-05T21:01:12.000Z",
  "site": "at://did:plc:r53zv4vpzeihop3aliwyejlu/site.standard.publication/3mos5q3a7jf2w",
  "tags": [
    "raspberrypi"
  ],
  "textContent": "When we set up our office earlier in the year I decided on a standing desk which\nI put together using the Ikea Algot system.  \nIn order to avoid using up desk space with a light I originally planned on a\nclip on light but then saw my Pi Zero and Unicorn pHat and thought they could\nmake a good alternative.\n\nHardware\n\nThe Raspberry Pi Zero is in a simple case, mounted onto the underside of the\nshelf above my working space.  Attached is it's power cable, a PiHut wireless\nadapter connected via USB and of course the Unicorn pHat.  The power cable is\nrouted down the side of the shelf to my PowerCube, which will eventually be\nmounted under my work surface but it's sticky pad wasn't strong enough to hold\nit on the underside of the desk!\n\nSoftware\n\nAs I've not yet added any switch for my light, it all has to be controllable\nremotely, so I set up an API to set the colour of the light which I initially\ncontrolled via a web browser with urls like:\n\n    http://192.168.0.15:8009/colour/<red>/<green>/<blue>\n\nAs you can imagine that got a bit tedious - especially to turn off after I'd\nshut down my laptop!  The next step was to add a simpler way to control the\nlight through my phone so I set up iControl Web with buttons to adjust the light settings.  Then when I saw the Home app on iOS 10, I researched ways to get my custom light controllable through that and came across Homebridge which I could point to my API via it's Better HTTP RGB plugin, a bit of config and a couple of changes to my API.\n\nAll the code for my API is on github and is very much a work in progress!",
  "title": "Pi Zero as a desklight"
}