Here's the wiring diagram showing how to wire up the Arduino and Raspberry Pi (powered by a uBEC of your choice). It's missing ethernet and the webcamera (along with any sensors of your choice), but those are easy to figure out where to plug in. The webcamera plugs into the Raspberry Pi's second USB port (the Arduino is in the first one). The ethernet might need to go to a small networking hub, but both the Arduino and the Raspberry Pi should be plugged into the ethernet. Unlike OpenROV, which uses the BeagleBone as the only attachment point for the network which then forwards the command packets to the Arduino over serial, the Raspberry Pi in this setup doesn't act as a forwarder. Instead, the Arduino gets the packets directly from Monterey. The Raspberry Pi is there to forward the webcamera video, allow for remote Arduino firmware flashing, etc. It is also used to power the Arduino, but that could also be done using the uBEC and the Arduino's VIN pin.
Thanks for stopping by!
Chris Konstad
A blog with updates and information regarding my many Qt, Android and Arduino projects.
Showing posts with label arduino. Show all posts
Showing posts with label arduino. Show all posts
Monday, July 15, 2013
ROV-Suite: OpenROV Compatible Bottomside
Labels:
arduino,
cpp,
documentation,
electronics,
monterey,
raspberrypi,
rov,
rov-suite
Sunday, October 7, 2012
[Tutorial] Bash Script for Arduino Uploader
Following the recent tutorial I wrote about flashing an Arduino hex file remotely using a Raspberry Pi, I wrote a bash script to automate the process. To use this function, just copy the highlighted code to your .bash_profile or .bashrc file in your home directory. With this function, you can just type arduinoupload path/to/my/file.hex in the command line and it will take care of the rest (assuming that you are trying to flash an Arduino Duemilanove using the "pi" user on the Raspberry Pi at IP 192.168.2.16 AND that you have already setup an SSH public key between the two). If you don't set up the SSH keys, you will be prompted to enter your password. You can tweak the function to adjust it to your setup, or you can rewrite it to make it more flexible. I chose to hardcode these values because my setup (IP, user, Arduino model) never changes.
This is just an interesting little bash script that somebody may be able to make use of. If you want any explanations regarding the script, you can either ask me in the comments or use Google (I'm new to bash so it probably will be more helpful that I will be).
Thanks for stopping by!
Chris Konstad
This is just an interesting little bash script that somebody may be able to make use of. If you want any explanations regarding the script, you can either ask me in the comments or use Google (I'm new to bash so it probably will be more helpful that I will be).
Thanks for stopping by!
Chris Konstad
Saturday, September 29, 2012
[Tutorial]Upload Arduino Sketches Using RPi
I just figured out how to do something really cool: upload sketches compiled on my laptop to my Arduino over my local network by using my Raspberry Pi.
It's pretty simple, really, but the uses are endless. The most immediate use for me is that I could have a RPi onboard my ROV and I could flash new Arduino software to my ROV without having to turn it off or open it up. That alone would save my robotics team a lot of time!
Here's a quick little tutorial on how to do this.
Step 0: Install AVRDUDE on Your RPi
This step is very simple. Connect your RPi to the interent and type sudo apt-get install avrdude. That will install all of the necessary packages (assuming SSH is already installed and enabled).
Step 1: Write and Compile Your Code
Write your code as normal and compile it as normal using the Arduino IDE. The only catch here is that you'll want to go into settings and turn on the verbose mode for compilation so that you can find the hex file that the avr-gcc makes. It moves around each time, just FYI. The highlighted line (also the second to last line) is the path to the hex file.
Step 2: Copy the Hex File onto the RPi
This step should be pretty simple for any SSH familiar users. Just use the scp fileToCopy user@hostname:/fileToCopyTo command. In the screenshot above, you can see that I copied over two different hex files. Remember where you copied the hex file to!
Step 3: Burn the Hex File
First off, you'll need to SSH into your RPi. Just type ssh user@hostname into your command line. It'll ask you for user's password, so enter that. If you need help SSHing, you can find some awesome tutorials for your OS by using Google. Once you're in, you can burn the hex file using avrdude. For my Arduino Duemilanove, I know that it is in /dev/ttyUSB0. You can find out which USB port your Arduino is under by typing ls /dev/tty* before plugging in your Arduino and then again afterwards. Compare the results to find out the name of your Arduino. Keep in mind that it should always stay the same unless you plug in another Arduino. Now for burning the software. The command for the Arduino Duemilanove is avrdude -b 57600 -p m328p -c arduino -P /dev/ttyUSB0 -U flash:w:fileToBurn -v. That "v" is there for verbose output. Let's break down that command.
avrdude: the application being called
-b 57600: sets the baud rate to 57600, which is what the Arduino Duemilanove
-p m328p: sets the part number of the processor (the atmega328p in this case)
-c arduino: sets the programmer type to "arduino" (which should be used for ALL "normal" Arduino software flashing)
-P /dev/ttyUSB0: this sets the port
-U flash:w:fileToBurn: this tells avrdude to "perform a memory operation" that involves the writing of the specified file to the flash memory of the microprocessor
-v: verbose output
And that's all there is to it!
Enjoy!
Chris Konstad
It's pretty simple, really, but the uses are endless. The most immediate use for me is that I could have a RPi onboard my ROV and I could flash new Arduino software to my ROV without having to turn it off or open it up. That alone would save my robotics team a lot of time!
Here's a quick little tutorial on how to do this.
Step 0: Install AVRDUDE on Your RPi
This step is very simple. Connect your RPi to the interent and type sudo apt-get install avrdude. That will install all of the necessary packages (assuming SSH is already installed and enabled).
Step 1: Write and Compile Your Code
Write your code as normal and compile it as normal using the Arduino IDE. The only catch here is that you'll want to go into settings and turn on the verbose mode for compilation so that you can find the hex file that the avr-gcc makes. It moves around each time, just FYI. The highlighted line (also the second to last line) is the path to the hex file.
Step 2: Copy the Hex File onto the RPi
This step should be pretty simple for any SSH familiar users. Just use the scp fileToCopy user@hostname:/fileToCopyTo command. In the screenshot above, you can see that I copied over two different hex files. Remember where you copied the hex file to!
Step 3: Burn the Hex File
First off, you'll need to SSH into your RPi. Just type ssh user@hostname into your command line. It'll ask you for user's password, so enter that. If you need help SSHing, you can find some awesome tutorials for your OS by using Google. Once you're in, you can burn the hex file using avrdude. For my Arduino Duemilanove, I know that it is in /dev/ttyUSB0. You can find out which USB port your Arduino is under by typing ls /dev/tty* before plugging in your Arduino and then again afterwards. Compare the results to find out the name of your Arduino. Keep in mind that it should always stay the same unless you plug in another Arduino. Now for burning the software. The command for the Arduino Duemilanove is avrdude -b 57600 -p m328p -c arduino -P /dev/ttyUSB0 -U flash:w:fileToBurn -v. That "v" is there for verbose output. Let's break down that command.
avrdude: the application being called
-b 57600: sets the baud rate to 57600, which is what the Arduino Duemilanove
-p m328p: sets the part number of the processor (the atmega328p in this case)
-c arduino: sets the programmer type to "arduino" (which should be used for ALL "normal" Arduino software flashing)
-P /dev/ttyUSB0: this sets the port
-U flash:w:fileToBurn: this tells avrdude to "perform a memory operation" that involves the writing of the specified file to the flash memory of the microprocessor
-v: verbose output
And that's all there is to it!
Enjoy!
Chris Konstad
Monday, July 16, 2012
ROV-Suite: Bottomside 1.1.0 Released
Great news! I just uploaded the first revision of ROV-Suite's bottomside code to the repo and to the downloads page. This new version supports a depth sensor, a voltage sensor and a digital compass. Please note that while the libraries have been used (my robotics team used those very libraries to get 3rd place in the MATE ROV competition) and tested, the entire setup has not been tested yet. Since it is late here tonight, I'll do some bench top testing tomorrow.
Here's the setup:
Compass (HMC6352) hooked up to the Arduino's A4 and A5 (I2C) pins.
Voltage sensor (Phidgets P1135) hooked up to the Arduino's A1 analog input pin
Depth sensor* (Phidgets P1115) hooked up to the Arduino's A2 analog input pin
Now the depth sensor's setup is a little tricky at first, but it is really robust in practice. In fact, in our testing, we found that the library was accurate to within a centimeter! Since the P1115 is really just an air pressure sensor, you must use the water to compress a volume of air that must then compress the pressure sensor.

The flexible diaphragm is pushed inwards (towards the P1115) as the water pressure increases. That causes the volume of air inside the sealed container to decrease, and since the container is sealed, the pressure then increases. From there, the P1115 reads the absolute air pressure inside the sealed container and converts that to a depth reading. I will admit, this is not my design. A mentor on the team, Jay Isaacs, came up with it. The only downfall of this setup is the maximum depth of the pressure sensor (as it can only have 36 PSI atmospheric on it, only 21.3 PSI of water pressure can be applied before it exceeds it's maximum pressure rating). According to some calculations with the help of Engineering Tool Box, it's maximum depth is 49.2 feet of water.
I hope to test out this code more fully soon so that I can catch any bugs it's hiding.
Thanks for stopping by!
Chris Konstad
Monday, June 11, 2012
Update: ROV-suite (short)
Hey! I'm super tired right now, so this post will be pretty short even though it covers some good material. I'll go more in depth into these topics at a later date. First, check out the latest screenshot of Monterey! Like the new compass? It's my first time embedding a QML widget in a QWidget application. I personally like it, although the ring around the compass has a few rough spots that I need to (and will) take care of soon. Nothing a little Pixelmator can't handle.
Also, Monterey is now multithreaded! Yay!!! You'll see a smoother, more responsive UI now on systems with a slower clock speed but with multiple cores. Granted, Monterey currently doesn't take up *that* much power, but who knows how intensive it'll be in the future. Monterey is admittedly my playground for learning about new technologies and new techniques.
If you haven't checked out OpenROV, check it out! It's a pretty awesome open source (hardware and software) ROV project. I'm working on making an Arduino binary that can act as a bottomside software for Monterey that is compatible with the current OpenROV setup. That way, if you get that hardware, you can still use ROV-suite.
A friend of mine, Nick Sopwith, who is a whiz at electronics (although I will have to take some credit for helping teach him some C++), has recently taught me how to etch my own circuit boards in my garage using a laserjet printer, an iron and some ferric chloride. He and I have a few surprises up our sleeves for our robotics team's ROV next year (he's a year younger than me and he's on the team). Can you say Arduino Mega 2560 Ethernet plus lockable breakouts for sensors, ESCs and more? With a built in digital video switcher? And some IP addressable cameras? It'll be fun stuff! Speaking of robotics, when this current season is over, I'm gonna post some articles about the awesome control application that I've been working on for the team. It's just about 5,000 lines of code and can help the ROV pilot itself. I won't open source it (the code is kinda messy because I wrote the foundation code before learning much about how to split up my code into classes), but it has some interesting features and though processes behind it.
Woah.... I just realized that I still have features to add to Monterey before I can feel comfortable removing the "beta" tag. That's after heavy testing, of course! I need to link it better with Tahoe and just make sure it is polished. I need to add more information to the debug tab as well. I'm thinking having a grid of squares and progress bars that show motor value percentages, servo percentages and relay states. Maybe I'll even through in a QVectorDecoder widget so that you can try your hand at coming up with a vector drive formula and be able to test it entirely within Monterey's UI.
Finally, I'd like to welcome my friend, Nick Sopwith, to the ROV-suite crew! Like I said earlier, he is quite talented with electronics (custom PCBs, homemade Arduinos, etc), so he will be able to help us develop an entire control system based on ROV-suite's software and his circuitry! Welcome aboard, Nick!
Thanks for stopping by,
Chris K
P.S. I'll post some pictures of our PCB etching and describe the process in more depth at a later date.
Tuesday, February 21, 2012
Serial COM Between Arduino and Android
If you're looking for a serial monitor application for Android that lets your tablet (or phone) talk to an Arduino, check out Slick USB 2 Serial. It can mimic the Arduino IDE's serial monitor, which is helpful for debugging projects that aren't on the benchtop!
Here is it working on my Acer A500 with Honeylicious 3.2.1. The output you see is from my Arduino Duemilanove running the serial ASCII table example sketch. I have also confirmed that this application works on Thor's ICS build v96 for the Acer A500.
Happy serial monitoring!
Chris
Here is it working on my Acer A500 with Honeylicious 3.2.1. The output you see is from my Arduino Duemilanove running the serial ASCII table example sketch. I have also confirmed that this application works on Thor's ICS build v96 for the Acer A500.
Happy serial monitoring!
Chris
Subscribe to:
Posts (Atom)