In the last post, we got DC motors up and running with the Raspberry Pi 3 as well as aquired, configured and tested all the necessary hardware and software to get our set up 100% project ready.
In this post, I’m using that know-how to build me a sick car! 😉
Building a Chassis
With all the gear ready, you can make a car out of pretty much anything your resourcefulness may come up with..but I got a 3d printer! So I’m just gonna head over to thingiverse and look for a blueprint that suits me and print that bad boy out!
If you do NoT have a 3d printer, Amazon’s got you covered with such low cost, diy car bodies as this Emo smart robot car chassis or this 4 wheeled drive model by Aitreasure
which is reminiscent of The Arduino 4 wheel drive robot chassis by sb43201 that I went with. its simple, durable design is compatible with regular DD dcmotors and you can the pi anywhere on it. It also leaves plenty of space to customize and expand your car bot projects. Sold!
Motors are easy to install on this thing and the frame uses these m3 screws/locknuts to fasten the wheels as well as the rest of the frame.
This thing was designed with the Arduino in mind so the Pi won’t be able to fit inside so I printed out this Pi case designed to house specifically the Raspberry pi/Adafruit motorhat configuration to attach to the hood.
…And ziptie any power chords to the frame to make sure everything stays in place.
The Anker Battery holster by pyromaniac. been looking for something like this…All my life. Designed for my favorite portable battery.
Time to double check everything and do some slight filing of the parts near the wheels to make sure the frame isn’t get in the way of the wheels rotation. And some cool studs to use as lock nuts 😉 and to give a more badass look to the car what with the horns and fangs.
Overall, the car came out much sturdier than I imagined. No loose parts at all and it can really take a beating. it reversed right off my bed when I first tested the motors. Sounded pretty painful lol but not a scractch on it!
Mobile Phone Control
Now you can’t very well run a car connected on hdmi so for true wireless control I use VncViewer Which let’s you control your desktop from your smart phone. 🙂
To program, I start off with my modded code of the official repo. From there, I can design any control scheme I want over the car: voice commands, wireless keyboard control, PlayStation 3 control etc. But I decided on something a bit more Hi-Tech.
I decided on the Myo Armband because hell! Why not!?
The Myo Armband is a nifty gadget that utilizes the electrical signals is your muscles to control electronics..in short, Gesture Control. dzhu’s famous Myo_raw repo allows you to hack the raspberry pi for almost full use of this brilliant device. With it, you can train it to recognize just about any gesture and control any aspect of the pi.
Now My code is a killer combo of dzhu’s brilliant myo hack and my DC motor controller modded from the official Adafruit motor hat python library.
You can put them together yourself which is not too difficult or you can download my complete, fully commented ready-to-go files for a donation of your choosing.
[sell_media_file item_name=”test download” name=”Sinistergenius.com” label=”Donate with Stripe” description=”Gesture Controlled Dc/Stepper Motors” amount=”5.50″ locale=”auto”
panelLabel=”Donate ” download_link=”https://sinistergenius.com/wp-content/uploads/2018/02/Motor_Bliss-master.zip”%5D
All donations go to researching and developing high tech yet simple and cost effective gadgets designed for the masses. 🙂
The Trick to Myo
So there’s a trick to connecting the armband if your not updated to the latest raspian Jessie Pixel on account of some sort of software hiccup. So if your experiencing this problem and don’t want to update for some reason, I documented the exact fix here.
Another small glitch in this system would be pygame crashing after training too much at once. Could be a pygame version issue. Don’t worry the data still saves and it’ll continue working fine. but again if your systems up to date, don’t even worry about it.
Basic Myo Training
So once your connected and ready to train it to your arm, simply run classify.py and with the number pad, hold a pose(not too tightly. give yourself a little range of motion so your pose doesn’t have to be perfect when performing the real thing.) while holding the desired number of the pose. Up to nine poses. (Remember your poses) The longer you hold on, the better it is trained making the pickups more accurate.
Then you open up Myo.py, you may want to do some editing at the beginning of myo.py in lines 33 and 37 to change where the data is saved and loaded. Which is great if you want to say have multiple sets of nine poses to swap out and use all in the same system.Edit the data in the test function starting on line 110 to better reflect your personal training data. Then when your ready, run Myo.py and perform your poses. It’s like hello world with gestures. 🙂
-hold pose, hold number you want that pose to be
Gesture Control Testing
In this video, the training data is at about 600 per gesture using these gestures:
This things already a blast but I noticed that it confuses my programmed gestures causing it to do the wrong thing at times. So I retrained the car with more distinct gestures and twice the training time..
And got this:
And with that, I now that I have a sick raspberry pi robot car with a nice Hi-Fi control scheme, and this is just a really good start. I can Branch out with some Computer Vision, sensors, servos etc. But for now, I’m just gonna screw around and have some fun. 😉
Until next time.
Please Show some love by commenting or subscribing to my YouTube Channel