Build a Voice-Controlled Car
TRANSCRIPT
Can I Drive a Voice Controlled Car
James Bruton
Now Deepgram have asked me to build something that could be controlled with their speech recognition API and the API lets developers get fast and accurate transcripts for both prerecorded and live audio. Deepgram have a whole set of SDKs to make it even easier to get started in your language of choice. Features include things like profanity filtering, redaction, and individual speaker detection so it can work out who’s speaking and when. and that makes the transcripts as useful as possible. You can get started with a hundred and fifty dollars of free credit when you sign up, which is enough for around a hundred and fifty hours of transcription, so that’s a pretty good price. Deepgram can be run locally or using the Deepgram cloud service and I’m gonna be using the cloud service with this raspberry pi computer to control some hardware. But first of all, I need to build something.
So I’ve got a steel chassis with a plywood top which is bolted on all the way around and that’s got various cut outs. a bit of machinery. So we’ve got a big hole and we’re gonna use a lazy Susan and this is where the steering wheel is gonna fit. In the middle of that, we’re gonna fit an eight inch caster wheel. So with that piece of wood or bolt it down, that gives us a nice smooth motion, so steering should be no problem. and the wheel is one from an actual eight inch caster and that’s got roller bearings already fitted in the middle, so that means it’s gonna roll nice and smoothly and we don’t have to fit any additional bearings. I’m gonna be driving this with a chain, so we’ve got a retainer that’s gonna stop the chain falling off when the whole thing is up the other way. So that’s just gonna be screwed glued on all the way around, and there’s also two holes in the front of this, which the chain’s actually gonna attach to. There’s quite a few three d printed parts in this project so I’ve got various brackets to make for the motor and also some feedback and various other parts. So I’m using a one point two millimeter nozzle to print these parts so that they’re really tough, and that means that we should have no problems with the strength of the parts. This is just PLA, but I’m using four parameters and I’m using about twenty percent infill with that fat nozzle on most of the parts. So here are some of the parts for the motor mount and the feedback part, and various other things that we have to fit. One of those brackets is gonna hold a windscreen wiper motor. Now these some pretty tough BC brushed motors with a worm drive on them. And as you can see, I fitted a sprocket there that’s gonna drive a chain to move that wheel. and that fits into one of my recesses and it can be slipped out with some forwards to tension the chain. So that’s gonna drive the chain around my wooden pulley, which the chain tied off to two bolts at the front that you can see just there. Hopefully, those bolts will be strong enough, but I might put a metal plate on the bottom of them to stop them pulling through the wood. To position the wheel, we need some feedback so we can tell what position it’s at. So I’ve got a ten turn port that goes around ten times fitted in a bracket and that’s got another sprocket on and the chain simply turns that sprocket as the wheel moves, which means I can drive it to different positions and I know where it is, which means I can position it and I can there accurately, and that seems to be working pretty well. My actual wheel is fitted on two more big tough three d prints, which I know will be more than strong enough So all we need now is some electronics to position it, and that consists of an Arduino UNO with a BTS seventy nine sixty motor driver. The feedback from that pot and some wires to drive the motor from the battery. So now I can feed in serial data to my Arduino and it uses our feedback port to position the motor to various different positions. Basically, they range from minus a hundred and fifty to plus a fifty for steering left and right. And I’m gonna use some hoverboard motors to drive the whole thing along. I’ve got the wheels bolted on and I’ve also got a seat which is fitted to two rails which are fitted on the top, so I’m not sitting right on the ground. So a quick test just with some open loop VESC motor controllers, so I haven’t got the whole effect sensors connected here, but it seems to run the motors okay, and we’ve got plain of talk to drive me along, so that seems like it’s going to work. I eventually settled on using an old drive three point six brush’s motor driver which drives those wheels fine and will also use the hall effect sensors for higher accuracy. So that seems to run line and I can control the speed. Just using an RC transmitter there to run the wheels forwards and backwards. I’m using a Raspberry Pi four and that’s hooked up to a USB audio interface and a microphone. And with a bit of help from the Deepgram team, we’ve got a python script that will recognize what I say.
Faster, slower, left, faster, faster, slower, left.
The Python script uses Py audio to take my mic even send it to the Deepgram API URL. Extra parameters can also be specified on the URL, so in my case, I’m telling it to use British English, and I’m also specifying various keywords that I specifically wanted to listen for. You can add positive and negative weightings to these keywords if you ish, and we’re sending the audio at sixteen kilohertz in eight k chunks. The transcript and various other parameters are returned as a JSON message and we’re using the Python JSON library to pause the message to get the words out. After that, it’s a simple case of matching the strings against the commands I want assigning an integer them and sending that over serial to the Arduino. The Arduino Uno controlling the hardware receives a serial commands and sets the steering and velocity demand position. If I say faster, slower, more or less, it adds a bit to these values. I’m using a PID controller to control the position of the steering based on a feedback port. Although in reality, I’ve only set the proportional term, which means the motor goes faster if the distance it has to move is bigger and slows down as it gets to the target, so it doesn’t shoots. I’m using the Arduino servo library to write the velocity to the Odrive, which is configured for servo PWM inputs. And I’m using some analog rights to set the steering motor velocity.
Left more more more Right. More more more
Less. Straight. forwards, faster, faster, faster, slower, slower, Stop.
Sorry, there is a little bit of lag maybe half a second or so, but that’s not too bad considering we’re sending the audio all the way over the Internet to Deepgram’s cloud service. where it’s working out what I’m saying, sending back the results. And then we’re sending serial data from the Raspberry Pi to the odd window that has to physically move a motor to steer the wheel or adjust the throttle. So I think it’s gonna be drivable, but we’re not gonna notal. We test it.
So we’re just testing tethering off my phone to see how good enough in this location.
Left. More, more, right. Straight. Forwards. Just take the e stop off. Faster. Left left, More, faster, Straight. Right, slower, right, slower, slower, faster, straight, straight left, more left, more stop stop stop. Right. Forwards, left. left, More, more, faster, more. more, faster, slower. right, more, faster. Straight, faster, faster, faster, left. Left. Slower. Slower. Stop. Stop. Stop. Stop. stop forwards left. Faster. Straight. faster, left, more, More. Forwards. It’s faster. Left. Left. slower, more, right, more, right, left, More, more, more. Right. Right. More. left, left more, more, more, right, right. More. Left, More. Right. right, more. More left. Right? More. Left. More. Right, More. Left. left, more. More, right, More faster. Straight. Left. Right. Stop. Stop.
Thanks to Deepgram for making this video possible. It’s been a really fun project to build and test. and don’t forget, you can sign up using the link in the description to this video and get a hundred and fifty dollars of free credit. And you don’t need to pay anything at all unless you wanna top that credit up, so it’s absolutely free to try out. I’ve only used about four dollars of credit in all of the tests and build and filming of this project. So it’s pretty good value. Alright. That’s all for now.