Whenever I create a project for Pi, mostly remote controlled devices, I always find difficult to control it with the existing interfaces provided by Windows IoT. Since WIoT runs as headless application the only way to see the application running is by using WIoT client running in windows. This limits the access to the running application. While we can write UWP applications that can run on various devices, it is additional step and also not a trivial task. Earlier for my projects I used Azure cloud for sending messages using AMQP for controlling the device. Check this project Remote Internet Controlled 3 Speed Transmission for details.
To make application portable and also work on single interface, I needed to run the remote controller using simple web interface. This will make it compatible to run across all platforms
This program forms the base for controlling pi. By running a simple webserver on Pi, we can send data to the web server from any device through HTML. The Web Server will listen to input on a particular port. The server will run as a service and provides a web page containing all the controls. The webpage is kept isolated from core programming. Thus it is possible to change the input controls by modifying the web page, without having to tinkle around with the core programming. The Web Server can also provide feedback from Navigator application to the Web client which is also incorporated with the HTML Text.
Salient features of Navigator:
Navigator project utilises many features of Raspberry Pi and Windows IoT.
1. Webservice: using a unique listening port for this Service, it will pass the commands received from a Web client to Navigator. The Service will host the page for Web client and will also provide feedback (albeit delayed) to the Web client.
2. I2C Communication: Inter Integrated circuit (I2C) available in Raspberry pi is used to communicate with a Honewell 5883L digital compass providing the direction Navigator is heading.
3. Serial Port: Utilising the Serial Port of Pi to communicate with the UBlox Neo-6M GPS Module to provide GPS co-ordinates and speed
4. PWM Control: Pi has a built in circuits to provide Pulse Width Modulation (PWM). Navigator uses this feature to control the speed of Motor. TI’s L293D quadruple half bridge IC is used as Motor Driver.
5. GPIO Pins: Since we need the Navigator to move forward and reverse, GPIO pins are used to dictate the direction of Motor. The L293D half bridge is used in full bridge configuration to facilitate this, thus avoiding requirement for dual supplies to motor.
The simplicity of the program is the Remote Control Web Page is written with pure HTML5, CSS3 and Jquery. It also provides adequate controls that Pi device can use. The project exploits various resources available in Raspberry pi thus forming a good educational kit for learning.
Building the project:
The hardware used for this project is Raspberry Pi 3 (RPI3) with Windows 10 IoT running. The Navigator itself is constructed from parts of the Lego Mindstorm. The motors used is also from Lego and hence to drive the Motor L293 bridge is used. The integrated GPS & Compass Module can be obtained from web, available as HAT (Hardware Attached on Top) for RPI3
Developing and programming environment is Visual Studio 2015 Community edition using visual C#. There are two applications, WebService and Navigator. There are also two basic HTML files aptly named Header and Body. For Style sheet, there is also a CSS file.
Creating WebService (Part I):
Because a webserver only needs to run in the background, without any display, we will create with a simple background application. In VS2005, we will first create a Blank solution and call it “RemoteNavi”.
Next in “Solution Explorer” right click on “RemoteNavi” solution and then select “Add / New Project”. Select “Windows IoT Core” under “Visual C# \Windows” Template. Then select Background Application (IoT). Name the application as WebService.
Read More: Remote Controlled Navigator