How to Make a Arduino+Raspberry Pi Robot Platform
by Ladvien in Circuits > Arduino
163332 Views, 178 Favorites, 0 Comments
How to Make a Arduino+Raspberry Pi Robot Platform
UPDATE: Lets Make Robots, my home digital hackerspace, was purchased by RobotShop. I don't want to go into, but the new owners banned myself and most of the veteran members. That stated, most of the links there will be broken. Luckily, I was able to make a copy of my content (the reason they banned me) and moved it to a Github site--it was a hurried move, so the content maybe a little rough right now.
This is not the definitive story on Pi and Arduino orchestration. Just my version.
Berryboot
SD Card Preperation
Berryboot
2. Setup RPi with Raspbian Wheezy (first option).
WiFi Dongle
If you have difficulty with manual WiFi dongle setup, you might try this video.
Lastly, if you are looking for a WiFi dongle for cheap, with good range, and uses very little mAhs (the Pi can only feed about 700mAhs through the USB port). You might try this one, $6.17.
SSH
You have to plug in your Pi's network number. You can find this by pulling up your wireless hub's configuration page. You should see what address your Pi is listed at. For some strange reason, if it doesn't list the device name, just view the page while the Pi is up, then unplug your Pi and refresh the wireless hub configuration page. The device that disappeared is your Pi. I've never had to change the port number, but beware you might need to depending on your setup.
SSH
If you want to know whether your have the correct information, try login' in and if you get a screen like this, your good.
Your username and password are by default: pi, raspberry
Remember! In the case of a Raspberry Pi, always share your password, 'cause everyone has it anyway :)
SSH
VNC
6. Setup a VNC Client on your Desktop Computer. Real VNC. There are many different programs, I happened to end up using Real VNC.
Once you have VNC setup on both machines, PuTTY into your Pi and start the VNC server.
$sudo vncserver
You should end up with at a windowed version of your Raspberry Pi desktop. One more note, somewhere in the video it gets you to setup the "geometry" of the VNC desktop. The limitations you put there will be reflected in the quality of the desktop you see in the window. In essence, if you put in 640x480, that's the resolution this desktop will end up. So, please, take advantage of the Pi's GPU :)
Use something like this, "-geometry 1024x728 -depth 24"
SD Card Resize
GIT
Install the git manager:
At Raspberry Pi prompt: $sudo apt-get install git
The way to use it is like so,
At Raspberry Pi prompt: $sudo git clone https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code.git
SMBus
At Raspberry Pi prompt: $sudo apt-get install python-smbus
Useful Robot Packages
Useful for keystroke, GUI, and other interfacing needs:
Pygame (should come with Raspbian). (sudo apt-get install pygame)
Lady Ada's Python codes for an array of I2C sensors:
Adafruit I2C library (git)
Access your Raspberry Pi from iDevice web based GUI:
PiUi (git)
Control serial devices:
pySerial (sudo apt-get install python3-serial)
Arduino IDE on Pi
WinSCP
Make an I2c Optoisolator
I2c Between Pi and Arduino
Once you have the board setup, you can run:
$sudo i2cdetect -y -a 1
This should bring up a list of active I2C registers. You should find your Arduino at whatever address you set in your Arduino code.
I2c
Tie It Up
So in theory, you can skip the optoisolator all together. But that's you, I'll stick with my optoisolation.
15. Download my code--or someone cooler's.
UPDATE: 8-12-13: User Buckleybw has let me know the code I put together is unstable. It'll run for 7-8 minutes before giving an error on Pi (Python) side. Poor guy had to troubleshoot it; this has been confirmed by another builder. As soon as time permits I'll troubleshoot the i2c code. Of course, this can all be done over a serial connection :)
Note, my code is really just the base for a robot. Right now, my it is nothing more than a very, very complex radio controller for a RC car. But someday, I'll make a real robot :)
16. Tweak and gut the code as you see fit.
17. Ask questions: Pretty much everyone on this site is smarter than me, they'll know the answer.
Some other stuff I've done with this platform--
Battery Powered USB Hub
OpenCV on the Pi
(The bot)