Raspberry PI based ROV

Anything to do with the Raspberry Pi
Post Reply
User avatar
Moki
Posts: 119
Joined: Oct 21st, 2014, 2:19 am
Location: The Netherlands

Raspberry PI based ROV

Post by Moki »

Project: Raspberry PI based ROV.

Description:
This project will make it possible to control a Raspberry PI based ROV from your web browser.

Hardware:
- Raspberry PI (Model B+)
- 2x 5V/7A UBEC 2-8S input (converts 5v-33v to 5V for PI and Servo board)
- Adafruit 16-Channel 12-bit PWM/Servo Driver - I2C interface - PCA9685 (http://www.adafruit.com/product/815)
Supports: Relay's, Servo's and LED's
- Depth/temp sensor (MS5803-14BA, http://store.openrov.com/products/openr ... pth-module)
- 9-axis IMU (MPU-9150, http://store.openrov.com/products/openr ... pth-module)
- USB Webcam / PI Camera (as long as it works with mjpg-streamer)

Software:
https://github.com/Moki38/Moki-ROV.git

If you require the use of I2C, please make sure your PI is configured correctly for this. See (https://learn.adafruit.com/adafruits-ra ... guring-i2c) if you need help with this.

ROV-PI requires a recent nodejs (built and tested with node > 0.10) (http://elinux.org/Node.js_on_RPi) as well as npm and bower for dependency management.

On your I2C en Node.js enabled Raspberry PI, use "git clone https://github.com/Moki38/Moki-ROV.git" to get the software.
Run it using "node server.js"

On your web browser, connect to http://<YOUR_PI_IP>:3000
Last edited by Moki on Feb 9th, 2015, 11:25 am, edited 3 times in total.
User avatar
Moki
Posts: 119
Joined: Oct 21st, 2014, 2:19 am
Location: The Netherlands

Re: Raspberry PI based ROV

Post by Moki »

Just a small preview of the screen layout. (Webscreen, using node.js)
Attachments
Naamloos.png
Naamloos.png (81.4 KiB) Viewed 19294 times
rossrov
Posts: 383
Joined: Feb 28th, 2013, 5:01 pm
Location: Australia

Re: Raspberry PI based ROV

Post by rossrov »

Hi Moki. The Raspberry Pi and webcam(s) is certainly a more compact and cheaper approach hardware-wise than what I am doing with an EtherTen (effectively a Uno and Ethernet shield combined), IP cam and a network switch. I know that the Pi lacks analog inputs, and apparently interrupts or timing is not as accurate as an Arduino. Attaching an A to D chip is simple enough though, SPI or I2C.
Fryslan76 mentioned a while back that the Model B Pi was better than the Model A regarding video latency. Personally I have had no experience with the Pi, and know very little about it other than just mentioned.
A quick look at what you have posted suggests that the page to be served is uploaded to the Pi? Is it easy to do on-the-fly edits, and how? With the Arduino the SD card had to be removed, written to and reinserted to edit. I was originally using a page stored locally on the PC to get around this, but then had cross-domain security issues (different addresses of PC and Arduino, even with I-Frames).
So with the GUI page and camera being on the Pi, same address, what benefits does node.JS give over plain JavaScript?

Cheers,

Ross
User avatar
Moki
Posts: 119
Joined: Oct 21st, 2014, 2:19 am
Location: The Netherlands

Re: Raspberry PI based ROV

Post by Moki »

The reason for going for the Raspberry PI, is that I am more of a CLI guy, than a soldering guy.
Its the old controller VS processor argument, I guess.
Yes, the PI isn't real-time... but close enough, to do the job.

From what I understand, is that the USB WEBCAM is doing most of the encoding work already. Using mjpg-streamer, we just pull the data from the USB device and put it on the network. That way, I guess, a single video stream only uses about 10-15% CPU power of the RASPI.
So we don't use the (RAM) filesystem at all, we don't store anything local on the PI.
The idea is that anything you want with the videostream, you do it from the web browser side.

I am not sure I understand the question, Node.js = JavaScript, right?
rossrov
Posts: 383
Joined: Feb 28th, 2013, 5:01 pm
Location: Australia

Re: Raspberry PI based ROV

Post by rossrov »

Thanks. I just Googled "node.js" and I can now see that it allows Javascript to be run on the server side... I guess what I really wanted to know was about the GUI you showed in the above post. The webpage that creates the GUI in the browser is stored on the Pi? So what procedure is used to edit that file. Do you use command line to open the HTML file and edit, then just "re-boot" the Pi? If so, I may end up getting a Pi and webcam :o :), and keep a simple Arduino to do the I/O.
User avatar
Moki
Posts: 119
Joined: Oct 21st, 2014, 2:19 am
Location: The Netherlands

Re: Raspberry PI based ROV

Post by Moki »

rossrov wrote:Thanks. I just Googled "node.js" and I can now see that it allows Javascript to be run on the server side... I guess what I really wanted to know was about the GUI you showed in the above post. The webpage that creates the GUI in the browser is stored on the Pi? So what procedure is used to edit that file. Do you use command line to open the HTML file and edit, then just "re-boot" the Pi? If so, I may end up getting a Pi and webcam :o :), and keep a simple Arduino to do the I/O.
Technically, you are right... just edit and restart.

Ofcourse on the Pi, you log in (using ssh/putty) stop the "node" program, edit the Node/JavaScript program and restart the "node" program.
It would look something like this:

Code: Select all

/root/rov-pi> pkill -9 node
/root/rov-pi> vi server.js
(vi is a unix text editor, if you have no unix skills... try using "nano" instead.)
/root/rov-pi> node server.js 
Server is running. (connect using http://192.168.1.30:5000 in your webbrowser)
The way I see it:
JavaScript is a programming language to dynamically create the needed HTML.
Node.js (or node for short) is a special webserver, that runs the JavaScript.

In my example, server.js is the JavaScript program, that is run/executed by "node"
Last edited by Moki on Nov 9th, 2014, 3:01 am, edited 2 times in total.
User avatar
Moki
Posts: 119
Joined: Oct 21st, 2014, 2:19 am
Location: The Netherlands

Re: Raspberry PI based ROV

Post by Moki »

rossrov wrote:... keep a simple Arduino to do the I/O.
Can you explain to me, why you would need/choice the Arduino for the I/O?

The Raspberry Pi, has an I2C bus. Connect all the I/O boards you need that way, keeps things simple, only 1 hardware platform to manage. (for me at least, as i have no Arduino skills/exp).
User avatar
Moki
Posts: 119
Joined: Oct 21st, 2014, 2:19 am
Location: The Netherlands

Re: Raspberry PI based ROV

Post by Moki »

The Video capture part is also taken care of (for now :D )

Found this free/opensource software package, called: CamStudio (http://sourceforge.net/projects/camstudio)
It allows you to capture, your screen,window or a boxed area on your PC screen.
rossrov
Posts: 383
Joined: Feb 28th, 2013, 5:01 pm
Location: Australia

Re: Raspberry PI based ROV

Post by rossrov »

That helps, thanks. A good thread too. Saved alot of Googling or actually buying a Pi and investing some time. The Pi may have been a better path than the Arduino considering that my ROV project has remained network-based. As you may have guessed I'm better with hardware/microcontrollers than operating systems, and this has put me off the Pi so far.
The reason to include the Arduino (as an I2C slave) is that it can do the A to D sampling at a fixed rate, and fast enough, important for one aspect of the project. At the same time it can generate the PWM. If not for the A to D timing requirements, then certainly using hardware A to D and PWM boards would be much better. Yes, messy having two completely different computer systems and programming environments to deal with.
User avatar
Moki
Posts: 119
Joined: Oct 21st, 2014, 2:19 am
Location: The Netherlands

Re: Raspberry PI based ROV

Post by Moki »

Rossrov, sounds like a great project yer having... be sure to keep us posted on it.

For me... I upgraded the software modules to the latest and greatest versions.... and something broke :roll:
Nothing major (I hope) just needs a little tweaking and tinkering.

When I got something that looks nice and stable, ill post the code on GitHub.
Post Reply