If you’d rather watch hear this story through a quick 4-minute video, I’ve got you covered:
This is Roshi. He is a one and a half year old Mississippi Map turtle and the inspiration for the world's first YouTube-powered water drone. Before I show you what this thing looks like. Let me show you how it works.
How It WorksThe bot has a camera inside the Roshi’s tank that streams a live video feed to YouTube. From YouTube, I, or anyone else who’s watching the stream, can control the camera by writing comments in the live chat.If someone types in left, it the camera will turn left, if they type in right, it’ll turn right, it can also go down, backwards, forwards, and even up, even out of the water, in case you want to see Roshi on his rock. At the end of the article I’ll show you how to try it yourself.
How It Was MadeThis bot is mainly just a Raspberry Pi 3, hooked up to a camera module, as well as some motors.
I work as software engineer, writing the code for this was relatively straightforward, but the hardware wasn’t. I haven’t actually built anything physical or wired up any electronics since middle school shop class, so just getting the motors working took me longer than I’d like to admit. And it gets worse.After wiring up the electrical components. With a project like this, typically you want to design a frame cut it out of wood or out of plastic using professional tools.That’s obvious to any DIY enthusiast. But I’m new to this, and, in case I haven’t made it clear, I have no idea what I’m doing.What did I do instead? I went to the dollar store, and got cardboard, chopsticks, microwave covers, paper cups and a bunch of other random stationery, and I ended up this absolute mess of a prototype.
Just to give you an example of the hacky craftsmanship is that went into this, I didn’t know how to make a waterproof casing for the camera and cable, so I gave up and just passed the whole thing through a long piece of poly tubing, that I closed off on one end with a heat seal.[ Camera module ]This machine isn’t pretty but it works, and unlike the sloppy frame, the software behind this work is something that I actually am somewhat proud of, so let’s talk about that.
The code is made of three main parts:
1. A program called FFMPEG, running on the Pi, it encodes the video feed from that camera and streams it to YouTube.
2. A Node.js script I wrote, that tracks the YouTube comments in that stream’s live chat, checks certain keywords, and when it finds them, sends out commands.
3. A Python server running on the Pi, which moves the bot around by turning on an off the different motors, based on the commands it receives from the Node server.
There are links in the description with all of the code. I know some of you are like me and you prefer being walked through how to write it, don’t worry that’s coming next.
What’s NextActually, there are a couple things that I’d like to do next with this project. For starters, this could use a much better view. Right now the only place I have to try this in is my Roshi’s tank, but it would be much more interesting to use in a bigger aquarium with lots of fish and other animals. That would make for a really immersive experience, almost like virtual scuba diving.
Maybe one day I’ll meet someone who can get me into the Vancouver Aquarium one night and try it out there. Or maybe it’ll be someone else who does it. That’s why the other, and more important next step for me, is to teach people how to make something like this. And I’ve already gotten started.
I’m working on a article and video tutorial to show your how to write your own YouTube Chatbot using Javascript. Mine sends commands to the the raft, but you’ll be able to get yours to do whatever you want.It’ll be ready in just a few days, so follow me here so you don’t miss it. In the meantime, those of you who would rather just copy the code, please feel free. If you just want to take it for a spin and see what Roshi's up to, I’ll have the bot streaming as often as possible for about a week. If you follow me on twitter or subscribe to my YouTube channel you can know when it’ll be streaming next.
Thank you for checking out my project!
Find me here:
Comments