Categories
Sunday, December 10, 2017, 02:34 AM - Robots
Posted by Administrator
Posted by Administrator
Balancing Robot Vehicle

I used this guy's YABR (Yet Another Balancing Robot) project as my guide: www.brokking.net/yabr_main.html
I used his code with some slight modifications:
- uses NRF24L01 radios instead of bluetooth to Nunchuk
- uses the pin mappings of my CNC shield whereas he directly wired to his DRV8825 drivers
- added incr/decr buttons for P and I and D to help to tune the PID variables.
My code is here:
https://github.com/nshaver/balancing_robot_vehicle/
Components:
2 x Arduino Uno (one for vehicle, one for joystick) - $20
1 x CNC shield - $5
2 x DRV8825 Stepper Drivers - $10
1 x MPU6050 Gyro/Accel - $5
2 x NEMA17 1.7A stepper motors - $25
2 x NRF24L01 2.4ghz radio with external antenna - $10
2 x NRF24L01 breakout adapter (converts to 5v) - $5
1 x Funduino Joystick - $10
2 x Wheel+Tire 12mm hex - $15
1 x Matek Duo power supply (12v for motors, 5v for Arduino) - $20
Everything above can be purchased on Amazon, probably Amazon Prime. If you enter exactly what I have for my description into your Amazon search you should be able to find the product.
2 x 3d printed wheel adapters
https://www.thingiverse.com/thing:270...
1 x 3d printed Kobalt battery adapter
https://www.thingiverse.com/thing:230444
The controller code is also at the link above.


Upgrade an LM293D Motor Controller
The lm293d is only rated for around 600ma of continuous current. To increase that greatly, swap out the chip, and stack the chips to double the current handling. The sn75441one chip is rated at 1 amp, 2 amps peak. Stacking them gives 2 amps, 4 amps peak (though I wouldn't recommend 4 amps through it).
How to hotrod a lm293d motor controller
1 - replace the lm293d chips with SN754410NE chips, like these: https://www.digikey.com/product-detail/en/texas-instruments/SN754410NE/296-9911-5-ND/380180
2 - stack the SN75441ONE chips pin-for-pin, use thermal tape, and use a heat sink like this: http://www.mouser.com/ProductDetail/Aav ... Asd08P8HAQ
thermal tape: https://www.amazon.com/gp/product/B01M723CAN/ref=oh_aui_detailpage_o05_s00?ie=UTF8&psc=1
This should provide around 2 amps per motor, continuous, over triple the original current handling of the lm293d. Here's what it looks like on the MotoPi motor controller that stacks onto a Raspberry Pi Zero W:


Raspberry Pi Arcade Machine

Purpose
A fairly inexpensive machine dedicated mostly to playing coin-op games from my childhood. It uses MAME (Multiple Arcade Machine Emulator) to play the ROMS from the original machines. It also can play movies and music using Kodi.
Parts List
This thing wasn't exactly cheap. It could definitely be done cheaper with a smaller monitor and lesser sound system. The total cost for mine was around $275. If you cut back on things you could probably build one for around $125.
1 x Raspberry Pi3, with power supply, HDMI cable, and Micro SD card - $60 https://www.amazon.com/gp/product/B01C6EQNNK/ref=oh_aui_detailpage_o02_s00?ie=UTF8&psc=1
1 x Plastic tote - $5 or so
2 x Joystick+Buttons kits - $16 each, $32 total - http://us.banggood.com/Wholesale-Wareho ... 39974.html
1 x 10" HDMI Monitor - $115 https://www.amazon.com/gp/product/B01D17GPI4/ref=oh_aui_detailpage_o01_s00?ie=UTF8&psc=1
1 x Audio Amplifier - $24 https://www.amazon.com/gp/product/B019MBUX40/ref=oh_aui_detailpage_o08_s00?ie=UTF8&psc=1
1 x Pair Car Speakers - $20 https://www.amazon.com/gp/product/B00INA9UBE/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1
1 x AC Power Switch/Port - $6 https://www.amazon.com/gp/product/B00ME5YAPK/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1
1 x Standard Computer Power Cable - $11 (I bought a really really long one)
1 x Miniature USB Computer keyboard (a bluetooth one would work too). I had one laying around, but I'll call it $10.
Retropie Linux - free - https://retropie.org.uk/
Instructions
Just connect it all together, copy retropi to your MicroSD card, boot it up, configure the joysticks/buttons in MAME, round up your MAME ROMS, and play!
I think it's harder to describe exactly how to build the thing than it was to build it. You'd benefit greatly from some Linux experience, some electrical wiring experience, some basic powertool experience, and you need to own some BIG drill bits. The big buttons require 1-5/8" holes I think. A hand router would probably do the job, too.
Kodi
I have Kodi installed, and with it comes all kinds of multimedia possibilities. Plug up a big USB hard drive with movies on it and it becomes a movie box. Add the Google Music (or spotify or pandora, etc...) addon and it becomes a party music machine.

Audio
I originally had a stereo board amp in it, sticking out the front. It was cheap ($12), but that thing was a pain in the ass. First off, it required 12vac. That's right - 12v AC. That means it can't be easily powered by a 12v LiPo battery should I want to make this thing portable. Also, I think one of the channels blew out after a few days of use.
I ditched the AC amp and sucked it up and paid $24 for a 12vdc-powered enclosed stereo amp. It didn't fit in the area in the front though, so I had to relocate the audio controls to the right-hand side of the tote.

The car speakers I got are two-way with a little tweeter in the center, and they sound very good when compared to your run-of-the-mill bluetooth speaker thing. This amp+speakers also get much much louder than any cheap bluetooth speaker I've run across.
Monitor

I wanted a 10" monitor, but if needed a lot of money could be saved by swapping out a 7" monitor (could probably save $60). The one I got has HDMI and SVGA inputs, but the HDMI input wasn't auto-detecting things from a cold boot. I had a spare HDMI->SVGA adapter, so I came HDMI out of the Raspberry Pi into the adapter, and then used a SVGA cable from the adapter to the monitor. That setup works perfect when power is applied and things boot up.
Joysticks/Buttons

I got the joysticks and buttons and USB gameport adapters from Banggood (USA warehouse). The item linked to in my parts list above is by far the cheapest way I've found to get mechanical joysticks and buttons for an arcade machine. At $15.77 per side (once side=one joystick, lots of buttons and wires, one USB controller board), two of them for $32 cost less than half of what you'll usually find equivalent parts on Amazon.

So, I wound up with two USB game controller things plugged into the Raspberry Pi. They work fine though, and it sees them as two separate joysticks.
AC Power Port

You could definitely omit this AC power port thing and instead use an extension cord or a power strip. I wanted an externally-accessible power button, and I wanted to be able to swap out the cable for a really really long one. I figure at parties you never know exactly where the arcade gaming might want to happen, or where the music might want to be. I got a 25 foot cable, which is super long compared to most computer power cords.


ESP8266 Program Over WiFi
Purpose:
The ESP8266 is a very inexpensive microcontroller that has a full TCP/IP stack and WiFi, and is compatible with the Arduino IDE. It programs very similar to a standard non-WiFi Arduino.
This project demonstrates how to program the ESP8266 via WiFi rather than via a USB cable directly connected to your development computer. It lets you build IOT devices, deploy them, and then later reprogram them without having to bring them back to your computer.
Requirements:
- 1 x ESP826612E
- Arduino IDE, I think it needs to be >= version 1.6.4
- Code from my github - https://github.com/nshaver/esp8266_webupdate
Instructions
1. Setup compile/upload environment for ESP8266
You first need to be able to compile and upload programs to your ESP8266. There are dozens of tutorials that should get you going with uploading to your ESP8266.
2. Initial compile and upload
Get the code from my github.
https://github.com/nshaver/esp8266_webupdate
Modify the ssid and password variables to match your WiFi network. The program doesn't really do much other than deliver a hello message to the browser, wait for an http upload connection from a browser at /update, and blink the built in LED.
3. Verify WiFi

Use a web browser to visit your ESP8266. Ideally, you can visit it at http://esp8266.local, but you may have to use the IP address from step #2 above.
4. Change your code
Make a small change to your code so that you will be able to tell whether or not your WiFi upload worked, and click the "Verify" button in the Arduino IDE. That will rebuild a new binary and place it in /tmp/buildxxxx (have to find it). I'd recommend keeping your serial terminal open so that you can easily see the IP address of your ESP8266 after the upload has finished and it connects to your network.
5. Upload via WiFi

Now for the real excitement. Visit the /upload page of your esp8266 at http://esp8266.local/update and click the "Choose File" button. Browse to the binary you hopefully created in step #4 above, and then click the "Update" button. This will hopefully send your new program to the ESP8266, and then it will reboot. After a few seconds you can visit its webpage and see any of your latest changes reflected.
Purpose:
The ESP8266 is a very inexpensive microcontroller that has a full TCP/IP stack and WiFi, and is compatible with the Arduino IDE. It programs very similar to a standard non-WiFi Arduino.
This project demonstrates how to program the ESP8266 via WiFi rather than via a USB cable directly connected to your development computer. It lets you build IOT devices, deploy them, and then later reprogram them without having to bring them back to your computer.
Requirements:
- 1 x ESP826612E
- Arduino IDE, I think it needs to be >= version 1.6.4
- Code from my github - https://github.com/nshaver/esp8266_webupdate
Instructions
1. Setup compile/upload environment for ESP8266
You first need to be able to compile and upload programs to your ESP8266. There are dozens of tutorials that should get you going with uploading to your ESP8266.
2. Initial compile and upload
Get the code from my github.
https://github.com/nshaver/esp8266_webupdate
Modify the ssid and password variables to match your WiFi network. The program doesn't really do much other than deliver a hello message to the browser, wait for an http upload connection from a browser at /update, and blink the built in LED.
3. Verify WiFi

Use a web browser to visit your ESP8266. Ideally, you can visit it at http://esp8266.local, but you may have to use the IP address from step #2 above.
4. Change your code
Make a small change to your code so that you will be able to tell whether or not your WiFi upload worked, and click the "Verify" button in the Arduino IDE. That will rebuild a new binary and place it in /tmp/buildxxxx (have to find it). I'd recommend keeping your serial terminal open so that you can easily see the IP address of your ESP8266 after the upload has finished and it connects to your network.
5. Upload via WiFi

Now for the real excitement. Visit the /upload page of your esp8266 at http://esp8266.local/update and click the "Choose File" button. Browse to the binary you hopefully created in step #4 above, and then click the "Update" button. This will hopefully send your new program to the ESP8266, and then it will reboot. After a few seconds you can visit its webpage and see any of your latest changes reflected.

Robo Roadie
Purpose
I've got this RockNRoller cart thing that's basically a dolly/cart with collapsible arms that can be extended, and is great for hauling speakers and heavy musical equipment around. It's very handy as is, but I don't really use it all that much. What would motivate me to use it more? If it were motorized and remote control from my cellphone, of course!
Parts
If you count the cost of the cart then this is a pretty expensive project. I've had the cart for years though. This could work with just about any wheeled cart you can round up, assuming you're willing to figure out how to mount the motors to it.
1 x Rock N Roller R10RT cart - $185
2 x Auto Power Seat Motors - $30
2 x 8" Pneumatic Tires+Wheels - $16
2 x Hobbywing Quicrun 1060 ESC - $40
1 x Arduino Nano - $4
1 x Arduino Nano I/O Shield (not required) - $8
1 x HC-06 Bluetooth Adapter - $8
1 x 5v BEC (not absolutely required) - $8
1 x 12v Battery (I used a 3S Lipo) - $15
1 x Android phone/tablet to control over bluetooth - ???
1 x Blueberry Android App - free
So, total cost not including the cart was about $130. With that particular cart, around $310 I guess.
Description
Here's what I wound up with:

Here's what I started with:

I'll upload a video as soon as I get a chance to video it in action.
So I took off the back wheels and mounted some fairly powerful motors onto it. I used two power seat motors for cars. They're great because:
1. they're cheap (around $15 on Amazon)
2. they're easily powered by 12vdc
3. the housing is not grounded (unlike most power wiper motors), so they're reversible without shorting out via the metal frame.
Here's a link to what I got, though I'd recommend looking for an "Amazon Prime" version if you can find it:

https://www.amazon.com/gp/product/B005IR1NBA/ref=oh_aui_search_detailpage?ie=UTF8&psc=1
I used a couple of wheels+tires that I got from Freight Harbor. It's 8", supposedly non-marring, and is fairly easy to adapt to the motors I've got by using some hardware from Lowes. I used a 0.5" sleeve to get it to snug down pretty tight on the motor shaft.

An Arduino Nano and a I/O shield handle the logic, and a cheap bluetooth adapter (around $8 on amazon) handles the communications from the controller. I use my Android phone as the controller, and the app Blueberry does a great job of collecting speed/direction via screen presses.
Inexpensive Arduino Nano on Amazon:

https://www.amazon.com/gp/product/B015MGHH6Q/ref=oh_aui_search_detailpage?ie=UTF8&psc=1
The Nano I/O shield:

https://www.amazon.com/gp/product/B011U8G1JO/ref=oh_aui_search_detailpage?ie=UTF8&psc=1
The bluetooth adapter:

https://www.amazon.com/JBtek-Bluetooth-Converter-Serial-Communication/dp/B00L08GA4Q/ref=sr_1_1?s=pc&ie=UTF8&qid=1471211629&sr=1-1&keywords=bluetooth+hc06
The Blueberry app:
https://play.google.com/store/apps/details?id=com.bluetooth&hl=en#details-reviews
That app "Blueberry" is really cool. It won't work by just installing and pairing it, you have to code for its heartbeat signals. That's a really good thing though. That way, if the Arduino quits responding then the app almost immediately notices it, and it disconnects. Also, the Arduino will know very quickly if the app has disappeared. It helps to keep this Robo Roadie from going berserko and breaking ankles. It's definitely powerful enough to do great harm to an ankle should it get loose.
To drive the motors I used some inexpensive reversible brushed speed controllers. I've used these on several projects and they're reliable and fairly powerful. The Hobbywing Quicrun 1060 - around $20 per wheel.

https://www.amazon.com/gp/product/B00LXCM3Q8/ref=oh_aui_search_detailpage?ie=UTF8&psc=1
For power, I use whatever 3S Lipo battery I've got charged up. They can be had for $15 or so from HobbyKing. It runs for a long time on a 5000Mah 3S battery. I also used a separate BEC to get the ~12v down to 5v for the arduino+bluetooth adapter. I could probably use the BEC that's built into the ESCs, but I've pretty much decided to quit trusting ESCs for 5v. Separate BECs are so cheap (around $8), I'd rather just use one and know for certain that I'm going to get around 5v. I used a Dr. Mad Thrust 3A BEC that also has an on/off switch that you can use to turn on/off another device, like headlights.

http://www.hobbyking.com/hobbyking/stor ... ouse_.html
My Arduino code does the following:
- connects to the bluetooth adapter via software serial
- waits for a connection from an external device (Blueberry)
- watches for speed commands, remaps/mixes them, and sends them out to the speed controllers
The code is here:
https://github.com/nshaver/roboroadie
