Tidelight: Proof of Concept
It’s been a while, hasn’t it. Recently, in my spare time, I have been working on a little project called ‘Tidelight’. There is capacity for it to become ‘Tidelamp’, but not just yet.
Last summer, I spent a while living on a houseboat. Come autumn, it became necessary (and preferable) to move into a house on slightly higher and more stable, dry lands… however, I found myself yearning to know what the tide was doing at most points of the day. See, when the tide went away from Penryn River, the whole boat would lean on its hip and everything would sort of…lurch. I, myself, would definitely lurch, although only slightly, I could feel the state of the tide. My rhythms became complimentary to that of the river, but I DID NOT REALISE IT until I left.
Upon noticing this phenomenon I felt it was totally pivotal that I introduce some of that watery cyclical wordlyness into my new static house. On a night time stroll to the quay, I saw a fisherman moored in the rain, lit up solely by a lamp, felt relatively moved. Admittedly, he was bashing the shit out of a crab, which wasn’t so atmospheric, but I loved the whole setup of the ‘scene’ and latched on to the idea of creating a lamp that displayed somehow the state of the tide.
Like a total keen babe of the night, I ran home and wrote a Python spider to retrieve current tide data from Tide Times, popped it as a cron job on my server (sorry guys, thats me pinging you every minute) and attempted some sort of data visualisation HTML/JS page with a whizzy knobby library. This visualisation, at the time of writing, can be found here, and the code here, and it looks like this…
Thus, part one was complete. Then, as happens, I left the project and probably forgot it existed at times, until this weekend when SUDDENLY I had passion for it again. This is largely due to a discussion I had with a friend about how his motion-detective smart heating could perhaps have interrupted the recent burglar visitors to his house, ’tis a long story, but basically residential IoT inspired me. Never thought that’d happen. I re-thought the old thought, what if I could innately *feel* the tide again? So, it was Raspberry Pi time.
I have just realised that I Snapchatted my progress instead of taking actual pictures that have a degree of permanence. And this being a work blog, I want to document it properly. I am an awful person, here is a minified version:
The first stage was to get a simple LED to change in brightness depending on how close it is to high tide in Penryn by using the data retrieved from Tide Times on my server. Soon, this will turn into something larger. I want it light based, as light is something that surrounds us and, although we don’t consider this moment by moment, is crucial to our waking/sleeping cycles. It might be a modified oil lamp full o’LEDs, or I might get on board with Phillips Hue. It made sense to start simple. This was made difficult, though, by the fact that I couldn’t find my breadboard, so prototyping was a bit of a pain, as you can see in above picture of sweet rig.
I utilised PWM (Pulse Width Modulation) to control the brightness of the LED. Around this, I created a few functions to fetch my tide times json data from my server and subsequently parse it into something actually useful, as apparently I was too lazy to do this when constructing the spider in the first place, and calculate at what percentage the tide was – 100% being high. This variable was then passed through to the LED via PWM & GPIO, and alas, it shone at whatever value that was. 0 being off, 100 being fully totally completely bright. This was stuck in a
while True: loop, with 1s delay.
Due to taking up half of the kitchen with ethernet cables and monitors and general electronics, I did not leave this running long enough to see any amazing results. The next phase of this is to create it as a system that does not rely on ethernet (finding wifi dongle is crucial) and monitoring changes throughout the day. But, as a first shot, i’m pretty happy. Will update with example code shortly.