I hope you are already aware of the basics of the RC communication and Hardware connection with the Arduino. If you are not, then just have a quick look at the previous blog in the series… 🙂

After looking into the problems of the polling method, The second method to interface the RC is Interrupt method. Well, as you know there are only two external hardware interrupts available in Arduino boards like Uno, Dueminalove etc.. (Ofcourse, Due is an exception 😛 ). For further clarification on this topic, click for Interrupts. I am taking Arduino Uno as a typical example here.

For interfacing all the six channels of RC you need 4 more interrupts. What can we do. Obviously we have to go for the software interrupts.

Here comes the PinChangeInterrupt for the rescue…

What are Pin Change interrupts? The ATmega processor has two different kinds of interrupts: “external”, and “pin change”. There are only two external hardware interrupt pins, INT0 and INT1, and they are mapped to Arduino pins 2 and 3. These interrupts can be set to trigger on RISING or FALLING signal edges, or on low level. Being hardware interrupts, they are very fast.

On the other hand the pin change interrupts can be enabled on any or all of the Arduino’s signal pins (Uno/Duemilanove/Nano). They are triggered equally on RISING or FALLING signal edges, so it is up to the interrupt code to set the proper pins to receive interrupts, to determine what happened (which pin? …did the signal rise, or fall?), and to handle it properly. Furthermore, the pin change interrupts are grouped into 3 “port”s on the MCU, so there are only 3 interrupt vectors (subroutines) for the entire body of 20 pins. This makes the job of resolving the action on a single interrupt even more complicated. The interrupt routine should be fast, but more the complication, lesser is the speed. The PinChangeInt library is designed to handle the Arduino’s pin change interrupts as quickly and reasonably as possible.

Well, how can you use it?? This is just a little finger’s work (literally :P)

The HK-T6A V2 is a classic 6-channel RC Transmitter, best option for starters.

HK-T6XV2-M1

The 4 channels are used for flying while rest 2 can be used for landing purposes. It is programmable as well. For that purpose one need to have the programming cable. It requires 12 V as the optimum voltage supply level. However, the status of LED shows the voltage level.

NEVER EXCEED 12 V..

Red : Voltage < 9.1 V

Orange : 9.4 V < Voltage < 10.1 V

Green : 10.4 < Voltage < 12

I used 12 V adapter with 1 A current rating.

Its range is upto 1 km for LOS, which is quite sufficient. Another big point is its cheap receivers, which comes for 9 $ only.

Basically, Rotary Encoder converts the angular motion of wheel or shaft intoanalog or digital codes, and by codes we can count the number of rotations of the same. That seems pretty simple. 😛

First thing one faces in robotics, is the motion update of the bot. This motion update requires the tracking of the number of rotation which when multiplied by the circumference of the wheel base gives the distance travelled. However, this approach is not for motion including turns 😛

While coding in PyQt, one should be little familiar with both the python language and Qt Gui programming.

How to write a minimal skeleton code:
First we have to add the following line to the script to avoid writing python for executing each script 😛#!/usr/bin/python

Thereafter all the necessary modules will have to be imported. sys is needed to initialise the QApplication. QApplication is a kind of parent application in which all the GUI components work. According to Qt documentation-

“The QApplication class manages the GUI application’s control flow and main settings. It contains the main event loop, where all events from the window system and other sources are processed and dispatched. It also handles the application’s initialization and finalization, and provides session management. It also handles most system-wide and application-wide settings. For any GUI application that uses Qt, there is precisely one QApplication object, no matter whether the application has 0, 1, 2 or more windows at any time.”

QtGui is needed here if we want to display widget. If no widget is to be displayed then this line can be dropped.

import sysfrom PyQt4 import QtGui

The main() function in C is analogous to the following line in python:

if __name__==’__main__’:a=QtGui.QApplication(sys.argv)
# this will create an application named ‘a’initialised with a command-line parameter.

sys.exit(a.exec_())
#application is executed.

Now if we want to display any widget or window, we have to write it between the above two lines.

While i was getting handy with Qt, came the problem of porting the application to the other platforms. For me, the main aim while jumping in Qt application development is to make the application run on embedded boards like mini2440, Raspi etc. and this time the board was Raspberry Pi.
There was some UI based project to be ported to Raspi, which required the cross-compiling of whole QT IDE for the Raspi, and i got something called qtonpi. Which, i felt, would require some tedious long hours, which i didn’t have.
Probably you will get this in my next blog on Qt.
But for now, there was another option called (drums beat…) PyQt. 😛

PyQt

Easy and light weight PyQt. it worked as magic. Almost every linux distribution has python installed and all you need is a PyQt dev-kit, which basically binds the Qt APIs to the python. It is really a light-weight package which can be easily installed in almost all linux-distros in all architectures.
Lets get started:

Setting the work environment and installations:

The dev-kit can be found in synaptic manager or at terminal by typing:-

Well, for an embedded system guy, serial port is one of the most popular way to make your PC communicate with a target board, be it SBC or some serial based automation sort of work. Now, challenge is to use your own serial terminal software 😛 Well that’s the least what can be expected from a Qt Application developer.

During early days of mine as an electronic hobbyist, the wireless communication had always

Wired bot

got me excited . Afterall, who wouldnot grow tired of those tangling wires of wired bot. 😛 So i got the cheapest rf module available in the market, without knowing much about it. 😛

So this is a simple project for the beginners who are going to use rf modules for the first time. Here, the signals are generated by the user via push buttons and is sent to the receiver module kept at a distance.

Let us grasp some basic information on the working of a RF- module.

Rf modules

These RF modules work between 30Khz-300 Ghz. In our case, it’s frequency is around 400Mhz-500Mhz (434 MHz approaximately). The digital data is represented as the variations in the amplitude of the carrier signal according to the message signal (known as ASK).It receives serial data and transmits it wirelessly through RF through its antenna. The transmission occurs at the rate of 1Kbps – 10Kbps.The transmitted data is received by an RF receiver operating at the same frequency as that of the transmitter.