ScopeDevelop a remote-controlled Drone with a camera feed. Requirement sparks from the need to investigate in small tight places. This is to help inspect specific environments that might prove difficult to reach without causing break and tear. Control is meant to be conducted through a laptop, mobile or tablet.
- Small flathead screwdriver (small electric testing screw driver will do the trick)
- Glue Gun
- Raspberry PI running the Raspbian OS (Follow NOOBs tutorial for setup )
- Mobile Battery Pack
- 2-Wheel chassis (will be used for prototype purpose but can be switched based on application)
- L298N board (for a 2 DC motor chassis, might be required to swap out if chassis is changed)
- USB WiFi adapter
- Raspberry PI camera (using 5MP standard camera, can be changed in the event of application change)
- LED (using a 3 color LED)
- 9v Battery (connector might be useful but unnecessary)
- Relevant jumper cables to connect it all together
- 5V Battery Pack (To power the Raspberry PI, if Possible identify one with a 2mA current as it will affect the performance of the PI)
- Download Visual Studio 2015 Community Edition
- .Net 4.5 Framework (Usually installed as part of VS2015)
- Download Putty
- Download vnc client (using VNC Viewer 6.0)
- Connect the camera to its designated location on the raspberry pi
- LED has 4 connectors, Left to Right:
- Connect the L298N board: the L298N board is split into 4 sections:
- Section on the left to control the left wheel, using 2 male-to-male jumper cable, connect the top slot on the L298N to the positive slot of the left DC wheel (on the chassis) and the bottom slot to the negative slot of the left DC wheel.
- Section on the right to control the right wheel, using 2 male-to-male jumper cable, connect the top slot on the L298N to the positive slot of the right DC wheel (on the chassis) and the bottom slot to the negative slot of the right DC wheel.
- On the top left slot, there are 4 pins that should be connected to the raspberry pi. The two on the left will control the left wheel, and the 2 on the right will control the right wheel. From Left to Right, connect the Pins in the following order 35, 37, 36, 38.
- On the top right side of the L298N board, there are three slot:
- using a male-to-male jumper cable, connect the right slot to the positive side of the 9V battery
- Using to jumper cables, connect the middle slot to the negative side of the 9V battery using a male-to-male jumper cable and to pin 39 using a male-to-female jumper cable
- leave the right left slot empty (you can potentially connect it to Pin 2 of the Raspberry PI but concern is that it will not be capable of providing the PI with a steady current which in turn will impact the stability of the PI.
- Connect the USB WiFi adapter to one of the USB slots on the raspberry PI
- Using a glue gun, fix everything in place to ensure it stays in place. ensure to fix the camera and the LED in place.
Configuring the Raspberry PI
- Run 'sudo apt-get update' and once completes, 'sudo apt-get upgrade' to ensure all dependencies have been applied
- using 'sudo apt-get install xxx' to install the following components where 'xxx' will be replaced by the component name:
- 'hostapd' to enable the raspberry pi to act like a WiFi hotspot
- 'dhcpd' to allow the pi to issue IP addresses for connectivity
- 'oracle-java8-jdk' to get the latest Java Development Kit (can be replaced with ‘java’ in case of applying the solution)
- 'vncserver' to enable remote desktop to Raspberry PI (Useful to run NetBeans, if using command line compiling, unneccesary)
- Install RPI Webcam (based on reference3)
- setup 'hostapd' and 'dhcpd' based on reference 2
- Download the latest "Netbeans" from 'http://http://netbeans.org/' and extract it. it might be useful to create a shortcut on the desktop.
- Install Visual Studio. Ensure to select Windows Desktop, .NET Framework 4.5 (or the latest) and Web components
- Connect to the Raspberry PI WiFi network you setup, I am using the SID "Drone"
- using putty, connect to the raspberry PI and ensure connectivity (I am using IP '192.168.15.1')
- Run 'vncserver :1' to enable X-Terminal
- using VNC client, connect to the PIs X Terminal using '192.168.15.1:1'
- Now you can directly configure the PI through the GUI interface or the Command Prompt as required.
ConnectionConnection to the Drone will be connected through WiFi as it:
- Helps with the distance that can be covered in contrast to bluetooth and infrared,
- In addition, with WiFi, we can configure a Wireless LAN that is hosted from the PI which would simplify the development of a TCP/IP application,
- Tutorials are readily available
- Both Java and .NET cover it as part of their standard Framework.
- Messages can be passed between client and server in ASCII format
Writing the Raspberry PI code (Server)
StartSetup TCP Listener
Listen: Establish Connection
Case to received command
Light: Toggle Light 'On' or 'Off'
Forward: Move Forward by setting pins 35 and 36 to true for 0.5 Secs
Backward: Move Backward by Setting pins 37 and 38 to true for 0.25 Secs
Left: In-Spot turn Left by switching pins 35 and 38 to true for 0.10 secs
Right: In-Spot turn Right by switching pins 36 and 37 to true for 0.10 secs
Default: Do nothing
Writing the Client Code
StartMainFrame: Execute Command
Connect to Server on Listening Port
Case to selected command
Light: Send Light Command to Server
Forward: Send Move Forward to Server
Backward: Send Move Backward to Server
Left: Send Turn Left to Server
Right: Send Turn Right to Server
Default: Do nothing
Camera FeedOn Server: Modify main page of web page on PI to only display the webcam picture (continuously refreshed picture). This can be identified by going through the PHP page as downloaded by the RPI webcam solution and clearing everything that is not related to the <div> for the camera shot. Your new PHP file should be reduced to fit in a page or slightly over.
On Client: Using a web control, point the URI to the webcam page on the PI (can test URI using any browser)
CloseAfter Closure, what was developed was a base product of a remote controlled drone with a camera feed. The idea is to be able to investigate locations that are difficult to reach. Based on the applications (highlighted below), the drone can be customized further to be built for a specific need. The above details the implementation which covers details of the development of the base product. A good step forward might be to try to deploy it as a live solution and omitting out all development steps.
- Installing Raspbian with NOOBS (19-Dec-2016)
- Setting Up a Raspberry Pi as a WiFi Access Point (19-Dec-2016)
- RPI-Webcam-Interface (24-Nov-2016)