Reputation: 1002
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?
Upvotes: 4
Views: 6178
Reputation: 10961
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.
Upvotes: 1
Reputation: 4219
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.
Upvotes: 3
Reputation: 1002
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.
Upvotes: 1
Reputation: 18517
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.
Upvotes: 2