PTHAT RC Transmitter Mecanum Bot Example using Instant Commands

For this project, we want to add a few parts to the Mecanum Bot and also expand a little more on the design and the workings of it.

After playing around for a few days with our Mecanum Bot, we decided that control over Wifi was a little restricted if we wanted our Bot to roam further a field and also reduce the amount of signal drop outs we were seeing.

So we started to look into RC transmitter and receivers and chose the Turnigy TGY-i6S Transmitter than came with a TGY-iA6B 6 channel receiver that gave PWM out on 6 individual channels.

The thing with RC receivers is that they do not simply give you a On or Off signal for each channel. They give out a PWM signal for each channel. This allows small servos usually found in RC airplanes, boats, cars etc to be easily controlled with minimum wiring as the standards are all in place.

There is also PPM receivers that put all six pulses on one channel, but we will focus on the dedicated six channel receiver that has one PWM for each channel.

 

The PWM signal is typically a pulse train running at a frequency of 50hz (50 pulses a second) and a pulse width of between 1-2 ms.

So for example a joystick would have a channel for each direction. When the joystick is in the center position it will give out a pulse width of 1.5ms, when it is fully pushed up it would give a pulse width of 2ms and fully down, a pulse width of 1ms. Between these points it will give linear range.

Now we probably could of got the Raspberry Pi to monitor these pulses and do the pulse width calculations of each channel, but we were not confident in the accuracy due to it already doing a lot of other things and also the GPIO pins on the Raspberry Pi are not 5 volt tolerant. So with this in mind we opted to get a cheap ARM module that could easily calculate the pulse width on each channel and also that had 5 volt tolerant pins.

We went for the STM32F103 minimum development board, that can be picked up on ebay and other places.

We can also supply one of these development boards already programmed with the RC Receiver code if needed.

As with all of the ARM STM32 family, the STM32F103 has loads of features, many of which we will not use. But hey it is low cost and does the job.

The USB port is configured as a HID device and is plug and play as far as Windows 10 IOT is concerned and no additional drivers are needed.

We thought it would be nice to get the exact reading of each channel, rather than just deciding if it was going to be a On or Off movement as we could then use the output for also varying the speed of the motors.

We opted to use the PA1-PA6 ports on the STM32F103 board as they are laid out next to each other and it means we can use a simple six wire connection loom straight over to the receiver for the Pulse Width readings.

Also we have 6 other pins that act as simple on/off switches, we can use of these for a keep alive that is connected to the PTHAT Emergency Stop input. These pin mappings are:

Channel1-PB14, Channel2-PB15 Channel3-PB5 Channel4-PB6 Channel5-PB7 Channel6-PB8

If any of these channels go over 155 reading then they take the Pin high.

For our keep alive signal, we are going to use Channel 6 which is controlled by a switch on the transmitter. When switched on it reads 200 and when off it reads 100. This means we can trigger the Emergency Stop using this switch, or if it looses signal.

We pull 5 volts and 0 volts from a 24V-5V regulator for the receiver and connect the Raspberry Pi via the USB port to the STM32F103 board.

Here is a picture of the wiring:

The example application was developed in Visual Studio 2015 that can be used with Windows 10 IOT on the Raspberry Pi or compiled to x86/x64 for use on a PC.

It has been written in C# as a Universal Windows Platform (UWP).

I ran it up on the desktop to get a screen shot for now, and hence why it does not show the Raspberrry Pi serial port or the USB STM32F103 board.

We had a choice of running the software on the Raspberry Pi and then using the remote client to access it over WiFi and set certain parameters. But we decided to add a 10″ universal LCD with HDMI interface and capacitive multi-touch input so we could do everything next to the machine. It also allowed up to have a bit of fun displaying animations that synced with the controller.

We have used two 12V batteries wired in series to give us 24 volts to supply the motors.

Also there are two regulators for taking the 24 volts down to 5 volts. One supplies the Raspberry Pi and the other for the 10″ Touch Screen and RC receiver.

We also have a voltage digital display, so we know when the batteries are getting low on charge.

Instant Commands used in this example are:

Set Axis Command

Start Axis Command

Stop Axis Command

Change Axis Speed on the fly Command

Enable/Disable Limit Switches Command

Toggle Motor Enable Line

Request Firmware Version

Reset PTHAT

The end developer has easily modify this example to build their own application.

The example application was developed in Visual Studio 2015 that can be used with Windows 10 IOT on the Raspberry Pi or compiled to x86/x64 for use on a PC.
The example has been written in C# as a Universal Windows Platform (UWP).

Please use the following link to download the full source code.

Closer look at the PCB's