Control your Ardupilot Mega Rover with your Android Smartphone (II)

Overview

As already indicated in my previous blog Control your Ardupilot Mega Rover with your Android Smartphone I continued to implement more features resulting in the new udpRC4UGV Android(TM) app with a number of rover specific functions. The most important enhancements are the selection of the flight mode and the toggling of channel 7 making a number of APM special functions available.

Description

As outlined in the previous blog a PiKoder/SSC wRX receiver replaces the standard RC receiver in the rover. The smartphone RC uses WLAN for command transmission: the PiKoder does offer an access point (AP) to which the smartphone will connect.

The udpRC4UGV app fashions various usage preferences: a simple button controlled interface, a virtual joystick, and an accelerometer based user interface.

Every user interface offers next to the generic control elements for RC the option for selecting the flight mode. Additionally, channel 7 can be triggered by hitting the CH7 button (thereby e.g. in LEARNING mode storing the current position as a way point for a mission).

The app is available free of charge in the Goggle Play Store. The user manual can be downloaded on the PiKoder webpage – it describes not only the program but also the hardware setup in more detail.

Arduino Pic Programmer

Overview

If you would search the internet you will find quite some DIY pic programmers. However, those designs often either require a true serial or parallel port instead of an easily available USB port or are designed around a pre-programmed controller assuming access to a programmer.

A compelling alternative would be the use of an Arduino as in the ArdPicProg. Load the Arduino sketch, the host program and add a prototype shield with a very limited number of additional components to build your pic programmer. This programmer features also a ICD connector and an RJ-11 jack (ICD2) interface. The complete project including hard- and software is open source and is released under the GNU General Public License Version 3. You can build your own ArdPicProg by using the especially designed PCB.

The complete setup and the application of the ArdPicProg is described in more detail in the User’s Guide.

Host-Software for ArdPicProg

For programming a pic controller a host software would be required. You can select between two options: the terminal program “Ardpicprog” or the “Arduino Pic Programmer” (ArdPicProgHost) with a Windows based graphical user interface. The source code for both programs is Open Source and would be available for download on github.

Arduino Pic Programmer (ArdPicProgHost)

This windows application offers a modern and intuitive way of programming a pic controller. Controllers which are supported by the Arduino Pic programmer can be read, erased, and written. The user interface and the program options are also described in the User’s Guide.

ArdPicProgHost was programmed with Microsoft VB2010 Express and is released under a GNU General Public License Version 3. The source code is provided through a github repository. The executable (Release 0.2.7) can be downloaded here:

 

The software does not require any installation. After downloading and unzipping the program can be executed right away.

PicProgHost (terminal program)

You could also employ the host application “PicProgHost” for programming pic controllers which offers a terminal interface. The application is based on the open source Ardpicprog host software you would find on the ArdpicProg project pages. These pages also provide for a suitable documentation of the program operation.

The original source code has been migrated to a Qt 5 environment and the most recent version is now capable of handling COM ports > 9. The <a href=”download/PicProgHost.zip”>executable for Windows 7</a> can be downloaded here:

 

The source code is available on github. The line commands are fully backwards compatible to Ardpicprog – therefore please refer to the ArdPicProg project pages for more information.

There is no program installation required. The user interface is also described in the User’s Guide.

Sketch “ProgramPic” for Arduino

The “ProgramPic” Sketch which is required for using the Arduino ArdPicProg shield is released under a GNU General Public License Version 3 The sketch is provided through the ProgramPic github repository.

ArdPicProg PCB

The ArdPicProg PCB is available in the store.

Control your Ardupilot Mega Rover with your Android Smartphone

Overview

In the standard setup of the Ardupilot Mega (APM) for Rovers you would deploy a conventional RC for manual control:  the RC receiver feeds the input channels of the APM with PWM signals for Rover movement and for executing special functions such as switching flight modes.

Replacing the RC receiver in this configuration by a PiKoder-Receiver such as the WLAN receiver PiKoder/SSC wRX gives you full control of the Ardupilot using your Android smartphone with the udpRC4UGV app which is available at the Play Store.

Setting up the Rover

Use the Mission Planer to configure your APM with the standard ROVER – configuration; the default settings worked for me perfectly.

The following image shows the straight forward hardware setup.

Connect the PiKoder – channel 1 with the APM input 1 (Steering) and PiKoder – channel 2 with the APM input 3 (Throttle). For the APM output the standard-rover-setup is used. (servo at channel 1, ESC with BEC at channel 3). In this configuration the Ardupilot provides the power for the receiver.

The Ardupilot does not process any PWM-signals outside of the standard range from approx. 1.000 – 2.000 µs. Therefore, you would have to adjust the PiKoder’s min. and max. lengths as shown in the following screen print using the PiKoder Control Center (PCC).

Please refer for more information about connecting and programming your PiKoder to the User’s Manual for the PiKoder/SSC wRX.

This completes the hardware setup. For a detailed description of the app’s user interface please refer to the respective user manual.

Radio control with your webbrowser – improved user interface

A few days ago I found the ESP8266 MikroE Buggy project.

This project implements a web server on the ESP8266 – similar to the setup described in my blog Radio control with your webbrowser. Using this concept, a browser based (and therefore operating system neutral) radio control could be easily made available. In this project, especially the HTML5 based user interface implementing a joystick caught my attention.

The software of this project is open source so that I could make the changes needed to use it in combination with the PiKoder/SSC wRX. Additionally, I adapted the code for controlling a ‘normal’ car or boat (one channel for speed, one channel for direction). The revised source code is provided through a github repository.

The steps for programming the ESP8266 ars described also in the Radio control with your webbrowser blog. Please note, that the ESP8266 MikroE Buggy project deploys the Arduino file system. For the installation and the usage please refer to this page.

Digital servo tester

Overview

This servo tester is designed around a PIC12F675 controller to provide for precise and reliable pulse generation (pulse length: 1 ms – 2 ms). The internal chip oscillator is specified for a 1% frequency tolerance.

Additionally, this servo tester supports voltages from 4.8 V to 6 V covering a broad range of different servos and allowing to use the BEC feature of speed regulators (please make sure to use either BEC or an external power supply to avoid a short). You can configure the polarity of the servo control pulse with a respective jumper.

Finally, this servo tester allows you to use standard servos for a wide range of additional applications such as e.g. controlling pan and tilt cameras.

Schematic

The PIC12F675 controller firmware is controlling the pulse generation and the user interface of the servo tester. The supply voltage of the controller (3.3 V) is generated by a low drop voltage regulator; running the controller at this voltage guarantees the internal oscillator’s precision and allows you to apply the various supply voltages to the tester.

However, this design requires a driver (transistor Q1) in order to adjust the voltage level from the controller’s output pin to the servo’s input. The power itself is directly feed into the servo.

The polarity of the servo control pulse is determined by jumper JP3. Please note that the LED is a bi-color type.

User interface

Using the servo tester is simple and intuitive. The servo tester features two operating modes: Manual-mode, which allows you to control the servo by turning P1 and to move the servo into the neutral position and Exercise-mode, which will make the servo tester move back and forth automatically. You can switch the mode by pushing S1. The build-in LED would indicate which mode the tester is in.

If you turn on the device the tester would be in Manual-mode by default and you can determine the pulse length by turning the pot P1. As long as the pulse length would be shorter than 1.45 ms or longer than 1.55 ms the LED will lit green. In order to easily find the neutral position, the LED color will change to &quot;yellow&quot; meaning that both colors will be visible when you enter the window from 1.45 ms to 1.55 ms. Once the pot is moved to the neutral position of 1.5 ms the LED color will turn to red. This design allows for hands-free neutral position allowing you to easily perform mechanical adjustments and such.

In Exercise-mode you would have two different speeds available. The LED will always blink red and the blinking frequency indicates speed selected: 0,25 s for a cycle from one end to the other is represented by 2 x blinks/s and 15 s for a cycle which would be coded by 2 s on, then 2 s off). You can select the speed by turning the pot P1: if a position in the left half would be selected then then the higher frequency would be selected and a position on the right half of the scale would translate into the lower speed operation.

Software Download

The current servo tester software (release 1.0) can be downloaded below. This firmware is provided as freeware, but only for private, non-commercial use.

Servotester kit and components

In the Store you will find a complete kit, the pcb only and a controller programmed with the latest firmware.

 

Wifi based RC with Arduino

The Arduino based open source digital radio control arduinodtx is build around transparent serial communication. Therefore, a wifi communication module such as an ESP8266-01 can be used in concert with a PiKoder/SSC wRX wifi based receiver to easily build a feature rich radio control.

In addition to the components for the basic setup of the arduinodtx you would need a logic level converter, a dc-dc converter, two jumpers as UART multiplexer and the wifi module as shown in the image above. The wiring of these building blocks is shown below (you would have connect all signals with identical names):

schaltplan-wrx-configuration

The setup is fairly simple and can be easily done on a prototype board. Please note that Arduino signals are shown in blue.

Then you would have to configure the transmitter’s wifi radio to establish a transparent link to your receiver radio – similar to binding a transmitter and receiver in a standard rc environment. This would be done by setting the jumpers as shown above to connect the radio directly to your computer. To avoid any interference from the Arduino it is necessary to upload the “DoNothing”-sketch to your Arduino:

void setup() {
// do nothing…
}

void loop() {
// do nothing…
}

The ESP8266 will be programmed using the standard AT command interface. This requires either your Arduino IDE’s Serial monitor or another terminal application running on your PC. The following description is based on the open source program Tera Term which can be downloaded for free.

You would start by setting up the serial port according to the default parameters of the ESP8266. Select „Setup“, then „Serial port…“ and you would see the following screen:

serial-port-setup

Select the serial port connected to your Arduino and select the “Baud rate” 115200. Then you would have to adjust the terminal setting by selecting „Setup“ followed by „Terminal…“:

terminal-settings

Match the configuration shown above. Now communication can be established. Please initiate a reset and you will see a cryptic message indicating a complete reset:

startup-message

The first step is changing the baud rate to 9600 baud. Please type the command „AT+UART=9600,8,1,0,0“. After hitting “Enter” the ESP would acknowledge command execution with OK:

screenshot029

Since the Baud rate for the port was changed you would have to make the respective change also in your terminal program by going from 115200 to 9600 Baud (see above).

Now you can start to program the radio’s wifi parameter. Since the receiver is offering an access point (ap) you would have to run the transmitter in station mode to log into the receiver’s ap. You would enter “AT+CWMODE=1” to get the right setting.

screenshot031

The next step requires you to enter the network parameters of the ap. The correct command would be “AT+CWJAP=”SSID”+”PASSWORD”” with SSID representing your receiver’s SSID and the respective (optional) PASSWORD. Please note that you have to turn on your PiKoder/SSC wRX receiver to allow the controller to acquire an IP address and connect to the ap – otherwise you will receive error messages similar to the ones shown in the screen print:

screenshot032

The final step will save all parameters and set the transparent mode. Based on the default configuration of the PiKoder/SSC wRX you would enter: “AT+SAVETRANSLINK=1,”192.168.4.255″,12001,”UDP”,12000″.

screenshot033

This completes the programming of the radio. After reconfiguring the jumpers of the UART multiplexer to the right position and resetting the Arduino your transmitter would be completed.

Arduino based XBee radio control

Combine the Arduino based open source digital radio control arduinodtx with an intelligent serial servo controller such as the PiKoder/SSC, an Arduino XBee shield and an XBee module to easily build a feature rich radio control.

The XBee communication link would be setup in transparent mode. Therefore, no changes are required in the Arduino sketch or the PiKoder/SSC firmware. The complete feature set of the radio control would be available.

The setup of the transmitter including the jumper configuration is shown below – for details regarding the wiring please refer to the arduinodtx webpage.

xbee-digital-rc_404p

The configuration of the receiver comprised of an XBee breakout adapter, the PiKoder/SSC board and a dc-dc converter to generate the 3,3 Volt required by the receiver is shown below. For more details – including the programming of the XBee modules – please refer to the PiKoder/SSC Application Note #3: XBee Communication.

complete-receiver-unit

Receiver module prototype

Radio control with your webbrowser

If your rc model would offer an access point and run a webserver, then you could control your model with a webbrowser running on your smartphone – no matter whether this is a Windows or Android device or an iPhone.

The PiKoder/SSC wRX (see below) is well suited as a hardware platform for this concept: the ESP8266-01 offers the access point and runs the webserver, the PiKoder/SSC manages all realtime aspects of controlling the servos and the electronic speed control.

pikoder_ssc_wrx-catalogue-image-png

PiKoder/SSC wRX

The standard configuration of the PiKoder/SSC wRX requires the ESP8266-01 to act as a transparent bridge. Since we will be needing a webserver, we would have to flash this wifi controller with a new firmware. This can be easily accomplished by using the latest Arduino IDE which is supporting generic ESP8266 modules.

The new controller firmware is open source and would be available through the github repository makerprojects/httpRC. After downloading open the sketch in the Arduino IDE. At the beginning of the source code you will find the settings recommended for compiling the program.

In order to flash the ESP8266-01 you will need an USB-Serial converter, since the wifi module does not feature a USB port. Please keep in mind also, that the ESP8266 requires a supply voltage of 3,3 Volts – the board is not 5 V tolerant! The offering of USB-Serial converter offering a 3,3 Volt supply as well as 3,3 Volt signal level is limited; therefore it might be easier to use a converter with 5 V supply and 3,3 V signal level such as the PL2303TA readily available at ebay (shown below) and build your own converter from 5 V to 3,3 V.

bild-9-usb-connector-ebay

USB-Serial converter

Since you would need a “reset” and “program” button for flashing the module you might consider to construct the little adapter shown below using a prototype board.

programmieradapter-esp8266

Programming adapter for the ESP8266-01

The schematic for the programming is shown below.

esp8266_flash_prog_board_sch

The conversion of the 5 V provided by the USB-Serial adapter to 3,3 V follows the design of the PiKoder/SSC wRX and requires a standard low drop voltage controller LF 33 CV (please refer to the following excerpt of the PiKoder/SSC wRX schematic; the 5 V input would be to the left, the output is to the right).

spannungsanpassung

Unfortunately the flashing of the ESP8266 does not start automatically as you might be used to when downloading a program into your Arduino but has to be initiated manually. You would push the RST and PROG button simultaneously and release the RST button while still holding the PROG button. After releasing the PROG button, the module would be in flash mode. Now you would start uploading the program. Once the upload is complete your controller would require another reset prior to being operational.