4

I would like to control a small robot based on arduino and an IP camera from a PC via WIFI, but I have been browsing the internet for quite a while now and I am still not sure how to set it up.

I thought of having on the robot a WIFI router such as this one, linked via ethernet to an arduino which will control the motors, and also linked via WIFI to an IP motorised camera next to it (I couldn't find such a small router with several ports). I would connect my laptop to the network broadcasted by this router (I can't use my school's network) to send commands to either the camera or the arduino, and retrieve the video from the camera.

Now, I've looked everywhere but couldn't find how I could interface with the camera from my client application on the laptop (C++/Qt/Windows)? OpenCV sounds apropriate for the live stream but what about its motors?

Kiquenet
  • 14,494
  • 35
  • 148
  • 243
Mister Mystère
  • 952
  • 2
  • 16
  • 39
  • I would be looking ideally for something like a simpler PTZCameraWrapper of PELCO, but I think it's specific to their networks and cameras : http://pdn.pelco.com/content/continuous-panning – Mister Mystère May 01 '13 at 11:15
  • It's not clear what's being asked here. Seems like a cool project, but a lot of it might not be relevant at all to the question. Maybe you should split this up into two questions, one for the networking stuff, and one for controlling the camera. Are looking for a camera with a C++ API, or for an API for the camera you linked? – Andreas Haferburg May 01 '13 at 13:32
  • Thanks for your answer. You're right, I should at least insist on the most delicate aspect: I already have the camera (model linked above), and there is a nice piece of software or even a website to access the camera, but I'd want to have an API to control the camera and retrieve video from it. OpenCV already exists for retrieving the video, but I've got no idea as to how to control the motors... It should be as conventional as retrieving the video, shouldn't it ? – Mister Mystère May 01 '13 at 16:58
  • Deleted as my suggestion was already made below. – user2019047 May 01 '13 at 19:12

4 Answers4

3

The IP camera does not need to be linked with the Arduino software. Sometimes it is better to use the simplest solution to reach a good result. I have done the same on one of my robot and I run the IP camera separately from the Arduino network so I can use all the feature of the camera that has the own app. It is possible to run the robot from a custom made app that launches also the camera app in a separate window within the same application. In this way you can have the motion motors controls and in a window of your app you can host the camera software and make the customer experience unified. Just work on your controls and colors in order to harmonize the layout of the form. You can find more references on how to code it here and here to start.

Community
  • 1
  • 1
FeliceM
  • 4,163
  • 9
  • 48
  • 75
  • That's a good point, and I am actually intending to do that, but from a unified custom-interface. The goal is to control the motors with something else than buttons on a screen, so I had to figure out a way to send the signals myself. – Mister Mystère May 06 '13 at 22:25
  • @MisterMystère, I have elaborated my original answer to give you some reference on how to achieve your target. Look at the the second part of the answer. – FeliceM May 07 '13 at 16:00
  • Thanks, even if I found a way through and because the links are for C# applications, it's still an alternative I hadn't thought of and which I could use later if there's no way around the applications. Plus you are in the early growth of your reputation so I'm glad to award you this bounty :) – Mister Mystère May 07 '13 at 23:03
  • @MisterMystère Thank you!! HIGHLY appreciated. I am a c# person however, the same can be done in c++. Good look. – FeliceM May 08 '13 at 02:29
2

It is not entirely clear what you are trying to do (specifics like range; also is the point is building the hardware or using the hardware), what hardware you already have (e.g. do you already have the robot, etc.), and what your experience level is.

If you are talking mobile robot with camera, I'd suggest taking a look at the Scribbler/Fluke combination (the link is for earlier versions of both - the more recent versions are fuller featured), either for a solution or for ideas and example code you can build off of.

Scribbler/Fluke uses Bluetooth to communicate with a host computer and the Fluke has an onboard camera for imaging. Range is @ 100 meters. Fluke runs a version of linux so it is hackable to handle processing of video and many other operations.

spring
  • 18,009
  • 15
  • 80
  • 160
  • Thank you for your answer. Let me clarify a bit, then: I am trying to communicate via WIFI between a laptop and a PTZ camera (model linked above) through an embedded WIFI router (model linked above). No bluetooth because of the datarate and range (> 100m) involved. The robot is made of several boards (among them, arduino) which are going to be bought soon; I only have the camera for now but that's enough normally. Finally I'm finishing my mechatronics engineering studies, have worked in electronics for a famous car manufacturer and in C++ programming for a national electricity provider. – Mister Mystère May 01 '13 at 16:53
  • As commented above, I am looking for either an API for controlling the motors of the camera (retrieving the video from it seems to be what does OpenCV quite elegantly), or help on how to do it myself. It seems to be based on HTTP protocols and I should maybe mention that I only have notions of it. – Mister Mystère May 01 '13 at 17:02
1

Got it! I sniffed the communication port established with my camera with WireShark (filtered the capture with "HTTP port 99"), and noticed HTTP requests "/decoder_control.cgi?command=0", "/decoder_control.cgi?command=2" etc. After sending them from my browser: "192.168.1.99:99/decoder_control.cgi?command=0" etc., turns out the commands of this IP camera are the same as those at this address, it works like a charm!

That's too bad though that the speed can't be adjusted (it's set up in the settings, maybe I can dynamically change its value by the same means) but that's a start.

Thank you for your help in any case, keep the good work that's by far my favorite professional forum.

Mister Mystère
  • 952
  • 2
  • 16
  • 39
1

I'd use a router that is flashed with OpenWrt as your on-robot comm center. From here you'd be able to directly hookup the IP camera as well as send serial commands to your Arduino to control.

You'd be able to directly hook up to the IP camera stream using OpenCV.

I would also write a small little server that would run as a background service on the router. This server would be responsible for sending out serial commands to the arduino to control the motors of the robot.

All in all this would take several pieces of software: arduino code to interpret serial commands to an H bridge for motor control, a server (python would be easy) to take in tcp packets (or standard web requests) and convert the information over to serial, your gui interface which loads the current image from the IP camera (which it looks like you've already figured out), and a TCP socket connection to the server to do the command and control of the motors.

g19fanatic
  • 10,567
  • 6
  • 33
  • 63
  • Thank you, that's some very valuable advice. This would avoid having an ethernet shield on the arduino, which means less cost (my time's not accounted for in my tight budget). I was more concerned about how to control the camera's motors in practice but it still answers part of my question (I agree it was composed of two) :) – Mister Mystère May 07 '13 at 23:01